Пример #1
0
// PHOTOMETRIC == MULTISPECTRAL turns off YCbCr conversion and downsampling
JPEG_Band::JPEG_Band( GDALMRFDataset *pDS, const ILImage &image,
                      int b, int level ) :
    GDALMRFRasterBand(pDS, image, b, int(level)),
    codec(image)
{
    const int nbands = image.pagesize.c;
    // Check behavior on signed 16bit.  Does the libjpeg sign extend?
#if defined(LIBJPEG_12_H)
    if (GDT_Byte != image.dt && GDT_UInt16 != image.dt)
#else
    if (GDT_Byte != image.dt)
#endif
    {
        CPLError(CE_Failure, CPLE_NotSupported,
                 "Data type not supported by MRF JPEG");
        return;
    }

    if( nbands == 3 )
    { // Only the 3 band JPEG has storage flavors
        CPLString const &pm = pDS->GetPhotometricInterpretation();
        if (pm == "RGB" || pm == "MULTISPECTRAL")
        { // Explicit RGB or MS
            codec.rgb = TRUE;
            codec.sameres = TRUE;
        }
        if (pm == "YCC")
            codec.sameres = TRUE;
    }

    if( GDT_Byte == image.dt )
        codec.optimize = GetOptlist().FetchBoolean("OPTIMIZE", FALSE) != FALSE;
    else
        codec.optimize = true; // Required for 12bit
}
Пример #2
0
LERC_Band::LERC_Band(GDALMRFDataset *pDS, const ILImage &image, int b, int level):
    GDALMRFRasterBand(pDS, image, b, level)
{
    // Pick 1/1000 for floats and 0.5 losless for integers
    if (eDataType == GDT_Float32 || eDataType == GDT_Float64 )
	precision = strtod(GetOptionValue( "LERC_PREC" , ".001" ),NULL);
    else
	precision = std::max(0.5, strtod(GetOptionValue("LERC_PREC", ".5"), NULL));

    // Encode in V2 by default
    version = GetOptlist().FetchBoolean("V1", FALSE) ? 1:2;

    // Enlarge the page buffer in this case, LERC may expand data
    pDS->SetPBufferSize( 2 * image.pageSizeBytes);
}