private static void buildYCCtoRGBtable ( ) { if ( ColorSpaces . DEBUG ) { System . err . println ( "Building YCC conversion table" ) ; } for ( int i = 0 , x = - CENTERJSAMPLE ; i <= MAXJSAMPLE ; i ++ , x ++ ) { // i is the actual input pixel value, in the range 0..MAXJSAMPLE // The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE // Cr=>R value is nearest int to 1.40200 * x Cr_R_LUT [ i ] = ( int ) ( ( 1.40200 * ( 1 << SCALEBITS ) + 0.5 ) * x + ONE_HALF ) >> SCALEBITS ; // Cb=>B value is nearest int to 1.77200 * x Cb_B_LUT [ i ] = ( int ) ( ( 1.77200 * ( 1 << SCALEBITS ) + 0.5 ) * x + ONE_HALF ) >> SCALEBITS ; // Cr=>G value is scaled-up -0.71414 * x Cr_G_LUT [ i ] = - ( int ) ( 0.71414 * ( 1 << SCALEBITS ) + 0.5 ) * x ; // Cb=>G value is scaled-up -0.34414 * x // We also add in ONE_HALF so that need not do it in inner loop Cb_G_LUT [ i ] = - ( int ) ( ( 0.34414 ) * ( 1 << SCALEBITS ) + 0.5 ) * x + ONE_HALF ; } }
Initializes tables for YCC - > RGB color space conversion .