[FFmpeg-cvslog] adpcm: fix clipping for yamaha
Paul B Mahol
git at videolan.org
Wed Feb 15 13:46:19 EET 2017
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Feb 15 12:36:24 2017 +0100| [ee4aa388b2231e988eccdab652c55df080d6ad45] | committer: Paul B Mahol
adpcm: fix clipping for yamaha
According to specification max value allowed is 0x6000.
Fixes #5862.
Signed-off-by: Paul B Mahol <onemda at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ee4aa388b2231e988eccdab652c55df080d6ad45
---
libavcodec/adpcm.c | 2 +-
libavcodec/adpcmenc.c | 4 ++--
tests/ref/acodec/adpcm-yamaha | 6 +++---
tests/ref/acodec/adpcm-yamaha-trellis | 6 +++---
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index cb7f644..be206c5 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 36974fd..668939c 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
}
diff --git a/tests/ref/acodec/adpcm-yamaha b/tests/ref/acodec/adpcm-yamaha
index 2741058..f3e6dbe 100644
--- a/tests/ref/acodec/adpcm-yamaha
+++ b/tests/ref/acodec/adpcm-yamaha
@@ -1,4 +1,4 @@
-e9c14f701d25947317db9367b9dc772d *tests/data/fate/acodec-adpcm-yamaha.wav
+245c194e84d482a70ca89de9c0bbd591 *tests/data/fate/acodec-adpcm-yamaha.wav
265274 tests/data/fate/acodec-adpcm-yamaha.wav
-93b95a663ec8799e0c4db18467b21234 *tests/data/fate/acodec-adpcm-yamaha.out.wav
-stddev: 1247.60 PSNR: 34.41 MAXDIFF:39895 bytes: 1058400/ 1060864
+758b4aee62964831d0a335ada9672104 *tests/data/fate/acodec-adpcm-yamaha.out.wav
+stddev: 1242.71 PSNR: 34.44 MAXDIFF:39960 bytes: 1058400/ 1060864
diff --git a/tests/ref/acodec/adpcm-yamaha-trellis b/tests/ref/acodec/adpcm-yamaha-trellis
index a099ec5..909a951 100644
--- a/tests/ref/acodec/adpcm-yamaha-trellis
+++ b/tests/ref/acodec/adpcm-yamaha-trellis
@@ -1,4 +1,4 @@
-247a06c3f26c57abd2db1a793174cb66 *tests/data/fate/acodec-adpcm-yamaha-trellis.wav
+c8306ada93ef52b1e87b6758853f4937 *tests/data/fate/acodec-adpcm-yamaha-trellis.wav
265274 tests/data/fate/acodec-adpcm-yamaha-trellis.wav
-a42b5fa74b39a07691b0df80ce67f77e *tests/data/fate/acodec-adpcm-yamaha-trellis.out.wav
-stddev: 928.29 PSNR: 36.98 MAXDIFF:33557 bytes: 1058400/ 1060864
+8ad27b0ea7e13e70ed334b5ec26c62ef *tests/data/fate/acodec-adpcm-yamaha-trellis.out.wav
+stddev: 926.56 PSNR: 36.99 MAXDIFF:33570 bytes: 1058400/ 1060864
More information about the ffmpeg-cvslog
mailing list