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

Unified Diff: media/base/sinc_resampler.h

Issue 12478002: Break out SSE functions into new media_sse target. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix presubmit. Created 7 years, 10 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: media/base/sinc_resampler.h
diff --git a/media/base/sinc_resampler.h b/media/base/sinc_resampler.h
index a1d3cf718bbf5982b6933eba385743bf6eb04ad5..95c6096907a8e9d5c4e66ca623a7220b85fcd7ff 100644
--- a/media/base/sinc_resampler.h
+++ b/media/base/sinc_resampler.h
@@ -16,9 +16,30 @@ namespace media {
// SincResampler is a high-quality single-channel sample-rate converter.
class MEDIA_EXPORT SincResampler {
public:
- // The maximum number of samples that may be requested from the callback ahead
- // of the current position in the stream.
- static const int kMaximumLookAheadSize;
+ enum {
+ // The kernel size can be adjusted for quality (higher is better) at the
+ // expense of performance. Must be a multiple of 32.
+ // TODO(dalecurtis): Test performance to see if we can jack this up to 64+.
+ kKernelSize = 32,
+
+ // The number of destination frames generated per processing pass. Affects
+ // how often and for how much SincResampler calls back for input. Must be
+ // greater than kKernelSize.
+ kBlockSize = 512,
+
+ // The kernel offset count is used for interpolation and is the number of
+ // sub-sample kernel shifts. Can be adjusted for quality (higher is better)
+ // at the expense of allocating more memory.
+ kKernelOffsetCount = 32,
+ kKernelStorageSize = kKernelSize * (kKernelOffsetCount + 1),
+
+ // The size (in samples) of the internal buffer used by the resampler.
+ kBufferSize = kBlockSize + kKernelSize,
+
+ // The maximum number of samples that may be requested from the callback
+ // ahead of the current position in the stream.
+ kMaximumLookAheadSize = kBufferSize
+ };
// Callback type for providing more data into the resampler. Expects |frames|
// of data to be rendered into |destination|; zero padded if not enough frames
@@ -36,7 +57,7 @@ class MEDIA_EXPORT SincResampler {
// The maximum size in frames that guarantees Resample() will only make a
// single call to |read_cb_| for more data.
- int ChunkSize();
+ int ChunkSize() const;
// Flush all buffered data and reset internal indices.
void Flush();
@@ -63,7 +84,7 @@ class MEDIA_EXPORT SincResampler {
double kernel_interpolation_factor);
// The ratio of input / output sample rates.
- double io_sample_rate_ratio_;
+ const double io_sample_rate_ratio_;
// An index on the source input buffer with sub-sample precision. It must be
// double precision to avoid drift.

Powered by Google App Engine
This is Rietveld 408576698