changeset 7023:54d22db12c03 libavcodec

use macro constants for array sizes in decode context
author jbr
date Sat, 07 Jun 2008 22:30:31 +0000
parents b4753ad6e34d
children 7781b4d9cca2
files ac3dec.h
diffstat 1 files changed, 14 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/ac3dec.h	Sat Jun 07 22:30:26 2008 +0000
+++ b/ac3dec.h	Sat Jun 07 22:30:31 2008 +0000
@@ -40,6 +40,9 @@
 
 #define AC3_OUTPUT_LFEON  8
 
+#define AC3_MAX_COEFS   256
+#define AC3_BLOCK_SIZE  256
+
 typedef struct {
     AVCodecContext *avctx;                  ///< parent context
     GetBitContext gbc;                      ///< bitstream reader
@@ -97,7 +100,7 @@
 
 ///@defgroup exponents exponents
     int num_exp_groups[AC3_MAX_CHANNELS];   ///< Number of exponent groups
-    int8_t dexps[AC3_MAX_CHANNELS][256];    ///< decoded exponents
+    int8_t dexps[AC3_MAX_CHANNELS][AC3_MAX_COEFS];  ///< decoded exponents
     int exp_strategy[AC3_MAX_CHANNELS];     ///< exponent strategies
 ///@}
 
@@ -105,8 +108,8 @@
     AC3BitAllocParameters bit_alloc_params;     ///< bit allocation parameters
     int snr_offset[AC3_MAX_CHANNELS];           ///< signal-to-noise ratio offsets
     int fast_gain[AC3_MAX_CHANNELS];            ///< fast gain values (signal-to-mask ratio)
-    uint8_t bap[AC3_MAX_CHANNELS][256];         ///< bit allocation pointers
-    int16_t psd[AC3_MAX_CHANNELS][256];         ///< scaled exponents
+    uint8_t bap[AC3_MAX_CHANNELS][AC3_MAX_COEFS];   ///< bit allocation pointers
+    int16_t psd[AC3_MAX_CHANNELS][AC3_MAX_COEFS];   ///< scaled exponents
     int16_t band_psd[AC3_MAX_CHANNELS][50];     ///< interpolated exponents
     int16_t mask[AC3_MAX_CHANNELS][50];         ///< masking curve values
     int dba_mode[AC3_MAX_CHANNELS];             ///< delta bit allocation mode
@@ -134,16 +137,16 @@
     float mul_bias;                         ///< scaling for float_to_int16 conversion
 ///@}
 
-    int fixed_coeffs[AC3_MAX_CHANNELS][256];    ///> fixed-point transform coefficients
+    int fixed_coeffs[AC3_MAX_CHANNELS][AC3_MAX_COEFS];  ///> fixed-point transform coefficients
 
 ///@defgroup arrays aligned arrays
-    DECLARE_ALIGNED_16(float, transform_coeffs[AC3_MAX_CHANNELS][256]); ///< transform coefficients
-    DECLARE_ALIGNED_16(float, delay[AC3_MAX_CHANNELS][256]);            ///< delay - added to the next block
-    DECLARE_ALIGNED_16(float, window[256]);                             ///< window coefficients
-    DECLARE_ALIGNED_16(float, tmp_output[512]);                         ///< temporary storage for output before windowing
-    DECLARE_ALIGNED_16(float, tmp_imdct[256]);                          ///< temporary storage for imdct transform
-    DECLARE_ALIGNED_16(float, output[AC3_MAX_CHANNELS][256]);           ///< output after imdct transform and windowing
-    DECLARE_ALIGNED_16(short, int_output[AC3_MAX_CHANNELS-1][256]);     ///< final 16-bit integer output
+    DECLARE_ALIGNED_16(float, transform_coeffs[AC3_MAX_CHANNELS][AC3_MAX_COEFS]);   ///< transform coefficients
+    DECLARE_ALIGNED_16(float, delay[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE]);             ///< delay - added to the next block
+    DECLARE_ALIGNED_16(float, window[AC3_BLOCK_SIZE]);                              ///< window coefficients
+    DECLARE_ALIGNED_16(float, tmp_output[AC3_BLOCK_SIZE*2]);                        ///< temporary storage for output before windowing
+    DECLARE_ALIGNED_16(float, tmp_imdct[AC3_BLOCK_SIZE]);                           ///< temporary storage for imdct transform
+    DECLARE_ALIGNED_16(float, output[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE]);            ///< output after imdct transform and windowing
+    DECLARE_ALIGNED_16(short, int_output[AC3_MAX_CHANNELS-1][AC3_BLOCK_SIZE]);      ///< final 16-bit integer output
 ///@}
 } AC3DecodeContext;