History

aacdec: switch-ify scalefactor decoding

Brings it in line with dequantization.

Lynne committed 2 years ago

Commit 7f3b3e21 parent 77a88bb1 file · +10 −5Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/aacdec_template.c+10−5
@@ -1460,11 +1460,13 @@ static int decode_scalefactors(AACDecContext *ac, int sfo[120], · 1459 unmodified lines
14601460 for (g = 0; g < ics->num_window_groups; g++) {
14611461 for (i = 0; i < ics->max_sfb;) {
14621462 int run_end = band_type_run_end[idx];
1463− if (band_type[idx] == ZERO_BT) {
1463+ switch (band_type[idx]) {
1464+ case ZERO_BT:
14641465 for (; i < run_end; i++, idx++)
14651466 sfo[idx] = 0;
1466− } else if ((band_type[idx] == INTENSITY_BT) ||
1467− (band_type[idx] == INTENSITY_BT2)) {
1467+ break;
1468+ case INTENSITY_BT: /* fallthrough */
1469+ case INTENSITY_BT2:
14681470 for (; i < run_end; i++, idx++) {
14691471 offset[2] += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;
14701472 clipped_offset = av_clip(offset[2], -155, 100);
@@ -1476,7 +1478,8 @@ static int decode_scalefactors(AACDecContext *ac, int sfo[120], · 5 unmodified lines
14761478 }
14771479 sfo[idx] = clipped_offset;
14781480 }
1479− } else if (band_type[idx] == NOISE_BT) {
1481+ break;
1482+ case NOISE_BT:
14801483 for (; i < run_end; i++, idx++) {
14811484 if (noise_flag-- > 0)
14821485 offset[1] += get_bits(gb, NOISE_PRE_BITS) - NOISE_PRE;
@@ -1491,7 +1494,8 @@ static int decode_scalefactors(AACDecContext *ac, int sfo[120], · 8 unmodified lines
14911494 }
14921495 sfo[idx] = clipped_offset;
14931496 }
1494− } else {
1497+ break;
1498+ default:
14951499 for (; i < run_end; i++, idx++) {
14961500 offset[0] += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;
14971501 if (offset[0] > 255U) {
@@ -1501,6 +1505,7 @@ static int decode_scalefactors(AACDecContext *ac, int sfo[120], · 3 unmodified lines
15011505 }
15021506 sfo[idx] = offset[0];
15031507 }
1508+ break;
15041509 }
15051510 }
15061511 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t