diff --git a/aom_dsp/prob.h b/aom_dsp/prob.h index 7975c160d45ff591f0411b6a12ed43314e558a18..50d8ffdc02dbe25d7068a4eacc14ec66e382331a 100644 --- a/aom_dsp/prob.h +++ b/aom_dsp/prob.h @@ -215,7 +215,15 @@ static INLINE void update_cdf(aom_cdf_prob *cdf, int val, int nsymbs) { #if 1 #if CONFIG_LV_MAP_MULTI - rate = 3 + (cdf[nsymbs] > 15) + (cdf[nsymbs] > 31) + get_msb(nsymbs); + // static const int nsymbs2speed[17] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, + // 3, 3, 3, 3, 4 }; + // static const int nsymbs2speed[17] = { 0, 0, 1, 1, 2, 2, 2, 2, 2, + // 2, 2, 2, 3, 3, 3, 3, 3 }; + static const int nsymbs2speed[17] = { 0, 0, 1, 1, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2 }; + assert(nsymbs < 17); + rate = 3 + (cdf[nsymbs] > 15) + (cdf[nsymbs] > 31) + + nsymbs2speed[nsymbs]; // + get_msb(nsymbs); tmp = AOM_ICDF(0); (void)rate2; (void)diff; diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c index 915e12274d557394a645a98f67074bdeb4145985..6438e0b2786a533c0f99f484a335970de8030bf5 100644 --- a/av1/encoder/encodetxb.c +++ b/av1/encoder/encodetxb.c @@ -771,13 +771,8 @@ int av1_cost_coeffs_txb(const AV1_COMMON *const cm, const MACROBLOCK *x, const LV_MAP_EOB_COST *const eob_costs = &x->eob_costs[eob_multi_size][plane_type]; #endif - - cost = 0; - - if (eob == 0) { - cost = coeff_costs->txb_skip_cost[txb_skip_ctx][1]; - return cost; - } + // eob must be greater than 0 here. + assert(eob > 0); cost = coeff_costs->txb_skip_cost[txb_skip_ctx][0]; av1_txb_init_levels(qcoeff, width, height, levels);