imagingmodules/jp2kcodec/Src/JP2KComponentInfo.cpp
changeset 10 ac33adcbae0f
parent 0 469c91dae73b
equal deleted inserted replaced
0:469c91dae73b 10:ac33adcbae0f
    97     TUint8 incomplete = 0;
    97     TUint8 incomplete = 0;
    98     TUint8 level = aTile.LastLevelProcessed();
    98     TUint8 level = aTile.LastLevelProcessed();
    99     TUint8 diff = (TUint8)( iNumOfLevels - level );
    99     TUint8 diff = (TUint8)( iNumOfLevels - level );
   100     if ( level <= iNumOfLevels )
   100     if ( level <= iNumOfLevels )
   101         {
   101         {
   102         TInt trx0 = TJ2kUtils::Ceil( iComponentCanvas.iTl.iX, 1 << diff );
   102         TInt trx0 = TJ2kUtils::CeilL( iComponentCanvas.iTl.iX, 1 << diff );
   103         TInt try0 = TJ2kUtils::Ceil( iComponentCanvas.iTl.iY, 1 << diff );
   103         TInt try0 = TJ2kUtils::CeilL( iComponentCanvas.iTl.iY, 1 << diff );
   104         const TSizMarker& sizMarker = aTile.ImageInfo().SizMarker();
   104         const TSizMarker& sizMarker = aTile.ImageInfo().SizMarker();
   105 
   105 
   106         if ( ( ( aTile.LastN1Processed() % (TInt)( sizMarker.iYRsiz[aTile.LastComponentProcessed()] * iGridList[level].iHeight ) == 0) ||
   106         if ( ( ( aTile.LastN1Processed() % (TInt)( sizMarker.iYRsiz[aTile.LastComponentProcessed()] * iGridList[level].iHeight ) == 0) ||
   107              ( ( aTile.LastN1Processed() == aTile.TileCanvas().iTl.iY ) && 
   107              ( ( aTile.LastN1Processed() == aTile.TileCanvas().iTl.iY ) && 
   108              ( ( try0 << diff) % iGridList[level].iHeight ) ) ) &&
   108              ( ( try0 << diff) % iGridList[level].iHeight ) ) ) &&
   128     TUint8 level = aTile.LastLevelProcessed();
   128     TUint8 level = aTile.LastLevelProcessed();
   129     TUint8 diff = (TUint8)( iNumOfLevels - level );
   129     TUint8 diff = (TUint8)( iNumOfLevels - level );
   130 
   130 
   131     if (level <= iNumOfLevels)
   131     if (level <= iNumOfLevels)
   132         {
   132         {
   133         TInt trx0 = TJ2kUtils::Ceil( iComponentCanvas.iTl.iX, 1 << diff );
   133         TInt trx0 = TJ2kUtils::CeilL( iComponentCanvas.iTl.iX, 1 << diff );
   134         TInt try0 = TJ2kUtils::Ceil( iComponentCanvas.iTl.iY, 1 << diff );
   134         TInt try0 = TJ2kUtils::CeilL( iComponentCanvas.iTl.iY, 1 << diff );
   135         const TSizMarker& sizMarker = aTile.ImageInfo().SizMarker();
   135         const TSizMarker& sizMarker = aTile.ImageInfo().SizMarker();
   136 
   136 
   137         if ( ( ( aTile.LastN1Processed() % (TInt)( sizMarker.iYRsiz[aTile.LastComponentProcessed()] * iGridList[level].iHeight ) == 0 ) ||
   137         if ( ( ( aTile.LastN1Processed() % (TInt)( sizMarker.iYRsiz[aTile.LastComponentProcessed()] * iGridList[level].iHeight ) == 0 ) ||
   138            ( ( aTile.LastN1Processed() == aTile.TileCanvas().iTl.iY ) && 
   138            ( ( aTile.LastN1Processed() == aTile.TileCanvas().iTl.iY ) && 
   139            ( ( try0 << diff) % iGridList[level].iHeight ) ) ) &&
   139            ( ( try0 << diff) % iGridList[level].iHeight ) ) ) &&
   252     {
   252     {
   253     CJ2kImageInfo& imageInfo = CONST_CAST( CJ2kImageInfo&, aTile.ImageInfo() );
   253     CJ2kImageInfo& imageInfo = CONST_CAST( CJ2kImageInfo&, aTile.ImageInfo() );
   254     const TSizMarker& sizMarker = imageInfo.SizMarker();
   254     const TSizMarker& sizMarker = imageInfo.SizMarker();
   255     const TRect& tileCanvas = aTile.TileCanvas();
   255     const TRect& tileCanvas = aTile.TileCanvas();
   256 
   256 
   257     iComponentCanvas.iTl = TPoint( TJ2kUtils::Ceil( tileCanvas.iTl.iX, sizMarker.iXRsiz[aIndex] ),
   257     iComponentCanvas.iTl = TPoint( TJ2kUtils::CeilL( tileCanvas.iTl.iX, sizMarker.iXRsiz[aIndex] ),
   258                                    TJ2kUtils::Ceil( tileCanvas.iTl.iY, sizMarker.iYRsiz[aIndex] ) );
   258                                    TJ2kUtils::CeilL( tileCanvas.iTl.iY, sizMarker.iYRsiz[aIndex] ) );
   259     iComponentCanvas.iBr = TPoint( TJ2kUtils::Ceil( tileCanvas.iBr.iX, sizMarker.iXRsiz[aIndex] ),
   259     iComponentCanvas.iBr = TPoint( TJ2kUtils::CeilL( tileCanvas.iBr.iX, sizMarker.iXRsiz[aIndex] ),
   260                                    TJ2kUtils::Ceil( tileCanvas.iBr.iY, sizMarker.iYRsiz[aIndex] ) );
   260                                    TJ2kUtils::CeilL( tileCanvas.iBr.iY, sizMarker.iYRsiz[aIndex] ) );
   261 
   261 
   262     if ( iComponentCanvas.Width(  ) <= 0 || iComponentCanvas.Height(  ) <= 0 )
   262     if ( iComponentCanvas.Width(  ) <= 0 || iComponentCanvas.Height(  ) <= 0 )
   263         {
   263         {
   264         // Empty may be caused by subsampled
   264         // Empty may be caused by subsampled
   265         return;
   265         return;
   323             ppx = ( *precinctSiz )[index] & 0x0f;
   323             ppx = ( *precinctSiz )[index] & 0x0f;
   324             ppy = ( ( *precinctSiz )[index] & 0xf0 ) >> 4;
   324             ppy = ( ( *precinctSiz )[index] & 0xf0 ) >> 4;
   325             }
   325             }
   326         denom = 1 << ( iNumOfLevels - index );
   326         denom = 1 << ( iNumOfLevels - index );
   327 
   327 
   328         trx0 = TJ2kUtils::Ceil( iComponentCanvas.iTl.iX, denom );
   328         trx0 = TJ2kUtils::CeilL( iComponentCanvas.iTl.iX, denom );
   329         try0 = TJ2kUtils::Ceil( iComponentCanvas.iTl.iY, denom );
   329         try0 = TJ2kUtils::CeilL( iComponentCanvas.iTl.iY, denom );
   330         trx1 = TJ2kUtils::Ceil( iComponentCanvas.iBr.iX, denom );
   330         trx1 = TJ2kUtils::CeilL( iComponentCanvas.iBr.iX, denom );
   331         try1 = TJ2kUtils::Ceil( iComponentCanvas.iBr.iY, denom );
   331         try1 = TJ2kUtils::CeilL( iComponentCanvas.iBr.iY, denom );
   332 
   332 
   333         if ( trx1 > trx0 )
   333         if ( trx1 > trx0 )
   334             {
   334             {
   335             precinct.iWidth = TJ2kUtils::Ceil( trx1, 1 << ppx ) - TJ2kUtils::Floor( trx0, 1 << ppx );
   335             precinct.iWidth = TJ2kUtils::CeilL( trx1, 1 << ppx ) - TJ2kUtils::FloorL( trx0, 1 << ppx );
   336             }
   336             }
   337         else
   337         else
   338             {
   338             {
   339             precinct.iWidth = 0;
   339             precinct.iWidth = 0;
   340             }
   340             }
   341 
   341 
   342         if ( try1 > try0 )
   342         if ( try1 > try0 )
   343             {
   343             {
   344             precinct.iHeight = TJ2kUtils::Ceil( try1, 1 << ppy ) - TJ2kUtils::Floor( try0, 1 << ppy );
   344             precinct.iHeight = TJ2kUtils::CeilL( try1, 1 << ppy ) - TJ2kUtils::FloorL( try0, 1 << ppy );
   345             }
   345             }
   346         else
   346         else
   347             {
   347             {
   348             precinct.iHeight = 0;
   348             precinct.iHeight = 0;
   349             }
   349             }