]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ac3.c
ARM: add helper macro for declaring constant data
[ffmpeg] / libavcodec / ac3.c
index 4ab77b84a1661c5958335496382ac332da6c4083..23eee52661a4f4c87202991a6d01e98f630410f6 100644 (file)
@@ -28,8 +28,6 @@
 #include "ac3.h"
 #include "get_bits.h"
 
-#if CONFIG_HARDCODED_TABLES
-
 /**
  * Starting frequency coefficient bin for each critical band.
  */
@@ -41,6 +39,8 @@ static const uint8_t band_start_tab[AC3_CRITICAL_BANDS+1] = {
      79,  85, 97, 109, 121, 133, 157, 181, 205, 229, 253
 };
 
+#if CONFIG_HARDCODED_TABLES
+
 /**
  * Map each frequency coefficient bin to the critical band that contains it.
  */
@@ -70,7 +70,6 @@ static const uint8_t bin_to_band_tab[253] = {
 };
 
 #else /* CONFIG_HARDCODED_TABLES */
-static uint8_t band_start_tab[51];
 static uint8_t bin_to_band_tab[253];
 #endif
 
@@ -237,45 +236,20 @@ void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end,
     } while (end > band_start_tab[band++]);
 }
 
-/* AC-3 bit allocation. The algorithm is the one described in the AC-3
-   spec. */
-void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap,
-                                   int8_t *exp, int start, int end,
-                                   int snr_offset, int fast_gain, int is_lfe,
-                                   int dba_mode, int dba_nsegs,
-                                   uint8_t *dba_offsets, uint8_t *dba_lengths,
-                                   uint8_t *dba_values)
-{
-    int16_t psd[AC3_MAX_COEFS];           /* scaled exponents */
-    int16_t band_psd[AC3_CRITICAL_BANDS]; /* interpolated exponents */
-    int16_t mask[AC3_CRITICAL_BANDS];   /* masking value */
-
-    ff_ac3_bit_alloc_calc_psd(exp, start, end, psd, band_psd);
-
-    ff_ac3_bit_alloc_calc_mask(s, band_psd, start, end, fast_gain, is_lfe,
-                               dba_mode, dba_nsegs, dba_offsets, dba_lengths,
-                               dba_values, mask);
-
-    ff_ac3_bit_alloc_calc_bap(mask, psd, start, end, snr_offset, s->floor,
-                              ff_ac3_bap_tab, bap);
-}
-
 /**
  * Initialize some tables.
  * note: This function must remain thread safe because it is called by the
  *       AVParser init code.
  */
-av_cold void ac3_common_init(void)
+av_cold void ff_ac3_common_init(void)
 {
 #if !CONFIG_HARDCODED_TABLES
-    /* compute bndtab and masktab from bandsz */
+    /* compute bin_to_band_tab from band_start_tab */
     int bin = 0, band;
     for (band = 0; band < AC3_CRITICAL_BANDS; band++) {
-        int band_end = bin + ff_ac3_critical_band_size_tab[band];
-        band_start_tab[band] = bin;
+        int band_end = band_start_tab[band+1];
         while (bin < band_end)
             bin_to_band_tab[bin++] = band;
     }
-    band_start_tab[AC3_CRITICAL_BANDS] = bin;
 #endif /* !CONFIG_HARDCODED_TABLES */
 }