Changeset 221 for libmpc/branches/r2d/libmpcenc/quant.c
- Timestamp:
- 02/17/07 21:18:35 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/branches/r2d/libmpcenc/quant.c
r159 r221 158 158 ISNR_Schaetzer ( const float* input, const float SNRcomp, const int res ) 159 159 { 160 int k; 161 const float fac = A [res]; 162 const float invfac = C [res]; 160 const float fac = A [res] * NoiseInjectionCompensation1D [res]; 161 const float invfac = C [res] / NoiseInjectionCompensation1D [res]; 163 162 float signal = 1.e-30f; 164 163 float error = 1.e-30f; 165 float err, sig;164 const float * in_end = input + 36; 166 165 167 166 // Summation of the absolute power and the quadratic error 168 for ( k = 0; k < 36; k++ ) { 169 sig = input[k] * NoiseInjectionCompensation1D [res]; 170 err = mpc_nearbyintf(sig * fac) * invfac - sig; 171 167 do { 168 float err; 169 err = mpc_nearbyintf(input[0] * fac) * invfac - input[0]; 172 170 error += err * err; 173 signal += sig * sig; 174 } 171 signal += input[0] * input[0]; 172 173 err = mpc_nearbyintf(input[1] * fac) * invfac - input[1]; 174 error += err * err; 175 signal += input[1] * input[1]; 176 177 err = mpc_nearbyintf(input[2] * fac) * invfac - input[2]; 178 error += err * err; 179 signal += input[2] * input[2]; 180 181 err = mpc_nearbyintf(input[3] * fac) * invfac - input[3]; 182 error += err * err; 183 signal += input[3] * input[3]; 184 185 input += 4; 186 187 } while (input < in_end); 188 189 error *= NoiseInjectionCompensation1D [res] * NoiseInjectionCompensation1D [res]; 190 signal *= NoiseInjectionCompensation1D [res] * NoiseInjectionCompensation1D [res]; 175 191 176 192 // Utilization of SNRcomp only if SNR > 1 !!!
Note: See TracChangeset
for help on using the changeset viewer.