[gdal-dev] Overriding IRasterIO in class derived from
jorge.arevalo at gmail.com
Fri Aug 7 13:43:44 EDT 2009
2009/8/7 Tamas Szekeres <szekerest at gmail.com>:
> Did you call DropLock() right after copying the data on the newly allocated
> block? This assertion shows the raster block have remained in locked state.
OK, I commented this part during tests, -1 for me. The assertion
disappeared. Many thanks.
And about the time, it's only when executing gdalinfo with options
"-mm -stats -checksum". Takes about 35 seconds, with this image
http://download.osgeo.org/gdal/data/gtiff/utm.tif and one overview of
factor 2 (50% of size in both dimensions). I suppose is normal...
> It's quite annoying if you find long executing times somewhere. Did you know
> how much time required to fetch the data and place that into the internal
> One issue with this concept would be related to the limited memory size of
> the particular machine, it may be more reasonable to copy the retrieved
> blocks directly onto the output buffer if possible. In this case you cannot
> much rely on the base RasterIO implementation.
So, you suggest to copy the block data into the buffer without calling
base implementation of IRasterIO, do you? This implies take care of
the endianess and pixel size "by hand".
> Best regards,
> 2009/8/7 Jorge Arévalo <jorge.arevalo at gmail.com>
>> Context: GDAL WKT Raster driver
>> In my class derived from GDALRasterBand, I've overrided the methods:
>> - IReadBlock: Fetch a block from database
>> - IRasterIO: Should fetch several blocks, that cover an area, and add
>> them to papoBlocks (cache). The idea is to avoid rounds in the server
>> AFAIK, the base IRasterIO implementation (in GDALRasterBand), tries to
>> fetch the block from the cache. If the block isn't in the cache, then
>> call to IReadBlock. So, the normal way to read blocks in any GDAL
>> driver should be IRasterIO --> IReadBlock
>> Then, If I override IRasterIO in my driver RasterBand's class, I
>> should fetch several blocks in one round and call GetLockedBlockRef to
>> add these blocks to the cache. After this, call the base
>> implementation of IRasterIO (in GDALRasterBand) to do its work (see
>> previous point).
>> Is it correct? I have problems with my IRasterIO implementation,
>> because it takes a long time executing until this fail:
>> ERROR 7: Assertion `nLockCount == 0' failed
>> in file `gdalrasterblock.cpp', line 228
>> Is there any mistake in this approach? If not, I suppose I had to
>> debug my queries, but I'd like to rule our wrong concepts first.
>> Many thanks in advance.
>> Best regards,
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
More information about the gdal-dev