From 827cad9e402b63bbe38787456115bcb681a8a152 Mon Sep 17 00:00:00 2001 From: Ken Russell Date: Fri, 11 Jun 2021 13:43:52 -0700 Subject: [PATCH] Increase video-rotation tolerance to 45 for VP9. (#3291) Hardware accelerated video decoders on some GPUs on Windows require this increased tolerance. Associated with http://crbug.com/1219015 . --- .../textures/misc/video-rotation.html | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/sdk/tests/conformance/textures/misc/video-rotation.html b/sdk/tests/conformance/textures/misc/video-rotation.html index 9fb9510920..19c39c54b2 100644 --- a/sdk/tests/conformance/textures/misc/video-rotation.html +++ b/sdk/tests/conformance/textures/misc/video-rotation.html @@ -29,7 +29,9 @@ let gl = wtu.create3DContext(canvas); let program = tiu.setupTexturedQuad(gl, gl.RGBA); const resourcePath = "../../../resources/"; - const tolerance = 10; + const mp4Tolerance = 10; + // Significantly higher tolerance needed for VP9 tests. http://crbug.com/1219015 . + const vp9Tolerance = 45; const expectedColors = { top: { location: [0.5, 0.25], color: [255, 0, 0] }, @@ -43,7 +45,7 @@ bufferedLogToConsole(str); } - function checkPixels() { + function checkPixels(tolerance) { for (let place in expectedColors) { let color = expectedColors[place]; let loc = color.location; @@ -64,7 +66,7 @@ }); } - async function testVideoElement(filename) { + async function testVideoElement(filename, isVP9) { const video = await loadVideoElement(filename); output("----------------------------------------------------------------"); @@ -73,13 +75,14 @@ output(" Testing texImage2D"); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, video); wtu.clearAndDrawUnitQuad(gl, [0, 0, 0, 255]); - checkPixels(); + const localTolerance = isVP9 ? vp9Tolerance : mp4Tolerance; + checkPixels(localTolerance); output(" Testing texSubImage2D"); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, video.videoWidth, video.videoHeight, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, video); wtu.clearAndDrawUnitQuad(gl, [0, 0, 0, 255]); - checkPixels(); + checkPixels(localTolerance); } async function run() { @@ -144,12 +147,12 @@ if (supports_h264) { for (let fn of filenames) - await testVideoElement(fn + ".mp4"); + await testVideoElement(fn + ".mp4", false); } if (supports_vp9) { for (let fn of filenames) - await testVideoElement(fn + ".vp9.mp4"); + await testVideoElement(fn + ".vp9.mp4", true); } finishTest(); @@ -159,4 +162,4 @@ - \ No newline at end of file +