Calculate coeff token cost from CDF
AWCY results:
PSNR PSNR HVS SSIM CIEDE 2000
-0.09 -0.04 -0.02 -0.03
On Google testsets:
lowres -0.18%
midres -0.20%
Above results are obtained with
--disable-ext-refs --disable-dual-filter --disable-loop-restoration
--disable-global-motion --disable-warped-motion
Change-Id: Iba58d5e5ec9a65d0afba29609aa2e379a80d7236
diff --git a/av1/encoder/rd.h b/av1/encoder/rd.h
index a6cb4ca..8d22355 100644
--- a/av1/encoder/rd.h
+++ b/av1/encoder/rd.h
@@ -631,6 +631,16 @@
#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;
@@ -676,9 +686,6 @@
int (*fact)[MAX_MODES], int rd_thresh, int bsize,
int best_mode_index);
-void av1_fill_token_costs(av1_coeff_cost *c,
- av1_coeff_probs_model (*p)[PLANE_TYPES]);
-
static INLINE int rd_less_than_thresh(int64_t best_rd, int thresh,
int thresh_fact) {
return best_rd < ((int64_t)thresh * thresh_fact >> 5) || thresh == INT_MAX;