Re: [gdal-dev] Any difference between VRT SimpleSource and no-op ComplexSource?

2023-12-21 Thread Even Rouault via gdal-dev



On Thu, Dec 21, 2023, at 15:51, Even Rouault wrote:


It only uses a ComplexSource when it needs to, that is to say when 
there is nodata or a mask band.


I didn't realize this. I think I'm hitting a corner case with 
-separate, which is practically the only way I've ever used it:


Ah, indeed, I now see the issue in that mode. Fixed per 
https://github.com/OSGeo/gdal/pull/8986


Even

--
http://www.spatialys.com
My software is free, but my time generally not.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] Any difference between VRT SimpleSource and no-op ComplexSource?

2023-12-21 Thread Rahkonen Jukka via gdal-dev
Hi,

About -separate and multi-band inputs, see 
https://gdal.org/programs/gdalbuildvrt.html#cmdoption-gdalbuildvrt-separate

“Starting with GDAL 3.8, all bands of each input file are added as separate VRT 
bands, unless -b is specified to select a subset of them. Before GDAL 3.8, only 
the first band of each input file was placed into a new VRT band, and -b was 
ignored.”

-Jukka Rahkonen-

Lähettäjä: gdal-dev  Puolesta Lauren?iu 
Nicola via gdal-dev
Lähetetty: torstai 21. joulukuuta 2023 16.09
Vastaanottaja: gdal-dev@lists.osgeo.org
Aihe: Re: [gdal-dev] Any difference between VRT SimpleSource and no-op 
ComplexSource?

On Thu, Dec 21, 2023, at 15:51, Even Rouault wrote:

It only uses a ComplexSource when it needs to, that is to say when there is 
nodata or a mask band.
I didn't realize this. I think I'm hitting a corner case with -separate, which 
is practically the only way I've ever used it:

$ gdalbuildvrt test.vrt T35TMK_20230520T090559_B02_10m.jp2 && cat test.vrt
0...10...20...30...40...50...60...70...80...90...100 - done.

  PROJCS["WGS 84 / UTM zone 
35N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",27],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",50],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","32635"]]
3.9996e+05,  1.e+01,  
0.e+00,  5.4000e+06,  0.e+00, 
-1.e+01
  
Gray

  T35TMK_20230520T090559_B02_10m.jp2
  1
  
  
  

  
  2 4 8 16


$ gdalbuildvrt -separate test.vrt T35TMK_20230520T090559_B02_10m.jp2 && cat 
test.vrt
0...10...20...30...40...50...60...70...80...90...100 - done.

  PROJCS["WGS 84 / UTM zone 
35N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",27],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",50],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","32635"]]
3.9996e+05,  1.e+01,  
0.e+00,  5.4000e+06,  0.e+00, 
-1.e+01
  

  T35TMK_20230520T090559_B02_10m.jp2
  1
  
  
  

  


Otherwise it will use SimpleSource. There is a performance hit in using 
ComplexSource when it is not needed. In 3.8, there has been an optimization to 
improve ComplexSource performance in common nodata-only scenarios: cf 
https://github.com/OSGeo/gdal/commit/cd67491d3909f5f05160fa209609b38d973c42de
Oh, that's great!

PS: are there good reasons for not allowing -separate for multi-band inputs (by 
including all bands) or propagating the input block size if it's the same for 
all of them?

Laurentiu
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] Any difference between VRT SimpleSource and no-op ComplexSource?

2023-12-21 Thread Laurențiu Nicola via gdal-dev
On Thu, Dec 21, 2023, at 15:51, Even Rouault wrote:
> It only uses a ComplexSource when it needs to, that is to say when there is 
> nodata or a mask band.
> 
I didn't realize this. I think I'm hitting a corner case with -separate, which 
is practically the only way I've ever used it:

$ gdalbuildvrt test.vrt T35TMK_20230520T090559_B02_10m.jp2 && cat test.vrt 
0...10...20...30...40...50...60...70...80...90...100 - done.

  PROJCS["WGS 84 / UTM zone 
35N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",27],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",50],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","32635"]]
3.9996e+05,  1.e+01,  
0.e+00,  5.4000e+06,  0.e+00, 
-1.e+01
  
Gray

  T35TMK_20230520T090559_B02_10m.jp2
  1
  
  
  

  
  2 4 8 16


$ gdalbuildvrt -separate test.vrt T35TMK_20230520T090559_B02_10m.jp2 && cat 
test.vrt
0...10...20...30...40...50...60...70...80...90...100 - done.

  PROJCS["WGS 84 / UTM zone 
35N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",27],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",50],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","32635"]]
3.9996e+05,  1.e+01,  
0.e+00,  5.4000e+06,  0.e+00, 
-1.e+01
  

  T35TMK_20230520T090559_B02_10m.jp2
  1
  
  
  

  


> Otherwise it will use SimpleSource. There is a performance hit in using 
> ComplexSource when it is not needed. In 3.8, there has been an optimization 
> to improve ComplexSource performance in common nodata-only scenarios: cf 
> https://github.com/OSGeo/gdal/commit/cd67491d3909f5f05160fa209609b38d973c42de
Oh, that's great!

PS: are there good reasons for not allowing -separate for multi-band inputs (by 
including all bands) or propagating the input block size if it's the same for 
all of them?

Laurentiu___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] Any difference between VRT SimpleSource and no-op ComplexSource?

2023-12-21 Thread Even Rouault via gdal-dev

Laurențiu,



I noticed that gdalbuildvrt with no options produces VRTs that use 
ComplexSource, when SimpleSource would be sufficient. Is there any 
meaningful performance difference between the two? I know I should 
measure myself, I just didn't get to try it yet.


It only uses a ComplexSource when it needs to, that is to say when there 
is nodata or a mask band. Otherwise it will use SimpleSource. There is a 
performance hit in using ComplexSource when it is not needed. In 3.8, 
there has been an optimization to improve ComplexSource performance in 
common nodata-only scenarios: cf 
https://github.com/OSGeo/gdal/commit/cd67491d3909f5f05160fa209609b38d973c42de


Even

--
http://www.spatialys.com
My software is free, but my time generally not.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


[gdal-dev] Any difference between VRT SimpleSource and no-op ComplexSource?

2023-12-21 Thread Laurențiu Nicola via gdal-dev
Hello,

I noticed that gdalbuildvrt with no options produces VRTs that use 
ComplexSource, when SimpleSource would be sufficient. Is there any meaningful 
performance difference between the two? I know I should measure myself, I just 
didn't get to try it yet.

Thanks,
Laurentiu___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev