Changeset 11513

Show
Ignore:
Timestamp:
05/14/07 13:30:36 (2 years ago)
Author:
warmerdam
Message:

fix handling of multi-tile ycbcr decocded data (#1636)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/gdal/frmts/jp2kak/jp2kakdataset.cpp

    r11437 r11513  
    204204    void        ApplyPalette( jp2_palette oJP2Palette ); 
    205205    void        ProcessYCbCrTile(kdu_tile tile, GByte *pabyBuffer,  
    206                                  int nBlockXOff, int nBlockYOff ); 
     206                                 int nBlockXOff, int nBlockYOff, 
     207                                 int nTileOffsetX, int nTileOffsetY ); 
    207208    void        ProcessTile(kdu_tile tile, GByte *pabyBuffer ); 
    208209}; 
     
    579580                kdu_coords offset = tile_dims.pos - dims.pos; 
    580581 
    581                 GByte *pabyDest; 
    582  
    583                 pabyDest = ((GByte *)pImage)  
    584                     + (offset.x + offset.y*nBlockXSize) * nWordSize; 
    585  
    586582                try  
    587583                { 
    588584                    if( tile.get_ycc() && nBand < 4 ) 
    589                         ProcessYCbCrTile( tile, pabyDest,  
    590                                           nBlockXOff, nBlockYOff ); 
     585                        ProcessYCbCrTile( tile, (GByte *) pImage, 
     586                                          nBlockXOff, nBlockYOff, 
     587                                          offset.x, offset.y ); 
    591588                    else 
     589                    { 
     590                        GByte *pabyDest; 
     591                         
     592                        pabyDest = ((GByte *)pImage)  
     593                            + (offset.x + offset.y*nBlockXSize) * nWordSize; 
     594 
    592595                        ProcessTile( tile, pabyDest ); 
     596                    } 
    593597                    tile.close(); 
    594598                } 
     
    672676 
    673677void JP2KAKRasterBand::ProcessYCbCrTile( kdu_tile tile, GByte *pabyDest,  
    674                                          int nTileXOff, int nTileYOff ) 
     678                                         int nBlockXOff, int nBlockYOff, 
     679                                         int nTileOffsetX, int nTileOffsetY ) 
    675680 
    676681{ 
     
    737742 
    738743            apoBlocks[iBand] =  
    739                 poBand->GetLockedBlockRef( nTileXOff, nTileYOff, TRUE ); 
     744                poBand->GetLockedBlockRef( nBlockXOff, nBlockYOff, TRUE ); 
    740745            apabyBandDest[iBand] = (GByte *) apoBlocks[iBand]->GetDataRef(); 
    741746        } 
     
    781786 
    782787        for( iBand = 0; iBand < 3; iBand++ ) 
    783             transfer_bytes(apabyBandDest[iBand] + y * nBlockXSize * nWordSize, 
     788            transfer_bytes(apabyBandDest[iBand]  
     789                           + (nTileOffsetX+nTileOffsetY*nBlockXSize)*nWordSize, 
    784790                           line[iBand], nWordSize, bit_depth, eDataType ); 
    785791    }