Commit 93f371ba7b for aom
commit 93f371ba7baebeb7086aed440996274e6dc020a6
Author: Frank Galligan <fgalligan@google.com>
Date: Fri Nov 13 10:44:05 2026 -0800
av1: Compute cul_level directly in txb ctx
Reuse the abs_sum and dc_sign computed inside
update_and_record_txb_context_multi instead of re-scanning
coefficients in av1_get_txb_entropy_context.
Speedup: -0.95% (1T) / -0.74% (8T) encode time reduction (bit-exact).
TAG=agy
CONV=b929a630-a6cd-45a0-979c-1767c30178ee
Change-Id: I7cfec9cd4350781691d88e1f8725518d449235c1
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index 4e44b93f56..7c0bf91b2c 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -721,6 +721,7 @@ static uint8_t update_and_record_txb_context_multi(
}
}
if (cpi->mt_info.pack_bs_mt_enabled) td->abs_sum_level += abs_sum;
+ int dc_sign_mask = 0;
// Update the context needed to code the DC sign (if applicable)
if (tcoeff[0] != 0) {
const int dc_sign = (tcoeff[0] < 0) ? 1 : 0;
@@ -730,11 +731,12 @@ static uint8_t update_and_record_txb_context_multi(
if (allow_update_cdf)
update_cdf(ec_ctx->dc_sign_cdf[plane_type][dc_sign_ctx], dc_sign, 2);
entropy_ctx[block] |= dc_sign_ctx << DC_SIGN_CTX_SHIFT;
+ dc_sign_mask = (2 - dc_sign) << COEFF_CONTEXT_BITS;
}
#if !CONFIG_ENTROPY_STATS
#undef allow_update_cdf
#endif
- return av1_get_txb_entropy_context(tcoeff, scan_order, eob);
+ return (uint8_t)(AOMMIN(abs_sum, COEFF_CONTEXT_MASK) | dc_sign_mask);
}
#if defined(__GNUC__) || defined(__clang__)