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

Unified Diff: Source/core/platform/audio/DownSampler.h

Issue 15619003: Add support for WaveShaperNode.oversample (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: thread-safety Created 7 years, 7 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
Index: Source/core/platform/audio/DownSampler.h
diff --git a/Source/core/platform/audio/DirectConvolver.h b/Source/core/platform/audio/DownSampler.h
similarity index 64%
copy from Source/core/platform/audio/DirectConvolver.h
copy to Source/core/platform/audio/DownSampler.h
index 0528d7cb6ce66e12fdcfda6cd25da8ed98f32ebf..2766ba79cbca30c5d42c07be8899a7b6a910b398 100644
--- a/Source/core/platform/audio/DirectConvolver.h
+++ b/Source/core/platform/audio/DownSampler.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Intel Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
Ken Russell (switch to Gerrit) 2013/05/23 02:29:25 The copyright notice on these new files is the wro
Chris Rogers 2013/05/24 20:09:04 Done.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,34 +26,45 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef DirectConvolver_h
-#define DirectConvolver_h
+#ifndef DownSampler_h
+#define DownSampler_h
#include "core/platform/audio/AudioArray.h"
-
-#if USE(WEBAUDIO_IPP)
-#include <ipps.h>
-#endif // USE(WEBAUDIO_IPP)
+#include "core/platform/audio/DirectConvolver.h"
namespace WebCore {
-class DirectConvolver {
+// DownSampler down-samples the source stream by a factor of 2x.
+
+class DownSampler {
public:
- DirectConvolver(size_t inputBlockSize);
+ DownSampler(size_t inputBlockSize);
- void process(AudioFloatArray* convolutionKernel, const float* sourceP, float* destP, size_t framesToProcess);
+ // The destination buffer |destP| is of size sourceFramesToProcess / 2.
+ void process(const float* sourceP, float* destP, size_t sourceFramesToProcess);
void reset();
+ // Latency based on the destination sample-rate.
+ size_t latencyFrames() const;
+
private:
+ enum { DefaultKernelSize = 256 };
+
size_t m_inputBlockSize;
-#if USE(WEBAUDIO_IPP)
- AudioFloatArray m_overlayBuffer;
-#endif // USE(WEBAUDIO_IPP)
- AudioFloatArray m_buffer;
+ // Computes ideal band-limited half-band filter coefficients.
+ // In other words, filter out all frequencies higher than 0.25 * Nyquist.
+ void initializeKernel();
+ AudioFloatArray m_reducedKernel;
+
+ // Half-band filter.
+ DirectConvolver m_convolver;
+
+ AudioFloatArray m_tempBuffer;
+ AudioFloatArray m_inputBuffer;
};
} // namespace WebCore
-#endif // DirectConvolver_h
+#endif // DownSampler_h

Powered by Google App Engine
This is Rietveld 408576698