diff dv.c @ 11523:3367dd5913a0 libavcodec

Add support for hard-coding the 256kB large dv_vlc_map table.
author reimar
date Sun, 21 Mar 2010 16:03:45 +0000
parents 85d679e0b591
children 04f5fe406669
line wrap: on
line diff
--- a/dv.c	Sun Mar 21 14:46:32 2010 +0000
+++ b/dv.c	Sun Mar 21 16:03:45 2010 +0000
@@ -44,7 +44,7 @@
 #include "put_bits.h"
 #include "simple_idct.h"
 #include "dvdata.h"
-#include "dv_vlc_data.h"
+#include "dv_tablegen.h"
 
 //#undef NDEBUG
 //#include <assert.h>
@@ -65,21 +65,8 @@
 
 #define TEX_VLC_BITS 9
 
-#if CONFIG_SMALL
-#define DV_VLC_MAP_RUN_SIZE 15
-#define DV_VLC_MAP_LEV_SIZE 23
-#else
-#define DV_VLC_MAP_RUN_SIZE  64
-#define DV_VLC_MAP_LEV_SIZE 512 //FIXME sign was removed so this should be /2 but needs check
-#endif
-
 /* XXX: also include quantization */
 static RL_VLC_ELEM dv_rl_vlc[1184];
-/* VLC encoding lookup table */
-static struct dv_vlc_pair {
-   uint32_t vlc;
-   uint8_t  size;
-} dv_vlc_map[DV_VLC_MAP_RUN_SIZE][DV_VLC_MAP_LEV_SIZE];
 
 static inline int dv_work_pool_size(const DVprofile *d)
 {
@@ -326,47 +313,7 @@
         }
         free_vlc(&dv_vlc);
 
-        for (i = 0; i < NB_DV_VLC - 1; i++) {
-           if (dv_vlc_run[i] >= DV_VLC_MAP_RUN_SIZE)
-               continue;
-#if CONFIG_SMALL
-           if (dv_vlc_level[i] >= DV_VLC_MAP_LEV_SIZE)
-               continue;
-#endif
-
-           if (dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].size != 0)
-               continue;
-
-           dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].vlc  =
-               dv_vlc_bits[i] << (!!dv_vlc_level[i]);
-           dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].size =
-               dv_vlc_len[i] + (!!dv_vlc_level[i]);
-        }
-        for (i = 0; i < DV_VLC_MAP_RUN_SIZE; i++) {
-#if CONFIG_SMALL
-           for (j = 1; j < DV_VLC_MAP_LEV_SIZE; j++) {
-              if (dv_vlc_map[i][j].size == 0) {
-                  dv_vlc_map[i][j].vlc = dv_vlc_map[0][j].vlc |
-                            (dv_vlc_map[i-1][0].vlc << (dv_vlc_map[0][j].size));
-                  dv_vlc_map[i][j].size = dv_vlc_map[i-1][0].size +
-                                          dv_vlc_map[0][j].size;
-              }
-           }
-#else
-           for (j = 1; j < DV_VLC_MAP_LEV_SIZE/2; j++) {
-              if (dv_vlc_map[i][j].size == 0) {
-                  dv_vlc_map[i][j].vlc = dv_vlc_map[0][j].vlc |
-                            (dv_vlc_map[i-1][0].vlc << (dv_vlc_map[0][j].size));
-                  dv_vlc_map[i][j].size = dv_vlc_map[i-1][0].size +
-                                          dv_vlc_map[0][j].size;
-              }
-              dv_vlc_map[i][((uint16_t)(-j))&0x1ff].vlc =
-                                            dv_vlc_map[i][j].vlc | 1;
-              dv_vlc_map[i][((uint16_t)(-j))&0x1ff].size =
-                                            dv_vlc_map[i][j].size;
-           }
-#endif
-        }
+        dv_vlc_map_tableinit();
     }
 
     /* Generic DSP setup */