imagingmodules/jp2kcodec/Src/JP2KPacket.cpp
branchRCL_3
changeset 4 3993b8f65362
parent 0 469c91dae73b
equal deleted inserted replaced
0:469c91dae73b 4:3993b8f65362
    95     iPacketCanvas.SetWidth( aWidth );
    95     iPacketCanvas.SetWidth( aWidth );
    96     iPacketCanvas.SetHeight( aHeight );
    96     iPacketCanvas.SetHeight( aHeight );
    97     }
    97     }
    98 
    98 
    99 // -----------------------------------------------------------------------------
    99 // -----------------------------------------------------------------------------
   100 // CJ2kPacket::SetNumOfBlocks
   100 // CJ2kPacket::SetNumOfBlocksL
   101 // Set the number of blocks
   101 // Set the number of blocks
   102 // (other items were commented in a header).
   102 // (other items were commented in a header).
   103 // -----------------------------------------------------------------------------
   103 // -----------------------------------------------------------------------------
   104 //
   104 //
   105 void CJ2kPacket::SetNumOfBlocks( TSize& aCodeBlock )
   105 void CJ2kPacket::SetNumOfBlocksL( TSize& aCodeBlock )
   106     {
   106     {
   107     TInt32 x0 = TJ2kUtils::Floor( iPacketCanvas.iTl.iX, aCodeBlock.iWidth ) * aCodeBlock.iWidth;
   107     TInt32 x0 = TJ2kUtils::FloorL( iPacketCanvas.iTl.iX, aCodeBlock.iWidth ) * aCodeBlock.iWidth;
   108     TInt32 y0 = TJ2kUtils::Floor( iPacketCanvas.iTl.iY, aCodeBlock.iHeight ) * aCodeBlock.iHeight;
   108     TInt32 y0 = TJ2kUtils::FloorL( iPacketCanvas.iTl.iY, aCodeBlock.iHeight ) * aCodeBlock.iHeight;
   109     TInt32 x1 = TJ2kUtils::Ceil( iPacketCanvas.iTl.iX + iPacketCanvas.Width(), aCodeBlock.iWidth ) * aCodeBlock.iWidth;
   109     TInt32 x1 = TJ2kUtils::CeilL( iPacketCanvas.iTl.iX + iPacketCanvas.Width(), aCodeBlock.iWidth ) * aCodeBlock.iWidth;
   110     TInt32 y1 = TJ2kUtils::Ceil( iPacketCanvas.iTl.iY + iPacketCanvas.Height(), aCodeBlock.iHeight ) * aCodeBlock.iHeight;
   110     TInt32 y1 = TJ2kUtils::CeilL( iPacketCanvas.iTl.iY + iPacketCanvas.Height(), aCodeBlock.iHeight ) * aCodeBlock.iHeight;
   111     iCodeBlockSize.iWidth  = ( x1 - x0 ) / aCodeBlock.iWidth;
   111     iCodeBlockSize.iWidth  = ( x1 - x0 ) / aCodeBlock.iWidth;
   112     iCodeBlockSize.iHeight = ( y1 - y0 ) / aCodeBlock.iHeight;
   112     iCodeBlockSize.iHeight = ( y1 - y0 ) / aCodeBlock.iHeight;
   113     }
   113     }
   114 
   114 
   115 // -----------------------------------------------------------------------------
   115 // -----------------------------------------------------------------------------
   235                         {
   235                         {
   236                         // Move to last subband processed
   236                         // Move to last subband processed
   237                         while ( subband->SubbandType() != aSubband.LastSubbandProcessed() )
   237                         while ( subband->SubbandType() != aSubband.LastSubbandProcessed() )
   238                             {
   238                             {
   239                             subband = subband->NextSubbandRaster();
   239                             subband = subband->NextSubbandRaster();
       
   240                             User::LeaveIfNull(subband);
   240                             }
   241                             }
   241                         }
   242                         }
   242                     }
   243                     }
   243 
   244 
   244                 TUint16 bandIndex = 0;
   245                 TUint16 bandIndex = 0;
   863                 {
   864                 {
   864                 // Move to last subband processed
   865                 // Move to last subband processed
   865                 while ( subband->SubbandType() != aSubband.LastSubbandProcessed() )
   866                 while ( subband->SubbandType() != aSubband.LastSubbandProcessed() )
   866                     {
   867                     {
   867                     subband = subband->NextSubbandRaster();
   868                     subband = subband->NextSubbandRaster();
       
   869                     User::LeaveIfNull(subband); 
   868                     }
   870                     }
   869                 }
   871                 }
   870             }
   872             }
   871         TUint16 xIndex = 0;
   873         TUint16 xIndex = 0;
   872         TUint16 yIndex = 0;
   874         TUint16 yIndex = 0;
   875         TUint16 index = 0;
   877         TUint16 index = 0;
   876         TUint16 cblkLength = 0;
   878         TUint16 cblkLength = 0;
   877         TUint16 layer = aTile.LastLayerProcessed();
   879         TUint16 layer = aTile.LastLayerProcessed();
   878         TInt32  totalLength = 0;
   880         TInt32  totalLength = 0;
   879         TUint8 *rollbackPtr = CONST_CAST( TUint8*, reader.iPtr );
   881         TUint8 *rollbackPtr = CONST_CAST( TUint8*, reader.iPtr );
       
   882         CJ2kCodeBlock *codeBlock = 0;
   880         
   883         
   881         CJ2kPacket *packet = CONST_CAST( CJ2kPacket*, &subband->PacketAt( aSubband.LastPacketProcessed() ) );
   884         CJ2kPacket * packet = CONST_CAST( CJ2kPacket*, &subband->PacketAt( aSubband.LastPacketProcessed() ) );
   882         CJ2kCodeBlock *codeBlock = 0;
   885         
   883         do
   886         do
   884             {
   887             {
   885         
   888         
   886             for ( yIndex = 0; yIndex < packet->NumOfBlocksY(); ++yIndex )
   889             for ( yIndex = 0; yIndex < packet->NumOfBlocksY(); ++yIndex )
   887                 {
   890                 {