diff options
author | Ralph Giles <giles@mozilla.com> | 2013-01-17 16:30:22 -0800 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2013-01-18 16:46:35 +1100 |
commit | f1841caba3d478e85e0488f7308d643b629fe9c6 (patch) | |
tree | e0793fbf3a1a6b8d12621c089b2feff719e25793 /src/flac/decode.c | |
parent | a53e85b889180b27f4f26724cea4158400701d3c (diff) | |
download | flac-f1841caba3d478e85e0488f7308d643b629fe9c6.tar.gz |
Hoist a repeated conditional in the channel mapping code.
This is equivalent and just makes the code shorter.
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Diffstat (limited to 'src/flac/decode.c')
-rw-r--r-- | src/flac/decode.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/flac/decode.c b/src/flac/decode.c index fa82c043..98fc430f 100644 --- a/src/flac/decode.c +++ b/src/flac/decode.c @@ -333,32 +333,26 @@ FLAC__bool DecoderSession_process(DecoderSession *d) return false; /* set channel mapping */ - if(!d->channel_map_none) { - /* currently FLAC order matches SMPTE/WAVEFORMATEXTENSIBLE order, so no reordering is necessary; see encode.c */ - /* only the channel mask must be set if it was not already picked up from the WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag */ + /* currently FLAC order matches SMPTE/WAVEFORMATEXTENSIBLE order, so no reordering is necessary; see encode.c */ + /* only the channel mask must be set if it was not already picked up from the WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag */ + if(!d->channel_map_none && d->channel_mask == 0) { if(d->channels == 1) { - if(d->channel_mask == 0) - d->channel_mask = 0x0001; + d->channel_mask = 0x0001; } else if(d->channels == 2) { - if(d->channel_mask == 0) - d->channel_mask = 0x0003; + d->channel_mask = 0x0003; } else if(d->channels == 3) { - if(d->channel_mask == 0) - d->channel_mask = 0x0007; + d->channel_mask = 0x0007; } else if(d->channels == 4) { - if(d->channel_mask == 0) - d->channel_mask = 0x0033; + d->channel_mask = 0x0033; } else if(d->channels == 5) { - if(d->channel_mask == 0) - d->channel_mask = 0x0607; + d->channel_mask = 0x0607; } else if(d->channels == 6) { - if(d->channel_mask == 0) - d->channel_mask = 0x060f; + d->channel_mask = 0x060f; } } |