Changeset 104308 in webkit


Ignore:
Timestamp:
Jan 6, 2012 11:51:19 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Use VectorMath lib when possible to optimize the processing in WebAudio AudioBus
https://bugs.webkit.org/show_bug.cgi?id=75334

Patch by Wei James <james.wei@intel.com> on 2012-01-06
Reviewed by Kenneth Russell.

  • platform/audio/AudioBus.cpp:

(WebCore::AudioBus::processWithGainFromMonoStereo):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r104306 r104308  
     12012-01-06  Wei James  <james.wei@intel.com>
     2
     3        Use VectorMath lib when possible to optimize the processing in WebAudio AudioBus
     4        https://bugs.webkit.org/show_bug.cgi?id=75334
     5
     6        Reviewed by Kenneth Russell.
     7
     8        * platform/audio/AudioBus.cpp:
     9        (WebCore::AudioBus::processWithGainFromMonoStereo):
     10
    1112012-01-06  Jer Noble  <jer.noble@apple.com>
    212
  • trunk/Source/WebCore/platform/audio/AudioBus.cpp

    r102888 r104308  
    245245    } \
    246246    gain = totalDesiredGain; \
    247     for (; k < framesToProcess; ++k)  \
    248         OP
     247    OP##_V
    249248
    250249#define STEREO_SUM \
     
    255254        *destinationR++ = sumR; \
    256255    }
     256
     257// FIXME: this can be optimized with additional VectorMath functions.
     258#define STEREO_SUM_V \
     259    for (; k < framesToProcess; ++k) \
     260        STEREO_SUM
    257261
    258262// Mono -> stereo (mix equally into L and R)
     
    267271    }
    268272
     273#define MONO2STEREO_SUM_V \
     274    for (; k < framesToProcess; ++k) \
     275        MONO2STEREO_SUM
     276   
    269277#define MONO_SUM \
    270278    { \
     
    272280        *destinationL++ = sum; \
    273281    }
     282
     283#define MONO_SUM_V \
     284    for (; k < framesToProcess; ++k) \
     285        MONO_SUM
    274286
    275287#define STEREO_NO_SUM \
     
    281293    }
    282294
     295#define STEREO_NO_SUM_V \
     296    { \
     297        vsmul(sourceL, 1, &gain, destinationL, 1, framesToProcess - k); \
     298        vsmul(sourceR, 1, &gain, destinationR, 1, framesToProcess - k); \
     299    }
     300
    283301// Mono -> stereo (mix equally into L and R)
    284302// FIXME: Really we should apply an equal-power scaling factor here, since we're effectively panning center...
     
    290308    }
    291309
     310#define MONO2STEREO_NO_SUM_V \
     311    { \
     312        vsmul(sourceL, 1, &gain, destinationL, 1, framesToProcess - k); \
     313        vsmul(sourceL, 1, &gain, destinationR, 1, framesToProcess - k); \
     314    }
     315
    292316#define MONO_NO_SUM \
    293317    { \
     
    296320    }
    297321
     322#define MONO_NO_SUM_V \
     323    { \
     324        vsmul(sourceL, 1, &gain, destinationL, 1, framesToProcess - k); \
     325    }
     326
    298327void AudioBus::processWithGainFromMonoStereo(const AudioBus &sourceBus, double* lastMixGain, double targetGain, bool sumToBus)
    299328{
     
    301330    // so we "de-zipper" by slowly changing the gain each sample-frame until we've achieved the target gain.
    302331
    303     // FIXME: optimize this method (SSE, etc.)
    304332    // FIXME: targetGain and lastMixGain should be changed to floats instead of doubles.
    305333   
     
    352380            return;
    353381
    354         // FIXME: if (framesToDezipper == 0) and DenormalDisabler::flushDenormalFloatToZero() is a NOP (gcc vs. Visual Studio)
    355         // then we can further optimize the PROCESS_WITH_GAIN codepaths below using vsmul().
    356382        if (sourceR && destinationR) {
    357383            // Stereo
Note: See TracChangeset for help on using the changeset viewer.