diff mbox series

[FFmpeg-devel,v4,1/6] avcodec/adpcm_ima_apm: support new extradata format

Message ID 20200620105857.25674-2-zane@zanevaniperen.com
State Accepted
Headers show
Series adpcm_ima_apm encoder + apm muxer | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Zane van Iperen June 20, 2020, 10:59 a.m. UTC
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
---
 libavcodec/adpcm.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

Comments

Michael Niedermayer June 26, 2020, 7:45 p.m. UTC | #1
On Sat, Jun 20, 2020 at 10:59:14AM +0000, Zane van Iperen wrote:
> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
> ---
>  libavcodec/adpcm.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)

will apply

thx

[...]
Zane van Iperen June 27, 2020, 8:41 a.m. UTC | #2
On Fri, 26 Jun 2020 21:45:37 +0200
"Michael Niedermayer" <michael@niedermayer.cc> wrote:

> On Sat, Jun 20, 2020 at 10:59:14AM +0000, Zane van Iperen wrote:
> > Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
> > ---
> >  libavcodec/adpcm.c | 17 ++++++++++++-----
> >  1 file changed, 12 insertions(+), 5 deletions(-)  
> 
> will apply
> 
Thanks. What about the rest of the series, is it alright to merge?
diff mbox series

Patch

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 79c5d625d1..4de4a23289 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -162,11 +162,18 @@  static av_cold int adpcm_decode_init(AVCodecContext * avctx)
         }
         break;
     case AV_CODEC_ID_ADPCM_IMA_APM:
-        if (avctx->extradata && avctx->extradata_size >= 16) {
-            c->status[0].predictor  = av_clip_intp2(AV_RL32(avctx->extradata +  0), 18);
-            c->status[0].step_index = av_clip(AV_RL32(avctx->extradata +  4), 0, 88);
-            c->status[1].predictor  = av_clip_intp2(AV_RL32(avctx->extradata +  8), 18);
-            c->status[1].step_index = av_clip(AV_RL32(avctx->extradata + 12), 0, 88);
+        if (avctx->extradata) {
+            if (avctx->extradata_size >= 28) {
+                c->status[0].predictor  = av_clip_intp2(AV_RL32(avctx->extradata + 16), 18);
+                c->status[0].step_index = av_clip(AV_RL32(avctx->extradata + 20), 0, 88);
+                c->status[1].predictor  = av_clip_intp2(AV_RL32(avctx->extradata + 4), 18);
+                c->status[1].step_index = av_clip(AV_RL32(avctx->extradata + 8), 0, 88);
+            } else if (avctx->extradata_size >= 16) {
+                c->status[0].predictor  = av_clip_intp2(AV_RL32(avctx->extradata +  0), 18);
+                c->status[0].step_index = av_clip(AV_RL32(avctx->extradata +  4), 0, 88);
+                c->status[1].predictor  = av_clip_intp2(AV_RL32(avctx->extradata +  8), 18);
+                c->status[1].step_index = av_clip(AV_RL32(avctx->extradata + 12), 0, 88);
+            }
         }
         break;
     case AV_CODEC_ID_ADPCM_IMA_WS: