Skip to content

Commit

Permalink
Increase video-rotation tolerance to 45 for VP9. (KhronosGroup#3291)
Browse files Browse the repository at this point in the history
Hardware accelerated video decoders on some GPUs on Windows require
this increased tolerance.

Associated with http://crbug.com/1219015 .
  • Loading branch information
kenrussell authored Jun 11, 2021
1 parent aca1420 commit 827cad9
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions sdk/tests/conformance/textures/misc/video-rotation.html
Original file line number Diff line number Diff line change
Expand Up @@ -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] },
Expand All @@ -43,7 +45,7 @@
bufferedLogToConsole(str);
}

function checkPixels() {
function checkPixels(tolerance) {
for (let place in expectedColors) {
let color = expectedColors[place];
let loc = color.location;
Expand All @@ -64,7 +66,7 @@
});
}

async function testVideoElement(filename) {
async function testVideoElement(filename, isVP9) {
const video = await loadVideoElement(filename);

output("----------------------------------------------------------------");
Expand All @@ -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() {
Expand Down Expand Up @@ -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();
Expand All @@ -159,4 +162,4 @@
</script>
</body>

</html>
</html>

0 comments on commit 827cad9

Please sign in to comment.