Le 13/07/2021 à 18:24, Javier Jimenez Shaw a écrit :
Sounds good.

My next question is how to write the overviews data efficiently.
I see that there is a method "GDALRasterBand * GDALRasterBand::GetOverview ( int i ) ", but for that I need to deinterlace the image (copying it), and call it 4 times. Is there any trick I am missing while calling GDALRasterBand::RasterIO? Maybe some black magic with the pixel and line spaces? The images/overviews I get from the GPU are interlaced (RGBARGBA) On the other side there is "GDALDataset::RasterIO(...)", but there is not explicit way to set the overview level.

You can call GetDataset() on the RasterBand returned by GetOverview(). Note that this will not necessarily return a non-NULL dataset for all drivers, but it will for GeoTIFF.

Internally though this will go through the GDAL block cache (per band), so there will be internal deinterlace & reinterlace, at least for internal overviews, that by default use pixel-interleaving (for external overviews, band interleaving is used)



Thanks
.___ ._ ..._ .. . ._. .___ .. __ . _. . __..  ... .... ._ .__
Entre dos pensamientos racionales
hay infinitos pensamientos irracionales.



On Tue, 13 Jul 2021 at 14:04, Even Rouault <[email protected] <mailto:[email protected]>> wrote:

    Javier,

    You can use the "NONE" resampling method in BuildOverviews() or
    gdaladdo to create the overviews IFD without allocating any
    storage, and then you can open the file in update mode to set
    whatever values you want. APPEND_SUBDATASET=YES will not set the
    appropriate value for the SubFileType TIFF tag, and thus such
    pages won't be recognized as overviews

    Even

    Le 13/07/2021 à 13:57, Javier Jimenez Shaw a écrit :
    Hi

    I am computing the overviews of a GeoTIFF on my own (using the
    GPU, much faster), and I want to include them in the tif file
    (also in the ovr sidecar file).
    What is the best way to do it? Just creating a multipage TIFF (I
    guess with the option APPEND_SUBDATASET=YES)? Is there anything
    else needed (metadata, tiff tags, etc)?

    So far I want to do it in RGBA 8 bit images. (In the future I
    want to do it also in float32 images with nodata value and any
    number of bands, but no hurry).

    I am using GDAL 3.3.1

    Any help is welcome.

    Thanks.
    Javier.
    .___ ._ ..._ .. . ._.  .___ .. __ . _. . __..  ... .... ._ .__
    Entre dos pensamientos racionales
    hay infinitos pensamientos irracionales.


    _______________________________________________
    gdal-dev mailing list
    [email protected]  <mailto:[email protected]>
    https://lists.osgeo.org/mailman/listinfo/gdal-dev  
<https://lists.osgeo.org/mailman/listinfo/gdal-dev>

-- http://www.spatialys.com <http://www.spatialys.com>
    My software is free, but my time generally not.

--
http://www.spatialys.com
My software is free, but my time generally not.

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

Reply via email to