[xiph-commits] r6957 - branches/monty-vorbis-aotuv-branch/lib

xiphmont at dactyl.lonelymoon.com xiphmont
Fri Jul 2 19:20:57 PDT 2004


Author: xiphmont
Date: Fri Jul  2 19:20:57 2004
New Revision: 6957

Modified:
branches/monty-vorbis-aotuv-branch/lib/scales.h
Log:
About time to correct an old, owrked around bug (fixing it would have
affected tuning thresholds.  The conversion was working properly, it
just had a .3dB offset from 'correct', and prior tuning took that into
account)



Modified: branches/monty-vorbis-aotuv-branch/lib/scales.h
===================================================================
--- branches/monty-vorbis-aotuv-branch/lib/scales.h	2004-07-02 22:30:24 UTC (rev 6956)
+++ branches/monty-vorbis-aotuv-branch/lib/scales.h	2004-07-03 02:20:56 UTC (rev 6957)
@@ -22,7 +22,7 @@
#include "os.h"

/* 20log10(x) */
-#define VORBIS_IEEE_FLOAT32 1
+//#define VORBIS_IEEE_FLOAT32 1
#ifdef VORBIS_IEEE_FLOAT32

static float unitnorm(float x){
@@ -37,13 +37,9 @@
return(*x);
}

+/* Segher was off (too high) by ~ .3 decibel.  Center the conversion correctly. */
static float todB(const float *x){
-  float calc;
-  ogg_int32_t *i=(ogg_int32_t *)x;
-  calc = ((*i) & 0x7fffffff);
-  calc *= 7.1771144e-7f;
-  calc += -764.27118f;
-  return calc;
+  return (float)((*(int32_t *)x)&0x7fffffff) * 7.17711438e-7f -764.6161886f;
}

#define todB_nn(x) todB(x)



More information about the commits mailing list