changeset 5466:587b3e6c8d4f libavcodec

no need to duplicate cid table vars in context
author bcoudurier
date Sat, 04 Aug 2007 13:09:08 +0000
parents 6478c562c80f
children 740cf5d1691e
files dnxhddec.c
diffstat 1 files changed, 7 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/dnxhddec.c	Sat Aug 04 13:03:12 2007 +0000
+++ b/dnxhddec.c	Sat Aug 04 13:09:08 2007 +0000
@@ -54,11 +54,7 @@
     unsigned int mb_width, mb_height;
     uint32_t mb_scan_index[68];         /* max for 1080p */
     int cur_field;                      ///< current interlaced field
-    int index_bits;                     ///< length of index value
     VLC ac_vlc, dc_vlc, run_vlc;
-    const uint8_t *ac_level, *run;
-    const uint8_t *ac_run_flag, *ac_index_flag;
-    const uint8_t *luma_weigth, *chroma_weigth;
     int last_dc[3];
     DSPContext dsp;
     DECLARE_ALIGNED_16(DCTELEM, blocks[8][64]);
@@ -124,15 +120,6 @@
                  ctx->cid_table->run_bits, 1, 1,
                  ctx->cid_table->run_codes, 2, 2, 0);
 
-        ctx->run           = ctx->cid_table->run;
-        ctx->ac_level      = ctx->cid_table->ac_level;
-        ctx->ac_run_flag   = ctx->cid_table->ac_run_flag;
-        ctx->ac_index_flag = ctx->cid_table->ac_index_flag;
-        ctx->luma_weigth   = ctx->cid_table->luma_weigth;
-        ctx->chroma_weigth = ctx->cid_table->chroma_weigth;
-
-        ctx->index_bits = ctx->cid_table->index_bits;
-
         ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable, ff_zigzag_direct);
     }
     return 0;
@@ -213,10 +200,10 @@
 
     if (n&2) {
         component = 1 + (n&1);
-        weigth_matrix = ctx->chroma_weigth;
+        weigth_matrix = ctx->cid_table->chroma_weigth;
     } else {
         component = 0;
-        weigth_matrix = ctx->luma_weigth;
+        weigth_matrix = ctx->cid_table->luma_weigth;
     }
 
     ctx->last_dc[component] += dnxhd_decode_dc(ctx);
@@ -225,20 +212,20 @@
     for (i = 1; ; i++) {
         index = get_vlc2(&ctx->gb, ctx->ac_vlc.table, DNXHD_VLC_BITS, 2);
         //av_log(ctx->avctx, AV_LOG_DEBUG, "index %d\n", index);
-        level = ctx->ac_level[index];
+        level = ctx->cid_table->ac_level[index];
         if (!level) { /* EOB */
             //av_log(ctx->avctx, AV_LOG_DEBUG, "EOB\n");
             return;
         }
         sign = get_sbits(&ctx->gb, 1);
 
-        if (ctx->ac_index_flag[index]) {
-            level += get_bits(&ctx->gb, ctx->index_bits)<<6;
+        if (ctx->cid_table->ac_index_flag[index]) {
+            level += get_bits(&ctx->gb, ctx->cid_table->index_bits)<<6;
         }
 
-        if (ctx->ac_run_flag[index]) {
+        if (ctx->cid_table->ac_run_flag[index]) {
             index2 = get_vlc2(&ctx->gb, ctx->run_vlc.table, DNXHD_VLC_BITS, 2);
-            i += ctx->run[index2];
+            i += ctx->cid_table->run[index2];
         }
 
         j = ctx->scantable.permutated[i];