History

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).

Andreas Rheinhardt committed 1 year ago

Commit ffa56f71 parent 2204efc1 file · +6 −4Browse files

Unified · Split

libavcodec/ac3dec.c+6−4
@@ -854,16 +854,18 @@ static void decode_band_structure(GetBitContext *gbc, int blk, int eac3, · 853 unmodified lines
854854 static inline int spx_strategy(AC3DecodeContext *s, int blk)
855855 {
856856 GetBitContext *bc = &s->gbc;
857− int fbw_channels = s->fbw_channels;
858857 int dst_start_freq, dst_end_freq, src_start_freq,
859− start_subband, end_subband, ch;
858+ start_subband, end_subband;
860859
861860 /* determine which channels use spx */
862861 if (s->channel_mode == AC3_CHMODE_MONO) {
863862 s->channel_uses_spx[1] = 1;
864863 } else {
865− for (ch = 1; ch <= fbw_channels; ch++)
866− s->channel_uses_spx[ch] = get_bits1(bc);
864+ unsigned channel_uses_spx = get_bits(bc, s->fbw_channels);
865+ for (int ch = s->fbw_channels; ch >= 1; --ch) {
866+ s->channel_uses_spx[ch] = channel_uses_spx & 1;
867+ channel_uses_spx >>= 1;
868+ }
867869 }
868870
869871 /* get the frequency bins of the spx copy region and the spx start

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