[FFmpeg-cvslog] aacdec: switch-ify scalefactor decoding

Lynne git at videolan.org
Tue Apr 23 09:58:25 EEST 2024


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Wed Mar 13 07:16:57 2024 +0100| [7f3b3e2df1d20d33aebd8c4f37eb4ac0e76cd58f] | committer: Lynne

aacdec: switch-ify scalefactor decoding

Brings it in line with dequantization.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7f3b3e2df1d20d33aebd8c4f37eb4ac0e76cd58f
---

 libavcodec/aacdec_template.c | 15 ++++++++++-----
 1 file 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;
             }
         }
     }



More information about the ffmpeg-cvslog mailing list