Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1072)

Unified Diff: Source/core/platform/audio/SincResampler.cpp

Issue 20294002: Fix trailing whitespace in .cpp, .h, and .idl files (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/platform/audio/SincResampler.h ('k') | Source/core/platform/audio/VectorMath.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/audio/SincResampler.cpp
diff --git a/Source/core/platform/audio/SincResampler.cpp b/Source/core/platform/audio/SincResampler.cpp
index 4faf98e111fa7501903ba1c5e3ca47fdd46c53c8..d429fbc978b55cd8f43e95279d310891a38611bd 100644
--- a/Source/core/platform/audio/SincResampler.cpp
+++ b/Source/core/platform/audio/SincResampler.cpp
@@ -45,15 +45,15 @@ using namespace std;
//
// |----------------|----------------------------------------------------------------|----------------|
//
-// blockSize + kernelSize / 2
+// blockSize + kernelSize / 2
// <-------------------------------------------------------------------------------->
// r0
//
-// kernelSize / 2 kernelSize / 2 kernelSize / 2 kernelSize / 2
+// kernelSize / 2 kernelSize / 2 kernelSize / 2 kernelSize / 2
// <---------------> <---------------> <---------------> <--------------->
// r1 r2 r3 r4
-//
-// blockSize
+//
+// blockSize
// <-------------------------------------------------------------->
// r5
@@ -132,13 +132,13 @@ void SincResampler::consumeSource(float* buffer, unsigned numberOfSourceFrames)
ASSERT(m_sourceProvider);
if (!m_sourceProvider)
return;
-
+
// Wrap the provided buffer by an AudioBus for use by the source provider.
RefPtr<AudioBus> bus = AudioBus::create(1, numberOfSourceFrames, false);
// FIXME: Find a way to make the following const-correct:
bus->setChannelMemory(0, buffer, numberOfSourceFrames);
-
+
m_sourceProvider->provideInput(bus.get(), numberOfSourceFrames);
}
@@ -153,14 +153,14 @@ public:
, m_sourceFramesAvailable(numberOfSourceFrames)
{
}
-
+
// Consumes samples from the in-memory buffer.
virtual void provideInput(AudioBus* bus, size_t framesToProcess)
{
ASSERT(m_source && bus);
if (!m_source || !bus)
return;
-
+
float* buffer = bus->channel(0)->mutableData();
// Clamp to number of frames available and zero-pad.
@@ -174,7 +174,7 @@ public:
m_sourceFramesAvailable -= framesToCopy;
m_source += framesToCopy;
}
-
+
private:
const float* m_source;
size_t m_sourceFramesAvailable;
@@ -189,11 +189,11 @@ void SincResampler::process(const float* source, float* destination, unsigned nu
unsigned numberOfDestinationFrames = static_cast<unsigned>(numberOfSourceFrames / m_scaleFactor);
unsigned remaining = numberOfDestinationFrames;
-
+
while (remaining) {
unsigned framesThisTime = min(remaining, m_blockSize);
process(&sourceProvider, destination, framesThisTime);
-
+
destination += framesThisTime;
remaining -= framesThisTime;
}
@@ -205,11 +205,11 @@ void SincResampler::process(AudioSourceProvider* sourceProvider, float* destinat
ASSERT(isGood);
if (!isGood)
return;
-
+
m_sourceProvider = sourceProvider;
unsigned numberOfDestinationFrames = framesToProcess;
-
+
// Setup various region pointers in the buffer (see diagram above).
float* r0 = m_inputBuffer.data() + m_kernelSize / 2;
float* r1 = m_inputBuffer.data();
@@ -224,7 +224,7 @@ void SincResampler::process(AudioSourceProvider* sourceProvider, float* destinat
consumeSource(r0, m_blockSize + m_kernelSize / 2);
m_isBufferPrimed = true;
}
-
+
// Step (2)
while (numberOfDestinationFrames) {
@@ -235,7 +235,7 @@ void SincResampler::process(AudioSourceProvider* sourceProvider, float* destinat
double virtualOffsetIndex = subsampleRemainder * m_numberOfKernelOffsets;
int offsetIndex = static_cast<int>(virtualOffsetIndex);
-
+
float* k1 = m_kernelStorage.data() + offsetIndex * m_kernelSize;
float* k2 = k1 + m_kernelSize;
@@ -249,7 +249,7 @@ void SincResampler::process(AudioSourceProvider* sourceProvider, float* destinat
// Figure out how much to weight each kernel's "convolution".
double kernelInterpolationFactor = virtualOffsetIndex - offsetIndex;
- // Generate a single output sample.
+ // Generate a single output sample.
int n = m_kernelSize;
#define CONVOLVE_ONE_SAMPLE \
@@ -331,10 +331,10 @@ void SincResampler::process(AudioSourceProvider* sourceProvider, float* destinat
}
#else
// FIXME: add ARM NEON optimizations for the following. The scalar code-path can probably also be optimized better.
-
+
// Optimize size 32 and size 64 kernels by unrolling the while loop.
// A 20 - 30% speed improvement was measured in some cases by using this approach.
-
+
if (n == 32) {
CONVOLVE_ONE_SAMPLE // 1
CONVOLVE_ONE_SAMPLE // 2
« no previous file with comments | « Source/core/platform/audio/SincResampler.h ('k') | Source/core/platform/audio/VectorMath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698