lib/quagga.js
/**
	 * @param inImg {ImageWrapper} input image to be sampled
	 * @param outImg {ImageWrapper} to be stored in
	 */
@param inImg {ImageWrapper} input image to be sampled
@param outImg {ImageWrapper} to be stored in
@param inImg { ImageWrapper } input image to be sampled @param outImg { ImageWrapper } to be stored in
function halfSample(inImgWrapper, outImgWrapper) {
	    var inImg = inImgWrapper.data;
	    var inWidth = inImgWrapper.size.x;
	    var outImg = outImgWrapper.data;
	    var topRowIdx = 0;
	    var bottomRowIdx = inWidth;
	    var endIdx = inImg.length;
	    var outWidth = inWidth / 2;
	    var outImgIdx = 0;
	    while (bottomRowIdx < endIdx) {
	        for (var i = 0; i < outWidth; i++) {
	            outImg[outImgIdx] = Math.floor((inImg[topRowIdx] + inImg[topRowIdx + 1] + inImg[bottomRowIdx] + inImg[bottomRowIdx + 1]) / 4);
	            outImgIdx++;
	            topRowIdx = topRowIdx + 2;
	            bottomRowIdx = bottomRowIdx + 2;
	        }
	        topRowIdx = topRowIdx + inWidth;
	        bottomRowIdx = bottomRowIdx + inWidth;
	    }
	}
function halfSample ( inImgWrapper , outImgWrapper ) { var inImg = inImgWrapper . data ; var inWidth = inImgWrapper . size . x ; var outImg = outImgWrapper . data ; var topRowIdx = 0 ; var bottomRowIdx = inWidth ; var endIdx = inImg . length ; var outWidth = inWidth / 2 ; var outImgIdx = 0 ; while ( bottomRowIdx < endIdx ) { for ( var i = 0 ; i < outWidth ; i ++ ) { outImg [ outImgIdx ] = Math . floor ( ( inImg [ topRowIdx ] + inImg [ topRowIdx + 1 ] + inImg [ bottomRowIdx ] + inImg [ bottomRowIdx + 1 ] ) / 4 ) ; outImgIdx ++ ; topRowIdx = topRowIdx + 2 ; bottomRowIdx = bottomRowIdx + 2 ; } topRowIdx = topRowIdx + inWidth ; bottomRowIdx = bottomRowIdx + inWidth ; } }
@param inImg {ImageWrapper} input image to be sampled
 @param outImg {ImageWrapper} to be stored in
@param inImg { ImageWrapper } input image to be sampled @param outImg { ImageWrapper } to be stored in