Changeset 76 for mppenc/branches/r2d/libmpcpsy/psy.c
 Timestamp:
 10/17/06 13:52:34 (18 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

mppenc/branches/r2d/libmpcpsy/psy.c
r74 r76 124 124 void Cepstrum2048 ( float* cep, const int ); 125 125 126 void Init_ANS ( void ); 127 126 128 // Resets Arrays 127 129 void Init_Psychoakustik ( PsyModel* m) … … 154 156 Init_FFT (m); 155 157 158 Init_ANS (); 159 156 160 Init_Psychoakustiktabellen (m); 157 161 … … 304 308 float e1; 305 309 306 307 #if 000000308 for ( n = 0; n < PART_LONG; n++ ) {309 k = wh[n]  wl[n];310 e0 = *spec0++;311 e1 = *spec1++;312 while ( k ) {313 e0 += *spec0++;314 e1 += *spec1++;315 }316 *erg0++ = e0;317 *erg1++ = e1;318 }319 #else320 310 n = 0; 321 311 … … 355 345 *erg1++ = e1; 356 346 } 357 358 #endif359 360 return;361 347 } 362 348 … … 377 363 float e1; 378 364 379 380 #if 000000381 for ( n = 0; n < PART_LONG; n++ ) {382 e0 = *spec0++ * *cw0++;383 e1 = *spec1++ * *cw1++;384 k = wh[n]  wl[n];385 while ( k ) {386 e0 += *spec0++ * *cw0++;387 e1 += *spec1++ * *cw1++;388 }389 *erg0++ = e0;390 *erg1++ = e1;391 }392 #else393 365 n = 0; 394 366 … … 428 400 *erg1++ = e1; 429 401 } 430 #endif431 432 return;433 402 } 434 403 … … 824 793 for ( n = 0; n < PART_LONG; n++ ) { 825 794 for ( k = wl[n]; k <= wh[n]; k++, thr0++, thr1++ ) { // threshold in quiet (Partition) 826 #if 0827 ltq = AdaptedLTQ * fftLtq [k];828 *thr0 = maxf ( partThr0 [n], ltq );829 *thr1 = maxf ( partThr1 [n], ltq );830 #else831 795 // Applies a much more gentle ATH rolloff + 6 dB more dynamic 832 796 ltq = sqrt (ms * fftLtq [k]); … … 835 799 tmp = sqrt (partThr1 [n]) + ltq; 836 800 *thr1 = tmp * tmp; 837 #endif838 801 } 839 802 } … … 878 841 // output: masking threshold *thr in short partitions 879 842 // Energy of the last short block *preerg in short partitions 880 #if 0881 static void882 CalcShortThreshold ( const float erg [] [128],883 const float PreechoFac,884 float* thr,885 float preerg[2][PART_SHORT],886 int* transient )887 {888 const int* lo = wl_short; // lower FFTindex889 const int* hi = wh_short; // upper FFTindex890 const float* iwidth = iw_short; // inverse partitionwidth891 int k;892 int n;893 int m;894 float tmp;895 float enrg;896 float th;897 const float* ep;898 899 for ( k = 0; k < PART_SHORT; k++, lo++, hi++ ) {900 transient[k] = 0;901 th = 1.e20f;902 for ( n = 0; n < 4; n++ ) {903 ep = erg[n] + *lo;904 m = *hi  *lo;905 enrg = *ep++;906 while (m)907 enrg += *ep++;908 909 // preecho prevention910 tmp = enrg;911 if (preerg[0][k] < enrg)912 enrg = preerg[0][k];913 preerg[0][k] = tmp;914 915 // is signal transient?916 if (tmp > TransDetect*enrg) transient[k] = 1;917 918 // assume short threshold = engr*PreechoFac919 th = minf (th, enrg*PreechoFac);920 }921 thr[k] = th * *iwidth++;922 }923 924 return;925 }926 #else927 843 static void 928 844 CalcShortThreshold ( PsyModel* m, … … 972 888 return; 973 889 } 974 975 #endif976 890 977 891 // input : previous simultaneous masking threshold *preThr,
Note: See TracChangeset
for help on using the changeset viewer.