Unless you want to hack into gdalrasterband.cpp, you generally don't have to 
care about that concept of subblocking. It is just an internal implementation 
detail to improve memory usage when a raster has a big number of blocks.

Usually, GDAL will create an array of pointers to blocks of size nBlocksPerRow 
x nBlocksPerColumn, stored in the papoBlocks member. Let's say your raster is 
of dimension 1000 x 1000 and the block size is 10x10. This would lead to the 
creation of an array of 100 x 100 pointers.

If the number of blocks in one dimension is greater than SUBBLOCK_SIZE/2, then 
GDAL will create instead an array of ceil(nBocksPerRow / SUBBLOCK_SIZE) * 
ceil(nBocksPerColumn / SUBBLOCK_SIZE) where SUBBLOCK_SIZE = 64. In the 
example, as 100 > 32, an array of 4 x 4 is created in papoBlocks. Each 
element of this array can contain a sub-array of 64x64 pointer to blocks. But 
at the beginning those sub-arrays are not created, in order to save memory.

When you need to access block (i, j), GDAL will first compute the subblock in 
which the block is contained : (i', j') = (i / 64, j / 64). If the element at 
(i', j') is NULL, GDAL will first instanciate the 64x64 array. Then it will 
reserve memory for the block located at (i'', j'') = (i % 64, j % 64) in the 
subblock.

In case of huge rasters, this concept could be extended to a third level of 
indirection ("sub-sub-blocks"), but this has not been implemented.

Not sure I've been very clear. But now if you read the code, you should 
understand what I mean ;-)

Le Sunday 07 June 2009 09:21:57 gispowerfan, vous avez écrit :
> hi,
>       Recently I read the sorce code of gdal, and I found that there are
> subblocking in GDALRasterBand, can anyone give some examples of subblock,
> and how to use it? some doc in detail will be better!
>
> thanks in advance!
>
> gispowerfan
>
> 2009-06-07
>
>
>
> gispowerfan


_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to