]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/snow.c
Remove unused variables in test code.
[ffmpeg] / libavcodec / snow.c
index eb5a9162d7329cd70f5dc1b32d8d5546dd819cc8..eedfe12cfda714a070ec7fe2e672b123c157e73f 100644 (file)
@@ -1160,7 +1160,7 @@ STOP_TIMER("horizontal_compose53i")}
     cs->y += 2;
 }
 
-static void spatial_compose53i(IDWTELEM *buffer, int width, int height, int stride){
+static void av_unused spatial_compose53i(IDWTELEM *buffer, int width, int height, int stride){
     dwt_compose_t cs;
     spatial_compose53i_init(&cs, buffer, height, stride);
     while(cs.y <= height)
@@ -1310,7 +1310,7 @@ STOP_TIMER("horizontal_compose97i")}}
     cs->y += 2;
 }
 
-static void spatial_compose97i(IDWTELEM *buffer, int width, int height, int stride){
+static void av_unused spatial_compose97i(IDWTELEM *buffer, int width, int height, int stride){
     dwt_compose_t cs;
     spatial_compose97i_init(&cs, buffer, height, stride);
     while(cs.y <= height)
@@ -3583,10 +3583,6 @@ static void encode_header(SnowContext *s){
                 put_symbol(&s->c, s->header_state, p->htaps/2-1, 0);
                 for(i= p->htaps/2; i; i--)
                     put_symbol(&s->c, s->header_state, FFABS(p->hcoeff[i]), 0);
-
-                p->last_diag_mc= p->diag_mc;
-                p->last_htaps= p->htaps;
-                memcpy(p->last_hcoeff, p->hcoeff, sizeof(p->hcoeff));
             }
         }
         if(s->last_spatial_decomposition_count != s->spatial_decomposition_count){
@@ -3603,6 +3599,20 @@ static void encode_header(SnowContext *s){
     put_symbol(&s->c, s->header_state, s->qbias           - s->last_qbias   , 1);
     put_symbol(&s->c, s->header_state, s->block_max_depth - s->last_block_max_depth, 1);
 
+}
+
+static void update_last_header_values(SnowContext *s){
+    int plane_index;
+
+    if(!s->keyframe){
+        for(plane_index=0; plane_index<2; plane_index++){
+            Plane *p= &s->plane[plane_index];
+            p->last_diag_mc= p->diag_mc;
+            p->last_htaps  = p->htaps;
+            memcpy(p->last_hcoeff, p->hcoeff, sizeof(p->hcoeff));
+        }
+    }
+
     s->last_spatial_decomposition_type= s->spatial_decomposition_type;
     s->last_qlog                      = s->qlog;
     s->last_qbias                     = s->qbias;
@@ -4473,6 +4483,8 @@ STOP_TIMER("pred-conv")}
         }
     }
 
+    update_last_header_values(s);
+
     if(s->last_picture[s->max_ref_frames-1].data[0]){
         avctx->release_buffer(avctx, &s->last_picture[s->max_ref_frames-1]);
         for(i=0; i<9; i++)
@@ -4763,13 +4775,13 @@ AVCodec snow_encoder = {
 #endif
 
 
-#if 0
+#ifdef TEST
 #undef malloc
 #undef free
 #undef printf
 #undef random
 
-int main(){
+int main(void){
     int width=256;
     int height=256;
     int buffer[2][width*height];
@@ -4871,9 +4883,8 @@ int64_t g=0;
     printf("};\n");
     {
             int level=2;
-            int orientation=3;
             int w= width  >> (s.spatial_decomposition_count-level);
-            int h= height >> (s.spatial_decomposition_count-level);
+            //int h= height >> (s.spatial_decomposition_count-level);
             int stride= width  << (s.spatial_decomposition_count-level);
             DWTELEM *buf= buffer[0];
             int64_t error=0;
@@ -4912,4 +4923,4 @@ int64_t g=0;
 }
     return 0;
 }
-#endif /* 0 */
+#endif /* TEST */