[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / tools / perf / page_sets / image_decoding_cases / yuv_decoding.html
blob12a0e8f385cc4d3740f6b091f72126a19e729657
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
5 <title>JPEG image decoding</title>
6 </head>
7 <body>
8 <img id="myimg">
9 <script>
10 var image_width = 1024;
11 var image_height = 1024;
12 var nb_images = 200;
13 var urls = [];
15 for (i = 0; i < nb_images; ++i) {
16 var canvas = document.createElement("canvas");
17 canvas.width = image_width;
18 canvas.height = image_height;
19 var ctx = canvas.getContext("2d");
20 ctx.fillStyle = "rgb("+
21 Math.floor(Math.random()*256)+","+
22 Math.floor(Math.random()*256)+","+
23 Math.floor(Math.random()*256)+")";
24 ctx.fillRect(0,0,image_width,image_height);
25 // If quality is 1, then we get YUV 444 encoding
26 // If quality is <1, then we get YUV 420 encoding
27 urls[i] = canvas.toDataURL("image/jpeg", 0.99);
30 var idx = 0;
31 function redraw() {
32 document.getElementById("myimg").src = urls[idx];
33 idx++;
34 if (idx >= nb_images) { idx = 0; }
35 window.setTimeout(redraw, 1);
37 window.setTimeout(redraw, 1);
38 </script>
39 </body>
40 </html>