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

Unified Diff: Source/platform/audio/HRTFPanner.cpp

Issue 375383002: Extending supported sample rate from 3.0KHz to 192.0KHz for OfflineAudioContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update layoutTest Created 6 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
Index: Source/platform/audio/HRTFPanner.cpp
diff --git a/Source/platform/audio/HRTFPanner.cpp b/Source/platform/audio/HRTFPanner.cpp
index 63d9fc49628394fbba237fa1de46c6c77615b84d..0056652b106179d8ac338ddc71ee62bd60038c5e 100644
--- a/Source/platform/audio/HRTFPanner.cpp
+++ b/Source/platform/audio/HRTFPanner.cpp
@@ -45,6 +45,10 @@ const double MaxDelayTimeSeconds = 0.002;
const int UninitializedAzimuth = -1;
const unsigned RenderingQuantum = 128;
+const float coefficientSampleRate = 11025.f;
Raymond Toy 2014/07/30 16:49:38 Where does 11025 come from? I thought the HRTF dat
KhNo 2014/07/31 16:45:54 This value is just determined to calculate fftsize
Raymond Toy 2014/07/31 17:25:13 Might be better to split this into two parts. One
+const size_t minimumFFTSize = 128;
+const size_t maximumFFTSize = 1024;
+
HRTFPanner::HRTFPanner(float sampleRate, HRTFDatabaseLoader* databaseLoader)
: Panner(PanningModelHRTF)
, m_databaseLoader(databaseLoader)
@@ -79,8 +83,13 @@ size_t HRTFPanner::fftSizeForSampleRate(float sampleRate)
// The HRTF impulse responses (loaded as audio resources) are 512 sample-frames @44.1KHz.
// Currently, we truncate the impulse responses to half this size, but an FFT-size of twice impulse response size is needed (for convolution).
// So for sample rates around 44.1KHz an FFT size of 512 is good. We double the FFT-size only for sample rates at least double this.
- ASSERT(sampleRate >= 44100 && sampleRate <= 96000.0);
- return (sampleRate < 88200.0) ? 512 : 1024;
+ ASSERT(sampleRate >= 8000 && sampleRate <= 96000.0);
+
+ size_t fftSize = minimumFFTSize;
Raymond Toy 2014/07/30 16:49:38 This initial value seems useless since you give ff
KhNo 2014/07/31 16:45:54 Done.
+ fftSize = floor(sampleRate / coefficientSampleRate) * minimumFFTSize;
+ fftSize = max(minimumFFTSize, fftSize);
+ fftSize = min(maximumFFTSize, fftSize);
+ return fftSize;
Raymond Toy 2014/07/30 16:49:38 If we expand the sample rate to 192 kHz, will this
KhNo 2014/07/31 16:45:54 Yes, it can be. kMaxFFTPow2Size is 15 for Android,
Raymond Toy 2014/07/31 17:25:13 One other thing. Don't we need to make fftSize a p
}
void HRTFPanner::reset()

Powered by Google App Engine
This is Rietveld 408576698