shithub: mp3dec

Download patch

ref: 121b41ecba11b1dea31b06af556d12e20d296df4
parent: 962758a53a845f32631083e6b45cd6ead053403b
author: lieff <[email protected]>
date: Wed Jan 10 13:25:11 EST 2018

test: patch he_mode vector (fate have buggy version?)

diff: cannot open b/vectors//null: file does not exist: 'b/vectors//null'
--- a/minimp3.c
+++ b/minimp3.c
@@ -1660,8 +1660,8 @@
 {
     static mp3dec_t mp3d = { 0, };
     mp3dec_frame_info_t info;
-    int i, data_bytes, samples, total_samples = 0, nbuf = 0;
-    double MSE = 0.0, MSEtemp, psnr;
+    int i, data_bytes, samples, total_samples = 0, nbuf = 0, maxdiff = 0;
+    double MSE = 0.0, psnr;
     unsigned char buf[4096];
 
     mp3dec_init(&mp3d);
@@ -1679,7 +1679,9 @@
             total_samples += samples*info.channels;
             for (i = 0; i < samples*info.channels; i++)
             {
-                MSEtemp = abs((int)pcm[i] - (int)pcm2[i]);
+                int MSEtemp = abs((int)pcm[i] - (int)pcm2[i]);
+                if (MSEtemp > maxdiff)
+                    maxdiff = MSEtemp;
                 MSE += MSEtemp*MSEtemp;
             }
             fwrite(pcm, samples, 2*info.channels, file_wav);
@@ -1692,7 +1694,7 @@
         psnr = 99.0;
     else
         psnr = 10.0*log10(((double)0x7fff*0x7fff)/MSE);
-    printf("samples=%d PSNR=%f\n", total_samples, psnr);
+    printf("samples=%d max_diff=%d PSNR=%f\n", total_samples, maxdiff, psnr);
     if (psnr < 96)
     {
         printf("PSNR compliance failed\n");
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -2,6 +2,7 @@
 
 if [ ! -d "fate-suite.ffmpeg.org" ]; then
   wget -np -r --level=1 http://fate-suite.ffmpeg.org/mp3-conformance/
+  cp vectors/l3-he_mode16.pcm fate-suite.ffmpeg.org/mp3-conformance/he_mode.pcm
 fi
 
 gcc -Dminimp3_test -O2 -g -o minimp3 minimp3.c -lm
binary files /dev/null b/vectors/l3-he_mode.wav differ
binary files /dev/null b/vectors/l3-he_mode16.pcm differ