-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify the logic of selection of overviews for non-nearest resampling… #9040
Modify the logic of selection of overviews for non-nearest resampling… #9040
Conversation
133fc2a
to
f6628ca
Compare
…; add a GDAL_OVERVIEW_OVERSAMPLING_THRESHOLD config option The current logic reads: ``` * Some formats may efficiently implement decimation into a buffer by * reading from lower resolution overview images. The logic of the default * implementation in the base class GDALRasterBand is the following one. It * computes a target_downscaling_factor from the window of interest and buffer * size which is min(nXSize/nBufXSize, nYSize/nBufYSize). * It then walks through overviews and will select the first one whose * downscaling factor is greater than target_downscaling_factor / 1.2. * * Let's assume we have overviews at downscaling factors 2, 4 and 8. * The relationship between target_downscaling_factor and the select overview * level is the following one: * * target_downscaling_factor | selected_overview * ------------------------- | ----------------- * ]0, 2 / 1.2] | full resolution band * ]2 / 1.2, 4 / 1.2] | 2x downsampled band * ]4 / 1.2, 8 / 1.2] | 4x downsampled band * ]8 / 1.2, infinity[ | 8x downsampled band ``` With this PR, is is ammended with the following complement: ``` * Note that starting with GDAL 3.9, this 1.2 oversampling factor can be * modified by setting the GDAL_OVERVIEW_OVERSAMPLING_THRESHOLD configuration * option. Also note that starting with GDAL 3.9, when the resampling algorithm * specified in psExtraArg->eResampleAlg is different from GRIORA_NearestNeighbour, * this oversampling threshold defaults to 1. Consequently if there are overviews * of downscaling factor 2, 4 and 8, and that the desired downscaling factor is * 7.99, the overview of factor 4 will be selected for a non nearest resampling. ```
f6628ca
to
be6481c
Compare
Co-authored-by: Alessandro Pasotti <[email protected]>
I am seeing qgis doing some back and forth between the full-resolution data and the first overview, while only doing a small pan. I believe this is due to some numerical instability when calculating the downscaling factor, and the default GDAL_OVERVIEW_OVERSAMPLING_THRESHOLD=1 used.
This can be "fixed" by setting GDAL_OVERVIEW_OVERSAMPLING_THRESHOLD=1.01. I believe that the default value used for GDAL_OVERVIEW_OVERSAMPLING_THRESHOLD should be set to 1+epsilon in order to avoid this instability on commonly used zoom levels. |
…L_OVERVIEW_OVERSAMPLING_THRESHOLD = 1.0 Fixes OSGeo#9040 (comment)
should be fixed per #9100 |
…L_OVERVIEW_OVERSAMPLING_THRESHOLD = 1.0 Fixes OSGeo#9040 (comment)
…; add a GDAL_OVERVIEW_OVERSAMPLING_THRESHOLD config option
The current logic reads:
With this PR, is is ammended with the following complement: