[xiph-commits] r18220 - trunk/postfish
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Fri Mar 2 21:00:42 PST 2012
Author: xiphmont
Date: 2012-03-02 21:00:42 -0800 (Fri, 02 Mar 2012)
New Revision: 18220
Modified:
trunk/postfish/output.c
trunk/postfish/version.h
Log:
Had a rounding bug in the < 24 bit output; caused a DC offset at very
low levels
Modified: trunk/postfish/output.c
===================================================================
--- trunk/postfish/output.c 2012-03-02 23:38:12 UTC (rev 18219)
+++ trunk/postfish/output.c 2012-03-03 05:00:42 UTC (rev 18220)
@@ -610,9 +610,20 @@
int bytes=(bits+7)>>3;
int32_t signxor=(signp?0:0x800000L);
int bytestep=bytes*(ch-1);
+ int round=0;
int endbytecase=endian*3+(bytes-1);
int j,i;
+
+ switch(endbytecase){
+ case 1:case 4:
+ round=128;
+ break;
+ case 0:case 3:
+ round=32768;
+ break;
+ }
+
for(j=0;j<ch;j++){
unsigned char *o=audiobuf+bytes*j;
if(!mute_channel_muted(link->active,j) && source[j]){
@@ -621,7 +632,7 @@
for(i=0;i<link->samples;i++){
float dval=d[i];
- int32_t val=rint(dval*8388608.);
+ int32_t val=rint(dval*8388608.)+round;
if(val>8388607)val=8388607;
if(val<-8388608)val=-8388608;
val ^= signxor;
Modified: trunk/postfish/version.h
===================================================================
--- trunk/postfish/version.h 2012-03-02 23:38:12 UTC (rev 18219)
+++ trunk/postfish/version.h 2012-03-03 05:00:42 UTC (rev 18220)
@@ -1,2 +1,2 @@
#define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Sat Aug 21 01:08:29 EDT 2010] */
+/* DO NOT EDIT: Automated versioning hack [Fri Mar 2 23:59:38 EST 2012] */
More information about the commits
mailing list