[gdal-dev] Possible interlaced 16-bit grayscale PNG read error
Ray at Daylon
rayg at daylongraphics.com
Sat Dec 28 10:01:50 PST 2024
That did the trick; thanks.
Ray
On 12/28/2024 9:15 AM, Even Rouault wrote:
> Hi,
>
> This should be fixed per https://github.com/OSGeo/gdal/pull/11553 . This
> is indeed a 25-year old issue. An indication of how 16-bit interlaced
> PNGs are popular :-)
>
> Even
>
> Le 28/12/2024 à 10:42, Ray at Daylon via gdal-dev a écrit :
>> In GDAL 1.8.0 on little-endian platforms like x64, the PNG driver will
>> not byteswap pixels from network order (big endian) to little-endian
>> if the PNG is interlaced (or at least if it's 16-bit grayscale
>> interlaced).
>>
>> Does anyone know if this was corrected in a future version?
>>
>> In pngdataset.cpp, PNGDataset::LoadScanline() has this code:
>>
>> if( bInterlaced )
>> return LoadInterlacedChunk( nLine );
>>
>> The early return causes this downstream byteswapping section:
>>
>> if( nBitDepth == 16 )
>> GDALSwapWords( row, 2, GetRasterXSize() * GetRasterCount(), 2 );
>>
>> to be skipped.
>>
>> LoadInterlacedChunk() as far as I can tell even in 3.9.2. doesn't
>> do any byteswapping.
>>
>>
>> Ray Gardener
>>
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
More information about the gdal-dev
mailing list