changeset 7136:7a73d76aaaa0 libavcodec

remove duplicate tables
author stefang
date Wed, 25 Jun 2008 11:33:49 +0000
parents 6bd6a2da306e
children 186eb61a9860
files mjpeg.c mjpeg.h mjpegdec.c mjpegenc.c msmpeg4.c msmpeg4data.c msmpeg4data.h vc1.c vc1data.c vc1data.h
diffstat 10 files changed, 19 insertions(+), 102 deletions(-) [+]
line wrap: on
line diff
--- a/mjpeg.c	Tue Jun 24 23:51:17 2008 +0000
+++ b/mjpeg.c	Wed Jun 25 11:33:49 2008 +0000
@@ -64,13 +64,11 @@
 /* IMPORTANT: these are only valid for 8-bit data precision! */
 const uint8_t ff_mjpeg_bits_dc_luminance[17] =
 { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
-const uint8_t ff_mjpeg_val_dc_luminance[] =
+const uint8_t ff_mjpeg_val_dc[12] =
 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
 
 const uint8_t ff_mjpeg_bits_dc_chrominance[17] =
 { /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
-const uint8_t ff_mjpeg_val_dc_chrominance[] =
-{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
 
 const uint8_t ff_mjpeg_bits_ac_luminance[17] =
 { /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d };
--- a/mjpeg.h	Tue Jun 24 23:51:17 2008 +0000
+++ b/mjpeg.h	Wed Jun 25 11:33:49 2008 +0000
@@ -138,10 +138,9 @@
     }
 
 extern const uint8_t ff_mjpeg_bits_dc_luminance[];
-extern const uint8_t ff_mjpeg_val_dc_luminance[];
+extern const uint8_t ff_mjpeg_val_dc[];
 
 extern const uint8_t ff_mjpeg_bits_dc_chrominance[];
-extern const uint8_t ff_mjpeg_val_dc_chrominance[];
 
 extern const uint8_t ff_mjpeg_bits_ac_luminance[];
 extern const uint8_t ff_mjpeg_val_ac_luminance[];
--- a/mjpegdec.c	Tue Jun 24 23:51:17 2008 +0000
+++ b/mjpegdec.c	Wed Jun 25 11:33:49 2008 +0000
@@ -64,9 +64,9 @@
 
 static void build_basic_mjpeg_vlc(MJpegDecodeContext * s) {
     build_vlc(&s->vlcs[0][0], ff_mjpeg_bits_dc_luminance,
-              ff_mjpeg_val_dc_luminance, 12, 0, 0);
+              ff_mjpeg_val_dc, 12, 0, 0);
     build_vlc(&s->vlcs[0][1], ff_mjpeg_bits_dc_chrominance,
-              ff_mjpeg_val_dc_chrominance, 12, 0, 0);
+              ff_mjpeg_val_dc, 12, 0, 0);
     build_vlc(&s->vlcs[1][0], ff_mjpeg_bits_ac_luminance,
               ff_mjpeg_val_ac_luminance, 251, 0, 1);
     build_vlc(&s->vlcs[1][1], ff_mjpeg_bits_ac_chrominance,
--- a/mjpegenc.c	Tue Jun 24 23:51:17 2008 +0000
+++ b/mjpegenc.c	Wed Jun 25 11:33:49 2008 +0000
@@ -59,11 +59,11 @@
     ff_mjpeg_build_huffman_codes(m->huff_size_dc_luminance,
                                  m->huff_code_dc_luminance,
                                  ff_mjpeg_bits_dc_luminance,
-                                 ff_mjpeg_val_dc_luminance);
+                                 ff_mjpeg_val_dc);
     ff_mjpeg_build_huffman_codes(m->huff_size_dc_chrominance,
                                  m->huff_code_dc_chrominance,
                                  ff_mjpeg_bits_dc_chrominance,
-                                 ff_mjpeg_val_dc_chrominance);
+                                 ff_mjpeg_val_dc);
     ff_mjpeg_build_huffman_codes(m->huff_size_ac_luminance,
                                  m->huff_code_ac_luminance,
                                  ff_mjpeg_bits_ac_luminance,
@@ -139,9 +139,9 @@
     put_bits(p, 16, 0); /* patched later */
     size = 2;
     size += put_huffman_table(s, 0, 0, ff_mjpeg_bits_dc_luminance,
-                              ff_mjpeg_val_dc_luminance);
+                              ff_mjpeg_val_dc);
     size += put_huffman_table(s, 0, 1, ff_mjpeg_bits_dc_chrominance,
-                              ff_mjpeg_val_dc_chrominance);
+                              ff_mjpeg_val_dc);
 
     size += put_huffman_table(s, 1, 0, ff_mjpeg_bits_ac_luminance,
                               ff_mjpeg_val_ac_luminance);
