Changeset 303


Ignore:
Timestamp:
05/02/07 22:47:48 (17 years ago)
Author:
zorg
Message:

Factorize some operations out of the inner loop

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libmpc/trunk/libmpcpsy/psy.c

    r221 r303  
    787787           int           MSflag )
    788788{
    789     int    n;
    790     int    k;
    791     float  ltq;
    792     float  tmp;
    793         float  ms = MSflag  ?  0.125f * AdaptedLTQ  :  0.25f * AdaptedLTQ ;
    794 
    795     for ( n = 0; n < PART_LONG; n++ ) {
    796         for ( k = wl[n]; k <= wh[n]; k++, thr0++, thr1++ ) {    // threshold in quiet (Partition)
     789    int     n, k;
     790    float   ms, ltq, tmp, tmpThr0, tmpThr1;
     791
     792    ms = AdaptedLTQ * (MSflag ? 0.125f : 0.25f);
     793    for( n = 0; n < PART_LONG; n++ )
     794    {
     795        tmpThr0 = sqrt(partThr0[n]);
     796        tmpThr1 = sqrt(partThr1[n]);
     797        for ( k = wl[n]; k <= wh[n]; k++, thr0++, thr1++ )
     798        {
     799            // threshold in quiet (Partition)
    797800            // Applies a much more gentle ATH rolloff + 6 dB more dynamic
    798801            ltq   = sqrt (ms * fftLtq [k]);
    799             tmp   = sqrt (partThr0 [n]) + ltq;
     802            tmp   = tmpThr0 + ltq;
    800803            *thr0 = tmp * tmp;
    801             tmp   = sqrt (partThr1 [n]) + ltq;
     804            tmp   = tmpThr1 + ltq;
    802805            *thr1 = tmp * tmp;
    803806        }
    804807    }
    805     return;
    806808}
    807809
Note: See TracChangeset for help on using the changeset viewer.