summaryrefslogtreecommitdiff
path: root/libavcodec/adpcm.c
diff options
context:
space:
mode:
authorZane van Iperen <zane@zanevaniperen.com>2020-11-02 15:47:21 +1000
committerZane van Iperen <zane@zanevaniperen.com>2020-11-09 14:58:30 +1000
commitd6912294d39b5d15cba0236e06e5a3710e57a1a0 (patch)
treee3c2b479615ba9c25a30d25ec52c9be228789608 /libavcodec/adpcm.c
parent2fb764e1f3932ddb5a2a071d238a4db83e6d5a1b (diff)
downloadffmpeg-d6912294d39b5d15cba0236e06e5a3710e57a1a0.tar.gz
avcodec/adpcm_ima_amv: restrict to 1 channel
The format doesn't allow for anything else. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Diffstat (limited to 'libavcodec/adpcm.c')
-rw-r--r--libavcodec/adpcm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index d018c1f91b..7b618dba17 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -110,6 +110,7 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
unsigned int max_channels = 2;
switch(avctx->codec->id) {
+ case AV_CODEC_ID_ADPCM_IMA_AMV:
case AV_CODEC_ID_ADPCM_IMA_CUNNING:
max_channels = 1;
break;
@@ -1681,6 +1682,8 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
}
break;
case AV_CODEC_ID_ADPCM_IMA_AMV:
+ av_assert0(avctx->channels == 1);
+
c->status[0].predictor = sign_extend(bytestream2_get_le16u(&gb), 16);
c->status[0].step_index = bytestream2_get_byteu(&gb);
bytestream2_skipu(&gb, 5);
@@ -1690,7 +1693,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA;
}
- for (n = nb_samples >> (1 - st); n > 0; n--) {
+ for (n = nb_samples >> 1; n > 0; n--) {
int v = bytestream2_get_byteu(&gb);
*samples++ = adpcm_ima_expand_nibble(&c->status[0], v >> 4, 3);