b=956604 Remove unnecessary channel count parameter from AudioBufferInPlaceScale r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Wed, 08 Jan 2014 16:57:53 +1300
changeset 162567 3555983eb8d23d538f2bc266e649d4ab3bb6dbfc
parent 162566 b73bf63d70c82fda2062109cf12eed553e100702
child 162568 59b94799b064f8d7efbaaf9e136bea1692d91f81
push id25960
push userryanvm@gmail.com
push dateWed, 08 Jan 2014 20:34:35 +0000
treeherdermozilla-central@0449f682dd31 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs956604
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
b=956604 Remove unnecessary channel count parameter from AudioBufferInPlaceScale r=padenot
content/media/AudioNodeEngine.cpp
content/media/AudioNodeEngine.h
content/media/AudioNodeEngineNEON.cpp
content/media/AudioNodeEngineNEON.h
content/media/webaudio/blink/PeriodicWave.cpp
--- a/content/media/AudioNodeEngine.cpp
+++ b/content/media/AudioNodeEngine.cpp
@@ -154,35 +154,34 @@ AudioBlockCopyChannelWithScale(const flo
   }
 }
 
 void
 AudioBlockInPlaceScale(float aBlock[WEBAUDIO_BLOCK_SIZE],
                        uint32_t aChannelCount,
                        float aScale)
 {
-  AudioBufferInPlaceScale(aBlock, aChannelCount, aScale, WEBAUDIO_BLOCK_SIZE);
+  AudioBufferInPlaceScale(aBlock, aScale, aChannelCount * WEBAUDIO_BLOCK_SIZE);
 }
 
 void
 AudioBufferInPlaceScale(float* aBlock,
-                        uint32_t aChannelCount,
                         float aScale,
                         uint32_t aSize)
 {
   if (aScale == 1.0f) {
     return;
   }
 #ifdef BUILD_ARM_NEON
   if (mozilla::supports_neon()) {
-    AudioBufferInPlaceScale_NEON(aBlock, aChannelCount, aScale, aSize);
+    AudioBufferInPlaceScale_NEON(aBlock, aScale, aSize);
     return;
   }
 #endif
-  for (uint32_t i = 0; i < aSize * aChannelCount; ++i) {
+  for (uint32_t i = 0; i < aSize; ++i) {
     *aBlock++ *= aScale;
   }
 }
 
 void
 AudioBlockPanMonoToStereo(const float aInput[WEBAUDIO_BLOCK_SIZE],
                           float aGainL, float aGainR,
                           float aOutputL[WEBAUDIO_BLOCK_SIZE],
--- a/content/media/AudioNodeEngine.h
+++ b/content/media/AudioNodeEngine.h
@@ -152,17 +152,16 @@ float AudioBufferPeakValue(const float* 
 void AudioBlockInPlaceScale(float aBlock[WEBAUDIO_BLOCK_SIZE],
                             uint32_t aChannelCount,
                             float aScale);
 
 /**
  * In place gain. aScale == 1.0f should be optimized.
  */
 void AudioBufferInPlaceScale(float* aBlock,
-                             uint32_t aChannelCount,
                              float aScale,
                              uint32_t aSize);
 
 /**
  * Upmix a mono input to a stereo output, scaling the two output channels by two
  * different gain value.
  * This algorithm is specified in the WebAudio spec.
  */
--- a/content/media/AudioNodeEngineNEON.cpp
+++ b/content/media/AudioNodeEngineNEON.cpp
@@ -122,31 +122,29 @@ AudioBlockCopyChannelWithScale_NEON(cons
     vst1q_f32(ADDRESS_OF(aOutput, i+4), vout1);
     vst1q_f32(ADDRESS_OF(aOutput, i+8), vout2);
     vst1q_f32(ADDRESS_OF(aOutput, i+12), vout3);
   }
 }
 
 void
 AudioBufferInPlaceScale_NEON(float* aBlock,
-                             uint32_t aChannelCount,
                              float aScale,
                              uint32_t aSize)
 {
   ASSERT_ALIGNED(aBlock);
 
   float32x4_t vin0, vin1, vin2, vin3;
   float32x4_t vout0, vout1, vout2, vout3;
   float32x4_t vscale = vmovq_n_f32(aScale);
 
-  uint32_t totalSize = aSize * aChannelCount;
-  uint32_t dif = totalSize % 16;
-  totalSize -= dif;
+  uint32_t dif = aSize % 16;
+  uint32_t vectorSize = aSize - dif;
   uint32_t i = 0;
-  for (; i < totalSize; i+=16) {
+  for (; i < vectorSize; i+=16) {
     vin0 = vld1q_f32(ADDRESS_OF(aBlock, i));
     vin1 = vld1q_f32(ADDRESS_OF(aBlock, i+4));
     vin2 = vld1q_f32(ADDRESS_OF(aBlock, i+8));
     vin3 = vld1q_f32(ADDRESS_OF(aBlock, i+12));
 
     vout0 = vmulq_f32(vin0, vscale);
     vout1 = vmulq_f32(vin1, vscale);
     vout2 = vmulq_f32(vin2, vscale);
--- a/content/media/AudioNodeEngineNEON.h
+++ b/content/media/AudioNodeEngineNEON.h
@@ -21,21 +21,20 @@ AudioBlockCopyChannelWithScale_NEON(cons
 
 void
 AudioBlockCopyChannelWithScale_NEON(const float aInput[WEBAUDIO_BLOCK_SIZE],
                                     const float aScale[WEBAUDIO_BLOCK_SIZE],
                                     float aOutput[WEBAUDIO_BLOCK_SIZE]);
 
 void
 AudioBufferInPlaceScale_NEON(float* aBlock,
-                             uint32_t aChannelCount,
                              float aScale,
                              uint32_t aSize);
 
 void
 AudioBlockPanStereoToStereo_NEON(const float aInputL[WEBAUDIO_BLOCK_SIZE],
                                  const float aInputR[WEBAUDIO_BLOCK_SIZE],
                                  float aGainL, float aGainR, bool aIsOnTheLeft,
                                  float aOutputL[WEBAUDIO_BLOCK_SIZE],
                                  float aOutputR[WEBAUDIO_BLOCK_SIZE]);
 }
 
-#endif /* MOZILLA_AUDIONODEENGINENEON_H_ */
\ No newline at end of file
+#endif /* MOZILLA_AUDIONODEENGINENEON_H_ */
--- a/content/media/webaudio/blink/PeriodicWave.cpp
+++ b/content/media/webaudio/blink/PeriodicWave.cpp
@@ -177,17 +177,17 @@ void PeriodicWave::createBandLimitedTabl
         for (i = numberOfComponents; i < halfSize; ++i) {
             realP[i] = 0;
             imagP[i] = 0;
         }
 
         // Generate complex conjugate because of the way the
         // inverse FFT is defined.
         float minusOne = -1;
-        AudioBufferInPlaceScale(imagP, 1, minusOne, halfSize);
+        AudioBufferInPlaceScale(imagP, minusOne, halfSize);
 
         // Find the starting bin where we should start culling.
         // We need to clear out the highest frequencies to band-limit
         // the waveform.
         unsigned numberOfPartials = numberOfPartialsForRange(rangeIndex);
 
         // Cull the aliasing partials for this pitch range.
         for (i = numberOfPartials + 1; i < halfSize; ++i) {
@@ -219,17 +219,17 @@ void PeriodicWave::createBandLimitedTabl
             float maxValue;
             maxValue = AudioBufferPeakValue(data, m_periodicWaveSize);
 
             if (maxValue)
                 normalizationScale = 1.0f / maxValue;
         }
 
         // Apply normalization scale.
-        AudioBufferInPlaceScale(data, 1, normalizationScale, m_periodicWaveSize);
+        AudioBufferInPlaceScale(data, normalizationScale, m_periodicWaveSize);
     }
 }
 
 void PeriodicWave::generateBasicWaveform(OscillatorType shape)
 {
     const float piFloat = M_PI;
     unsigned fftSize = periodicWaveSize();
     unsigned halfSize = fftSize / 2 + 1;