diff options
author | Lynne <dev@lynne.ee> | 2024-03-13 07:16:57 +0100 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2024-04-23 08:31:31 +0200 |
commit | 7f3b3e2df1d20d33aebd8c4f37eb4ac0e76cd58f (patch) | |
tree | 05c7d8051800c815f2a6afd98c52e0acc61ca0d1 | |
parent | 77a88bbddaa9b1afa3c61ea4f3271b31b0aa87a2 (diff) | |
download | ffmpeg-7f3b3e2df1d20d33aebd8c4f37eb4ac0e76cd58f.tar.gz |
aacdec: switch-ify scalefactor decoding
Brings it in line with dequantization.
-rw-r--r-- | libavcodec/aacdec_template.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index a14b03263d..70a9c0c014 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -1460,11 +1460,13 @@ static int decode_scalefactors(AACDecContext *ac, int sfo[120], for (g = 0; g < ics->num_window_groups; g++) { for (i = 0; i < ics->max_sfb;) { int run_end = band_type_run_end[idx]; - if (band_type[idx] == ZERO_BT) { + switch (band_type[idx]) { + case ZERO_BT: for (; i < run_end; i++, idx++) sfo[idx] = 0; - } else if ((band_type[idx] == INTENSITY_BT) || - (band_type[idx] == INTENSITY_BT2)) { + break; + case INTENSITY_BT: /* fallthrough */ + case INTENSITY_BT2: for (; i < run_end; i++, idx++) { offset[2] += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO; clipped_offset = av_clip(offset[2], -155, 100); @@ -1476,7 +1478,8 @@ static int decode_scalefactors(AACDecContext *ac, int sfo[120], } sfo[idx] = clipped_offset; } - } else if (band_type[idx] == NOISE_BT) { + break; + case NOISE_BT: for (; i < run_end; i++, idx++) { if (noise_flag-- > 0) offset[1] += get_bits(gb, NOISE_PRE_BITS) - NOISE_PRE; @@ -1491,7 +1494,8 @@ static int decode_scalefactors(AACDecContext *ac, int sfo[120], } sfo[idx] = clipped_offset; } - } else { + break; + default: for (; i < run_end; i++, idx++) { offset[0] += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO; if (offset[0] > 255U) { @@ -1501,6 +1505,7 @@ static int decode_scalefactors(AACDecContext *ac, int sfo[120], } sfo[idx] = offset[0]; } + break; } } } |