Changeset 69 for libmpcdec/branches/zorg/src/requant.c
- Timestamp:
- 10/06/06 17:26:37 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpcdec/branches/zorg/src/requant.c
r68 r69 74 74 static mpc_uint32_t find_shift(double fval) 75 75 { 76 77 78 76 mpc_int64_t val = (mpc_int64_t) fval; 77 mpc_uint32_t ptr = 0; 78 if(val<0) 79 79 val = -val; 80 80 while(val) 81 81 { 82 82 val >>= 1; 83 83 ptr++; 84 84 } 85 85 return ptr > 31 ? 0 : 31 - ptr; 86 86 } 87 87 #endif … … 97 97 98 98 #ifndef MPC_FIXED_POINT 99 99 factor *= 1.0 / (double) (1<<(MPC_FIXED_POINT_SHIFT-1)); 100 100 #else 101 101 factor *= 1.0 / (double) (1<<(16-MPC_FIXED_POINT_SHIFT)); 102 102 #endif 103 103 f1 = f2 = factor; 104 104 105 105 // handles +1.58...-98.41 dB, where's scf[n] / scf[n-1] = 1.20050805774840750476 106 107 106 107 SET_SCF(1,factor); 108 108 109 110 109 f1 *= 0.83298066476582673961; 110 f2 *= 1/0.83298066476582673961; 111 111 112 112 for ( n = 1; n <= 128; n++ ) { 113 114 113 SET_SCF((mpc_uint8_t)(1+n),f1); 114 SET_SCF((mpc_uint8_t)(1-n),f2); 115 115 f1 *= 0.83298066476582673961; 116 116 f2 *= 1/0.83298066476582673961;
Note: See TracChangeset
for help on using the changeset viewer.