Skip to content

Commit

Permalink
Bring out the constant factors and avoid dividing in a while loop wit…
Browse files Browse the repository at this point in the history
…hin JP2KAKCreateCopy

git-svn-id: https://svn.osgeo.org/gdal/trunk@37078 f0d54148-0727-0410-94bb-9a71ac55c965
  • Loading branch information
schwehr committed Jan 9, 2017
1 parent 04a049e commit bacd915
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gdal/frmts/jp2kak/jp2kakdataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2418,8 +2418,8 @@ JP2KAKCreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
/* 64K tiles. There is a hard limit on the number of tiles */
/* allowed in JPEG2000. */
/* -------------------------------------------------------------------- */
while( (double)nXSize*(double)nYSize
/ (double)nTileXSize / (double)nTileYSize / 1024.0 >= 64.0 )
const double dfXbyY = static_cast<double>(nXSize * nYSize) / (1024 * 64);
while( dfXbyY >= static_cast<double>(nTileXSize * nTileYSize) )
{
nTileXSize *= 2;
nTileYSize *= 2;
Expand Down

0 comments on commit bacd915

Please sign in to comment.