Revision c787cb33 libavcodec/dv.c

View differences:

libavcodec/dv.c
44 44
#include "put_bits.h"
45 45
#include "simple_idct.h"
46 46
#include "dvdata.h"
47
#include "dv_vlc_data.h"
47
#include "dv_tablegen.h"
48 48

  
49 49
//#undef NDEBUG
50 50
//#include <assert.h>
......
65 65

  
66 66
#define TEX_VLC_BITS 9
67 67

  
68
#if CONFIG_SMALL
69
#define DV_VLC_MAP_RUN_SIZE 15
70
#define DV_VLC_MAP_LEV_SIZE 23
71
#else
72
#define DV_VLC_MAP_RUN_SIZE  64
73
#define DV_VLC_MAP_LEV_SIZE 512 //FIXME sign was removed so this should be /2 but needs check
74
#endif
75

  
76 68
/* XXX: also include quantization */
77 69
static RL_VLC_ELEM dv_rl_vlc[1184];
78
/* VLC encoding lookup table */
79
static struct dv_vlc_pair {
80
   uint32_t vlc;
81
   uint8_t  size;
82
} dv_vlc_map[DV_VLC_MAP_RUN_SIZE][DV_VLC_MAP_LEV_SIZE];
83 70

  
84 71
static inline int dv_work_pool_size(const DVprofile *d)
85 72
{
......
326 313
        }
327 314
        free_vlc(&dv_vlc);
328 315

  
329
        for (i = 0; i < NB_DV_VLC - 1; i++) {
330
           if (dv_vlc_run[i] >= DV_VLC_MAP_RUN_SIZE)
331
               continue;
332
#if CONFIG_SMALL
333
           if (dv_vlc_level[i] >= DV_VLC_MAP_LEV_SIZE)
334
               continue;
335
#endif
336

  
337
           if (dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].size != 0)
338
               continue;
339

  
340
           dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].vlc  =
341
               dv_vlc_bits[i] << (!!dv_vlc_level[i]);
342
           dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].size =
343
               dv_vlc_len[i] + (!!dv_vlc_level[i]);
344
        }
345
        for (i = 0; i < DV_VLC_MAP_RUN_SIZE; i++) {
346
#if CONFIG_SMALL
347
           for (j = 1; j < DV_VLC_MAP_LEV_SIZE; j++) {
348
              if (dv_vlc_map[i][j].size == 0) {
349
                  dv_vlc_map[i][j].vlc = dv_vlc_map[0][j].vlc |
350
                            (dv_vlc_map[i-1][0].vlc << (dv_vlc_map[0][j].size));
351
                  dv_vlc_map[i][j].size = dv_vlc_map[i-1][0].size +
352
                                          dv_vlc_map[0][j].size;
353
              }
354
           }
355
#else
356
           for (j = 1; j < DV_VLC_MAP_LEV_SIZE/2; j++) {
357
              if (dv_vlc_map[i][j].size == 0) {
358
                  dv_vlc_map[i][j].vlc = dv_vlc_map[0][j].vlc |
359
                            (dv_vlc_map[i-1][0].vlc << (dv_vlc_map[0][j].size));
360
                  dv_vlc_map[i][j].size = dv_vlc_map[i-1][0].size +
361
                                          dv_vlc_map[0][j].size;
362
              }
363
              dv_vlc_map[i][((uint16_t)(-j))&0x1ff].vlc =
364
                                            dv_vlc_map[i][j].vlc | 1;
365
              dv_vlc_map[i][((uint16_t)(-j))&0x1ff].size =
366
                                            dv_vlc_map[i][j].size;
367
           }
368
#endif
369
        }
316
        dv_vlc_map_tableinit();
370 317
    }
371 318

  
372 319
    /* Generic DSP setup */

Also available in: Unified diff