[gdal-dev] Read from Erdas Img too slow,
Even Rouault
even.rouault at mines-paris.org
Sun May 11 02:29:31 PDT 2014
Le dimanche 11 mai 2014 11:03:38, Jiang Wang a écrit :
> Hi,
> My gdal is 1.8.0.I use GDALDataset::RasterIO to read from a img file .The
> file size is 30G bytes ,three bands,data type is GDT_Byte and have 8
> overviews.When overview is used or there is no need to resample ,it`s
> fast.But when resample is needed,i found gdal copy pixel data 1 byte by 1
> byte in fllow codes:
> memcpy( ((GByte *) pData) + iBandBufOffset,
> pabySrcBlock + iSrcOffset, nBandDataSize );
> Codes is in rasterio.cpp at 2150 lines.
> My question is why copy 1 byte at one time.
For each pixel of the output buffer, you need to find which source pixel to
fetch, and then copy it. As there's resampling involved, the source pixels
cannot be contiguous, hence a copy one pixel at a time.
> and how to improve it..
That's an open question ! Well-tested patches welcome.
Perhaps you could start by saving the cost of memcpy() if you know the data
type is one byte. Similarly to what has been done in the
GDALRasterBand::IRasterIO() in a more recent version of GDAL. See
http://trac.osgeo.org/gdal/browser/trunk/gdal/gcore/rasterio.cpp#L503 . If you
look in the above lines, there have been some tricks to decrease the number of
multiplications, etc. in the most inner loop.
> Thanks.
--
Geospatial professional services
http://even.rouault.free.fr/services.html
More information about the gdal-dev
mailing list