mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-22 15:23:11 +00:00
aacdec: Use macros for constants
This commit replaces the previous hardcoded constants with both new and previously defined macros from aac.h. This change makes it easy for anyone reading the code to know how encoding and decoding scalefactors works. It's also possibly a step in unifying some of the code across both the encoder and decoder. Reviewed-by: Claudio Freire <klaussfreire@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
37d93fdbf0
commit
a61c75e9f7
@ -1394,7 +1394,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
|
|||||||
int band_type_run_end[120])
|
int band_type_run_end[120])
|
||||||
{
|
{
|
||||||
int g, i, idx = 0;
|
int g, i, idx = 0;
|
||||||
int offset[3] = { global_gain, global_gain - 90, 0 };
|
int offset[3] = { global_gain, global_gain - NOISE_OFFSET, 0 };
|
||||||
int clipped_offset;
|
int clipped_offset;
|
||||||
int noise_flag = 1;
|
int noise_flag = 1;
|
||||||
for (g = 0; g < ics->num_window_groups; g++) {
|
for (g = 0; g < ics->num_window_groups; g++) {
|
||||||
@ -1406,7 +1406,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
|
|||||||
} else if ((band_type[idx] == INTENSITY_BT) ||
|
} else if ((band_type[idx] == INTENSITY_BT) ||
|
||||||
(band_type[idx] == INTENSITY_BT2)) {
|
(band_type[idx] == INTENSITY_BT2)) {
|
||||||
for (; i < run_end; i++, idx++) {
|
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);
|
clipped_offset = av_clip(offset[2], -155, 100);
|
||||||
if (offset[2] != clipped_offset) {
|
if (offset[2] != clipped_offset) {
|
||||||
avpriv_request_sample(ac->avctx,
|
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) {
|
} else if (band_type[idx] == NOISE_BT) {
|
||||||
for (; i < run_end; i++, idx++) {
|
for (; i < run_end; i++, idx++) {
|
||||||
if (noise_flag-- > 0)
|
if (noise_flag-- > 0)
|
||||||
offset[1] += get_bits(gb, 9) - 256;
|
offset[1] += get_bits(gb, NOISE_PRE_BITS) - NOISE_PRE;
|
||||||
else
|
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);
|
clipped_offset = av_clip(offset[1], -100, 155);
|
||||||
if (offset[1] != clipped_offset) {
|
if (offset[1] != clipped_offset) {
|
||||||
avpriv_request_sample(ac->avctx,
|
avpriv_request_sample(ac->avctx,
|
||||||
@ -1433,7 +1433,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (; i < run_end; i++, idx++) {
|
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) {
|
if (offset[0] > 255U) {
|
||||||
av_log(ac->avctx, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"Scalefactor (%d) out of range.\n", offset[0]);
|
"Scalefactor (%d) out of range.\n", offset[0]);
|
||||||
|
Loading…
Reference in New Issue
Block a user