[FFmpeg-cvslog] avcodec/aac/aacdec_usac: Simplify decode_usac_scale_factors()

Michael Niedermayer git at videolan.org
Mon Feb 17 03:35:21 EET 2025


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Feb  8 00:18:24 2025 +0100| [41cd72d76e14137a68c50f5a4e7dcab1c367e39c] | committer: Michael Niedermayer

avcodec/aac/aacdec_usac: Simplify decode_usac_scale_factors()

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/aac/aacdec_usac.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/libavcodec/aac/aacdec_usac.c b/libavcodec/aac/aacdec_usac.c
index 2938e69387..ccdf58bc8e 100644
--- a/libavcodec/aac/aacdec_usac.c
+++ b/libavcodec/aac/aacdec_usac.c
@@ -567,15 +567,8 @@ static int decode_usac_scale_factors(AACDecContext *ac,
     int offset_sf = global_gain;
     for (int g = 0; g < ics->num_window_groups; g++) {
         for (int sfb = 0; sfb < ics->max_sfb; sfb++) {
-            /* First coefficient is just the global gain */
-            if (!g && !sfb) {
-                /* The cannonical representation of quantized scalefactors
-                 * in the spec is with 100 subtracted. */
-                sce->sfo[0] = offset_sf - 100;
-                continue;
-            }
-
-            offset_sf += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;
+            if (g || sfb)
+                offset_sf += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;
             if (offset_sf > 255U) {
                 av_log(ac->avctx, AV_LOG_ERROR,
                        "Scalefactor (%d) out of range.\n", offset_sf);



More information about the ffmpeg-cvslog mailing list