[Webkit-unassigned] [Bug 69703] HRTF Database consolidation
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Nov 8 17:21:40 PST 2011
https://bugs.webkit.org/show_bug.cgi?id=69703
--- Comment #14 from Chris Rogers <crogers at google.com> 2011-11-08 17:21:40 PST ---
(From update of attachment 113299)
View in context: https://bugs.webkit.org/attachment.cgi?id=113299&action=review
Hi Philippe, looks like we're getting really close. The latest comments fix a problem where we were sample-rate converting the entire concatenated buffer. Instead, it's more correct to extract the individual impulse-response at the same sample-rate as the audio file, then finally sample-rate convert that to the sample-rate we use for the audio hardware...
> Source/WebCore/platform/audio/HRTFElevation.cpp:54
> +static const size_t TotalNumberOfResponses = 240;
nit: you can remove the "static" keyword since it's implicit
> Source/WebCore/platform/audio/HRTFElevation.cpp:57
> +static const size_t ResponseByteSize = 256;
nit: remove the "static" keyword
Also, it appears that this should be called "ResponseFrameSize" instead of "ResponseByteSize" shouldn't it?
> Source/WebCore/platform/audio/HRTFElevation.cpp:60
> +static const float ResponseSampleRate = 44100;
nit: remove the "static" keyword
> Source/WebCore/platform/audio/HRTFElevation.cpp:92
> +static AudioBus* getConcatenatedImpulseResponsesForSubject(const String& subjectName, float sampleRate)
We don't need to pass in a "sampleRate" argument here since we need to load at "ResponseSampleRate"
> Source/WebCore/platform/audio/HRTFElevation.cpp:100
> + OwnPtr<AudioBus> impulseResponse = AudioBus::loadPlatformResource(subjectName.utf8().data(), sampleRate);
I think a better name for "impulseResponse" would be "concatenatedImpulseResponses"
Instead of using "sampleRate" here, we need to load the concatenated impulse responses at the exact rate as stored in the audio resource -- which is "ResponseSampleRate"
> Source/WebCore/platform/audio/HRTFElevation.cpp:107
> + size_t expectedLength = static_cast<size_t>(TotalNumberOfResponses * ResponseByteSize * (sampleRate / ResponseSampleRate));
Since we shouldn't be resampling here, this simplifies to:
TotalNumberOfResponses * ResponseFrameSize
in other words we shouldn't scale by (sampleRate / ResponseSampleRate)
> Source/WebCore/platform/audio/HRTFElevation.cpp:162
> + AudioChannel* totalRightEarImpulseResponse = bus->channelByType(AudioBus::ChannelRight);
We can remove lines 161:162
> Source/WebCore/platform/audio/HRTFElevation.cpp:164
> + unsigned stopFrame = startFrame + ResponseByteSize;
Keep lines 163:164
(except change ResponseByteSize -> ResponseFrameSize
> Source/WebCore/platform/audio/HRTFElevation.cpp:171
> + rightEarImpulseResponse->copyFromRange(totalRightEarImpulseResponse, startFrame, stopFrame);
Replace lines 165:171 with:
OwnPtr<AudioBus> preSampleRateConvertedResponse = createBufferFromRange(bus, startFrame, stopFrame);
OwnPtr<AudioBus> response = createBySampleRateConverting(preSampleRateConvertedResponse.get(), false, sampleRate);
AudioChannel* leftEarImpulseResponse = response->channel(AudioBus::ChannelLeft);
AudioChannel* rightEarImpulseResponse = response->channel(AudioBus::ChannelRight);
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list