Changeset 71 for mppenc/branches/r2d/libmpcpsy/psy_tab.c
- Timestamp:
- 10/07/06 02:49:28 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mppenc/branches/r2d/libmpcpsy/psy_tab.c
r65 r71 47 47 const float iw_short [PART_SHORT] = { 1.f, 1.f, 1.f, 1.f, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/3, 1.f/3, 1.f/4, 1.f/6, 1.f/7, 1.f/8, 1.f/11, 1.f/13, 1.f/17, 1.f/25, 1.f/29 }; 48 48 49 float MinVal [PART_LONG]; // contains minimum tonality soffsets 50 float Loudness [PART_LONG]; // weighting factors for loudness calculation 51 float SPRD [PART_LONG] [PART_LONG]; // tabulated spreading function 52 float O_MAX; 53 float O_MIN; 54 float FAC1; 55 float FAC2; // constants for offset calculation 56 float partLtq [PART_LONG]; // threshold in quiet (partitions) 57 float invLtq [PART_LONG]; // inverse threshold in quiet (partitions, long) 58 float fftLtq [512]; // threshold in quiet (FFT) 49 59 50 60 static float … … 165 175 tmp = mind ( tmp, Ltq_max ); // Limit ATH 166 176 tmp += Ltq_offset - 23; // Add chosen Offset 167 m->fftLtq[n] = absLtq[n] = POW10 ( 0.1 * tmp); // conversion into power177 fftLtq[n] = absLtq[n] = POW10 ( 0.1 * tmp); // conversion into power 168 178 } 169 179 … … 174 184 erg = minf (erg, absLtq[k]); 175 185 176 m->partLtq[n] = erg; // threshold in quiet177 m->invLtq [n] = 1.f / m->partLtq[n]; // Inverse186 partLtq[n] = erg; // threshold in quiet 187 invLtq [n] = 1.f / partLtq[n]; // Inverse 178 188 } 179 189 } … … 219 229 tmp = LOG10 (midfreq) - 3.5f; // dB(A) 220 230 tmp = -10 * tmp * tmp + 3 - midfreq/3000; 221 m->Loudness [n] = POW10 ( 0.1 * tmp ); // conversion into power231 Loudness [n] = POW10 ( 0.1 * tmp ); // conversion into power 222 232 } 223 233 } … … 286 296 for ( n = 0; n < PART_LONG; n++ ) { 287 297 tmp = Bass ( (wl [n] + wh [n]) / 2048. * m->SampleFreq, m->TMN, m->NMT, bass ); 288 m->MinVal [n] = POW10 ( -0.1 * tmp ); // conversion into power298 MinVal [n] = POW10 ( -0.1 * tmp ); // conversion into power 289 299 } 290 300 291 301 // calculation of the constants for "tonality offset" 292 m->O_MAX = POW10 ( -0.1 * m->TMN );293 m->O_MIN = POW10 ( -0.1 * m->NMT );294 m->FAC1 = POW10 ( -0.1 * (m->NMT - (m->TMN - m->NMT) * 0.229) ) ;295 m->FAC2 = (m->TMN - m->NMT) * (0.99011159 * 0.1);302 O_MAX = POW10 ( -0.1 * m->TMN ); 303 O_MIN = POW10 ( -0.1 * m->NMT ); 304 FAC1 = POW10 ( -0.1 * (m->NMT - (m->TMN - m->NMT) * 0.229) ) ; 305 FAC2 = (m->TMN - m->NMT) * (0.99011159 * 0.1); 296 306 } 297 307 … … 333 343 334 344 // calculate coefficient 335 m->SPRD[i][j] = POW10 ( -0.1 * (tmpy+tmpz) ); // [Source] [Target]345 SPRD[i][j] = POW10 ( -0.1 * (tmpy+tmpz) ); // [Source] [Target] 336 346 } 337 347 } … … 341 351 float norm = 0.f; 342 352 for ( j = 0; j < PART_LONG; j++ ) // j is masking Partition 343 norm += m->SPRD [j] [i];353 norm += SPRD [j] [i]; 344 354 for ( j = 0; j < PART_LONG; j++ ) // j is masking Partition 345 m->SPRD [j] [i] /= norm;355 SPRD [j] [i] /= norm; 346 356 } 347 357 }
Note: See TracChangeset
for help on using the changeset viewer.