[FFmpeg-cvslog] adpcmdec: use planar sample format for adpcm_ima_ws for vqa version 3

Justin Ruggles git at videolan.org
Wed Oct 10 13:05:21 CEST 2012


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Wed Aug 29 15:54:39 2012 -0400| [8b854283c3463d28ceedb55456b362e914e8fe77] | committer: Justin Ruggles

adpcmdec: use planar sample format for adpcm_ima_ws for vqa version 3

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b854283c3463d28ceedb55456b362e914e8fe77
---

 libavcodec/adpcm.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 95e97c9..fca5f1b 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -141,6 +141,10 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
         case AV_CODEC_ID_ADPCM_4XM:
             avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
             break;
+        case AV_CODEC_ID_ADPCM_IMA_WS:
+            avctx->sample_fmt = c->vqa_version == 3 ? AV_SAMPLE_FMT_S16P :
+                                                      AV_SAMPLE_FMT_S16;
+            break;
         default:
             avctx->sample_fmt = AV_SAMPLE_FMT_S16;
     }
@@ -862,14 +866,12 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
     case AV_CODEC_ID_ADPCM_IMA_WS:
         if (c->vqa_version == 3) {
             for (channel = 0; channel < avctx->channels; channel++) {
-                int16_t *smp = samples + channel;
+                int16_t *smp = samples_p[channel];
 
                 for (n = nb_samples / 2; n > 0; n--) {
                     int v = bytestream2_get_byteu(&gb);
-                    *smp = adpcm_ima_expand_nibble(&c->status[channel], v >> 4  , 3);
-                    smp += avctx->channels;
-                    *smp = adpcm_ima_expand_nibble(&c->status[channel], v & 0x0F, 3);
-                    smp += avctx->channels;
+                    *smp++ = adpcm_ima_expand_nibble(&c->status[channel], v >> 4  , 3);
+                    *smp++ = adpcm_ima_expand_nibble(&c->status[channel], v & 0x0F, 3);
                 }
             }
         } else {
@@ -1273,6 +1275,9 @@ static const enum AVSampleFormat sample_fmts_s16[]  = { AV_SAMPLE_FMT_S16,
                                                         AV_SAMPLE_FMT_NONE };
 static const enum AVSampleFormat sample_fmts_s16p[] = { AV_SAMPLE_FMT_S16,
                                                         AV_SAMPLE_FMT_NONE };
+static const enum AVSampleFormat sample_fmts_both[] = { AV_SAMPLE_FMT_S16,
+                                                        AV_SAMPLE_FMT_S16P,
+                                                        AV_SAMPLE_FMT_NONE };
 
 #define ADPCM_DECODER(id_, sample_fmts_, name_, long_name_) \
 AVCodec ff_ ## name_ ## _decoder = {                        \
@@ -1306,7 +1311,7 @@ ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_ISS,     sample_fmts_s16,  adpcm_ima_iss,
 ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_QT,      sample_fmts_s16p, adpcm_ima_qt,      "ADPCM IMA QuickTime");
 ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_SMJPEG,  sample_fmts_s16,  adpcm_ima_smjpeg,  "ADPCM IMA Loki SDL MJPEG");
 ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_WAV,     sample_fmts_s16p, adpcm_ima_wav,     "ADPCM IMA WAV");
-ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_WS,      sample_fmts_s16,  adpcm_ima_ws,      "ADPCM IMA Westwood");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_WS,      sample_fmts_both, adpcm_ima_ws,      "ADPCM IMA Westwood");
 ADPCM_DECODER(AV_CODEC_ID_ADPCM_MS,          sample_fmts_s16,  adpcm_ms,          "ADPCM Microsoft");
 ADPCM_DECODER(AV_CODEC_ID_ADPCM_SBPRO_2,     sample_fmts_s16,  adpcm_sbpro_2,     "ADPCM Sound Blaster Pro 2-bit");
 ADPCM_DECODER(AV_CODEC_ID_ADPCM_SBPRO_3,     sample_fmts_s16,  adpcm_sbpro_3,     "ADPCM Sound Blaster Pro 2.6-bit");



More information about the ffmpeg-cvslog mailing list