|
Lines 25-45
Link Here
|
| 25 |
#define VORBIS_IEEE_FLOAT32 1 |
25 |
#define VORBIS_IEEE_FLOAT32 1 |
| 26 |
#ifdef VORBIS_IEEE_FLOAT32 |
26 |
#ifdef VORBIS_IEEE_FLOAT32 |
| 27 |
|
27 |
|
| 28 |
static float unitnorm(float x){ |
28 |
static inline float unitnorm(float x){ |
| 29 |
ogg_uint32_t *ix=(ogg_uint32_t *)&x; |
29 |
union { |
| 30 |
*ix=(*ix&0x80000000UL)|(0x3f800000UL); |
30 |
ogg_uint32_t i; |
| 31 |
return(x); |
31 |
float f; |
|
|
32 |
} ix; |
| 33 |
ix.f = x; |
| 34 |
ix.i=(ix.i&0x80000000UL)|(0x3f800000UL); |
| 35 |
return(ix.f); |
| 32 |
} |
36 |
} |
| 33 |
|
37 |
|
| 34 |
static float FABS(float *x){ |
38 |
static float FABS(float *x){ |
| 35 |
ogg_uint32_t *ix=(ogg_uint32_t *)x; |
39 |
union { |
| 36 |
*ix&=0x7fffffffUL; |
40 |
ogg_uint32_t i; |
|
|
41 |
float f; |
| 42 |
} ix; |
| 43 |
ix.f = *x; |
| 44 |
ix.i = ix.i&0x7fffffffUL; |
| 45 |
/* *x = ix.f; -- #define below doesn't do this, but original here did. */ |
| 37 |
return(*x); |
46 |
return(*x); |
| 38 |
} |
47 |
} |
| 39 |
|
48 |
|
| 40 |
/* Segher was off (too high) by ~ .3 decibel. Center the conversion correctly. */ |
49 |
/* Segher was off (too high) by ~ .3 decibel. Center the conversion correctly. */ |
| 41 |
static float todB(const float *x){ |
50 |
static float todB(const float *x){ |
| 42 |
return (float)((*(ogg_int32_t *)x)&0x7fffffff) * 7.17711438e-7f -764.6161886f; |
51 |
union { |
|
|
52 |
ogg_int32_t i; |
| 53 |
float f; |
| 54 |
} ix; |
| 55 |
ix.f = *x; |
| 56 |
ix.i = ix.i&0x7fffffff; |
| 57 |
return (float)ix.i * 7.17711438e-7f -764.6161886f; |
| 43 |
} |
58 |
} |
| 44 |
|
59 |
|
| 45 |
#define todB_nn(x) todB(x) |
60 |
#define todB_nn(x) todB(x) |