Changeset 13658

Show
Ignore:
Timestamp:
02/01/08 16:46:01 (3 months ago)
Author:
warmerdam
Message:

Modified so that the RGBA interface is not used for YCbCr mode JPEG
compressed data. Set JPEGCOLORMODE to RGB at the point a directory is read
to avoid error report if doing it later during writing. This fixes the
GDAL 1.5.0 issues with writing YCbCr JPEG compressed data (#2189).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/gdal/frmts/gtiff/geotiff.cpp

    r13408 r13658  
    19001900    if( nLoadedBlock == nBlockId ) 
    19011901        return CE_None; 
    1902  
    1903 /* -------------------------------------------------------------------- */ 
    1904 /*      This is rather overkill, but relatively harmless so we do it    */ 
    1905 /*      here to be sure.                                                */ 
    1906 /* -------------------------------------------------------------------- */ 
    1907     if( nCompression == COMPRESSION_JPEG  
    1908         && nPhotometric == PHOTOMETRIC_YCBCR  
    1909         && CSLTestBoolean( CPLGetConfigOption("CONVERT_YCBCR_TO_RGB", 
    1910                                               "YES") ) ) 
    1911     { 
    1912         TIFFSetField(hTIFF, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB); 
    1913     } 
    19141902 
    19151903/* -------------------------------------------------------------------- */ 
     
    31013089        nPhotometric == PHOTOMETRIC_LOGLUV || 
    31023090        ( nPhotometric == PHOTOMETRIC_YCBCR  
    3103           && CSLTestBoolean( CPLGetConfigOption("CONVERT_YCBCR_TO_RGB", 
    3104                                                 "YES") ))  ) 
     3091          && nCompression != COMPRESSION_JPEG ) ) 
    31053092    { 
    31063093        char    szMessage[1024]; 
     
    31173104    } 
    31183105         
     3106/* -------------------------------------------------------------------- */ 
     3107/*      YCbCr JPEG compressed images should be translated on the fly    */ 
     3108/*      to RGB by libtiff/libjpeg unless specifically requested         */ 
     3109/*      otherwise.                                                      */ 
     3110/* -------------------------------------------------------------------- */ 
     3111    if( nCompression == COMPRESSION_JPEG  
     3112        && nPhotometric == PHOTOMETRIC_YCBCR  
     3113        && CSLTestBoolean( CPLGetConfigOption("CONVERT_YCBCR_TO_RGB", 
     3114                                              "YES") ) ) 
     3115    { 
     3116        TIFFSetField(hTIFF, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB); 
     3117    } 
     3118 
    31193119/* -------------------------------------------------------------------- */ 
    31203120/*      Should we treat this via the odd bits interface?                */