<commit_before>/**
 * @author <NAME> / Copyright Orange 2013
 * 
 * Inspired by:
 * 
 * Fast Summed-AreaTable Generation and its Applications
 * 
 * <NAME>, <NAME>, <NAME>, <NAME>
 * and <NAME>
 * 
 * http://www.shaderwrangler.com/publications/sat/SAT_EG2005.pdf
 * 
 */
(function(global) {
    
    var _initShader,_haddShader,_vaddShader;
    var _frames;
    
    global.integral = function(frameIn,frameOut,n) {
        if (!frameOut || !frameOut.highres) {
            throw new Error('The output needs to be a high res texture');
        }
        n = n || 2;
        var hpass = Math.ceil(Math.log(frameIn.width)/Math.log(n));
        var vpass = Math.ceil(Math.log(frameIn.height)/Math.log(n));
        if (!_frames 
        || (_frames[0].width != frameIn.width)
        || (_frames[0].height != frameIn.height)){
            _frames = [
                global.frame(null,frameIn.width,frameIn.height,true),
                global.frame(null,frameIn.width,frameIn.height,true)
            ];
        }
        var _commonShaderStr = '\
            float offset(float length,float pass) {\
                return 1.0/length*exp2(pass);\
            }';
        _initShader = _initShader || global.createFilter(
            // Vertex Shader (null uses default)
            null,
            // Fragment Shader (null uses default)     
            '\
            uniform sampler2D texture;\
            varying vec2 texCoord;\
            void main() {\
                vec4 color = texture2D(texture, texCoord);\
                float s = (color.r * 4899. + color.g * 9617. + color.b * 1868.)*255./16384.;\
                gl_FragColor = vec4(s,0.,0.,0.);\
            }\
            ',
            // Uniforms callback
            null
        );
        _haddShader = _haddShader || global.createFilter(
            // Vertex Shader (null uses default)
            null,
            // Fragment Shader (null uses default)
            _commonShaderStr +         
            '\
            uniform sampler2D texture;\
            uniform float width;\
            uniform float pass;\<commit_msg>integral images: also compute squared sum and store it in second component<commit_after>/**
 * @author <NAME> / Copyright Orange 2013
 * 
 * Inspired by:
 * 
 * Fast Summed-AreaTable Generation and its Applications
 * 
 * <NAME>, <NAME>, <NAME>, <NAME>
 * and <NAME>
 * 
 * http://www.shaderwrangler.com/publications/sat/SAT_EG2005.pdf
 * 
 */
(function(global) {
    
    var _initShader,_haddShader,_vaddShader;
    var _frames;
    
    global.integral = function(frameIn,frameOut,n) {
        if (!frameOut || !frameOut.highres) {
            throw new Error('The output needs to be a high res texture');
        }
        n = n || 2;
        var hpass = Math.ceil(Math.log(frameIn.width)/Math.log(n));
        var vpass = Math.ceil(Math.log(frameIn.height)/Math.log(n));
        if (!_frames 
        || (_frames[0].width != frameIn.width)
        || (_frames[0].height != frameIn.height)){
            _frames = [
                global.frame(null,frameIn.width,frameIn.height,true),
                global.frame(null,frameIn.width,frameIn.height,true)
            ];
        }
        var _commonShaderStr = '\
            float offset(float length,float pass) {\
                return 1.0/length*exp2(pass);\
            }';
        _initShader = _initShader || global.createFilter(
            // Vertex Shader (null uses default)
            null,
            // Fragment Shader (null uses default)     
            '\
            uniform sampler2D texture;\
            varying vec2 texCoord;\
            void main() {\
                vec4 color = texture2D(texture, texCoord);\
                float s = (color.r * 4899. + color.g * 9617. + color.b * 1868.)*255./16384.;\
                gl_FragColor = vec4(s,s*s,0.,0.);\
            }\
            ',
            // Uniforms callback
            null
        );
        _haddShader = _haddShader || global.createFilter(
            // Vertex Shader (null uses default)
            null,
            // Fragment Shader (null uses default)
            _commonShaderStr +         
            '\
            uniform sampler2D texture;\
            uniform float width;\
            uniform float pass;\
{'fraction_non_alphanumeric': 0.12295081967213115, 'fraction_numerical': 0.01990632318501171, 'mean_word_length': 1.63154651879236, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, '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': '2097021', 'n_tokens_mistral': 1299, 'n_tokens_neox': 1210, 'n_words': 272}