[FFmpeg-devel] [PATCH 3/3] [GSoC] [AAC] aacdec: Use defined macros for constants
Rostislav Pehlivanov
atomnuker at gmail.com
Sun Apr 12 06:50:36 CEST 2015
This commit changes the decoder to use the macro definitions for scalefactors and noise energy values reading. This was done to reduce confusion when looking at the encoder and decoder and possibly as a first step in unifying some of the code in the two files.
---
libavcodec/aacdec.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 5a0c05a..3ed66c3 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -1406,7 +1406,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
} else if ((band_type[idx] == INTENSITY_BT) ||
(band_type[idx] == INTENSITY_BT2)) {
for (; i < run_end; i++, idx++) {
- offset[2] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
+ offset[2] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - SCALE_DIFF_ZERO;
clipped_offset = av_clip(offset[2], -155, 100);
if (offset[2] != clipped_offset) {
avpriv_request_sample(ac->avctx,
@@ -1419,9 +1419,9 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
} else if (band_type[idx] == NOISE_BT) {
for (; i < run_end; i++, idx++) {
if (noise_flag-- > 0)
- offset[1] += get_bits(gb, 9) - 256;
+ offset[1] += get_bits(gb, NOISE_PRE_BITS) - NOISE_PRE;
else
- offset[1] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
+ offset[1] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - SCALE_DIFF_ZERO;
clipped_offset = av_clip(offset[1], -100, 155);
if (offset[1] != clipped_offset) {
avpriv_request_sample(ac->avctx,
@@ -1433,7 +1433,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
}
} else {
for (; i < run_end; i++, idx++) {
- offset[0] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
+ offset[0] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - SCALE_DIFF_ZERO;
if (offset[0] > 255U) {
av_log(ac->avctx, AV_LOG_ERROR,
"Scalefactor (%d) out of range.\n", offset[0]);
--
2.1.4
More information about the ffmpeg-devel
mailing list