Commit 96b165fa authored by Christophe Gisquet's avatar Christophe Gisquet Committed by Michael Niedermayer

dnxhd: interleave AC levels and flags

This allows more efficient access to the array as the level and flags
are contiguous. Around 4% faster coefficient decoding.
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 2c2d1624
This diff is collapsed.
......@@ -46,8 +46,7 @@ typedef struct CIDEntry {
const uint8_t *luma_weight, *chroma_weight;
const uint8_t *dc_codes, *dc_bits;
const uint16_t *ac_codes;
const uint8_t *ac_bits, *ac_level;
const uint8_t *ac_flags;
const uint8_t *ac_bits, *ac_info;
const uint16_t *run_codes;
const uint8_t *run_bits, *run;
int bit_rates[5]; ///< Helper to choose variants, rounded to nearest 5Mb/s
......
......@@ -327,8 +327,7 @@ static av_always_inline int dnxhd_decode_dct_block(const DNXHDContext *ctx,
int level, component, sign;
const int *scale;
const uint8_t *weight_matrix;
const uint8_t *ac_level = ctx->cid_table->ac_level;
const uint8_t *ac_flags = ctx->cid_table->ac_flags;
const uint8_t *ac_info = ctx->cid_table->ac_info;
int16_t *block = row->blocks[n];
const int eob_index = ctx->cid_table->eob_index;
int ret = 0;
......@@ -375,8 +374,8 @@ static av_always_inline int dnxhd_decode_dct_block(const DNXHDContext *ctx,
DNXHD_VLC_BITS, 2);
while (index1 != eob_index) {
level = ac_level[index1];
flags = ac_flags[index1];
level = ac_info[2*index1+0];
flags = ac_info[2*index1+1];
sign = SHOW_SBITS(bs, &row->gb, 1);
SKIP_BITS(bs, &row->gb, 1);
......
......@@ -163,9 +163,9 @@ static av_cold int dnxhd_init_vlc(DNXHDEncContext *ctx)
alevel -= offset << 6;
}
for (j = 0; j < 257; j++) {
if (ctx->cid_table->ac_level[j] >> 1 == alevel &&
(!offset || (ctx->cid_table->ac_flags[j] & 1) && offset) &&
(!run || (ctx->cid_table->ac_flags[j] & 2) && run)) {
if (ctx->cid_table->ac_info[2*j+0] >> 1 == alevel &&
(!offset || (ctx->cid_table->ac_info[2*j+1] & 1) && offset) &&
(!run || (ctx->cid_table->ac_info[2*j+1] & 2) && run)) {
av_assert1(!ctx->vlc_codes[index]);
if (alevel) {
ctx->vlc_codes[index] =
......
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