Fix yamaha adpcm stereo (issue 1117).
authorYoshihisa Uchida <yoshihisa.uchida@gmail.com>
Sat, 20 Jun 2009 13:07:21 +0000 (13:07 +0000)
committerCarl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at>
Sat, 20 Jun 2009 13:07:21 +0000 (13:07 +0000)
Patch by Yoshihisa Uchida, yoshihisa D uchida A gmail

Originally committed as revision 19237 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/adpcm.c
tests/rotozoom.regression.ref
tests/vsynth.regression.ref

index 8184378a16570ec21382ef520975c168a0c148d5..4d2146f23a2b2a9a8c83ea833225deb4f4bd802e 100644 (file)
@@ -648,14 +648,11 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
                     *dst++ = buf[0][i] | (buf[1][i] << 4);
             }
         } else
-        for (; n>0; n--) {
-            for(i = 0; i < avctx->channels; i++) {
-                int nibble;
-                nibble  = adpcm_yamaha_compress_sample(&c->status[i], samples[i]);
-                nibble |= adpcm_yamaha_compress_sample(&c->status[i], samples[i+avctx->channels]) << 4;
-                *dst++ = nibble;
-            }
-            samples += 2 * avctx->channels;
+        for (n *= avctx->channels; n>0; n--) {
+            int nibble;
+            nibble  = adpcm_yamaha_compress_sample(&c->status[ 0], *samples++);
+            nibble |= adpcm_yamaha_compress_sample(&c->status[st], *samples++) << 4;
+            *dst++ = nibble;
         }
         break;
     default:
index 99f077725f36ede8a7b45244bd3a096ef91c54ee..d7060639c5132e8a158648da5b6050a826e67a91 100644 (file)
@@ -193,10 +193,10 @@ stddev:  914.63 PSNR: 37.09 bytes:  1058604/  1058444
 268344 ./tests/data/a-adpcm_ms.wav
 7be370f937c51e8a967e6a3d08d5156a *./tests/data/adpcm_ms.rotozoom.out.wav
 stddev: 1050.00 PSNR: 35.90 bytes:  1060620/  1058444
-14df8b8bb7c127ec70c0167df1c0dbf7 *./tests/data/a-adpcm_yam.wav
+2546d72df736b5ffa1557e8c9c9ef788 *./tests/data/a-adpcm_yam.wav
 266296 ./tests/data/a-adpcm_yam.wav
-2f73107dafef6db42e545f9e466d3f05 *./tests/data/adpcm_yam.rotozoom.out.wav
-stddev:18302.45 PSNR: 11.07 bytes:  1065004/  1058444
+c80c847a53a0fee17a88fa889ec34a4e *./tests/data/adpcm_yam.rotozoom.out.wav
+stddev: 1247.64 PSNR: 34.40 bytes:  1065004/  1058444
 42d4639866ed4d692eaf126228a4fa2a *./tests/data/a-adpcm_swf.flv
 269166 ./tests/data/a-adpcm_swf.flv
 628089745a7059ae4055c2515b6d668b *./tests/data/adpcm_swf.rotozoom.out.wav
index dd4f4733c918816c622fdff8d4fcdeb7bd330034..9a671c9b58e66ea4c620d0d2f9b504bc1767c7ed 100644 (file)
@@ -193,10 +193,10 @@ stddev:  914.63 PSNR: 37.09 bytes:  1058604/  1058444
 268344 ./tests/data/a-adpcm_ms.wav
 7be370f937c51e8a967e6a3d08d5156a *./tests/data/adpcm_ms.vsynth.out.wav
 stddev: 1050.00 PSNR: 35.90 bytes:  1060620/  1058444
-14df8b8bb7c127ec70c0167df1c0dbf7 *./tests/data/a-adpcm_yam.wav
+2546d72df736b5ffa1557e8c9c9ef788 *./tests/data/a-adpcm_yam.wav
 266296 ./tests/data/a-adpcm_yam.wav
-2f73107dafef6db42e545f9e466d3f05 *./tests/data/adpcm_yam.vsynth.out.wav
-stddev:18302.45 PSNR: 11.07 bytes:  1065004/  1058444
+c80c847a53a0fee17a88fa889ec34a4e *./tests/data/adpcm_yam.vsynth.out.wav
+stddev: 1247.64 PSNR: 34.40 bytes:  1065004/  1058444
 42d4639866ed4d692eaf126228a4fa2a *./tests/data/a-adpcm_swf.flv
 269166 ./tests/data/a-adpcm_swf.flv
 628089745a7059ae4055c2515b6d668b *./tests/data/adpcm_swf.vsynth.out.wav