Commit 34a69293 authored by Madeleine Barowsky's avatar Madeleine Barowsky Committed by Commit Bot

Replace flashing JPEG test with RGB/YUV tests for WebP and JPEG

The current yuv_decoding JPEG decoding Telemetry story is
misleading for two reasons: it does not decode to or render
from YUV (see crbug.com/921875) and it uses canvas.toDataURL
to create random test images each time, which means encoding
duration is also measured. Furthermore, the test flashes
rapidly and could potentially trigger photosensitive epilepsy.

Because YUV decoding and rendering is in progress for WebP
(crbug.com/900264), we would like holistic and consistent
measurement of the performance between YUV and RGB decoding.
The YUV decoding feature is being implemented for GPU
rasterization first. Later, we will do the same for JPEG
(crbug.com/919627).

This CL replaces the existing story with four new ones:
 * WebP GPU rasterization that does not disable YUV
 * WebP GPU rasterization that disables YUV (hence is RGB)
 * JPEG GPU rasterization that does not disable YUV (is
RGB for now)
 * JPEG GPU rasterization that disables YUV (hence is RGB)
These ImageDecodingStory tests draw 10 pastel-colored squares
from hard-coded base64 data and at a relatively slow rate.

Bug: 944756
Change-Id: Id46817eb300b3c6f3681ccf331ba23f67bbdfef6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1536460Reviewed-by: default avatarCaleb Rouleau <crouleau@chromium.org>
Reviewed-by: default avatarLeon Scroggins <scroggo@chromium.org>
Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Commit-Queue: Madeleine Barowsky <mbarowsky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659026}
parent 0c6bd621
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/* Given |array| of base64 data or image paths, this function successively
* replaces the source of <img id="img"> with elements
* {0, 1, ..., |numSquares| - 1} for |numSquares| from the initial call.
* This happens every 450 ms.
*/
function drawColorfulSquares(numSquares, array) {
if (numSquares > 0) {
setTimeout(function() {
var image_width = 1024;
var image_height = 1024;
document.getElementById('img').src = array[numSquares - 1];
drawColorfulSquares(numSquares - 1, array);
}, 450);
}
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>JPEG image decoding</title>
<script src="decoding_story_helpers.js"></script>
<script src="jpeg_squares_base64.js"></script>
</head>
<body>
<img id="img">
<script>
var numSquares = jpeg_squares_base64.length;
drawColorfulSquares(numSquares, jpeg_squares_base64);
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>WebP image decoding</title>
<script src="decoding_story_helpers.js"></script>
<script src="webp_squares_base64.js"></script>
</head>
<body>
<img id="img">
<script>
var numSquares = webp_squares_base64.length;
drawColorfulSquares(numSquares, webp_squares_base64);
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>JPEG image decoding</title>
</head>
<body>
<img id="myimg">
<script>
var image_width = 1024;
var image_height = 1024;
var nb_images = 200;
var urls = [];
for (i = 0; i < nb_images; ++i) {
var canvas = document.createElement("canvas");
canvas.width = image_width;
canvas.height = image_height;
var ctx = canvas.getContext("2d");
ctx.fillStyle = "rgb("+
Math.floor(Math.random()*256)+","+
Math.floor(Math.random()*256)+","+
Math.floor(Math.random()*256)+")";
ctx.fillRect(0,0,image_width,image_height);
// If quality is 1, then we get YUV 444 encoding
// If quality is <1, then we get YUV 420 encoding
urls[i] = canvas.toDataURL("image/jpeg", 0.99);
}
var idx = 0;
function redraw() {
document.getElementById("myimg").src = urls[idx];
idx++;
if (idx >= nb_images) { idx = 0; }
window.setTimeout(redraw, 1);
}
window.setTimeout(redraw, 1);
</script>
</body>
</html>
...@@ -16,8 +16,6 @@ class ImageDecodingPage(rendering_story.RenderingStory): ...@@ -16,8 +16,6 @@ class ImageDecodingPage(rendering_story.RenderingStory):
shared_page_state_class=shared_page_state.SharedPageState, shared_page_state_class=shared_page_state.SharedPageState,
name_suffix='', name_suffix='',
extra_browser_args=None): extra_browser_args=None):
if extra_browser_args is None:
extra_browser_args = ['--disable-accelerated-jpeg-decoding']
super(ImageDecodingPage, self).__init__( super(ImageDecodingPage, self).__init__(
page_set=page_set, page_set=page_set,
shared_page_state_class=shared_page_state_class, shared_page_state_class=shared_page_state_class,
...@@ -29,7 +27,12 @@ class ImageDecodingPage(rendering_story.RenderingStory): ...@@ -29,7 +27,12 @@ class ImageDecodingPage(rendering_story.RenderingStory):
action_runner.Wait(5) action_runner.Wait(5)
class YuvDecodingPage(ImageDecodingPage): class WebPDecodingPage(ImageDecodingPage):
BASE_NAME = 'yuv_decoding' BASE_NAME = 'webp_decoding'
URL = 'file://../image_decoding_cases/yuv_decoding.html' URL = 'file://../image_decoding_cases/webp_decoding.html'
TAGS = ImageDecodingPage.TAGS + [story_tags.REPRESENTATIVE_MAC_DESKTOP] TAGS = ImageDecodingPage.TAGS + [story_tags.GPU_RASTERIZATION]
class JpegDecodingPage(ImageDecodingPage):
BASE_NAME = 'jpeg_decoding'
URL = 'file://../image_decoding_cases/jpeg_decoding.html'
TAGS = ImageDecodingPage.TAGS + [story_tags.GPU_RASTERIZATION]
...@@ -41,6 +41,7 @@ class RenderingStorySet(story.StorySet): ...@@ -41,6 +41,7 @@ class RenderingStorySet(story.StorySet):
continue continue
required_args = [] required_args = []
name_suffix = ''
if (story_class.TAGS and if (story_class.TAGS and
story_tags.USE_FAKE_CAMERA_DEVICE in story_class.TAGS): story_tags.USE_FAKE_CAMERA_DEVICE in story_class.TAGS):
required_args += [ required_args += [
...@@ -56,20 +57,25 @@ class RenderingStorySet(story.StorySet): ...@@ -56,20 +57,25 @@ class RenderingStorySet(story.StorySet):
# 'backdrop-filter' CSS property to work. # 'backdrop-filter' CSS property to work.
required_args.append('--enable-experimental-web-platform-features') required_args.append('--enable-experimental-web-platform-features')
self.AddStory(story_class(
page_set=self,
shared_page_state_class=shared_page_state_class,
extra_browser_args=required_args))
if (story_class.TAGS and if (story_class.TAGS and
story_tags.IMAGE_DECODING in story_class.TAGS): story_tags.IMAGE_DECODING in story_class.TAGS and
story_tags.GPU_RASTERIZATION in story_class.TAGS):
required_args.append('--force-gpu-rasterization')
# Run RGB decoding with GPU rasterization (to be most comparable to YUV)
self.AddStory(story_class( self.AddStory(story_class(
page_set=self, page_set=self,
extra_browser_args=required_args +
['--disable-yuv-image-decoding'],
shared_page_state_class=shared_page_state_class, shared_page_state_class=shared_page_state_class,
name_suffix='_gpu_rasterization_and_decoding', name_suffix='_rgb_and_gpu_rasterization'))
extra_browser_args=required_args + [ # Also run YUV decoding story with GPU rasterization.
'--force-gpu-rasterization', name_suffix = '_yuv_and_gpu_rasterization'
]))
self.AddStory(story_class(
page_set=self,
extra_browser_args=required_args,
shared_page_state_class=shared_page_state_class,
name_suffix=name_suffix))
class DesktopRenderingStorySet(RenderingStorySet): class DesktopRenderingStorySet(RenderingStorySet):
......
...@@ -25,7 +25,8 @@ USE_FAKE_CAMERA_DEVICE = Tag( ...@@ -25,7 +25,8 @@ USE_FAKE_CAMERA_DEVICE = Tag(
BACKDROP_FILTER = Tag( BACKDROP_FILTER = Tag(
'backdrop_filter', 'Backdrop filter stories') 'backdrop_filter', 'Backdrop filter stories')
IMAGE_DECODING = Tag( IMAGE_DECODING = Tag(
'image_decoding', 'Stories with accelerated jpeg decoding') 'image_decoding', ('Stories decoding JPEG and WebP (and using GPU '
'rasterization) to compare YUV and RGB'))
KEY_DESKTOP_MOVE = Tag( KEY_DESKTOP_MOVE = Tag(
'key_desktop_move', 'Key desktop move stories') 'key_desktop_move', 'Key desktop move stories')
KEY_HIT_TEST = Tag( KEY_HIT_TEST = Tag(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment