blob: 12a0e8f385cc4d3740f6b091f72126a19e729657 [file] [log] [blame]
<!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>