<commit_before><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta charset=utf-8/>
        <style>
          body {
            background: black;
            color:#CCCCCC;
          }
          #c2 {
            background-image: url(foo.png);
            background-repeat: no-repeat;
          }
          div {
            float: left;
            border :1px solid #444444;
            padding:10px;
            margin: 10px;
            background:#3B3B3B;
          }
        </style>
        <script type="text/javascript;version=1.8">
            let processor = {
                timerCallback: function() {
                    if (this.video.paused || this.video.ended) {
                        return;
                }
                this.computeFrame();
                let self = this;
                setTimeout(function () {
                    self.timerCallback();
                }, 0);
            },

            doLoad: function() {
                this.video = document.getElementById("video");
                this.c1 = document.getElementById("c1");
                this.ctx1 = this.c1.getContext("2d");
                this.c2 = document.getElementById("c2");
                this.ctx2 = this.c2.getContext("2d");
                let self = this;
                this.video.addEventListener("play", function() {
                    self.width = self.video.videoWidth / 2;
                    self.height = self.video.videoHeight / 2;
                    self.timerCallback();
                }, false);
            },

            computeFrame: function() {
                this.ctx1.drawImage(this.video, 0, 0, this.width, this.height);
                let frame = this.ctx1.getImageData(0, 0, this.width, this.height);
                let l = frame.data.length / 4;

                for (let i = 0; i < l; i++) {
                    let r = frame.data[i * 4 + 0];
                    let g = frame.data[i * 4 + 1];
                    let b = frame.data[i * 4 + 2];
                    if (g > 100 && r > 100 && b < 43)
                        frame.data[i * 4 + 3] = 0;
                    }
                this.ctx2.putImageData(frame, 0, 0);
                return;
                }
            };

        </script>
    </head>

    <body onload="processor.doLoad()">
        <div>
            <video id="video" src="moz.ogv" controls="true"/>
        </div>
        <div>
            <canvas id="c1" width="160" height="96"></canvas>
            <canvas id="c2" width="160" height="96"></canvas>
        </div>
    </body>
</html>
<commit_msg>- added fps management.<commit_after><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta charset=utf-8 />
        <style>
          body {
            background: black;
            color:#CCCCCC;
          }
          #c1 {
            background-image: url(foo.png);
            background-repeat: no-repeat;
          }
          div {
            float: left;
            border :1px solid #444444;
            padding:5px;
            margin: 5px;
            background:#3B3B3B;
          }
        </style>
        <script type="text/javascript;version=1.8">

            var deltaArray = new Array(50);
            var lastCalledTime;

            let processor = {
                timerCallback: function() {
                    if (this.video.paused || this.video.ended) {
                        return;
                }
                this.computeFrame();
                let self = this;
                setTimeout(function () {
                    self.timerCallback();
                }, 0);
            },

            doLoad: function() {
                this.video = document.getElementById("video");
                this.c1 = document.getElementById("c1");
                this.ctx1 = this.c1.getContext("2d");
                let self = this;
                this.video.addEventListener("play", function() {
                    self.width = self.video.videoWidth;
                    self.height = self.video.videoHeight;
                    self.timerCallback();
                }, false);
            },

            computeFrame: function() {
                this.ctx1.drawImage(this.video, 0, 0, this.width, this.height);
                let frame = this.ctx1.getImageData(0, 0, this.width, this.height);
                let l = frame.data.length / 4;

                for (let i = 0; i < l; i++) {
                    let r = frame.data[i * 4 + 0];
                    let g = frame.data[i * 4 + 1];
                    let b = frame.data[i * 4 + 2];
                    if (g > 100 && r > 100 && b < 43)
                        frame.data[i * 4 + 3] = 0;
                    }
                this.ctx1.putImageData(frame, 0, 0);

                if(!lastCalledTime) {
                    lastCalledTime = Date.now();
                    return;
                }
                deltaArray.push((Date.now() - lastCalledTime)/1000);
                deltaArray.shift();
                lastCalledTime = Date.now();
                let delta = deltaArray.reduce(function(pv, cv) { return pv + cv; }, 0) / deltaArray.length;
                let fps = Math.round(1/delta*100)/100;

                this.ctx1.fillText('FPS : ' + fps,10,10);

                return;
                }
            };

        </script>
    </head>

    <body onload="processor.doLoad()">
        <div>
            <video id="video" src="moz.ogv" controls="true"/>
        </div>
        <div>
            <canvas id="c1"></canvas>
        </div>
    </body>
</html>

{'fraction_non_alphanumeric': 0.13359629566112158, 'fraction_numerical': 0.027954038758360486, 'mean_word_length': 1.156007393715342, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4077211', 'n_tokens_mistral': 1784, 'n_tokens_neox': 1582, 'n_words': 326}