Commit e21c0811 authored by Luc Trudeau's avatar Luc Trudeau
Browse files

[CFL] use CDF_SIZE macro

EC_ADAPT stores the count at the last position. As such, the CDF_SIZE
macro adds 1 to the array size. This resolves valgrind warnings about
jumps on uninitialized variables.

Change-Id: I58d607a57756cb166a9ae5c4565537ce202183fd
parent 4cbf7a3e
...@@ -2931,7 +2931,7 @@ static const aom_cdf_prob ...@@ -2931,7 +2931,7 @@ static const aom_cdf_prob
#endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP #endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
#if CONFIG_CFL #if CONFIG_CFL
static const aom_cdf_prob default_cfl_alpha_cdf[CFL_ALPHABET_SIZE] = { static const aom_cdf_prob default_cfl_alpha_cdf[CDF_SIZE(CFL_ALPHABET_SIZE)] = {
// decreasing likelihood, after 6 iterations of alpha RDO on subset 3 // decreasing likelihood, after 6 iterations of alpha RDO on subset 3
AOM_ICDF(23928), AOM_ICDF(26267), AOM_ICDF(27319), AOM_ICDF(28330), AOM_ICDF(23928), AOM_ICDF(26267), AOM_ICDF(27319), AOM_ICDF(28330),
AOM_ICDF(29341), AOM_ICDF(30160), AOM_ICDF(30581), AOM_ICDF(30983), AOM_ICDF(29341), AOM_ICDF(30160), AOM_ICDF(30581), AOM_ICDF(30983),
......
...@@ -304,7 +304,7 @@ typedef struct frame_contexts { ...@@ -304,7 +304,7 @@ typedef struct frame_contexts {
od_adapt_ctx pvq_context; od_adapt_ctx pvq_context;
#endif // CONFIG_PVQ #endif // CONFIG_PVQ
#if CONFIG_CFL #if CONFIG_CFL
aom_cdf_prob cfl_alpha_cdf[CFL_ALPHABET_SIZE]; aom_cdf_prob cfl_alpha_cdf[CDF_SIZE(CFL_ALPHABET_SIZE)];
#endif #endif
} FRAME_CONTEXT; } FRAME_CONTEXT;
......
...@@ -1642,8 +1642,9 @@ void av1_predict_intra_block_encoder_facade(MACROBLOCK *x, int plane, ...@@ -1642,8 +1642,9 @@ void av1_predict_intra_block_encoder_facade(MACROBLOCK *x, int plane,
#error "CfL rate estimation requires ec_adapt." #error "CfL rate estimation requires ec_adapt."
#endif #endif
FRAME_CONTEXT *const ec_ctx = xd->tile_ctx; FRAME_CONTEXT *const ec_ctx = xd->tile_ctx;
assert(ec_ctx->cfl_alpha_cdf[CFL_ALPHABET_SIZE - 1] == AOM_ICDF(32768U)); assert(ec_ctx->cfl_alpha_cdf[CFL_ALPHABET_SIZE - 1] ==
const int prob_den = 32768U; AOM_ICDF(CDF_PROB_TOP));
const int prob_den = CDF_PROB_TOP;
CFL_CTX *const cfl = xd->cfl; CFL_CTX *const cfl = xd->cfl;
int cfl_costs[CFL_ALPHABET_SIZE]; int cfl_costs[CFL_ALPHABET_SIZE];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment