private void build_ycc_rgb_table()
{
/* Normal case, sYCC */
m_Cr_r_tab = new int[JpegConstants.MAXJSAMPLE + 1];
m_Cb_b_tab = new int[JpegConstants.MAXJSAMPLE + 1];
m_Cr_g_tab = new int[JpegConstants.MAXJSAMPLE + 1];
m_Cb_g_tab = new int[JpegConstants.MAXJSAMPLE + 1];
for (int i = 0, x = -JpegConstants.CENTERJSAMPLE; i <= JpegConstants.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.402 * x */
m_Cr_r_tab[i] = JpegUtils.RIGHT_SHIFT(FIX(1.402) * x + ONE_HALF, SCALEBITS);
/* Cb=>B value is nearest int to 1.772 * x */
m_Cb_b_tab[i] = JpegUtils.RIGHT_SHIFT(FIX(1.772) * x + ONE_HALF, SCALEBITS);
/* Cr=>G value is scaled-up -0.714136286 * x */
m_Cr_g_tab[i] = (-FIX(0.714136286)) * x;
/* Cb=>G value is scaled-up -0.344136286 * x */
/* We also add in ONE_HALF so that need not do it in inner loop */
m_Cb_g_tab[i] = (-FIX(0.344136286)) * x + ONE_HALF;
}
}