OSDN Git Service

wavpack: drop redundant if/else blocks
authorAnton Khirnov <anton@khirnov.net>
Sat, 25 May 2013 05:49:25 +0000 (07:49 +0200)
committerAnton Khirnov <anton@khirnov.net>
Tue, 28 May 2013 06:01:16 +0000 (08:01 +0200)
libavcodec/wavpack.c

index 7136e7a..4349ccb 100644 (file)
@@ -1125,13 +1125,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
     }
 
     if (s->stereo_in) {
-        if (avctx->sample_fmt == AV_SAMPLE_FMT_S16)
-            samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_S16);
-        else if (avctx->sample_fmt == AV_SAMPLE_FMT_S32)
-            samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_S32);
-        else
-            samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_FLT);
-
+        samplecount = wv_unpack_stereo(s, &s->gb, samples, avctx->sample_fmt);
         if (samplecount < 0)
             return samplecount;
 
@@ -1139,13 +1133,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
     } else {
         const int channel_stride = avctx->channels;
 
-        if (avctx->sample_fmt == AV_SAMPLE_FMT_S16)
-            samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_S16);
-        else if (avctx->sample_fmt == AV_SAMPLE_FMT_S32)
-            samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_S32);
-        else
-            samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_FLT);
-
+        samplecount = wv_unpack_mono(s, &s->gb, samples, avctx->sample_fmt);
         if (samplecount < 0)
             return samplecount;