private void rgb_ycc_start()
{
/* Allocate and fill in the conversion tables. */
m_rgb_ycc_tab = new int[TABLE_SIZE];
for (int i = 0; i <= JpegConstants.MAXJSAMPLE; i++)
{
m_rgb_ycc_tab[i + R_Y_OFF] = FIX(0.299) * i;
m_rgb_ycc_tab[i + G_Y_OFF] = FIX(0.587) * i;
m_rgb_ycc_tab[i + B_Y_OFF] = FIX(0.114) * i + ONE_HALF;
m_rgb_ycc_tab[i + R_CB_OFF] = (-FIX(0.168735892)) * i;
m_rgb_ycc_tab[i + G_CB_OFF] = (-FIX(0.331264108)) * i;
/* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr.
* This ensures that the maximum output will round to MAXJSAMPLE
* not MAXJSAMPLE+1, and thus that we don't have to range-limit.
*/
m_rgb_ycc_tab[i + B_CB_OFF] = FIX(0.5) * i + CBCR_OFFSET + ONE_HALF - 1;
/* B=>Cb and R=>Cr tables are the same
m_rgb_ycc_tab[i + R_CR_OFF] = FIX(0.5) * i + CBCR_OFFSET + ONE_HALF - 1;
*/
m_rgb_ycc_tab[i + G_CR_OFF] = (-FIX(0.418687589)) * i;
m_rgb_ycc_tab[i + B_CR_OFF] = (-FIX(0.081312411)) * i;
}
}