jsjpeg.js
/**
 * Perform YCbCr to RGB colorspace conversion using the algorithm in the JFIF spec.
 * 
 * Writes the RGB values (and sets alpha = 255) into pixel
 * 
 * @param {*} Y 
 * @param {*} Cb 
 * @param {*} Cr 
 * @param {*} pixel 4-element array of RGBA
 */
Perform YCbCr to RGB colorspace conversion using the algorithm in the JFIF spec.

Writes the RGB values (and sets alpha = 255) into pixel


Perform YCbCr to RGB colorspace conversion using the algorithm in the JFIF spec . Writes the RGB values ( and sets alpha = 255 ) into pixel
function YCbCrToRGB(Y, Cb, Cr, pixel) {
    pixel[0] = clamp(Math.round(Y + (1.402 * (Cr - 128))));
    pixel[1] = clamp(Math.round(Y - (0.34414 * (Cb - 128)) - (0.71414 * (Cr - 128))));
    pixel[2] = clamp(Math.round(Y + 1.772 * (Cb - 128)));
    pixel[3] = 255;
}
function YCbCrToRGB ( Y , Cb , Cr , pixel ) { pixel [ 0 ] = clamp ( Math . round ( Y + ( 1.402 * ( Cr - 128 ) ) ) ) ; pixel [ 1 ] = clamp ( Math . round ( Y - ( 0.34414 * ( Cb - 128 ) ) - ( 0.71414 * ( Cr - 128 ) ) ) ) ; pixel [ 2 ] = clamp ( Math . round ( Y + 1.772 * ( Cb - 128 ) ) ) ; pixel [ 3 ] = 255 ; }
Perform YCbCr to RGB colorspace conversion using the algorithm in the JFIF spec.
Perform YCbCr to RGB colorspace conversion using the algorithm in the JFIF spec .