diff options
author | trav90 <travawine@palemoon.org> | 2018-10-19 21:52:15 -0500 |
---|---|---|
committer | trav90 <travawine@palemoon.org> | 2018-10-19 21:52:20 -0500 |
commit | bbcc64772580c8a979288791afa02d30bc476d2e (patch) | |
tree | 437ce94c3fdd7497508e5b55de06c6d011678597 /third_party/aom/av1/encoder/rd.h | |
parent | 14805f6ddbfb173c327768fff9f81f40ce5e81b0 (diff) | |
download | UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.gz UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.lz UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.xz UXP-bbcc64772580c8a979288791afa02d30bc476d2e.zip |
Update aom to v1.0.0
Update aom to commit id d14c5bb4f336ef1842046089849dee4a301fbbf0.
Diffstat (limited to 'third_party/aom/av1/encoder/rd.h')
-rw-r--r-- | third_party/aom/av1/encoder/rd.h | 235 |
1 files changed, 53 insertions, 182 deletions
diff --git a/third_party/aom/av1/encoder/rd.h b/third_party/aom/av1/encoder/rd.h index 35ada8e6c..281b676b0 100644 --- a/third_party/aom/av1/encoder/rd.h +++ b/third_party/aom/av1/encoder/rd.h @@ -14,9 +14,6 @@ #include <limits.h> -#if CONFIG_ANS -#include "aom_dsp/ans.h" -#endif // CONFIG_ANS #include "av1/common/blockd.h" #include "av1/encoder/block.h" @@ -30,9 +27,9 @@ extern "C" { #define RDDIV_BITS 7 #define RD_EPB_SHIFT 6 -#define RDCOST(RM, R, D) \ - (ROUND_POWER_OF_TWO(((int64_t)R) * (RM), AV1_PROB_COST_SHIFT) + \ - (D << RDDIV_BITS)) +#define RDCOST(RM, R, D) \ + (ROUND_POWER_OF_TWO(((int64_t)(R)) * (RM), AV1_PROB_COST_SHIFT) + \ + ((D) * (1 << RDDIV_BITS))) #define RDCOST_DBL(RM, R, D) \ (((((double)(R)) * (RM)) / (double)(1 << AV1_PROB_COST_SHIFT)) + \ @@ -50,102 +47,43 @@ extern "C" { // const MODE_DEFINITION av1_mode_order[MAX_MODES] used in the rd code. typedef enum { THR_NEARESTMV, -#if CONFIG_EXT_REFS THR_NEARESTL2, THR_NEARESTL3, THR_NEARESTB, THR_NEARESTA2, -#endif // CONFIG_EXT_REFS THR_NEARESTA, THR_NEARESTG, THR_DC, THR_NEWMV, -#if CONFIG_EXT_REFS THR_NEWL2, THR_NEWL3, THR_NEWB, THR_NEWA2, -#endif // CONFIG_EXT_REFS THR_NEWA, THR_NEWG, THR_NEARMV, -#if CONFIG_EXT_REFS THR_NEARL2, THR_NEARL3, THR_NEARB, THR_NEARA2, -#endif // CONFIG_EXT_REFS THR_NEARA, THR_NEARG, - THR_ZEROMV, -#if CONFIG_EXT_REFS - THR_ZEROL2, - THR_ZEROL3, - THR_ZEROB, - THR_ZEROA2, -#endif // CONFIG_EXT_REFS - THR_ZEROA, - THR_ZEROG, - -#if CONFIG_COMPOUND_SINGLEREF - THR_SR_NEAREST_NEARMV, -#if CONFIG_EXT_REFS - THR_SR_NEAREST_NEARL2, - THR_SR_NEAREST_NEARL3, - THR_SR_NEAREST_NEARB, -#endif // CONFIG_EXT_REFS - THR_SR_NEAREST_NEARG, - THR_SR_NEAREST_NEARA, - - /* - THR_SR_NEAREST_NEWMV, -#if CONFIG_EXT_REFS - THR_SR_NEAREST_NEWL2, - THR_SR_NEAREST_NEWL3, - THR_SR_NEAREST_NEWB, -#endif // CONFIG_EXT_REFS - THR_SR_NEAREST_NEWG, - THR_SR_NEAREST_NEWA,*/ - - THR_SR_NEAR_NEWMV, -#if CONFIG_EXT_REFS - THR_SR_NEAR_NEWL2, - THR_SR_NEAR_NEWL3, - THR_SR_NEAR_NEWB, -#endif // CONFIG_EXT_REFS - THR_SR_NEAR_NEWG, - THR_SR_NEAR_NEWA, - - THR_SR_ZERO_NEWMV, -#if CONFIG_EXT_REFS - THR_SR_ZERO_NEWL2, - THR_SR_ZERO_NEWL3, - THR_SR_ZERO_NEWB, -#endif // CONFIG_EXT_REFS - THR_SR_ZERO_NEWG, - THR_SR_ZERO_NEWA, - - THR_SR_NEW_NEWMV, -#if CONFIG_EXT_REFS - THR_SR_NEW_NEWL2, - THR_SR_NEW_NEWL3, - THR_SR_NEW_NEWB, -#endif // CONFIG_EXT_REFS - THR_SR_NEW_NEWG, - THR_SR_NEW_NEWA, -#endif // CONFIG_COMPOUND_SINGLEREF + THR_GLOBALMV, + THR_GLOBALL2, + THR_GLOBALL3, + THR_GLOBALB, + THR_GLOBALA2, + THR_GLOBALA, + THR_GLOBALG, THR_COMP_NEAREST_NEARESTLA, -#if CONFIG_EXT_REFS THR_COMP_NEAREST_NEARESTL2A, THR_COMP_NEAREST_NEARESTL3A, -#endif // CONFIG_EXT_REFS THR_COMP_NEAREST_NEARESTGA, -#if CONFIG_EXT_REFS THR_COMP_NEAREST_NEARESTLB, THR_COMP_NEAREST_NEARESTL2B, THR_COMP_NEAREST_NEARESTL3B, @@ -154,21 +92,16 @@ typedef enum { THR_COMP_NEAREST_NEARESTL2A2, THR_COMP_NEAREST_NEARESTL3A2, THR_COMP_NEAREST_NEARESTGA2, -#if CONFIG_EXT_COMP_REFS THR_COMP_NEAREST_NEARESTLL2, THR_COMP_NEAREST_NEARESTLL3, THR_COMP_NEAREST_NEARESTLG, THR_COMP_NEAREST_NEARESTBA, -#endif // CONFIG_EXT_COMP_REFS -#endif // CONFIG_EXT_REFS - THR_TM, + THR_PAETH, THR_SMOOTH, -#if CONFIG_SMOOTH_HV THR_SMOOTH_V, THR_SMOOTH_H, -#endif // CONFIG_SMOOTH_HV THR_COMP_NEAR_NEARLA, THR_COMP_NEW_NEARESTLA, @@ -176,16 +109,15 @@ typedef enum { THR_COMP_NEW_NEARLA, THR_COMP_NEAR_NEWLA, THR_COMP_NEW_NEWLA, - THR_COMP_ZERO_ZEROLA, + THR_COMP_GLOBAL_GLOBALLA, -#if CONFIG_EXT_REFS THR_COMP_NEAR_NEARL2A, THR_COMP_NEW_NEARESTL2A, THR_COMP_NEAREST_NEWL2A, THR_COMP_NEW_NEARL2A, THR_COMP_NEAR_NEWL2A, THR_COMP_NEW_NEWL2A, - THR_COMP_ZERO_ZEROL2A, + THR_COMP_GLOBAL_GLOBALL2A, THR_COMP_NEAR_NEARL3A, THR_COMP_NEW_NEARESTL3A, @@ -193,8 +125,7 @@ typedef enum { THR_COMP_NEW_NEARL3A, THR_COMP_NEAR_NEWL3A, THR_COMP_NEW_NEWL3A, - THR_COMP_ZERO_ZEROL3A, -#endif // CONFIG_EXT_REFS + THR_COMP_GLOBAL_GLOBALL3A, THR_COMP_NEAR_NEARGA, THR_COMP_NEW_NEARESTGA, @@ -202,16 +133,15 @@ typedef enum { THR_COMP_NEW_NEARGA, THR_COMP_NEAR_NEWGA, THR_COMP_NEW_NEWGA, - THR_COMP_ZERO_ZEROGA, + THR_COMP_GLOBAL_GLOBALGA, -#if CONFIG_EXT_REFS THR_COMP_NEAR_NEARLB, THR_COMP_NEW_NEARESTLB, THR_COMP_NEAREST_NEWLB, THR_COMP_NEW_NEARLB, THR_COMP_NEAR_NEWLB, THR_COMP_NEW_NEWLB, - THR_COMP_ZERO_ZEROLB, + THR_COMP_GLOBAL_GLOBALLB, THR_COMP_NEAR_NEARL2B, THR_COMP_NEW_NEARESTL2B, @@ -219,7 +149,7 @@ typedef enum { THR_COMP_NEW_NEARL2B, THR_COMP_NEAR_NEWL2B, THR_COMP_NEW_NEWL2B, - THR_COMP_ZERO_ZEROL2B, + THR_COMP_GLOBAL_GLOBALL2B, THR_COMP_NEAR_NEARL3B, THR_COMP_NEW_NEARESTL3B, @@ -227,7 +157,7 @@ typedef enum { THR_COMP_NEW_NEARL3B, THR_COMP_NEAR_NEWL3B, THR_COMP_NEW_NEWL3B, - THR_COMP_ZERO_ZEROL3B, + THR_COMP_GLOBAL_GLOBALL3B, THR_COMP_NEAR_NEARGB, THR_COMP_NEW_NEARESTGB, @@ -235,7 +165,7 @@ typedef enum { THR_COMP_NEW_NEARGB, THR_COMP_NEAR_NEWGB, THR_COMP_NEW_NEWGB, - THR_COMP_ZERO_ZEROGB, + THR_COMP_GLOBAL_GLOBALGB, THR_COMP_NEAR_NEARLA2, THR_COMP_NEW_NEARESTLA2, @@ -243,7 +173,7 @@ typedef enum { THR_COMP_NEW_NEARLA2, THR_COMP_NEAR_NEWLA2, THR_COMP_NEW_NEWLA2, - THR_COMP_ZERO_ZEROLA2, + THR_COMP_GLOBAL_GLOBALLA2, THR_COMP_NEAR_NEARL2A2, THR_COMP_NEW_NEARESTL2A2, @@ -251,7 +181,7 @@ typedef enum { THR_COMP_NEW_NEARL2A2, THR_COMP_NEAR_NEWL2A2, THR_COMP_NEW_NEWL2A2, - THR_COMP_ZERO_ZEROL2A2, + THR_COMP_GLOBAL_GLOBALL2A2, THR_COMP_NEAR_NEARL3A2, THR_COMP_NEW_NEARESTL3A2, @@ -259,7 +189,7 @@ typedef enum { THR_COMP_NEW_NEARL3A2, THR_COMP_NEAR_NEWL3A2, THR_COMP_NEW_NEWL3A2, - THR_COMP_ZERO_ZEROL3A2, + THR_COMP_GLOBAL_GLOBALL3A2, THR_COMP_NEAR_NEARGA2, THR_COMP_NEW_NEARESTGA2, @@ -267,16 +197,24 @@ typedef enum { THR_COMP_NEW_NEARGA2, THR_COMP_NEAR_NEWGA2, THR_COMP_NEW_NEWGA2, - THR_COMP_ZERO_ZEROGA2, + THR_COMP_GLOBAL_GLOBALGA2, + + THR_H_PRED, + THR_V_PRED, + THR_D135_PRED, + THR_D203_PRED, + THR_D157_PRED, + THR_D67_PRED, + THR_D113_PRED, + THR_D45_PRED, -#if CONFIG_EXT_COMP_REFS THR_COMP_NEAR_NEARLL2, THR_COMP_NEW_NEARESTLL2, THR_COMP_NEAREST_NEWLL2, THR_COMP_NEW_NEARLL2, THR_COMP_NEAR_NEWLL2, THR_COMP_NEW_NEWLL2, - THR_COMP_ZERO_ZEROLL2, + THR_COMP_GLOBAL_GLOBALLL2, THR_COMP_NEAR_NEARLL3, THR_COMP_NEW_NEARESTLL3, @@ -284,7 +222,7 @@ typedef enum { THR_COMP_NEW_NEARLL3, THR_COMP_NEAR_NEWLL3, THR_COMP_NEW_NEWLL3, - THR_COMP_ZERO_ZEROLL3, + THR_COMP_GLOBAL_GLOBALLL3, THR_COMP_NEAR_NEARLG, THR_COMP_NEW_NEARESTLG, @@ -292,7 +230,7 @@ typedef enum { THR_COMP_NEW_NEARLG, THR_COMP_NEAR_NEWLG, THR_COMP_NEW_NEWLG, - THR_COMP_ZERO_ZEROLG, + THR_COMP_GLOBAL_GLOBALLG, THR_COMP_NEAR_NEARBA, THR_COMP_NEW_NEARESTBA, @@ -300,79 +238,25 @@ typedef enum { THR_COMP_NEW_NEARBA, THR_COMP_NEAR_NEWBA, THR_COMP_NEW_NEWBA, - THR_COMP_ZERO_ZEROBA, -#endif // CONFIG_EXT_COMP_REFS -#endif // CONFIG_EXT_REFS + THR_COMP_GLOBAL_GLOBALBA, - THR_H_PRED, - THR_V_PRED, - THR_D135_PRED, - THR_D207_PRED, - THR_D153_PRED, - THR_D63_PRED, - THR_D117_PRED, - THR_D45_PRED, - - THR_COMP_INTERINTRA_ZEROL, - THR_COMP_INTERINTRA_NEARESTL, - THR_COMP_INTERINTRA_NEARL, - THR_COMP_INTERINTRA_NEWL, - -#if CONFIG_EXT_REFS - THR_COMP_INTERINTRA_ZEROL2, - THR_COMP_INTERINTRA_NEARESTL2, - THR_COMP_INTERINTRA_NEARL2, - THR_COMP_INTERINTRA_NEWL2, - - THR_COMP_INTERINTRA_ZEROL3, - THR_COMP_INTERINTRA_NEARESTL3, - THR_COMP_INTERINTRA_NEARL3, - THR_COMP_INTERINTRA_NEWL3, -#endif // CONFIG_EXT_REFS - - THR_COMP_INTERINTRA_ZEROG, - THR_COMP_INTERINTRA_NEARESTG, - THR_COMP_INTERINTRA_NEARG, - THR_COMP_INTERINTRA_NEWG, - -#if CONFIG_EXT_REFS - THR_COMP_INTERINTRA_ZEROB, - THR_COMP_INTERINTRA_NEARESTB, - THR_COMP_INTERINTRA_NEARB, - THR_COMP_INTERINTRA_NEWB, - - THR_COMP_INTERINTRA_ZEROA2, - THR_COMP_INTERINTRA_NEARESTA2, - THR_COMP_INTERINTRA_NEARA2, - THR_COMP_INTERINTRA_NEWA2, -#endif // CONFIG_EXT_REFS - - THR_COMP_INTERINTRA_ZEROA, - THR_COMP_INTERINTRA_NEARESTA, - THR_COMP_INTERINTRA_NEARA, - THR_COMP_INTERINTRA_NEWA, MAX_MODES } THR_MODES; typedef enum { THR_LAST, -#if CONFIG_EXT_REFS THR_LAST2, THR_LAST3, THR_BWDR, THR_ALTR2, -#endif // CONFIG_EXT_REFS THR_GOLD, THR_ALTR, THR_COMP_LA, -#if CONFIG_EXT_REFS THR_COMP_L2A, THR_COMP_L3A, -#endif // CONFIG_EXT_REFS THR_COMP_GA, -#if CONFIG_EXT_REFS THR_COMP_LB, THR_COMP_L2B, THR_COMP_L3B, @@ -382,7 +266,6 @@ typedef enum { THR_COMP_L2A2, THR_COMP_L3A2, THR_COMP_GA2, -#endif // CONFIG_EXT_REFS THR_INTRA, @@ -399,7 +282,7 @@ typedef struct RD_OPT { int threshes[MAX_SEGMENTS][BLOCK_SIZES_ALL][MAX_MODES]; - int64_t prediction_type_threshes[TOTAL_REFS_PER_FRAME][REFERENCE_MODES]; + int64_t prediction_type_threshes[REF_FRAMES][REFERENCE_MODES]; int RDMULT; } RD_OPT; @@ -417,16 +300,16 @@ static INLINE void av1_init_rd_stats(RD_STATS *rd_stats) { rd_stats->invalid_rate = 0; rd_stats->ref_rdcost = INT64_MAX; #if CONFIG_RD_DEBUG + // This may run into problems when monochrome video is + // encoded, as there will only be 1 plane for (plane = 0; plane < MAX_MB_PLANE; ++plane) { rd_stats->txb_coeff_cost[plane] = 0; -#if CONFIG_VAR_TX { int r, c; for (r = 0; r < TXB_COEFF_COST_MAP_SIZE; ++r) for (c = 0; c < TXB_COEFF_COST_MAP_SIZE; ++c) rd_stats->txb_coeff_cost_map[plane][r][c] = 0; } -#endif } #endif } @@ -444,16 +327,16 @@ static INLINE void av1_invalid_rd_stats(RD_STATS *rd_stats) { rd_stats->invalid_rate = 1; rd_stats->ref_rdcost = INT64_MAX; #if CONFIG_RD_DEBUG + // This may run into problems when monochrome video is + // encoded, as there will only be 1 plane for (plane = 0; plane < MAX_MB_PLANE; ++plane) { rd_stats->txb_coeff_cost[plane] = INT_MAX; -#if CONFIG_VAR_TX { int r, c; for (r = 0; r < TXB_COEFF_COST_MAP_SIZE; ++r) for (c = 0; c < TXB_COEFF_COST_MAP_SIZE; ++c) rd_stats->txb_coeff_cost_map[plane][r][c] = INT_MAX; } -#endif } #endif } @@ -464,14 +347,17 @@ static INLINE void av1_merge_rd_stats(RD_STATS *rd_stats_dst, int plane; #endif rd_stats_dst->rate += rd_stats_src->rate; + if (!rd_stats_dst->zero_rate) + rd_stats_dst->zero_rate = rd_stats_src->zero_rate; rd_stats_dst->dist += rd_stats_src->dist; rd_stats_dst->sse += rd_stats_src->sse; rd_stats_dst->skip &= rd_stats_src->skip; rd_stats_dst->invalid_rate &= rd_stats_src->invalid_rate; #if CONFIG_RD_DEBUG + // This may run into problems when monochrome video is + // encoded, as there will only be 1 plane for (plane = 0; plane < MAX_MB_PLANE; ++plane) { rd_stats_dst->txb_coeff_cost[plane] += rd_stats_src->txb_coeff_cost[plane]; -#if CONFIG_VAR_TX { // TODO(angiebird): optimize this part int r, c; @@ -484,21 +370,10 @@ static INLINE void av1_merge_rd_stats(RD_STATS *rd_stats_dst, } assert(ref_txb_coeff_cost == rd_stats_dst->txb_coeff_cost[plane]); } -#endif } #endif } -static INLINE int av1_get_coeff_token_cost(int token, int eob_val, int is_first, - const int *head_cost_table, - const int *tail_cost_table) { - if (eob_val == LAST_EOB) return av1_cost_zero(128); - const int comb_symb = 2 * AOMMIN(token, TWO_TOKEN) - eob_val + is_first; - int cost = head_cost_table[comb_symb]; - if (token > ONE_TOKEN) cost += tail_cost_table[token - TWO_TOKEN]; - return cost; -} - struct TileInfo; struct TileDataEnc; struct AV1_COMP; @@ -528,13 +403,12 @@ YV12_BUFFER_CONFIG *av1_get_scaled_ref_frame(const struct AV1_COMP *cpi, void av1_init_me_luts(void); -void av1_set_mvcost(MACROBLOCK *x, MV_REFERENCE_FRAME ref_frame, int ref, - int ref_mv_idx); +void av1_set_mvcost(MACROBLOCK *x, int ref, int ref_mv_idx); -void av1_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size, +void av1_get_entropy_contexts(BLOCK_SIZE bsize, const struct macroblockd_plane *pd, - ENTROPY_CONTEXT t_above[2 * MAX_MIB_SIZE], - ENTROPY_CONTEXT t_left[2 * MAX_MIB_SIZE]); + ENTROPY_CONTEXT t_above[MAX_MIB_SIZE], + ENTROPY_CONTEXT t_left[MAX_MIB_SIZE]); void av1_set_rd_speed_thresholds(struct AV1_COMP *cpi); @@ -562,7 +436,8 @@ void av1_setup_pred_block(const MACROBLOCKD *xd, struct buf_2d dst[MAX_MB_PLANE], const YV12_BUFFER_CONFIG *src, int mi_row, int mi_col, const struct scale_factors *scale, - const struct scale_factors *scale_uv); + const struct scale_factors *scale_uv, + const int num_planes); int av1_get_intra_cost_penalty(int qindex, int qdelta, aom_bit_depth_t bit_depth); @@ -570,12 +445,8 @@ int av1_get_intra_cost_penalty(int qindex, int qdelta, void av1_fill_mode_rates(AV1_COMMON *const cm, MACROBLOCK *x, FRAME_CONTEXT *fc); -#if CONFIG_LV_MAP -void av1_fill_coeff_costs(MACROBLOCK *x, FRAME_CONTEXT *fc); -#endif - -void av1_fill_token_costs_from_cdf(av1_coeff_cost *cost, - coeff_cdf_model (*cdf)[PLANE_TYPES]); +void av1_fill_coeff_costs(MACROBLOCK *x, FRAME_CONTEXT *fc, + const int num_planes); #ifdef __cplusplus } // extern "C" |