Unified · Split
| @@ -738,7 +738,7 @@ static void L3_huffman(float *dst, bs_t *bs, const L3_gr_info_t *gr_info, const · 737 unmodified lines | |||
| 738 | #define CHECK_BITS while (bs_sh >= 0) { bs_cache |= (uint32_t)*bs_next_ptr++ << bs_sh; bs_sh -= 8; } | 738 | #define CHECK_BITS while (bs_sh >= 0) { bs_cache |= (uint32_t)*bs_next_ptr++ << bs_sh; bs_sh -= 8; } |
| 739 | #define BSPOS ((bs_next_ptr - bs->buf)*8 - 24 + bs_sh) | 739 | #define BSPOS ((bs_next_ptr - bs->buf)*8 - 24 + bs_sh) |
| 740 | 740 | ||
| 741 | float one; | 741 | float one = 0.0f; |
| 742 | int ireg = 0, big_val_cnt = gr_info->big_values; | 742 | int ireg = 0, big_val_cnt = gr_info->big_values; |
| 743 | const uint8_t *sfb = gr_info->sfbtab; | 743 | const uint8_t *sfb = gr_info->sfbtab; |
| 744 | const uint8_t *bs_next_ptr = bs->buf + bs->pos/8; | 744 | const uint8_t *bs_next_ptr = bs->buf + bs->pos/8; |
| @@ -806,7 +806,7 @@ static void L3_huffman(float *dst, bs_t *bs, const L3_gr_info_t *gr_info, const · 61 unmodified lines | |||
| 806 | break; | 806 | break; |
| 807 | } | 807 | } |
| 808 | #define RELOAD_SCALEFACTOR if (!--np) {np = *sfb++/2; if (!np) break; one = *scf++;} | 808 | #define RELOAD_SCALEFACTOR if (!--np) {np = *sfb++/2; if (!np) break; one = *scf++;} |
| 809 | #define DEQ_COUNT1(s) if (leaf & (128 >> s)) {dst[s] = ((int32_t)bs_cache < 0)?-one:one; FLUSH_BITS(1)} | 809 | #define DEQ_COUNT1(s) if (leaf & (128 >> s)) {dst[s] = ((int32_t)bs_cache < 0) ? -one : one; FLUSH_BITS(1)} |
| 810 | RELOAD_SCALEFACTOR; | 810 | RELOAD_SCALEFACTOR; |
| 811 | DEQ_COUNT1(0); | 811 | DEQ_COUNT1(0); |
| 812 | DEQ_COUNT1(1); | 812 | DEQ_COUNT1(1); |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | #include <stdio.h> | 3 | #include <stdio.h> |
| 4 | #include <math.h> | 4 | #include <math.h> |
| 5 | 5 | ||
| 6 | static char *wav_header(int hz, int ch, int bips, int data_bytes) | 6 | /*static char *wav_header(int hz, int ch, int bips, int data_bytes) |
| 7 | { | 7 | { |
| 8 | static char hdr[44] = "RIFFsizeWAVEfmt \x10\0\0\0\1\0ch_hz_abpsbabsdatasize"; | 8 | static char hdr[44] = "RIFFsizeWAVEfmt \x10\0\0\0\1\0ch_hz_abpsbabsdatasize"; |
| 9 | unsigned long nAvgBytesPerSec = bips*ch*hz >> 3; | 9 | unsigned long nAvgBytesPerSec = bips*ch*hz >> 3; |
| @@ -18,13 +18,13 @@ static char *wav_header(int hz, int ch, int bips, int data_bytes) · 8 unmodified lines | |||
| 18 | *(short *)(hdr + 0x22) = bips; | 18 | *(short *)(hdr + 0x22) = bips; |
| 19 | *(int * )(hdr + 0x28) = data_bytes; | 19 | *(int * )(hdr + 0x28) = data_bytes; |
| 20 | return hdr; | 20 | return hdr; |
| 21 | } | 21 | }*/ |
| 22 | 22 | ||
| 23 | static void decode_file(FILE *file_mp3, FILE *file_ref, FILE *file_out) | 23 | static void decode_file(FILE *file_mp3, FILE *file_ref, FILE *file_out) |
| 24 | { | 24 | { |
| 25 | static mp3dec_t mp3d = { 0, }; | 25 | static mp3dec_t mp3d = { 0, }; |
| 26 | mp3dec_frame_info_t info; | 26 | mp3dec_frame_info_t info; |
| 27 | int i, data_bytes, samples, total_samples = 0, nbuf = 0, maxdiff = 0; | 27 | int i, /*data_bytes, */samples, total_samples = 0, nbuf = 0, maxdiff = 0; |
| 28 | double MSE = 0.0, psnr; | 28 | double MSE = 0.0, psnr; |
| 29 | unsigned char buf[4096]; | 29 | unsigned char buf[4096]; |
| 30 | 30 | ||
| @@ -39,7 +39,9 @@ static void decode_file(FILE *file_mp3, FILE *file_ref, FILE *file_out) · 8 unmodified lines | |||
| 39 | samples = mp3dec_decode_frame(&mp3d, buf, nbuf, pcm, &info); | 39 | samples = mp3dec_decode_frame(&mp3d, buf, nbuf, pcm, &info); |
| 40 | if (samples) | 40 | if (samples) |
| 41 | { | 41 | { |
| 42 | fread(pcm2, 1, 2*info.channels*samples, file_ref); | 42 | int readed = fread(pcm2, 1, 2*info.channels*samples, file_ref); |
| 43 | if (readed < 0) | ||
| 44 | exit(1); | ||
| 43 | total_samples += samples*info.channels; | 45 | total_samples += samples*info.channels; |
| 44 | for (i = 0; i < samples*info.channels; i++) | 46 | for (i = 0; i < samples*info.channels; i++) |
| 45 | { | 47 | { |
| @@ -11,7 +11,7 @@ if [ ! -d "fate-suite.ffmpeg.org" ]; then · 10 unmodified lines | |||
| 11 | cp vectors/l3-he_mode16.pcm fate-suite.ffmpeg.org/mp3-conformance/he_mode.pcm | 11 | cp vectors/l3-he_mode16.pcm fate-suite.ffmpeg.org/mp3-conformance/he_mode.pcm |
| 12 | fi | 12 | fi |
| 13 | 13 | ||
| 14 | gcc -O2 -g -o minimp3 minimp3_test.c -lm | 14 | gcc -O2 -g -Wall -Wextra -o minimp3 minimp3_test.c -lm |
| 15 | 15 | ||
| 16 | APP=./minimp3 | 16 | APP=./minimp3 |
| 17 | 17 | ||