private static void defaultRefBlackWhite(TiffDirectory td)
{
td.td_refblackwhite = new float[6];
if (td.td_photometric == Photometric.YCBCR)
{
// YCbCr (Class Y) images must have the ReferenceBlackWhite tag set. Fix the
// broken images, which lacks that tag.
td.td_refblackwhite[0] = 0.0F;
td.td_refblackwhite[1] = td.td_refblackwhite[3] = td.td_refblackwhite[5] = 255.0F;
td.td_refblackwhite[2] = td.td_refblackwhite[4] = 128.0F;
}
else
{
// Assume RGB (Class R)
for (int i = 0; i < 3; i++)
{
td.td_refblackwhite[2 * i + 0] = 0;
td.td_refblackwhite[2 * i + 1] = (float)((1L << td.td_bitspersample) - 1L);
}
}
}