aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/adpcm.c
diff options
context:
space:
mode:
authorZane van Iperen <zane@zanevaniperen.com>2020-11-02 15:47:26 +1000
committerZane van Iperen <zane@zanevaniperen.com>2020-11-09 14:58:37 +1000
commit8903cb3c15344d90a6959cd5f416b74e4ef23dbc (patch)
tree5124f208bc38796b1d798699288dfd36f766a7fd /libavcodec/adpcm.c
parent50d3a751aab0bd7a831b12f8336c47c315a5f579 (diff)
downloadffmpeg-8903cb3c15344d90a6959cd5f416b74e4ef23dbc.tar.gz
avcodec/adpcm_ima_amv: document header format
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Diffstat (limited to 'libavcodec/adpcm.c')
-rw-r--r--libavcodec/adpcm.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 7762694e3e..01aced2e10 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1690,6 +1690,16 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
case AV_CODEC_ID_ADPCM_IMA_AMV:
av_assert0(avctx->channels == 1);
+ /*
+ * Header format:
+ * int16_t predictor;
+ * uint8_t step_index;
+ * uint8_t reserved;
+ * uint32_t frame_size;
+ *
+ * Some implementations have step_index as 16-bits, but others
+ * only use the lower 8 and store garbage in the upper 8.
+ */
c->status[0].predictor = sign_extend(bytestream2_get_le16u(&gb), 16);
c->status[0].step_index = bytestream2_get_byteu(&gb);
bytestream2_skipu(&gb, 5);