Ralph Giles
2013-Jan-18 00:30 UTC
[PATCH] Hoist a repeated conditional in the channel mapping code.
This is equivalent and just makes the code shorter. --- src/flac/decode.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/flac/decode.c b/src/flac/decode.c index fa82c04..98fc430 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; } } -- 1.7.10.2 (Apple Git-33) --------------090005000902090600060701--
Reasonably Related Threads
- [PATCH] Add appropriate WAV channel masks for 7 and 8 channel files.
- [PATCH] support 7 and 8 channel wav files as input
- WAVEFORMATEXTENSIBLE_CHANNEL_MASK is not described
- PATCH: WAVEFORMATEXTENSIBLE_CHANNEL_MASK is ignored when decoding
- [PATCH] for flac/decode.c