Even,

Thanks!

I did built gdal 2.2.4 with openjpeg 2.1.2 on a docker container and that solves the simple case of:

gdalinfo -stats /data/850011.jp2

but it still fails with:

root@436a09289084:/usr/local# gdal_translate -of GTiff -co TILED=YES /data/850011.jp2 /data/850011.tif
Input file size is 29364, 25856
0ERROR 1: psImage->comps[0].data == NULL
ERROR 1: /data/850011.jp2, band 1: IReadBlock failed at X offset 0, Y offset 0
ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0

In my Dockerfile, I have:

# Compile and install OpenJPEG
RUN cd src && tar -xvf openjpeg-${OPENJPEG_VERSION}.tar.gz && cd openjpeg-${OPENJPEG_VERSION}/ \
    && mkdir build && cd build \
    && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$ROOTDIR \
    && make && make install && make clean \
    && cd $ROOTDIR && rm -Rf src/openjpeg*

Any idea how that should change to apply your pull request so I can test that?

-Steve

$ docker run -v $(pwd):/data -t -i gdal2:local  /bin/bash
root@436a09289084:/usr/local# gdalinfo -stats /data/850011.jp2
Driver: JP2OpenJPEG/JPEG-2000 driver based on OpenJPEG library
Files: /data/850011.jp2
       /data/850011.jp2.aux.xml
Size is 29364, 25856
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (50.811767578125000,18.406654712112974)
Pixel Size = (0.000020390753690,-0.000020390753690)
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (  50.8117676,  18.4066547) ( 50d48'42.36"E, 18d24'23.96"N)
Lower Left  (  50.8117676,  17.8794314) ( 50d48'42.36"E, 17d52'45.95"N)
Upper Right (  51.4105217,  18.4066547) ( 51d24'37.88"E, 18d24'23.96"N)
Lower Right (  51.4105217,  17.8794314) ( 51d24'37.88"E, 17d52'45.95"N)
Center      (  51.1111446,  18.1430430) ( 51d 6'40.12"E, 18d 8'34.95"N)
Band 1 Block=1024x1024 Type=Byte, ColorInterp=Red
  Min=122.000 Max=254.000
  Minimum=122.000, Maximum=254.000, Mean=204.487, StdDev=9.596
  Overviews: 14682x12928, 7341x6464, 3670x3232, 1835x1616, 917x808
  Overviews: arbitrary
  Metadata:
    STATISTICS_MAXIMUM=254
    STATISTICS_MEAN=204.48710711705
    STATISTICS_MINIMUM=122
    STATISTICS_STDDEV=9.596017845156
  Image Structure Metadata:
    COMPRESSION=JPEG2000
Band 2 Block=1024x1024 Type=Byte, ColorInterp=Green
  Min=98.000 Max=239.000
  Minimum=98.000, Maximum=239.000, Mean=178.492, StdDev=10.197
  Overviews: 14682x12928, 7341x6464, 3670x3232, 1835x1616, 917x808
  Overviews: arbitrary
  Metadata:
    STATISTICS_MAXIMUM=239
    STATISTICS_MEAN=178.49220443461
    STATISTICS_MINIMUM=98
    STATISTICS_STDDEV=10.197171404633
  Image Structure Metadata:
    COMPRESSION=JPEG2000
Band 3 Block=1024x1024 Type=Byte, ColorInterp=Blue
  Min=63.000 Max=215.000
  Minimum=63.000, Maximum=215.000, Mean=145.743, StdDev=14.060
  Overviews: 14682x12928, 7341x6464, 3670x3232, 1835x1616, 917x808
  Overviews: arbitrary
  Metadata:
    STATISTICS_MAXIMUM=215
    STATISTICS_MEAN=145.74315841763
    STATISTICS_MINIMUM=63
    STATISTICS_STDDEV=14.060045889747
  Image Structure Metadata:
    COMPRESSION=JPEG2000
root@436a09289084:/usr/local# gdal_translate -of GTiff /data/850011.jp2 /data/850011.tif
Input file size is 29364, 25856
0ERROR 1: psImage->comps[0].data == NULL
ERROR 1: /data/850011.jp2, band 1: IReadBlock failed at X offset 0, Y offset 0
ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0

root@436a09289084:/usr/local# gdal_translate -of GTiff -co TILED=YES /data/850011.jp2 /data/850011.tif
Input file size is 29364, 25856
0ERROR 1: psImage->comps[0].data == NULL
ERROR 1: /data/850011.jp2, band 1: IReadBlock failed at X offset 0, Y offset 0
ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0

On 6/20/2018 10:27 AM, Even Rouault wrote:
On mardi 19 juin 2018 23:07:24 CEST Stephen Woodbridge wrote:
I tried the following:

git clone https://github.com/GeographicaGS/Docker-GDAL2.git
cd Docker-GDAL2/2.2.4
#Edit Dockerfile and set 'ENV OPENJPEG_VERSION 2.3.0'
docker build -t gdal2:local ./
cd /path/to/jp2
docker run -t -i gdal2:local -v $(pwd):/data /bin/bash
gdalinfo -stats /data/850011.jp2

And got the same errors.

Even, I sent you a link to download the file from my dropbox.
Steve,

I've investigated and those JPEG2000 files have a particular characteristic
that triggered a regression dating back to openjpeg 2.2.0

I've just fixed it in openjpeg master per
https://github.com/uclouvain/openjpeg/pull/1121

So I'd suggest you to track openjpeg master (or revert back to 2.1.2, but
you'll loose performance optimizations)

Note: the sample file you provided to me has also a non-conformity (declaring
codestream "Profile 0" but with tile dimensions of 1024x1024 instead of
128x128 as expected) in the codestream header, as pointed by Kakadu, but that
is not critical

Even



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to