Changeset 73 for mppenc/branches/r2d
- Timestamp:
- 10/12/06 18:08:02 (18 years ago)
- Location:
- mppenc/branches/r2d
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
mppenc/branches/r2d/libmpcenc/quant.c
r65 r73 161 161 float tmp ; 162 162 float tmp2; 163 float tmp3;164 163 165 164 // Summation of the absolute power and the quadratic error 166 165 for ( k = 0; k < 36; k++ ) { 167 166 tmp2 = input[k] * NoiseInjectionCompensation1D [res]; 168 // q = ftol(in), correct rounding 169 tmp = tmp2 * fac + 0xFF8000; 170 tmp3 = (*(int*) & tmp - 0x4B7F8000) * invfac; 171 tmp = tmp3 - tmp2; 167 tmp = __builtin_nearbyintf(tmp2 * fac) * invfac - tmp2; 172 168 173 169 Fehler += tmp * tmp; … … 191 187 float tmp ; 192 188 float tmp2; 193 float tmp3;194 189 195 190 // Summation of the absolute power and the quadratic error … … 198 193 for ( ; k < 12; k++ ) { 199 194 tmp2 = input[k] * NoiseInjectionCompensation1D [res]; 200 // q = ftol(in), correct rounding 201 tmp = tmp2 * fac + 0xFF8000; 202 tmp3 = (*(int*) & tmp - 0x4B7F8000) * invfac; 203 tmp = tmp3 - tmp2; 195 tmp = __builtin_nearbyintf(tmp2 * fac) * invfac - tmp2; 204 196 205 197 Fehler += tmp * tmp; … … 211 203 for ( ; k < 24; k++ ) { 212 204 tmp2 = input[k] * NoiseInjectionCompensation1D [res]; 213 // q = ftol(in), correct rounding 214 tmp = tmp2 * fac + 0xFF8000; 215 tmp3 = (*(int*) & tmp - 0x4B7F8000) * invfac; 216 tmp = tmp3 - tmp2; 205 tmp = __builtin_nearbyintf(tmp2 * fac) * invfac - tmp2; 217 206 218 207 Fehler += tmp * tmp; … … 225 214 for ( ; k < 36; k++ ) { 226 215 tmp2 = input[k] * NoiseInjectionCompensation1D [res]; 227 // q = ftol(in), correct rounding 228 tmp = tmp2 * fac + 0xFF8000; 229 tmp3 = (*(int*) & tmp - 0x4B7F8000) * invfac; 230 tmp = tmp3 - tmp2; 216 tmp = __builtin_nearbyintf(tmp2 * fac) * invfac - tmp2; 231 217 232 218 Fehler += tmp * tmp; … … 250 236 float mult = A [res] * NoiseInjectionCompensation1D [res]; 251 237 float invmult = C [res]; 252 float tmp;253 238 int quant; 254 239 float signal; 255 240 256 241 for ( n = 0; n < 36 - maxNsOrder; n++, input++, qu_output++ ) { 257 // q = ftol(in), correct rounding 258 tmp = *input * mult + 0xFF8000; 259 quant = (unsigned int)(*(int*) & tmp - 0x4B7F8000 + offset); 242 quant = (unsigned int)(__builtin_lrintf(*input * mult) + offset); 260 243 261 244 // limitation to 0...2D … … 268 251 269 252 for ( ; n < 36; n++, input++, qu_output++ ) { 270 // q = ftol(in), correct rounding271 253 signal = *input * mult; 272 tmp = signal + 0xFF8000; 273 quant = (unsigned int)(*(int*) & tmp - 0x4B7F8000 + offset); 254 quant = (unsigned int)(__builtin_lrintf(signal) + offset); 274 255 275 256 // calculate the current error and save it for error refeeding … … 293 274 294 275 float signal; 295 float tmp;296 276 float mult = A [res]; 297 277 float invmult = C [res]; … … 304 284 for ( n = 0; n < 36; n++, input++, qu_output++ ) { 305 285 signal = *input * NoiseInjectionCompensation1D [res] - (FIR[5]*errors[n+0] + FIR[4]*errors[n+1] + FIR[3]*errors[n+2] + FIR[2]*errors[n+3] + FIR[1]*errors[n+4] + FIR[0]*errors[n+5]); 306 307 // quant = ftol(signal), correct rounding 308 tmp = signal * mult + 0xFF8000; 309 quant = *(int*) & tmp - 0x4B7F8000; 286 quant = __builtin_lrintf(signal * mult); 310 287 311 288 // calculate the current error and save it for error refeeding -
mppenc/branches/r2d/mppenc.kdevelop
r72 r73 19 19 <general> 20 20 <activetarget>src/mppenc</activetarget> 21 <useconfiguration> debug</useconfiguration>21 <useconfiguration>optimized</useconfiguration> 22 22 </general> 23 23 <run> … … 39 39 <cxxcompiler>kdevgppoptions</cxxcompiler> 40 40 <f77compiler>kdevg77options</f77compiler> 41 <cflags>-O3 -fomit-frame-pointer -pipe - g0 -Wall</cflags>41 <cflags>-O3 -fomit-frame-pointer -pipe -Wall -ffast-math</cflags> 42 42 <envvars/> 43 43 <configargs></configargs> … … 59 59 <cflags>-O0 -Wall -g3</cflags> 60 60 <envvars/> 61 <topsourcedir ></topsourcedir>62 <cppflags ></cppflags>63 <ldflags ></ldflags>64 <ccompilerbinary ></ccompilerbinary>65 <cxxcompilerbinary ></cxxcompilerbinary>66 <f77compilerbinary ></f77compilerbinary>67 <cxxflags ></cxxflags>68 <f77flags ></f77flags>61 <topsourcedir/> 62 <cppflags/> 63 <ldflags/> 64 <ccompilerbinary/> 65 <cxxcompilerbinary/> 66 <f77compilerbinary/> 67 <cxxflags/> 68 <f77flags/> 69 69 </debug> 70 70 </configurations>
Note: See TracChangeset
for help on using the changeset viewer.