Revision e732af87 libavcodec/ac3.c

View differences:

libavcodec/ac3.c
28 28
#include "ac3.h"
29 29
#include "get_bits.h"
30 30

  
31
#if CONFIG_HARDCODED_TABLES
32

  
33 31
/**
34 32
 * Starting frequency coefficient bin for each critical band.
35 33
 */
......
41 39
     79,  85, 97, 109, 121, 133, 157, 181, 205, 229, 253
42 40
};
43 41

  
42
#if CONFIG_HARDCODED_TABLES
43

  
44 44
/**
45 45
 * Map each frequency coefficient bin to the critical band that contains it.
46 46
 */
......
70 70
};
71 71

  
72 72
#else /* CONFIG_HARDCODED_TABLES */
73
static const uint8_t ff_ac3_critical_band_size_tab[AC3_CRITICAL_BANDS]={
74
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
75
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3,
76
    3, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 24, 24, 24, 24, 24
77
};
78

  
79
static uint8_t band_start_tab[51];
80 73
static uint8_t bin_to_band_tab[253];
81 74
#endif
82 75

  
......
251 244
av_cold void ac3_common_init(void)
252 245
{
253 246
#if !CONFIG_HARDCODED_TABLES
254
    /* compute bndtab and masktab from bandsz */
247
    /* compute bin_to_band_tab from band_start_tab */
255 248
    int bin = 0, band;
256 249
    for (band = 0; band < AC3_CRITICAL_BANDS; band++) {
257
        int band_end = bin + ff_ac3_critical_band_size_tab[band];
258
        band_start_tab[band] = bin;
250
        int band_end = band_start_tab[band+1];
259 251
        while (bin < band_end)
260 252
            bin_to_band_tab[bin++] = band;
261 253
    }
262
    band_start_tab[AC3_CRITICAL_BANDS] = bin;
263 254
#endif /* !CONFIG_HARDCODED_TABLES */
264 255
}

Also available in: Unified diff