[xiph-commits] r3332 - libfishsound/branches/1.0-stable-flac/src/libfishsound

conrad at svn.annodex.net conrad at svn.annodex.net
Thu Jan 10 03:10:10 PST 2008


Author: conrad
Date: 2008-01-10 03:10:09 -0800 (Thu, 10 Jan 2008)
New Revision: 3332

Modified:
   libfishsound/branches/1.0-stable-flac/src/libfishsound/flac.c
Log:
Improve rounding in FLAC decode conversion to float
Checked with (hacked) sndfile-cmp, allowing for 1 bit error


Modified: libfishsound/branches/1.0-stable-flac/src/libfishsound/flac.c
===================================================================
--- libfishsound/branches/1.0-stable-flac/src/libfishsound/flac.c	2008-01-10 09:00:47 UTC (rev 3331)
+++ libfishsound/branches/1.0-stable-flac/src/libfishsound/flac.c	2008-01-10 11:10:09 UTC (rev 3332)
@@ -109,9 +109,13 @@
 #endif
   fsound->frameno += frame->header.blocksize*frame->header.channels;
   if (fsound->callback.decoded_float) {
+    /*float norm = 1.0 / (1 + (1 << (frame->header.bits_per_sample - 1)));*/
+    float norm = 1.0 / ((1 << (frame->header.bits_per_sample - 1)));
+
     if (fsound->interleave) {
 	FishSoundDecoded_FloatIlv dfi;
-	float* retpcm, norm = 1.0 / (1 + (1 << (frame->header.bits_per_sample - 1)));
+	float* retpcm;
+
 	fi->pcm = realloc(fi->pcm, sizeof(float)*frame->header.channels*frame->header.blocksize);
 	retpcm = (float*) fi->pcm;
 	for (i=0; i<frame->header.blocksize; i++) {
@@ -123,7 +127,8 @@
 	dfi (fsound, (float **)retpcm, frame->header.blocksize, fsound->user_data);
       } else {
 	FishSoundDecoded_Float df;
-	float** retpcm, *p, norm = 1.0 / (1 + (1 << (frame->header.bits_per_sample - 1)));
+	float** retpcm, *p;
+
 	fi->pcm = realloc(fi->pcm, sizeof(float)*frame->header.channels*frame->header.blocksize);
 	retpcm = fi->pcm;
 	for (i=0; i<frame->header.blocksize; i++)



More information about the commits mailing list