src/weightedBoxBlurGaussian.js
function boxBlurH(scl, tcl, w, h, r) {
    var iarr = 1 / (r+r+1); // averaging adjustment parameter
    for (var i = 0; i < h; i++) {
        var ti = i * w, // current target index
            li = ti, // current left side of the examined range
            ri = ti + r, // current right side of the examined range
            fv = scl[ti], // first value in the row
            lv = scl[ti + w - 1], // last value in the row
            val = (r+1) * fv, // target value, accumulated over examined points
            j;
        // Sum the source values in the box
        for (j = 0; j < r; j++) { val += scl[ti + j]; }
        // Compute the target value by taking the average of the surrounding
        // values. This is done by adding the deviations so far and adjusting,
        // accounting for the edges by extending the first and last values.
        for (j = 0  ; j <= r ; j++) { val += scl[ri++] - fv       ; tcl[ti++] = val*iarr; }
        for (j = r+1; j < w-r; j++) { val += scl[ri++] - scl[li++]; tcl[ti++] = val*iarr; }
        for (j = w-r; j < w  ; j++) { val += lv        - scl[li++]; tcl[ti++] = val*iarr; }
    }
}
function boxBlurH(scl, tcl, w, h, r) {
    var iarr = 1 / (r+r+1); // averaging adjustment parameter
    for (var i = 0; i < h; i++) {
        var ti = i * w, // current target index
            li = ti, // current left side of the examined range
            ri = ti + r, // current right side of the examined range
            fv = scl[ti], // first value in the row
            lv = scl[ti + w - 1], // last value in the row
            val = (r+1) * fv, // target value, accumulated over examined points
            j;
        // Sum the source values in the box
        for (j = 0; j < r; j++) { val += scl[ti + j]; }
        // Compute the target value by taking the average of the surrounding
        // values. This is done by adding the deviations so far and adjusting,
        // accounting for the edges by extending the first and last values.
        for (j = 0  ; j <= r ; j++) { val += scl[ri++] - fv       ; tcl[ti++] = val*iarr; }
        for (j = r+1; j < w-r; j++) { val += scl[ri++] - scl[li++]; tcl[ti++] = val*iarr; }
        for (j = w-r; j < w  ; j++) { val += lv        - scl[li++]; tcl[ti++] = val*iarr; }
    }
}
function boxBlurH ( scl , tcl , w , h , r ) { var iarr = 1 / ( r + r + 1 ) ; // averaging adjustment parameter for ( var i = 0 ; i < h ; i ++ ) { var ti = i * w , // current target index li = ti , // current left side of the examined range ri = ti + r , // current right side of the examined range fv = scl [ ti ] , // first value in the row lv = scl [ ti + w - 1 ] , // last value in the row val = ( r + 1 ) * fv , // target value, accumulated over examined points j ; // Sum the source values in the box for ( j = 0 ; j < r ; j ++ ) { val += scl [ ti + j ] ; } // Compute the target value by taking the average of the surrounding // values. This is done by adding the deviations so far and adjusting, // accounting for the edges by extending the first and last values. for ( j = 0 ; j <= r ; j ++ ) { val += scl [ ri ++ ] - fv ; tcl [ ti ++ ] = val * iarr ; } for ( j = r + 1 ; j < w - r ; j ++ ) { val += scl [ ri ++ ] - scl [ li ++ ] ; tcl [ ti ++ ] = val * iarr ; } for ( j = w - r ; j < w ; j ++ ) { val += lv - scl [ li ++ ] ; tcl [ ti ++ ] = val * iarr ; } } }
Perform a horizontal box blur.

Uses the same parameters as gaussblur().
Perform a horizontal box blur .