summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <[email protected]>2025-03-30 13:40:58 +0200
committerAndreas Rheinhardt <[email protected]>2025-04-02 09:25:30 +0200
commitffa56f73a9bc5505a0d4d1e1e04a65bf10113dee (patch)
treec5c092a18f959ac76706243c8c7c701879b296a2
parent2204efc2a656ae60d77a4d01c6cf8e7d6baaf030 (diff)
avcodec/ac3dec: Read spx flags at once, not one bit at a time
Doing so gets rid of a stupid GCC -Wstringop-overflow= warning (GCC somehow believes that fbw_channels can be 7 with the old form of the code, so that channel_uses_spx[7] would be written to, but now it no longer believes so). Signed-off-by: Andreas Rheinhardt <[email protected]>
-rw-r--r--libavcodec/ac3dec.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 2cf82abc19..49b170c235 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -854,16 +854,18 @@ static void decode_band_structure(GetBitContext *gbc, int blk, int eac3,
static inline int spx_strategy(AC3DecodeContext *s, int blk)
{
GetBitContext *bc = &s->gbc;
- int fbw_channels = s->fbw_channels;
int dst_start_freq, dst_end_freq, src_start_freq,
- start_subband, end_subband, ch;
+ start_subband, end_subband;
/* determine which channels use spx */
if (s->channel_mode == AC3_CHMODE_MONO) {
s->channel_uses_spx[1] = 1;
} else {
- for (ch = 1; ch <= fbw_channels; ch++)
- s->channel_uses_spx[ch] = get_bits1(bc);
+ unsigned channel_uses_spx = get_bits(bc, s->fbw_channels);
+ for (int ch = s->fbw_channels; ch >= 1; --ch) {
+ s->channel_uses_spx[ch] = channel_uses_spx & 1;
+ channel_uses_spx >>= 1;
+ }
}
/* get the frequency bins of the spx copy region and the spx start