mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
cosmetics: Define AC3_WINDOW_SIZE and use it instead of AC3_BLOCK_SIZE*2.
Originally committed as revision 25951 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
7066cc8f2b
commit
1fda2c10f6
@ -36,6 +36,7 @@
|
|||||||
#define AC3_BLOCK_SIZE 256
|
#define AC3_BLOCK_SIZE 256
|
||||||
#define AC3_MAX_BLOCKS 6
|
#define AC3_MAX_BLOCKS 6
|
||||||
#define AC3_FRAME_SIZE (AC3_MAX_BLOCKS * 256)
|
#define AC3_FRAME_SIZE (AC3_MAX_BLOCKS * 256)
|
||||||
|
#define AC3_WINDOW_SIZE (AC3_BLOCK_SIZE * 2)
|
||||||
|
|
||||||
/* exponent encoding strategy */
|
/* exponent encoding strategy */
|
||||||
#define EXP_REUSE 0
|
#define EXP_REUSE 0
|
||||||
|
@ -1187,7 +1187,7 @@ static int AC3_encode_frame(AVCodecContext *avctx,
|
|||||||
AC3EncodeContext *s = avctx->priv_data;
|
AC3EncodeContext *s = avctx->priv_data;
|
||||||
const int16_t *samples = data;
|
const int16_t *samples = data;
|
||||||
int i, j, k, v, ch;
|
int i, j, k, v, ch;
|
||||||
int16_t input_samples[AC3_BLOCK_SIZE*2];
|
int16_t input_samples[AC3_WINDOW_SIZE];
|
||||||
int32_t mdct_coef[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][AC3_MAX_COEFS];
|
int32_t mdct_coef[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][AC3_MAX_COEFS];
|
||||||
uint8_t exp[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][AC3_MAX_COEFS];
|
uint8_t exp[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][AC3_MAX_COEFS];
|
||||||
uint8_t exp_strategy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS];
|
uint8_t exp_strategy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS];
|
||||||
@ -1219,17 +1219,17 @@ static int AC3_encode_frame(AVCodecContext *avctx,
|
|||||||
for(j=0;j<AC3_BLOCK_SIZE;j++) {
|
for(j=0;j<AC3_BLOCK_SIZE;j++) {
|
||||||
input_samples[j] = MUL16(input_samples[j],
|
input_samples[j] = MUL16(input_samples[j],
|
||||||
ff_ac3_window[j]) >> 15;
|
ff_ac3_window[j]) >> 15;
|
||||||
input_samples[AC3_BLOCK_SIZE*2-j-1] = MUL16(input_samples[AC3_BLOCK_SIZE*2-j-1],
|
input_samples[AC3_WINDOW_SIZE-j-1] = MUL16(input_samples[AC3_WINDOW_SIZE-j-1],
|
||||||
ff_ac3_window[j]) >> 15;
|
ff_ac3_window[j]) >> 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Normalize the samples to use the maximum available
|
/* Normalize the samples to use the maximum available
|
||||||
precision */
|
precision */
|
||||||
v = 14 - log2_tab(input_samples, AC3_BLOCK_SIZE*2);
|
v = 14 - log2_tab(input_samples, AC3_WINDOW_SIZE);
|
||||||
if (v < 0)
|
if (v < 0)
|
||||||
v = 0;
|
v = 0;
|
||||||
exp_samples[i][ch] = v - 9;
|
exp_samples[i][ch] = v - 9;
|
||||||
lshift_tab(input_samples, AC3_BLOCK_SIZE*2, v);
|
lshift_tab(input_samples, AC3_WINDOW_SIZE, v);
|
||||||
|
|
||||||
/* do the MDCT */
|
/* do the MDCT */
|
||||||
mdct512(mdct_coef[i][ch], input_samples);
|
mdct512(mdct_coef[i][ch], input_samples);
|
||||||
|
Loading…
Reference in New Issue
Block a user