Skip to content

Commit 67bec2b

Browse files
padenotsadym-chromium
authored andcommitted
Support planar -> interleaved copy.
w3c/webcodecs#819 Differential Revision: https://phabricator.services.mozilla.com/D216561 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1907438 gecko-commit: f909b83620331385e7bb8ef1291b7df7a310f9a5 gecko-reviewers: chunmin
1 parent 7e19418 commit 67bec2b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

webcodecs/audio-data.any.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ const TEST_TEMPLATE = {
192192
// For each test, copy this template and replace the number by the appropriate
193193
// number for this type
194194
testInput: [MIN, BIAS, MAX, MIN, HALF, NEGATIVE_HALF, BIAS, MAX, BIAS, BIAS],
195+
testInterleavedResult: [MIN, NEGATIVE_HALF, BIAS, BIAS, MAX, MAX, MIN, BIAS, HALF, BIAS],
195196
testVectorInterleavedResult: [
196197
[MIN, MAX, HALF, BIAS, BIAS],
197198
[BIAS, MIN, NEGATIVE_HALF, MAX, BIAS],
@@ -274,6 +275,10 @@ function get_type_values(type) {
274275
cloned.testInput,
275276
idx => TEST_VALUES[type][idx]
276277
);
278+
cloned.testInterleavedResult = Array.from(
279+
cloned.testInterleavedResult,
280+
idx => TEST_VALUES[type][idx]
281+
);
277282
cloned.testVectorInterleavedResult = Array.from(
278283
cloned.testVectorInterleavedResult,
279284
c => {
@@ -418,7 +423,15 @@ function conversionTest(sourceType, destinationType) {
418423
"planar channel 1",
419424
assert_func
420425
);
421-
// Planar to interleaved isn't supported
426+
// Copy to interleaved from planar: all channels are copied
427+
data.copyTo(destInterleaved, {planeIndex: 0, format: destinationType});
428+
check_array_equality(
429+
destInterleaved,
430+
result.testInterleavedResult,
431+
sourceType,
432+
"planar to interleaved",
433+
assert_func
434+
);
422435
}, `Test conversion of ${sourceType} to ${destinationType}`);
423436
}
424437

0 commit comments

Comments
 (0)