Skip to content

Commit

Permalink
Add 4:4:4 encoding to WebCodecs for VP9. Simplify VpxVideoEncoder.
Browse files Browse the repository at this point in the history
This adds support for configurable subsampling to WebCodecs along
with a test for the new behavior.

Implementing support in VpxVideoEncoder required simplifying how
it handles frame conversions and allocations. One unnecessary
allocation is actually removed from all encoding profiles.

Both I444 (profile 1) and I444P10 (profile 3) encoding are added.

Bug: 1116617, 1116564, 1378115
Change-Id: I99f7570c4a565fbd028b456c030b82ba4dd357db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5231639
Commit-Queue: Dale Curtis <[email protected]>
Reviewed-by: Eugene Zemtsov <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1252908}
  • Loading branch information
dalecurtis authored and chromium-wpt-export-bot committed Jan 26, 2024
1 parent 21246f3 commit edec5cd
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion webcodecs/full-cycle-test.https.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// META: variant=?vp8
// META: variant=?vp9_p0
// META: variant=?vp9_p2
// META: variant=?vp9_444_p1
// META: variant=?vp9_444_p3
// META: variant=?h264_avc
// META: variant=?h264_annexb
// META: variant=?h265_hevc
Expand All @@ -13,7 +15,6 @@
var ENCODER_CONFIG = null;
promise_setup(async () => {
const config = {
// FIXME: H.264 has embedded color space information too.
'?av1': {
codec: 'av01.0.04M.08',
hasEmbeddedColorSpace: true,
Expand All @@ -33,6 +34,21 @@ promise_setup(async () => {
codec: 'vp09.02.10.10',
hasEmbeddedColorSpace: true,
hardwareAcceleration: 'prefer-software',
// TODO(https://github.com/w3c/webcodecs/issues/384):
// outputPixelFormat should be 'I420P10'
},
'?vp9_444_p1': {
codec: 'vp09.01.10.08.03',
hasEmbeddedColorSpace: true,
hardwareAcceleration: 'prefer-software',
outputPixelFormat: 'I444',
},
'?vp9_444_p3': {
codec: 'vp09.03.10.10.03',
hasEmbeddedColorSpace: true,
hardwareAcceleration: 'prefer-software',
// TODO(https://github.com/w3c/webcodecs/issues/384):
// outputPixelFormat should be 'I444P10'
},
'?h264_avc': {
codec: 'avc1.42001E',
Expand Down Expand Up @@ -91,6 +107,12 @@ async function runFullCycleTest(t, options) {
assert_equals(frame.timestamp, next_ts++, "decode timestamp");
}

if (ENCODER_CONFIG.outputPixelFormat) {
assert_equals(
frame.format, ENCODER_CONFIG.outputPixelFormat,
"decoded pixel format");
}

// The encoder is allowed to change the color space to satisfy the
// encoder when readback is needed to send the frame for encoding, but
// the decoder shouldn't change it after the fact.
Expand Down

0 comments on commit edec5cd

Please sign in to comment.