comparison ac3dec.h @ 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
comparison
equal deleted inserted replaced
7022:b4753ad6e34d 7023:54d22db12c03
37 #undef AC3_MAX_CHANNELS 37 #undef AC3_MAX_CHANNELS
38 #define AC3_MAX_CHANNELS 7 38 #define AC3_MAX_CHANNELS 7
39 #define CPL_CH 0 39 #define CPL_CH 0
40 40
41 #define AC3_OUTPUT_LFEON 8 41 #define AC3_OUTPUT_LFEON 8
42
43 #define AC3_MAX_COEFS 256
44 #define AC3_BLOCK_SIZE 256
42 45
43 typedef struct { 46 typedef struct {
44 AVCodecContext *avctx; ///< parent context 47 AVCodecContext *avctx; ///< parent context
45 GetBitContext gbc; ///< bitstream reader 48 GetBitContext gbc; ///< bitstream reader
46 uint8_t *input_buffer; ///< temp buffer to prevent overread 49 uint8_t *input_buffer; ///< temp buffer to prevent overread
95 int rematrixing_flags[4]; ///< rematrixing flags 98 int rematrixing_flags[4]; ///< rematrixing flags
96 ///@} 99 ///@}
97 100
98 ///@defgroup exponents exponents 101 ///@defgroup exponents exponents
99 int num_exp_groups[AC3_MAX_CHANNELS]; ///< Number of exponent groups 102 int num_exp_groups[AC3_MAX_CHANNELS]; ///< Number of exponent groups
100 int8_t dexps[AC3_MAX_CHANNELS][256]; ///< decoded exponents 103 int8_t dexps[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< decoded exponents
101 int exp_strategy[AC3_MAX_CHANNELS]; ///< exponent strategies 104 int exp_strategy[AC3_MAX_CHANNELS]; ///< exponent strategies
102 ///@} 105 ///@}
103 106
104 ///@defgroup bitalloc bit allocation 107 ///@defgroup bitalloc bit allocation
105 AC3BitAllocParameters bit_alloc_params; ///< bit allocation parameters 108 AC3BitAllocParameters bit_alloc_params; ///< bit allocation parameters
106 int snr_offset[AC3_MAX_CHANNELS]; ///< signal-to-noise ratio offsets 109 int snr_offset[AC3_MAX_CHANNELS]; ///< signal-to-noise ratio offsets
107 int fast_gain[AC3_MAX_CHANNELS]; ///< fast gain values (signal-to-mask ratio) 110 int fast_gain[AC3_MAX_CHANNELS]; ///< fast gain values (signal-to-mask ratio)
108 uint8_t bap[AC3_MAX_CHANNELS][256]; ///< bit allocation pointers 111 uint8_t bap[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< bit allocation pointers
109 int16_t psd[AC3_MAX_CHANNELS][256]; ///< scaled exponents 112 int16_t psd[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< scaled exponents
110 int16_t band_psd[AC3_MAX_CHANNELS][50]; ///< interpolated exponents 113 int16_t band_psd[AC3_MAX_CHANNELS][50]; ///< interpolated exponents
111 int16_t mask[AC3_MAX_CHANNELS][50]; ///< masking curve values 114 int16_t mask[AC3_MAX_CHANNELS][50]; ///< masking curve values
112 int dba_mode[AC3_MAX_CHANNELS]; ///< delta bit allocation mode 115 int dba_mode[AC3_MAX_CHANNELS]; ///< delta bit allocation mode
113 int dba_nsegs[AC3_MAX_CHANNELS]; ///< number of delta segments 116 int dba_nsegs[AC3_MAX_CHANNELS]; ///< number of delta segments
114 uint8_t dba_offsets[AC3_MAX_CHANNELS][8]; ///< delta segment offsets 117 uint8_t dba_offsets[AC3_MAX_CHANNELS][8]; ///< delta segment offsets
132 DSPContext dsp; ///< for optimization 135 DSPContext dsp; ///< for optimization
133 float add_bias; ///< offset for float_to_int16 conversion 136 float add_bias; ///< offset for float_to_int16 conversion
134 float mul_bias; ///< scaling for float_to_int16 conversion 137 float mul_bias; ///< scaling for float_to_int16 conversion
135 ///@} 138 ///@}
136 139
137 int fixed_coeffs[AC3_MAX_CHANNELS][256]; ///> fixed-point transform coefficients 140 int fixed_coeffs[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///> fixed-point transform coefficients
138 141
139 ///@defgroup arrays aligned arrays 142 ///@defgroup arrays aligned arrays
140 DECLARE_ALIGNED_16(float, transform_coeffs[AC3_MAX_CHANNELS][256]); ///< transform coefficients 143 DECLARE_ALIGNED_16(float, transform_coeffs[AC3_MAX_CHANNELS][AC3_MAX_COEFS]); ///< transform coefficients
141 DECLARE_ALIGNED_16(float, delay[AC3_MAX_CHANNELS][256]); ///< delay - added to the next block 144 DECLARE_ALIGNED_16(float, delay[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE]); ///< delay - added to the next block
142 DECLARE_ALIGNED_16(float, window[256]); ///< window coefficients 145 DECLARE_ALIGNED_16(float, window[AC3_BLOCK_SIZE]); ///< window coefficients
143 DECLARE_ALIGNED_16(float, tmp_output[512]); ///< temporary storage for output before windowing 146 DECLARE_ALIGNED_16(float, tmp_output[AC3_BLOCK_SIZE*2]); ///< temporary storage for output before windowing
144 DECLARE_ALIGNED_16(float, tmp_imdct[256]); ///< temporary storage for imdct transform 147 DECLARE_ALIGNED_16(float, tmp_imdct[AC3_BLOCK_SIZE]); ///< temporary storage for imdct transform
145 DECLARE_ALIGNED_16(float, output[AC3_MAX_CHANNELS][256]); ///< output after imdct transform and windowing 148 DECLARE_ALIGNED_16(float, output[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE]); ///< output after imdct transform and windowing
146 DECLARE_ALIGNED_16(short, int_output[AC3_MAX_CHANNELS-1][256]); ///< final 16-bit integer output 149 DECLARE_ALIGNED_16(short, int_output[AC3_MAX_CHANNELS-1][AC3_BLOCK_SIZE]); ///< final 16-bit integer output
147 ///@} 150 ///@}
148 } AC3DecodeContext; 151 } AC3DecodeContext;
149 152
150 #endif /* FFMPEG_AC3DEC_H */ 153 #endif /* FFMPEG_AC3DEC_H */