You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After create a COG via CreateCopy() with the GTIFF driver and an explicit mask, the mask read back doesn't preserve the original bytes. When we read back the mask, the mask is expanded from the 1-bit mask to the 8-bit mask through the pathway of gtiffoddbitsband.h which is the correct path. However, the mask is not a 1-bit mask when I add logging in this file; instead, it's the original 8-bit mask (with 255s and 0s). So when it gets expanded to 8-bits, it's no longer the original mask:
E.g.,
The mask 255 0 255 255 is stored verbatim and becomes 255 255 ... 255 255 0 0 ... 0 0 255 255
Instead of being stored as 128 (10000000) 192 (11000000) which becomes 255 0 255 255.
So my guess is that somewhere along the line we either copy the mask without turning it back into a bitmask, or we lose metadata tracking that the mask is encoded a certain way.
The issue does not occur when either COPY_SRC_OVERVIEWS="YES" is removed or INTERLEAVE is set to PIXEL (it only fails on band interleaving). This is using the 'GTiff' driver.
What is the bug?
After create a COG via CreateCopy() with the GTIFF driver and an explicit mask, the mask read back doesn't preserve the original bytes. When we read back the mask, the mask is expanded from the 1-bit mask to the 8-bit mask through the pathway of gtiffoddbitsband.h which is the correct path. However, the mask is not a 1-bit mask when I add logging in this file; instead, it's the original 8-bit mask (with 255s and 0s). So when it gets expanded to 8-bits, it's no longer the original mask:
E.g.,
The mask 255 0 255 255 is stored verbatim and becomes 255 255 ... 255 255 0 0 ... 0 0 255 255
Instead of being stored as 128 (10000000) 192 (11000000) which becomes 255 0 255 255.
So my guess is that somewhere along the line we either copy the mask without turning it back into a bitmask, or we lose metadata tracking that the mask is encoded a certain way.
The issue does not occur when either COPY_SRC_OVERVIEWS="YES" is removed or INTERLEAVE is set to PIXEL (it only fails on band interleaving). This is using the 'GTiff' driver.
Steps to reproduce the issue
Example gist: https://gist.github.com/orglofch/40cf4d9136978b0384141cc74d1039b6.
The final mask is 0 0 255 255 instead of 0 255 255 255.
Versions and provenance
In current master head. This failure only started occurring after 3bdc81a.
Additional context
No response
The text was updated successfully, but these errors were encountered: