|
Line
Link Here
|
| 0 |
-- trunk/vorbis/lib/scales.h 2005-09-05 01:07:26 UTC (rev 9958) |
0 |
++ trunk/vorbis/lib/scales.h 2005-09-05 11:04:48 UTC (rev 9959) |
|
Lines 26-45
Link Here
|
| 26 |
#ifdef VORBIS_IEEE_FLOAT32 |
26 |
#ifdef VORBIS_IEEE_FLOAT32 |
| 27 |
static float unitnorm(float x){ |
27 |
static float unitnorm(float x){ |
| 28 |
ogg_uint32_t *ix=(ogg_uint32_t *)&x; |
28 |
union { |
| 29 |
*ix=(*ix&0x80000000UL)|(0x3f800000UL); |
29 |
ogg_uint32_t i; |
| 30 |
return(x); |
30 |
float f; |
|
|
31 |
} ix; |
| 32 |
ix.f = x; |
| 33 |
ix.i = (ix.i & 0x80000000U) | (0x3f800000U); |
| 34 |
return ix.f; |
| 31 |
} |
35 |
} |
| 32 |
static float FABS(float *x){ |
|
|
| 33 |
ogg_uint32_t *ix=(ogg_uint32_t *)x; |
| 34 |
*ix&=0x7fffffffUL; |
| 35 |
return(*x); |
| 36 |
} |
| 37 |
|
| 38 |
/* Segher was off (too high) by ~ .3 decibel. Center the conversion correctly. */ |
36 |
/* Segher was off (too high) by ~ .3 decibel. Center the conversion correctly. */ |
| 39 |
static float todB(const float *x){ |
37 |
static float todB(const float *x){ |
| 40 |
return (float)((*(ogg_int32_t *)x)&0x7fffffff) * 7.17711438e-7f -764.6161886f; |
38 |
union { |
|
|
39 |
ogg_uint32_t i; |
| 40 |
float f; |
| 41 |
} ix; |
| 42 |
ix.f = *x; |
| 43 |
ix.i = ix.i&0x7fffffff; |
| 44 |
return (float)(ix.i * 7.17711438e-7f -764.6161886f); |
| 41 |
} |
45 |
} |
| 42 |
#define todB_nn(x) todB(x) |
46 |
#define todB_nn(x) todB(x) |
|
Lines 51-58
Link Here
|
| 51 |
return(1.f); |
55 |
return(1.f); |
| 52 |
} |
56 |
} |
| 53 |
#define FABS(x) fabs(*(x)) |
|
|
| 54 |
|
| 55 |
#define todB(x) (*(x)==0?-400.f:log(*(x)**(x))*4.34294480f) |
57 |
#define todB(x) (*(x)==0?-400.f:log(*(x)**(x))*4.34294480f) |
| 56 |
#define todB_nn(x) (*(x)==0.f?-400.f:log(*(x))*8.6858896f) |
58 |
#define todB_nn(x) (*(x)==0.f?-400.f:log(*(x))*8.6858896f) |