[FFmpeg-devel] [PATCH 2/6] avcodec/aac/aacdec_usac: Simplify decode_usac_scale_factors()
Michael Niedermayer
michael at niedermayer.cc
Sun Feb 9 04:24:17 EET 2025
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
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 2938e693874..ccdf58bc8e2 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);
--
2.48.1
More information about the ffmpeg-devel
mailing list