private void read_tiff_size(Tiff input)
{
if (m_pdf_transcode == t2p_transcode_t.T2P_TRANSCODE_RAW)
{
FieldValue[] result = null;
if (m_pdf_compression == t2p_compress_t.T2P_COMPRESS_G4)
{
result = input.GetField(TiffTag.STRIPBYTECOUNTS);
int[] sbc = result[0].ToIntArray();
m_tiff_datasize = sbc[0];
return;
}
if (m_pdf_compression == t2p_compress_t.T2P_COMPRESS_ZIP)
{
result = input.GetField(TiffTag.STRIPBYTECOUNTS);
int[] sbc = result[0].ToIntArray();
m_tiff_datasize = sbc[0];
return;
}
if (m_tiff_compression == Compression.JPEG)
{
result = input.GetField(TiffTag.JPEGTABLES);
if (result != null)
{
int count = result[0].ToInt();
if (count > 4)
{
m_tiff_datasize += count;
m_tiff_datasize -= 2; /* don't use EOI of header */
}
}
else
{
m_tiff_datasize = 2; /* SOI for first strip */
}
int stripcount = input.NumberOfStrips();
int[] sbc = null;
result = input.GetField(TiffTag.STRIPBYTECOUNTS);
if (result == null)
{
Tiff.Error(Tiff2PdfConstants.TIFF2PDF_MODULE,
"Input file {0} missing field: STRIPBYTECOUNTS",
input.FileName());
m_error = true;
return;
}
else
sbc = result[0].ToIntArray();
for (int i = 0; i < stripcount; i++)
{
m_tiff_datasize += sbc[i];
m_tiff_datasize -= 4; /* don't use SOI or EOI of strip */
}
m_tiff_datasize += 2; /* use EOI of last strip */
return;
}
}
m_tiff_datasize = input.ScanlineSize() * m_tiff_length;
if (m_tiff_planar == PlanarConfig.SEPARATE)
m_tiff_datasize *= m_tiff_samplesperpixel;
}