[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec cook.c,1.2,1.3

Diego Biurrun CVS diego
Wed Jan 4 13:48:12 CET 2006


Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv29333/libavcodec

Modified Files:
	cook.c 
Log Message:
Fix an out of array access and some minor cleanup of the code.
All available cook samples decode correctly now.
patch by Benjamin Larsson < banan ** at ** student ** dot ** ltu ** dot ** se >


Index: cook.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/cook.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cook.c	11 Dec 2005 00:56:39 -0000	1.2
+++ cook.c	4 Jan 2006 12:48:10 -0000	1.3
@@ -131,11 +131,6 @@
     float               rootpow2tab[127];
 
     /* data buffers */
-    uint8_t*            frame_reorder_buffer;
-    int*                frame_reorder_index;
-    int                 frame_reorder_counter;
-    int                 frame_reorder_complete;
-    int                 frame_reorder_index_size;
 
     uint8_t*            decoded_bytes_buffer;
     float               mono_mdct_output[2048] __attribute__((aligned(16)));
@@ -325,8 +320,6 @@
     av_free(q->mlt_precos);
     av_free(q->mlt_presin);
     av_free(q->mlt_postcos);
-    av_free(q->frame_reorder_index);
-    av_free(q->frame_reorder_buffer);
     av_free(q->decoded_bytes_buffer);
 
     /* Free the transform. */
@@ -915,7 +908,7 @@
                          float* mlt_buffer2) {
     int i,j;
     int decouple_tab[SUBBAND_SIZE];
-    float decode_buffer[2048];  //Only 1060 might be needed.
+    float decode_buffer[1060];
     int idx, cpl_tmp,tmp_idx;
     float f1,f2;
     float* cplscale;
@@ -940,20 +933,18 @@
     /* When we reach js_subband_start (the higher frequencies)
        the coefficients are stored in a coupling scheme. */
     idx = (1 << q->js_vlc_bits) - 1;
-    if (q->js_subband_start < q->subbands) {
-        for (i=0 ; i<q->subbands ; i++) {
-            cpl_tmp = cplband[i + q->js_subband_start];
-            idx -=decouple_tab[cpl_tmp];
-            cplscale = (float*)cplscales[q->js_vlc_bits-2];  //choose decoupler table
-            f1 = cplscale[decouple_tab[cpl_tmp]];
-            f2 = cplscale[idx-1];
-            for (j=0 ; j<SUBBAND_SIZE ; j++) {
-                tmp_idx = ((2*q->js_subband_start + i)*20)+j;
-                mlt_buffer1[20*(i+q->js_subband_start) + j] = f1 * decode_buffer[tmp_idx];
-                mlt_buffer2[20*(i+q->js_subband_start) + j] = f2 * decode_buffer[tmp_idx];
-            }
-            idx = (1 << q->js_vlc_bits) - 1;
+    for (i=q->js_subband_start ; i<q->subbands ; i++) {
+        cpl_tmp = cplband[i];
+        idx -=decouple_tab[cpl_tmp];
+        cplscale = (float*)cplscales[q->js_vlc_bits-2];  //choose decoupler table
+        f1 = cplscale[decouple_tab[cpl_tmp]];
+        f2 = cplscale[idx-1];
+        for (j=0 ; j<SUBBAND_SIZE ; j++) {
+            tmp_idx = ((q->js_subband_start + i)*20)+j;
+            mlt_buffer1[20*i + j] = f1 * decode_buffer[tmp_idx];
+            mlt_buffer2[20*i + j] = f2 * decode_buffer[tmp_idx];
         }
+        idx = (1 << q->js_vlc_bits) - 1;
     }
 }
 
@@ -1159,8 +1150,6 @@
     PRINT("numvector_bits",q->numvector_bits);
     PRINT("numvector_size",q->numvector_size);
     PRINT("total_subbands",q->total_subbands);
-    PRINT("frame_reorder_counter",q->frame_reorder_counter);
-    PRINT("frame_reorder_index_size",q->frame_reorder_index_size);
 }
 #endif
 /**
@@ -1293,8 +1282,9 @@
     /* Initialize transform. */
     if ( init_cook_mlt(q) == 0 )
         return -1;
-
-    //dump_cook_context(q,e);
+#ifdef COOKDEBUG
+    dump_cook_context(q,e);
+#endif
     return 0;
 }
 





More information about the ffmpeg-cvslog mailing list