avcodec/ac3enc: Use bit-operations for bit-mask

Simply masking the LFE bit is more natural than subtracting
if set.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2024-04-07 13:21:46 +02:00
parent b3d12fe200
commit 8261d5d38c
1 changed files with 1 additions and 3 deletions

View File

@ -2199,10 +2199,8 @@ static av_cold void set_channel_info(AVCodecContext *avctx)
s->channels = channels;
s->fbw_channels = channels - s->lfe_on;
s->lfe_channel = s->lfe_on ? s->fbw_channels + 1 : -1;
if (s->lfe_on)
mask -= AV_CH_LOW_FREQUENCY;
switch (mask) {
switch (mask & ~AV_CH_LOW_FREQUENCY) {
case AV_CH_LAYOUT_MONO: s->channel_mode = AC3_CHMODE_MONO; break;
case AV_CH_LAYOUT_STEREO: s->channel_mode = AC3_CHMODE_STEREO; break;
case AV_CH_LAYOUT_SURROUND: s->channel_mode = AC3_CHMODE_3F; break;