diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-05-16 11:55:43 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-07-01 12:11:55 +0200 |
commit | 2d2c0796889c9b5abc83b372c1387127ef6aeeea (patch) | |
tree | c4760e6a91d4734a604036346c0ef5d09332d040 /libavcodec/aacdec_template.c | |
parent | 52410bc41af8acd43eed0711b0a4afc57155d516 (diff) | |
download | ffmpeg-2d2c0796889c9b5abc83b372c1387127ef6aeeea.tar.gz |
avcodec/aacdec_template: Merge 3 #ifs related to noise handling
Fewer #if and fewer lines
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit bc33c99d56791fc26ccafb49512b59e38b99ca12)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/aacdec_template.c')
-rw-r--r-- | libavcodec/aacdec_template.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 42aacd8612..9aebbad476 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -1618,25 +1618,24 @@ static int decode_spectrum_and_dequant(AACContext *ac, INTFLOAT coef[1024], } } else if (cbt_m1 == NOISE_BT - 1) { for (group = 0; group < (AAC_SIGNE)g_len; group++, cfo+=128) { -#if !USE_FIXED - float scale; -#endif /* !USE_FIXED */ INTFLOAT band_energy; - +#if USE_FIXED for (k = 0; k < off_len; k++) { ac->random_state = lcg_random(ac->random_state); -#if USE_FIXED cfo[k] = ac->random_state >> 3; -#else - cfo[k] = ac->random_state; -#endif /* USE_FIXED */ } -#if USE_FIXED band_energy = ac->fdsp->scalarproduct_fixed(cfo, cfo, off_len); band_energy = fixed_sqrt(band_energy, 31); noise_scale(cfo, sf[idx], band_energy, off_len); #else + float scale; + + for (k = 0; k < off_len; k++) { + ac->random_state = lcg_random(ac->random_state); + cfo[k] = ac->random_state; + } + band_energy = ac->fdsp->scalarproduct_float(cfo, cfo, off_len); scale = sf[idx] / sqrtf(band_energy); ac->fdsp->vector_fmul_scalar(cfo, cfo, scale, off_len); |