<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>That should be relatively straightforward to adapt
GDALResampleChunk_AverageOrRMS_T to do sum. Reuse the average code
path, but just don't divide the sum by dfTotalWeight at lines
1418, 1473, 1688, 1700 and 1712. And error out if applied to a
band with a color table (cf line 4361)<br>
</p>
<p>For other algorithms, it could potentially be possible to re-use
the warping code with an adaptation layer like done in
GDALRasterBand::RasterIOResampled() in the bUseWarp case. Of
course that would be less performant than implementing a specific
overview resampling kernel which can assume that a source
rectangle maps to a target rectangle at the band level, while the
warping code only process pixel by pixel.<br>
</p>
<div class="moz-cite-prefix">Le 21/09/2023 à 22:25, Michael Sumner
via gdal-dev a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:CAAcGz9-ro434yh8cj0nGTor1p8+Uqfisbc8upJpixE-5KYxwSw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Can we aspire to translate having the same set of
resampling algorithms as the warper?
<div><br>
</div>
<div>I see the warper adds min, max, mod, q1, q3, sum</div>
<div><br>
</div>
<div>I especially wanted sum for OVERVIEW_RESAMPLING in COG, and
I can see where it's done and ... can maybe see my way
through that ... but the 600 lines of code
in GDALResampleChunk_AverageOrRMS_T kind of reins in my
confidence. </div>
<div><br>
</div>
<div><a
href="https://github.com/OSGeo/gdal/blob/26e7ff91504e0303434f440e6d19e58f2a206b45/gcore/overview.cpp#L1211C15-L1211C47"
moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/OSGeo/gdal/blob/26e7ff91504e0303434f440e6d19e58f2a206b45/gcore/overview.cpp#L1211C15-L1211C47</a><br>
</div>
<div><br>
</div>
<div>It came up as a need for statistical properties required
for overview-publishers, and while I think we can
incrementally build up the SUM-pyramid with external
overivews via CLI it would be awesome to have the same stats
for the two resampling regimes. </div>
<div><br>
</div>
<div>Thank you</div>
<div><br>
</div>
<div><br clear="all">
<div><br>
</div>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature"
data-smartmail="gmail_signature">Michael Sumner<br>
Software and Database Engineer<br>
Australian Antarctic Division<br>
Hobart, Australia<br>
e-mail: <a href="mailto:mdsumner@gmail.com" target="_blank"
moz-do-not-send="true" class="moz-txt-link-freetext">mdsumner@gmail.com</a></div>
</div>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>