comparison ac3.h @ 6003:608c8e9ac412 libavcodec

cosmetics: rename ac3 bit allocation variables
author jbr
date Sun, 09 Dec 2007 03:23:04 +0000
parents 1d83e9c34641
children 713d66164428
comparison
equal deleted inserted replaced
6002:29635f7c3d9c 6003:608c8e9ac412
62 AC3_ACMOD_2F2R, 62 AC3_ACMOD_2F2R,
63 AC3_ACMOD_3F2R 63 AC3_ACMOD_3F2R
64 } AC3ChannelMode; 64 } AC3ChannelMode;
65 65
66 typedef struct AC3BitAllocParameters { 66 typedef struct AC3BitAllocParameters {
67 int fscod; /* frequency */ 67 int sr_code;
68 int halfratecod; 68 int sr_shift;
69 int sgain, sdecay, fdecay, dbknee, floor; 69 int slow_gain, slow_decay, fast_decay, db_per_bit, floor;
70 int cplfleak, cplsleak; 70 int cpl_fast_leak, cpl_slow_leak;
71 } AC3BitAllocParameters; 71 } AC3BitAllocParameters;
72 72
73 /** 73 /**
74 * @struct AC3HeaderInfo 74 * @struct AC3HeaderInfo
75 * Coded AC-3 header values up to the lfeon element, plus derived values. 75 * Coded AC-3 header values up to the lfeon element, plus derived values.
78 /** @defgroup coded Coded elements 78 /** @defgroup coded Coded elements
79 * @{ 79 * @{
80 */ 80 */
81 uint16_t sync_word; 81 uint16_t sync_word;
82 uint16_t crc1; 82 uint16_t crc1;
83 uint8_t fscod; 83 uint8_t sr_code;
84 uint8_t frmsizecod; 84 uint8_t frmsizecod;
85 uint8_t bsid; 85 uint8_t bsid;
86 uint8_t bsmod; 86 uint8_t bsmod;
87 uint8_t acmod; 87 uint8_t acmod;
88 uint8_t cmixlev; 88 uint8_t cmixlev;
92 /** @} */ 92 /** @} */
93 93
94 /** @defgroup derived Derived values 94 /** @defgroup derived Derived values
95 * @{ 95 * @{
96 */ 96 */
97 uint8_t halfratecod; 97 uint8_t sr_shift;
98 uint16_t sample_rate; 98 uint16_t sample_rate;
99 uint32_t bit_rate; 99 uint32_t bit_rate;
100 uint8_t channels; 100 uint8_t channels;
101 uint16_t frame_size; 101 uint16_t frame_size;
102 /** @} */ 102 /** @} */
115 * 115 *
116 * @param[in] exp frequency coefficient exponents 116 * @param[in] exp frequency coefficient exponents
117 * @param[in] start starting bin location 117 * @param[in] start starting bin location
118 * @param[in] end ending bin location 118 * @param[in] end ending bin location
119 * @param[out] psd signal power for each frequency bin 119 * @param[out] psd signal power for each frequency bin
120 * @param[out] bndpsd signal power for each critical band 120 * @param[out] band_psd signal power for each critical band
121 */ 121 */
122 void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd, 122 void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd,
123 int16_t *bndpsd); 123 int16_t *band_psd);
124 124
125 /** 125 /**
126 * Calculates the masking curve. 126 * Calculates the masking curve.
127 * First, the excitation is calculated using parameters in \p s and the signal 127 * First, the excitation is calculated using parameters in \p s and the signal
128 * power in each critical band. The excitation is compared with a predefined 128 * power in each critical band. The excitation is compared with a predefined
129 * hearing threshold table to produce the masking curve. If delta bit 129 * hearing threshold table to produce the masking curve. If delta bit
130 * allocation information is provided, it is used for adjusting the masking 130 * allocation information is provided, it is used for adjusting the masking
131 * curve, usually to give a closer match to a better psychoacoustic model. 131 * curve, usually to give a closer match to a better psychoacoustic model.
132 * 132 *
133 * @param[in] s adjustable bit allocation parameters 133 * @param[in] s adjustable bit allocation parameters
134 * @param[in] bndpsd signal power for each critical band 134 * @param[in] band_psd signal power for each critical band
135 * @param[in] start starting bin location 135 * @param[in] start starting bin location
136 * @param[in] end ending bin location 136 * @param[in] end ending bin location
137 * @param[in] fgain fast gain (estimated signal-to-mask ratio) 137 * @param[in] fast_gain fast gain (estimated signal-to-mask ratio)
138 * @param[in] is_lfe whether or not the channel being processed is the LFE 138 * @param[in] is_lfe whether or not the channel being processed is the LFE
139 * @param[in] deltbae delta bit allocation exists (none, reuse, or new) 139 * @param[in] dba_mode delta bit allocation mode (none, reuse, or new)
140 * @param[in] deltnseg number of delta segments 140 * @param[in] dba_nsegs number of delta segments
141 * @param[in] deltoffst location offsets for each segment 141 * @param[in] dba_offsets location offsets for each segment
142 * @param[in] deltlen length of each segment 142 * @param[in] dba_lengths length of each segment
143 * @param[in] deltba delta bit allocation for each segment 143 * @param[in] dba_values delta bit allocation for each segment
144 * @param[out] mask calculated masking curve 144 * @param[out] mask calculated masking curve
145 */ 145 */
146 void ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *bndpsd, 146 void ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
147 int start, int end, int fgain, int is_lfe, 147 int start, int end, int fast_gain, int is_lfe,
148 int deltbae, int deltnseg, uint8_t *deltoffst, 148 int dba_mode, int dba_nsegs, uint8_t *dba_offsets,
149 uint8_t *deltlen, uint8_t *deltba, 149 uint8_t *dba_lengths, uint8_t *dba_values,
150 int16_t *mask); 150 int16_t *mask);
151 151
152 /** 152 /**
153 * Calculates bit allocation pointers. 153 * Calculates bit allocation pointers.
154 * The SNR is the difference between the masking curve and the signal. AC-3 154 * The SNR is the difference between the masking curve and the signal. AC-3
157 * 157 *
158 * @param[in] mask masking curve 158 * @param[in] mask masking curve
159 * @param[in] psd signal power for each frequency bin 159 * @param[in] psd signal power for each frequency bin
160 * @param[in] start starting bin location 160 * @param[in] start starting bin location
161 * @param[in] end ending bin location 161 * @param[in] end ending bin location
162 * @param[in] snroffset SNR adjustment 162 * @param[in] snr_offset SNR adjustment
163 * @param[in] floor noise floor 163 * @param[in] floor noise floor
164 * @param[out] bap bit allocation pointers 164 * @param[out] bap bit allocation pointers
165 */ 165 */
166 void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end, 166 void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end,
167 int snroffset, int floor, uint8_t *bap); 167 int snr_offset, int floor, uint8_t *bap);
168 168
169 void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap, 169 void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap,
170 int8_t *exp, int start, int end, 170 int8_t *exp, int start, int end,
171 int snroffset, int fgain, int is_lfe, 171 int snr_offset, int fast_gain, int is_lfe,
172 int deltbae,int deltnseg, 172 int dba_mode, int dba_nsegs,
173 uint8_t *deltoffst, uint8_t *deltlen, uint8_t *deltba); 173 uint8_t *dba_offsets, uint8_t *dba_lengths,
174 uint8_t *dba_values);
174 175
175 #endif /* FFMPEG_AC3_H */ 176 #endif /* FFMPEG_AC3_H */