<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.2900.5512" name=GENERATOR>
<STYLE>@font-face {
        font-family: 宋体;
}
@font-face {
        font-family: Verdana;
}
@font-face {
        font-family: @宋体;
}
@page Section1 {size: 595.3pt 841.9pt; margin: 72.0pt 90.0pt 72.0pt 90.0pt; layout-grid: 15.6pt; }
P.MsoNormal {
        TEXT-JUSTIFY: inter-ideograph; FONT-SIZE: 10.5pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"; TEXT-ALIGN: justify
}
LI.MsoNormal {
        TEXT-JUSTIFY: inter-ideograph; FONT-SIZE: 10.5pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"; TEXT-ALIGN: justify
}
DIV.MsoNormal {
        TEXT-JUSTIFY: inter-ideograph; FONT-SIZE: 10.5pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"; TEXT-ALIGN: justify
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.EmailStyle17 {
        FONT-WEIGHT: normal; COLOR: windowtext; FONT-STYLE: normal; FONT-FAMILY: Verdana; TEXT-DECORATION: none; mso-style-type: personal-compose
}
DIV.Section1 {
        page: Section1
}
UNKNOWN {
        FONT-SIZE: 10pt
}
BLOCKQUOTE {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; MARGIN-LEFT: 2em
}
OL {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
UL {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
</STYLE>
</HEAD>
<BODY style="FONT-SIZE: 10pt; MARGIN: 10px; FONT-FAMILY: verdana">
<DIV><FONT face=Verdana color=#000080 size=2>thank you very much! I understand
the concept of subblocking in brief.</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=2>It is the skill of memory
management of large image block using the default paras such as <FONT
color=#000000>SUBBLOCK_SIZE=64.</FONT></FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=2>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?</FONT></DIV>
<DIV><FONT face=Verdana size=2>Is papoBlocks member the block list of
memory?</FONT></DIV>
<DIV> </DIV>
<DIV>thanks</DIV>
<DIV> </DIV>
<DIV>
<DIV><FONT face=Verdana color=#c0c0c0 size=2><SPAN>gispowerfan</SPAN>
</FONT></DIV>
<DIV><FONT color=#c0c0c0></FONT> </DIV></DIV>
<DIV><FONT face=Verdana color=#c0c0c0 size=2>2009-06-07 </FONT></DIV><FONT
face=Verdana color=#000080 size=2>
<HR style="WIDTH: 100px" align=left color=#b5c4df SIZE=1>
</FONT>
<HR color=#b5c4df SIZE=1>
<DIV><FONT face=Verdana size=2><STRONG>发件人:</STRONG> Even Rouault </FONT></DIV>
<DIV><FONT face=Verdana size=2><STRONG>发送时间:</STRONG> 2009-06-07 16:56:17
</FONT></DIV>
<DIV><FONT face=Verdana size=2><STRONG>收件人:</STRONG> gdal-dev </FONT></DIV>
<DIV><FONT face=Verdana size=2><STRONG>抄送:</STRONG> gispowerfan </FONT></DIV>
<DIV><FONT face=Verdana size=2><STRONG>主题:</STRONG> Re: [gdal-dev] subblock of
gdal source code </FONT></DIV>
<DIV><FONT face=Verdana size=2></FONT> </DIV>
<DIV><FONT face=Verdana size=2>
<DIV>Unless you want to hack into gdalrasterband.cpp, you generally don't have to </DIV>
<DIV>care about that concept of subblocking. It is just an internal implementation </DIV>
<DIV>detail to improve memory usage when a raster has a big number of blocks.</DIV>
<DIV></DIV>
<DIV>Usually, GDAL will create an array of pointers to blocks of size nBlocksPerRow </DIV>
<DIV>x nBlocksPerColumn, stored in the papoBlocks member. Let's say your raster is </DIV>
<DIV>of dimension 1000 x 1000 and the block size is 10x10. This would lead to the </DIV>
<DIV>creation of an array of 100 x 100 pointers.</DIV>
<DIV></DIV>
<DIV>If the number of blocks in one dimension is greater than SUBBLOCK_SIZE/2, then </DIV>
<DIV>GDAL will create instead an array of ceil(nBocksPerRow / SUBBLOCK_SIZE) * </DIV>
<DIV>ceil(nBocksPerColumn / SUBBLOCK_SIZE) where SUBBLOCK_SIZE = 64. In the </DIV>
<DIV>example, as 100 > 32, an array of 4 x 4 is created in papoBlocks. Each </DIV>
<DIV>element of this array can contain a sub-array of 64x64 pointer to blocks. But </DIV>
<DIV>at the beginning those sub-arrays are not created, in order to save memory.</DIV>
<DIV></DIV>
<DIV>When you need to access block (i, j), GDAL will first compute the subblock in </DIV>
<DIV>which the block is contained : (i', j') = (i / 64, j / 64). If the element at </DIV>
<DIV>(i', j') is NULL, GDAL will first instanciate the 64x64 array. Then it will </DIV>
<DIV>reserve memory for the block located at (i'', j'') = (i % 64, j % 64) in the </DIV>
<DIV>subblock.</DIV>
<DIV></DIV>
<DIV>In case of huge rasters, this concept could be extended to a third level of </DIV>
<DIV>indirection ("sub-sub-blocks"), but this has not been implemented.</DIV>
<DIV></DIV>
<DIV>Not sure I've been very clear. But now if you read the code, you should </DIV>
<DIV>understand what I mean ;-)</DIV>
<DIV></DIV>
<DIV>Le Sunday 07 June 2009 09:21:57 gispowerfan, vous avez écrit :</DIV>
<DIV>> hi,</DIV>
<DIV>> Recently I read the sorce code of gdal, and I found that there are</DIV>
<DIV>> subblocking in GDALRasterBand, can anyone give some examples of subblock,</DIV>
<DIV>> and how to use it? some doc in detail will be better!</DIV>
<DIV>></DIV>
<DIV>> thanks in advance!</DIV>
<DIV>></DIV>
<DIV>> gispowerfan</DIV>
<DIV>></DIV>
<DIV>> 2009-06-07</DIV>
<DIV>></DIV>
<DIV>></DIV>
<DIV>></DIV>
<DIV>> gispowerfan</DIV>
<DIV></DIV>
<DIV></DIV></FONT></DIV></BODY></HTML>