Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gecko Bug 1907438] Support planar -> interleaved copy. #47172

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion webcodecs/audio-data.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ const TEST_TEMPLATE = {
// For each test, copy this template and replace the number by the appropriate
// number for this type
testInput: [MIN, BIAS, MAX, MIN, HALF, NEGATIVE_HALF, BIAS, MAX, BIAS, BIAS],
testInterleavedResult: [MIN, NEGATIVE_HALF, BIAS, BIAS, MAX, MAX, MIN, BIAS, HALF, BIAS],
testVectorInterleavedResult: [
[MIN, MAX, HALF, BIAS, BIAS],
[BIAS, MIN, NEGATIVE_HALF, MAX, BIAS],
Expand Down Expand Up @@ -274,6 +275,10 @@ function get_type_values(type) {
cloned.testInput,
idx => TEST_VALUES[type][idx]
);
cloned.testInterleavedResult = Array.from(
cloned.testInterleavedResult,
idx => TEST_VALUES[type][idx]
);
cloned.testVectorInterleavedResult = Array.from(
cloned.testVectorInterleavedResult,
c => {
Expand Down Expand Up @@ -418,7 +423,15 @@ function conversionTest(sourceType, destinationType) {
"planar channel 1",
assert_func
);
// Planar to interleaved isn't supported
// Copy to interleaved from planar: all channels are copied
data.copyTo(destInterleaved, {planeIndex: 0, format: destinationType});
check_array_equality(
destInterleaved,
result.testInterleavedResult,
sourceType,
"planar to interleaved",
assert_func
);
}, `Test conversion of ${sourceType} to ${destinationType}`);
}

Expand Down