Commit 9dfd89b8 authored by Mans Rullgard's avatar Mans Rullgard

dnxhddec: merge ac_{index,run}_flags

These tables contain only a 1-bit flag each.  Combining them reduces
the data size and saves some instructions in the block decode loop.
Signed-off-by: 's avatarMans Rullgard <mans@mansr.com>
parent 185a2c08
This diff is collapsed.
......@@ -38,7 +38,7 @@ typedef struct {
const uint8_t *dc_codes, *dc_bits;
const uint16_t *ac_codes;
const uint8_t *ac_bits, *ac_level;
const uint8_t *ac_run_flag, *ac_index_flag;
const uint8_t *ac_flags;
const uint16_t *run_codes;
const uint8_t *run_bits, *run;
int bit_rates[5]; ///< Helpher to choose variants, rounded to nearest 5Mb/s
......
......@@ -179,10 +179,11 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
int level_bias,
int level_shift)
{
int i, j, index1, index2, len;
int i, j, index1, index2, len, flags;
int level, component, sign;
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 int eob_index = ctx->cid_table->eob_index;
OPEN_READER(bs, &ctx->gb);
......@@ -214,16 +215,17 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
while (index1 != eob_index) {
level = ac_level[index1];
flags = ac_flags[index1];
sign = SHOW_SBITS(bs, &ctx->gb, 1);
SKIP_BITS(bs, &ctx->gb, 1);
if (ctx->cid_table->ac_index_flag[index1]) {
if (flags & 1) {
level += SHOW_UBITS(bs, &ctx->gb, index_bits) << 7;
SKIP_BITS(bs, &ctx->gb, index_bits);
}
if (ctx->cid_table->ac_run_flag[index1]) {
if (flags & 2) {
UPDATE_CACHE(bs, &ctx->gb);
GET_VLC(index2, bs, &ctx->gb, ctx->run_vlc.table,
DNXHD_VLC_BITS, 2);
......
......@@ -122,8 +122,8 @@ static int dnxhd_init_vlc(DNXHDEncContext *ctx)
}
for (j = 0; j < 257; j++) {
if (ctx->cid_table->ac_level[j] >> 1 == alevel &&
(!offset || (ctx->cid_table->ac_index_flag[j] && offset)) &&
(!run || (ctx->cid_table->ac_run_flag [j] && run))) {
(!offset || (ctx->cid_table->ac_flags[j] & 1) && offset) &&
(!run || (ctx->cid_table->ac_flags[j] & 2) && run)) {
assert(!ctx->vlc_codes[index]);
if (alevel) {
ctx->vlc_codes[index] = (ctx->cid_table->ac_codes[j]<<1)|(sign&1);
......
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