summaryrefslogtreecommitdiff
path: root/libavcodec/adpcm.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2012-03-17 14:17:48 -0700
committerRonald S. Bultje <rsbultje@gmail.com>2012-03-18 15:33:11 -0700
commit16b7a5e241e9e1ef861a12509a7c60b57c69bb5d (patch)
tree3a62875aea2e0d09558894197d99982b7781b13a /libavcodec/adpcm.c
parent74d7ac95fbf4913406a81f85e2f020867e771b0e (diff)
adpcm: convert ima_ws to bytestream2.
Diffstat (limited to 'libavcodec/adpcm.c')
-rw-r--r--libavcodec/adpcm.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 90caf6563a..4faac6feef 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -809,28 +809,29 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
}
break;
case CODEC_ID_ADPCM_IMA_WS:
- for (channel = 0; channel < avctx->channels; channel++) {
- const uint8_t *src0;
- int src_stride;
- int16_t *smp = samples + channel;
+ if (c->vqa_version == 3) {
+ for (channel = 0; channel < avctx->channels; channel++) {
+ int16_t *smp = samples + channel;
- if (c->vqa_version == 3) {
- src0 = src + channel * buf_size / 2;
- src_stride = 1;
- } else {
- src0 = src + channel;
- src_stride = avctx->channels;
+ 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;
+ }
}
+ } else {
for (n = nb_samples / 2; n > 0; n--) {
- uint8_t v = *src0;
- src0 += src_stride;
- *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;
+ for (channel = 0; channel < avctx->channels; channel++) {
+ int v = bytestream2_get_byteu(&gb);
+ *samples++ = adpcm_ima_expand_nibble(&c->status[channel], v >> 4 , 3);
+ samples[st] = adpcm_ima_expand_nibble(&c->status[channel], v & 0x0F, 3);
+ }
+ samples += avctx->channels;
}
}
- src = buf + buf_size;
+ bytestream2_seek(&gb, 0, SEEK_END);
break;
case CODEC_ID_ADPCM_XA:
while (buf_size >= 128) {