From cf0260ec2d9faff691a41472a6e516bce30a0ded Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 13 Nov 2024 17:45:24 +0100 Subject: [PATCH] OpenJPEG: add a TPSOT_COMPLIANT open option that defaults to YES Fixes the issue reported in https://lists.osgeo.org/pipermail/gdal-dev/2024-November/059805.html Requires openjpeg >= https://github.com/uclouvain/openjpeg/pull/1560 (likely 2.5.3 when it is released) --- doc/source/drivers/raster/jp2openjpeg.rst | 10 ++++++++++ frmts/openjpeg/openjpegdrivercore.cpp | 3 +++ frmts/openjpeg/opjdatasetbase.h | 19 ++++++++++++++++++- frmts/opjlike/jp2opjlikedataset.cpp | 7 ++++++- frmts/opjlike/jp2opjlikedataset.h | 1 + 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/doc/source/drivers/raster/jp2openjpeg.rst b/doc/source/drivers/raster/jp2openjpeg.rst index a244542319d1..1ce5d9f6df39 100644 --- a/doc/source/drivers/raster/jp2openjpeg.rst +++ b/doc/source/drivers/raster/jp2openjpeg.rst @@ -119,6 +119,16 @@ The following open options are available: the image is single-tiled. Note however that the tile size must not exceed 2 GB since that's the limit supported by GDAL. +- .. oo:: TPSOT_COMPLIANT + :choices: YES, NO + :default: YES + :since: 3.11 + + (OpenJPEG >= 2.5.3) Assume that a multi-tilepart file is compliant with + respect to the TPSOT value. Turn that setting to NO only if you may deal + with non-compliant files such as the ones of https://github.com/uclouvain/openjpeg/pull/514 . + Default behavior prior to OpenJPEG 2.5.3 was equivalent to YES. + Creation Options ---------------- diff --git a/frmts/openjpeg/openjpegdrivercore.cpp b/frmts/openjpeg/openjpegdrivercore.cpp index 5a9d592b7f09..ee4f2282f814 100644 --- a/frmts/openjpeg/openjpegdrivercore.cpp +++ b/frmts/openjpeg/openjpegdrivercore.cpp @@ -101,6 +101,9 @@ void OPENJPEGDriverSetCommonMetadata(GDALDriver *poDriver) "description='Whether to always use the JPEG-2000 block size as " "the " "GDAL block size' default='NO'/>" + "