[FFmpeg-cvslog] avcodec/adxenc: fix rounding

Michael Niedermayer git at videolan.org
Sun Nov 30 13:04:21 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Nov 30 12:56:02 2014 +0100| [0b5adc35200888ca87e68823ac73905b7eb4279e] | committer: Michael Niedermayer

avcodec/adxenc: fix rounding

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

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

 libavcodec/adxenc.c                |    2 +-
 tests/ref/acodec/adpcm-adx         |    6 +++---
 tests/ref/acodec/adpcm-adx-trellis |    6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/adxenc.c b/libavcodec/adxenc.c
index aee444e..4387ffb 100644
--- a/libavcodec/adxenc.c
+++ b/libavcodec/adxenc.c
@@ -81,7 +81,7 @@ static void adx_encode(ADXContext *c, uint8_t *adx, const int16_t *wav,
     for (i = 0, j = 0; j < 32; i += channels, j++) {
         d = ((wav[i] << COEFF_BITS) - c->coeff[0] * s1 - c->coeff[1] * s2) >> COEFF_BITS;
 
-        d = av_clip(d / scale, -8, 7);
+        d = av_clip(ROUNDED_DIV(d, scale), -8, 7);
 
         put_sbits(&pb, 4, d);
 
diff --git a/tests/ref/acodec/adpcm-adx b/tests/ref/acodec/adpcm-adx
index 33a502f..34dd9b6 100644
--- a/tests/ref/acodec/adpcm-adx
+++ b/tests/ref/acodec/adpcm-adx
@@ -1,4 +1,4 @@
-d82a87942d6500adb4d07d21cbcbdb78 *tests/data/fate/acodec-adpcm-adx.adx
+d7ec7d52a2f5c91464812d031b07cc1d *tests/data/fate/acodec-adpcm-adx.adx
 297720 tests/data/fate/acodec-adpcm-adx.adx
-4e78a1153eb8fc4dfc050836f46b62f8 *tests/data/fate/acodec-adpcm-adx.out.wav
-stddev: 3096.24 PSNR: 26.51 MAXDIFF:53110 bytes:  1058400/  1058432
+5b5a436ec9d528d6eb0bebaf667521b0 *tests/data/fate/acodec-adpcm-adx.out.wav
+stddev: 2549.93 PSNR: 28.20 MAXDIFF:57514 bytes:  1058400/  1058432
diff --git a/tests/ref/acodec/adpcm-adx-trellis b/tests/ref/acodec/adpcm-adx-trellis
index a36e7f9..d620d4a 100644
--- a/tests/ref/acodec/adpcm-adx-trellis
+++ b/tests/ref/acodec/adpcm-adx-trellis
@@ -1,4 +1,4 @@
-d82a87942d6500adb4d07d21cbcbdb78 *tests/data/fate/acodec-adpcm-adx-trellis.adx
+d7ec7d52a2f5c91464812d031b07cc1d *tests/data/fate/acodec-adpcm-adx-trellis.adx
 297720 tests/data/fate/acodec-adpcm-adx-trellis.adx
-4e78a1153eb8fc4dfc050836f46b62f8 *tests/data/fate/acodec-adpcm-adx-trellis.out.wav
-stddev: 3096.24 PSNR: 26.51 MAXDIFF:53110 bytes:  1058400/  1058432
+5b5a436ec9d528d6eb0bebaf667521b0 *tests/data/fate/acodec-adpcm-adx-trellis.out.wav
+stddev: 2549.93 PSNR: 28.20 MAXDIFF:57514 bytes:  1058400/  1058432



More information about the ffmpeg-cvslog mailing list