diff options
author | Paul B Mahol <onemda@gmail.com> | 2017-02-15 12:36:24 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2017-02-15 12:46:01 +0100 |
commit | ee4aa388b2231e988eccdab652c55df080d6ad45 (patch) | |
tree | 17a7437f9bab72bb82662d6cf0d1d749335df3d9 /libavcodec | |
parent | 6a37abc59af4d87d4c55f7d812ac62d4d6a7464b (diff) |
adpcm: fix clipping for yamaha
According to specification max value allowed is 0x6000.
Fixes #5862.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/adpcm.c | 2 | ||||
-rw-r--r-- | libavcodec/adpcmenc.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index cb7f644f66..be206c55ba 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -343,7 +343,7 @@ static inline int16_t adpcm_yamaha_expand_nibble(ADPCMChannelStatus *c, uint8_t c->predictor += (c->step * ff_adpcm_yamaha_difflookup[nibble]) / 8; c->predictor = av_clip_int16(c->predictor); c->step = (c->step * ff_adpcm_yamaha_indexscale[nibble]) >> 8; - c->step = av_clip(c->step, 127, 24567); + c->step = av_clip(c->step, 127, 24576); return c->predictor; } diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c index 36974fd953..668939c778 100644 --- a/libavcodec/adpcmenc.c +++ b/libavcodec/adpcmenc.c @@ -258,7 +258,7 @@ static inline uint8_t adpcm_yamaha_compress_sample(ADPCMChannelStatus *c, c->predictor += ((c->step * ff_adpcm_yamaha_difflookup[nibble]) / 8); c->predictor = av_clip_int16(c->predictor); c->step = (c->step * ff_adpcm_yamaha_indexscale[nibble]) >> 8; - c->step = av_clip(c->step, 127, 24567); + c->step = av_clip(c->step, 127, 24576); return nibble; } @@ -415,7 +415,7 @@ static void adpcm_compress_trellis(AVCodecContext *avctx, } else { //AV_CODEC_ID_ADPCM_YAMAHA LOOP_NODES(yamaha, step, av_clip((step * ff_adpcm_yamaha_indexscale[nibble]) >> 8, - 127, 24567)); + 127, 24576)); #undef LOOP_NODES #undef STORE_NODE } |