[FFmpeg-cvslog] avcodec/adpcm: use av_clip_intp2()

Michael Niedermayer git at videolan.org
Sat Feb 21 20:52:18 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Feb 21 20:41:36 2015 +0100| [f848a66009f25e32ee5e1244a20060a34c777be0] | committer: Michael Niedermayer

avcodec/adpcm: use av_clip_intp2()

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/adpcm.c    |    2 +-
 libavcodec/adpcmenc.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 7785a7a..1c3fdc4 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -269,7 +269,7 @@ static inline short adpcm_ima_oki_expand_nibble(ADPCMChannelStatus *c, int nibbl
     if (sign) predictor -= diff;
     else predictor += diff;
 
-    c->predictor = av_clip(predictor, -2048, 2047);
+    c->predictor = av_clip_intp2(predictor, 11);
     c->step_index = step_index;
 
     return c->predictor << 4;
diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c
index c3546f9..6816463 100644
--- a/libavcodec/adpcmenc.c
+++ b/libavcodec/adpcmenc.c
@@ -227,7 +227,7 @@ static inline uint8_t adpcm_ms_compress_sample(ADPCMChannelStatus *c,
         bias = -c->idelta / 2;
 
     nibble = (nibble + bias) / c->idelta;
-    nibble = av_clip(nibble, -8, 7) & 0x0F;
+    nibble = av_clip_intp2(nibble, 3) & 0x0F;
 
     predictor += ((nibble & 0x08) ? (nibble - 0x10) : nibble) * c->idelta;
 



More information about the ffmpeg-cvslog mailing list