Commit f848a660 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/adpcm: use av_clip_intp2()

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent d1c70508
...@@ -269,7 +269,7 @@ static inline short adpcm_ima_oki_expand_nibble(ADPCMChannelStatus *c, int nibbl ...@@ -269,7 +269,7 @@ static inline short adpcm_ima_oki_expand_nibble(ADPCMChannelStatus *c, int nibbl
if (sign) predictor -= diff; if (sign) predictor -= diff;
else predictor += diff; else predictor += diff;
c->predictor = av_clip(predictor, -2048, 2047); c->predictor = av_clip_intp2(predictor, 11);
c->step_index = step_index; c->step_index = step_index;
return c->predictor << 4; return c->predictor << 4;
......
...@@ -227,7 +227,7 @@ static inline uint8_t adpcm_ms_compress_sample(ADPCMChannelStatus *c, ...@@ -227,7 +227,7 @@ static inline uint8_t adpcm_ms_compress_sample(ADPCMChannelStatus *c,
bias = -c->idelta / 2; bias = -c->idelta / 2;
nibble = (nibble + bias) / c->idelta; 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; predictor += ((nibble & 0x08) ? (nibble - 0x10) : nibble) * c->idelta;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment