[webkit-changes] [WebKit/WebKit] bf54b5: Add primitive routines to perform Audio Sample for...
Jean-Yves Avenard
noreply at github.com
Tue Dec 3 20:27:07 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: bf54b5a538ebd488a067445fef3a72c7067051bc
https://github.com/WebKit/WebKit/commit/bf54b5a538ebd488a067445fef3a72c7067051bc
Author: Jean-Yves Avenard <jya at apple.com>
Date: 2024-12-03 (Tue, 03 Dec 2024)
Changed paths:
M Source/WebCore/platform/AudioSampleFormat.h
M Tools/TestWebKitAPI/CMakeLists.txt
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
A Tools/TestWebKitAPI/Tests/WebCore/AudioSampleFormat.cpp
Log Message:
-----------
Add primitive routines to perform Audio Sample format conversion.
https://bugs.webkit.org/show_bug.cgi?id=283902
rdar://140782221
Reviewed by Gerald Squelart.
Add convertAudioSample method to convert uint8_t, int16_t, int32_t, float audio sample formats.
Float Audio samples use a float range of [-1.0, 1.0] inclusive.
This method will be used with the WebCodec's AudioData API.
The conversion had two requirements to fullfill the WebCodec's AudioData wpt:
1- The conversion is symmetric between int and float.
2- +1.0 can be mapped to std::numeric_limits<T>::max().
Requirement 2) was removed in later WebCodec's wpt, but for the version currently in the tree, it is required.
Float conversion accuracy has been given preferential treatment over speed.
Add API tests.
* Source/WebCore/platform/AudioSampleFormat.h:
(WebCore::detail::maxAsFloat):
(WebCore::detail::maxPlus1AsFloat):
(WebCore::detail::lowestAsFloat):
(WebCore::detail::divideWithBiasAndClamp):
(WebCore::detail::uint8ToAudioSample):
(WebCore::detail::int16ToAudioSample):
(WebCore::detail::int32ToAudioSample):
(WebCore::detail::floatToAudioSample):
(WebCore::convertAudioSample):
* Tools/TestWebKitAPI/CMakeLists.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebCore/AudioSampleFormat.cpp: Added.
(TestWebKitAPI::TEST(AudioSampleFormat, U8)):
(TestWebKitAPI::TEST(AudioSampleFormat, U8toS16)):
(TestWebKitAPI::TEST(AudioSampleFormat, S16)):
(TestWebKitAPI::TEST(AudioSampleFormat, S16toS32)):
(TestWebKitAPI::TEST(AudioSampleFormat, S32)):
(TestWebKitAPI::TEST(AudioSampleFormat, F32)):
Canonical link: https://commits.webkit.org/287327@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list