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

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: Change some review point and logic to find fftsize. Created 6 years, 3 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/modules/webaudio/OfflineAudioContext.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/audio/HRTFPanner.cpp
diff --git a/Source/platform/audio/HRTFPanner.cpp b/Source/platform/audio/HRTFPanner.cpp
index 04e410dba233decde70c91472d12cf7ba6103ab3..b9077cc2d3164eeb7a41c38c0072c346c05bdc5a 100644
--- a/Source/platform/audio/HRTFPanner.cpp
+++ b/Source/platform/audio/HRTFPanner.cpp
@@ -45,6 +45,8 @@ const double MaxDelayTimeSeconds = 0.002;
const int UninitializedAzimuth = -1;
const unsigned RenderingQuantum = 128;
+const size_t fftSizes[] = { 64, 128, 256, 512, 1024, 2048, 4096 };
+
HRTFPanner::HRTFPanner(float sampleRate, HRTFDatabaseLoader* databaseLoader)
: Panner(PanningModelHRTF)
, m_databaseLoader(databaseLoader)
@@ -79,8 +81,24 @@ 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 >= 3000 && sampleRate <= 192000);
Raymond Toy 2014/09/05 05:18:30 I think you should use AudioBuffer::minAllowedSamp
KhNo 2014/09/05 05:32:39 Yes, I agree with that. However, current implement
+
+ int index = 6;
+
+ if (sampleRate <= 5512.5)
+ index = 0;
+ else if (sampleRate <= 11025)
+ index = 1;
+ else if (sampleRate <= 22050)
+ index = 2;
+ else if (sampleRate <= 44100)
+ index = 3;
+ else if (sampleRate <= 88200)
+ index = 4;
+ else if (sampleRate <= 176400)
+ index = 5;
+
+ return fftSizes[index];
Raymond Toy 2014/09/05 05:18:30 Since this is so simple, I think you should just d
KhNo 2014/09/05 05:32:39 Done.
}
void HRTFPanner::reset()
« no previous file with comments | « Source/modules/webaudio/OfflineAudioContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698