--- a/msmpeg4.c	Tue Jun 24 23:51:17 2008 +0000
+++ b/msmpeg4.c	Wed Jun 25 11:33:49 2008 +0000
@@ -98,7 +98,7 @@
     case 3:
         if(s->workaround_bugs){
             s->y_dc_scale_table= old_ff_y_dc_scale_table;
-            s->c_dc_scale_table= old_ff_c_dc_scale_table;
+            s->c_dc_scale_table= wmv1_c_dc_scale_table;
         } else{
             s->y_dc_scale_table= ff_mpeg4_y_dc_scale_table;
             s->c_dc_scale_table= ff_mpeg4_c_dc_scale_table;
--- a/msmpeg4data.c	Tue Jun 24 23:51:17 2008 +0000
+++ b/msmpeg4data.c	Wed Jun 25 11:33:49 2008 +0000
@@ -1823,10 +1823,6 @@
 //  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
     0, 8, 8, 8, 8,10,12,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39
 };
-const uint8_t old_ff_c_dc_scale_table[32]={
-//  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
-    0, 8, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22
-};
 
 const uint8_t wmv1_scantable[WMV1_SCANTABLE_COUNT][64]={
   {
--- a/msmpeg4data.h	Tue Jun 24 23:51:17 2008 +0000
+++ b/msmpeg4data.h	Wed Jun 25 11:33:49 2008 +0000
@@ -76,7 +76,6 @@
 extern const uint8_t wmv1_y_dc_scale_table[32];
 extern const uint8_t wmv1_c_dc_scale_table[32];
 extern const uint8_t old_ff_y_dc_scale_table[32];
-extern const uint8_t old_ff_c_dc_scale_table[32];
 
 extern MVTable mv_tables[2];
 
--- a/vc1.c	Tue Jun 24 23:51:17 2008 +0000
+++ b/vc1.c	Wed Jun 25 11:33:49 2008 +0000
@@ -783,8 +783,8 @@
     }
     else
     {
-        v->zz_8x4 = ff_vc1_simple_progressive_8x4_zz;
-        v->zz_4x8 = ff_vc1_simple_progressive_4x8_zz;
+        v->zz_8x4 = wmv2_scantableA;
+        v->zz_4x8 = wmv2_scantableB;
         v->res_sm = get_bits(gb, 2); //reserved
         if (v->res_sm)
         {
@@ -2398,11 +2398,11 @@
 
         if(v->s.ac_pred) {
             if(!dc_pred_dir)
-                zz_table = ff_vc1_horizontal_zz;
+                zz_table = wmv1_scantable[2];
             else
-                zz_table = ff_vc1_vertical_zz;
+                zz_table = wmv1_scantable[3];
         } else
-            zz_table = ff_vc1_normal_zz;
+            zz_table = wmv1_scantable[1];
 
         ac_val = s->ac_val[0][0] + s->block_index[n] * 16;
         ac_val2 = ac_val;
@@ -2581,11 +2581,11 @@
 
         if(v->s.ac_pred) {
             if(!dc_pred_dir)
-                zz_table = ff_vc1_horizontal_zz;
+                zz_table = wmv1_scantable[2];
             else
-                zz_table = ff_vc1_vertical_zz;
+                zz_table = wmv1_scantable[3];
         } else
-            zz_table = ff_vc1_normal_zz;
+            zz_table = wmv1_scantable[1];
 
         while (!last) {
             vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
@@ -2786,7 +2786,7 @@
         const int8_t *zz_table;
         int k;
 
-        zz_table = ff_vc1_simple_progressive_8x8_zz;
+        zz_table = wmv1_scantable[0];
 
         while (!last) {
             vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
@@ -2928,7 +2928,7 @@
             i += skip;
             if(i > 63)
                 break;
-            idx = ff_vc1_simple_progressive_8x8_zz[i++];
+            idx = wmv1_scantable[0][i++];
             block[idx] = value * scale;
             if(!v->pquantizer)
                 block[idx] += (block[idx] < 0) ? -mquant : mquant;
--- a/vc1data.c	Tue Jun 24 23:51:17 2008 +0000
+++ b/vc1data.c	Wed Jun 25 11:33:49 2008 +0000
@@ -562,75 +562,6 @@
 
 /* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */
 
-/* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */
-const int8_t ff_vc1_normal_zz[64] = {
-       0,     8,     1,     2,     9,    16,    24,    17,
-      10,     3,     4,    11,    18,    25,    32,    40,
-      33,    48,    26,    19,    12,     5,     6,    13,
-      20,    27,    34,    41,    56,    49,    57,    42,
-      35,    28,    21,    14,     7,    15,    22,    29,
-      36,    43,    50,    58,    51,    59,    44,    37,
-      30,    23,    31,    38,    45,    52,    60,    53,
-      61,    46,    39,    47,    54,    62,    55,    63
-};
-
-const int8_t ff_vc1_horizontal_zz [64] = /* Table 227 */
-{
-       0,     1,     8,     2,     3,     9,    16,    24,
-      17,    10,     4,     5,    11,    18,    25,    32,
-      40,    48,    33,    26,    19,    12,     6,     7,
-      13,    20,    27,    34,    41,    56,    49,    57,
-      42,    35,    28,    21,    14,    15,    22,    29,
-      36,    43,    50,    58,    51,    44,    37,    30,
-      23,    31,    38,    45,    52,    59,    60,    53,
-      46,    39,    47,    54,    61,    62,    55,    63
-};
-
-const int8_t ff_vc1_vertical_zz [64] = /* Table 228 */
-{
-       0,     8,    16,     1,    24,    32,    40,     9,
-       2,     3,    10,    17,    25,    48,    56,    41,
-      33,    26,    18,    11,     4,     5,    12,    19,
-      27,    34,    49,    57,    50,    42,    35,    28,
-      20,    13,     6,     7,    14,    21,    29,    36,
-      43,    51,    58,    59,    52,    44,    37,    30,
-      22,    15,    23,    31,    38,    45,    60,    53,
-      46,    39,    47,    54,    61,    62,    55,    63
-};
-
-const int8_t ff_vc1_simple_progressive_8x8_zz [64] =
-/* Table 229 */
-{
-       0,     8,     1,     2,     9,    16,    24,    17,
-      10,     3,     4,    11,    18,    25,    32,    40,
-      48,    56,    41,    33,    26,    19,    12,     5,
-       6,    13,    20,    27,    34,    49,    57,    58,
-      50,    42,    35,    28,    21,    14,     7,    15,
-      22,    29,    36,    43,    51,    59,    60,    52,
-      44,    37,    30,    23,    31,    38,    45,    53,
-      61,    62,    54,    46,    39,    47,    55,    63
-};
-
-const int8_t ff_vc1_simple_progressive_8x4_zz [32] = /* Table 230 */
-{
-       0,     1,     2,     8,     3,     9,    10,    16,
-       4,    11,    17,    24,    18,    12,     5,    19,
-      25,    13,    20,    26,    27,     6,    21,    28,
-      14,    22,    29,     7,    30,    15,    23,    31
-};
-
-const int8_t ff_vc1_simple_progressive_4x8_zz [32] = /* Table 231 */
-{
-       0,     8,     1,    16,
-       9,    24,    17,     2,
-      32,    10,    25,    40,
-      18,    48,    33,    26,
-      56,    41,    34,     3,
-      49,    57,    11,    42,
-      19,    50,    27,    58,
-      35,    43,    51,    59
-};
-
 /* Table 232 */
 const int8_t ff_vc1_simple_progressive_4x4_zz [16] =
 {
--- a/vc1data.h	Tue Jun 24 23:51:17 2008 +0000
+++ b/vc1data.h	Wed Jun 25 11:33:49 2008 +0000
@@ -143,12 +143,6 @@
 /* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */
 
 /* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */
-extern const int8_t ff_vc1_normal_zz[64];
-extern const int8_t ff_vc1_horizontal_zz [64];
-extern const int8_t ff_vc1_vertical_zz [64];
-extern const int8_t ff_vc1_simple_progressive_8x8_zz [64];
-extern const int8_t ff_vc1_simple_progressive_8x4_zz [32];
-extern const int8_t ff_vc1_simple_progressive_4x8_zz [32];
 extern const int8_t ff_vc1_simple_progressive_4x4_zz [16];
 extern const int8_t ff_vc1_adv_progressive_8x4_zz [32];
 extern const int8_t ff_vc1_adv_progressive_4x8_zz [32];