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

Unified · Split

libavcodec/aacdec_template.c+10−5
@@ -1460,11 +1460,13 @@ static int decode_scalefactors(AACDecContext *ac, int sfo[120], · 1459 unmodified lines
1460 for (g = 0; g < ics->num_window_groups; g++) {1460 for (g = 0; g < ics->num_window_groups; g++) {
1461 for (i = 0; i < ics->max_sfb;) {1461 for (i = 0; i < ics->max_sfb;) {
1462 int run_end = band_type_run_end[idx];1462 int run_end = band_type_run_end[idx];
1463 if (band_type[idx] == ZERO_BT) {1463 switch (band_type[idx]) {
1464 case ZERO_BT:
1464 for (; i < run_end; i++, idx++)1465 for (; i < run_end; i++, idx++)
1465 sfo[idx] = 0;1466 sfo[idx] = 0;
1466 } else if ((band_type[idx] == INTENSITY_BT) ||1467 break;
1467 (band_type[idx] == INTENSITY_BT2)) {1468 case INTENSITY_BT: /* fallthrough */
1469 case INTENSITY_BT2:
1468 for (; i < run_end; i++, idx++) {1470 for (; i < run_end; i++, idx++) {
1469 offset[2] += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;1471 offset[2] += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;
1470 clipped_offset = av_clip(offset[2], -155, 100);1472 clipped_offset = av_clip(offset[2], -155, 100);
@@ -1476,7 +1478,8 @@ static int decode_scalefactors(AACDecContext *ac, int sfo[120], · 5 unmodified lines
1476 }1478 }
1477 sfo[idx] = clipped_offset;1479 sfo[idx] = clipped_offset;
1478 }1480 }
1479 } else if (band_type[idx] == NOISE_BT) {1481 break;
1482 case NOISE_BT:
1480 for (; i < run_end; i++, idx++) {1483 for (; i < run_end; i++, idx++) {
1481 if (noise_flag-- > 0)1484 if (noise_flag-- > 0)
1482 offset[1] += get_bits(gb, NOISE_PRE_BITS) - NOISE_PRE;1485 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
1491 }1494 }
1492 sfo[idx] = clipped_offset;1495 sfo[idx] = clipped_offset;
1493 }1496 }
1494 } else {1497 break;
1498 default:
1495 for (; i < run_end; i++, idx++) {1499 for (; i < run_end; i++, idx++) {
1496 offset[0] += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;1500 offset[0] += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;
1497 if (offset[0] > 255U) {1501 if (offset[0] > 255U) {
@@ -1501,6 +1505,7 @@ static int decode_scalefactors(AACDecContext *ac, int sfo[120], · 3 unmodified lines
1501 }1505 }
1502 sfo[idx] = offset[0];1506 sfo[idx] = offset[0];
1503 }1507 }
1508 break;
1504 }1509 }
1505 }1510 }
1506 }1511 }

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