[SCM] libav/experimental: Add quant_table_index to ffv1 PlaneContext and use it instead of duplicating the currents implementation of calculating it.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 17:18:06 UTC 2013


The following commit has been merged in the experimental branch:
commit e1f51b8821e199833847188df4164695d04e2605
Author: Michael Niedermayer <michaelni at gmx.at>
Date:   Tue Oct 26 01:59:03 2010 +0000

    Add quant_table_index to ffv1 PlaneContext and use it instead of duplicating the currents implementation of calculating it.
    
    Originally committed as revision 25570 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index 825b926..0c0ba8d 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -218,6 +218,7 @@ typedef struct VlcState{
 
 typedef struct PlaneContext{
     int16_t quant_table[MAX_CONTEXT_INPUTS][256];
+    int quant_table_index;
     int context_count;
     uint8_t (*state)[CONTEXT_SIZE];
     VlcState *vlc_state;
@@ -658,8 +659,10 @@ static void write_header(FFV1Context *f){
             put_symbol(c, state, (fs->slice_y     +1)*f->num_v_slices / f->height  , 0);
             put_symbol(c, state, (fs->slice_width +1)*f->num_h_slices / f->width -1, 0);
             put_symbol(c, state, (fs->slice_height+1)*f->num_v_slices / f->height-1, 0);
-            for(j=0; j<f->plane_count; j++)
-            put_symbol(c, state, f->avctx->context_model, 0);
+            for(j=0; j<f->plane_count; j++){
+                put_symbol(c, state, f->plane[j].quant_table_index, 0);
+                av_assert0(f->plane[j].quant_table_index == f->avctx->context_model);
+            }
         }
     }
 }
@@ -860,17 +863,16 @@ static av_cold int encode_init(AVCodecContext *avctx)
             s->quant_tables[1][4][i]= 5*5*11*11*quant5_10bit[i];
         }
     }
+    s->context_count[0]= (11*11*11+1)/2;
+    s->context_count[1]= (11*11*5*5*5+1)/2;
     memcpy(s->quant_table, s->quant_tables[avctx->context_model], sizeof(s->quant_table));
 
     for(i=0; i<s->plane_count; i++){
         PlaneContext * const p= &s->plane[i];
 
         memcpy(p->quant_table, s->quant_table, sizeof(p->quant_table));
-        if(avctx->context_model==0){
-            p->context_count= (11*11*11+1)/2;
-        }else{
-            p->context_count= (11*11*5*5*5+1)/2;
-        }
+        p->quant_table_index= avctx->context_model;
+        p->context_count= s->context_count[p->quant_table_index];
     }
 
     avctx->coded_frame= &s->picture;
@@ -1468,6 +1470,7 @@ static int read_header(FFV1Context *f){
                     av_log(f->avctx, AV_LOG_ERROR, "quant_table_index out of range\n");
                     return -1;
                 }
+                p->quant_table_index= idx;
                 memcpy(p->quant_table, f->quant_tables[idx], sizeof(p->quant_table));
                 context_count= f->context_count[idx];
             }else{

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list