Re: Re: [gdal-dev] subblock of gdal source code
gispowerfan
gispowerfan at gmail.com
Sun Jun 7 06:18:24 EDT 2009
thank you very much! I understand the concept of subblocking in brief.
It is the skill of memory management of large image block using the default paras such as SUBBLOCK_SIZE=64.
The strategy of memory block management in GDAL is LRU, I got the idea from mail list archives, and now are there only block list for all GDAL datasets? or one block list for one GDAL datasets?
Is papoBlocks member the block list of memory?
thanks
gispowerfan
2009-06-07
发件人: Even Rouault
发送时间: 2009-06-07 16:56:17
收件人: gdal-dev
抄送: gispowerfan
主题: Re: [gdal-dev] subblock of gdal source code
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20090607/9b2eaa6e/attachment-0001.html
More information about the gdal-dev
mailing list