private bool prepare_JPEGTables()
{
InitializeLibJPEG(false, false);
/* Initialize quant tables for current quality setting */
if (!TIFFjpeg_set_quality(m_jpegquality, false))
return false;
/* Mark only the tables we want for output */
/* NB: chrominance tables are currently used only with YCbCr */
if (!TIFFjpeg_suppress_tables(true))
return false;
if ((m_jpegtablesmode & JpegTablesMode.QUANT) != 0)
{
unsuppress_quant_table(0);
if (m_photometric == Photometric.YCBCR)
unsuppress_quant_table(1);
}
if ((m_jpegtablesmode & JpegTablesMode.HUFF) != 0)
{
unsuppress_huff_table(0);
if (m_photometric == Photometric.YCBCR)
unsuppress_huff_table(1);
}
// Direct LibJpeg.Net output into jpegtables
if (!TIFFjpeg_tables_dest())
return false;
/* Emit tables-only datastream */
if (!TIFFjpeg_write_tables())
return false;
return true;
}