Opened 6 years ago

Closed 4 years ago

Last modified 3 years ago

#4050 closed defect (fixed)

JP2KAK : offset in lossless unsigned int (16 bits)

Reported by: pinchonn Owned by: warmerdam
Priority: high Milestone: 1.11.0
Component: default Version: 1.9.0
Severity: blocker Keywords: kakadu lossless JP2KAK JPEG2000
Cc:

Description (last modified by pinchonn)

There is a problem with creating a lossless JPEG2000 image with JP2KAK (kakadu) from an unsigned int image : the output image has an +32768 offset. This offset seems to be constant.

The test image is an unsigned int TIFF image (see attachment).

I tried last GDAL versions : 1.8.1 and 1.9.0
Kakadu version is 6.4.1 (latest).
Platform is Linux Red Hat 5 64 bits.

To reproduce the bug :

gdal_translate -of JP2KAK -co QUALITY=100 input.tif out_gdal_translate.jp2

Using kakadu tools there is no problem :

kdu_compress -i input.tif -o out_kdu_compress.jp2 Creversible=yes Clayers=16

(Creversible is used instead of QUALITY=100)

Attachments (4)

input.zip (829.1 KB) - added by pinchonn 6 years ago.
input image
out_gdal_translate.jp2 (850.6 KB) - added by pinchonn 6 years ago.
ouput image created with gdal_translate
out_kdu_compress.jp2 (850.7 KB) - added by pinchonn 6 years ago.
output image created with kdu_compress
jp2kakdataset.cpp (104.3 KB) - added by GMaillet 5 years ago.
patched file to fix this problem

Change History (11)

Changed 6 years ago by pinchonn

Attachment: input.zip added

input image

Changed 6 years ago by pinchonn

Attachment: out_gdal_translate.jp2 added

ouput image created with gdal_translate

Changed 6 years ago by pinchonn

Attachment: out_kdu_compress.jp2 added

output image created with kdu_compress

comment:1 Changed 6 years ago by pinchonn

Severity: normalblocker
Version: unspecified1.8.0

comment:2 Changed 5 years ago by pinchonn

Resolution: fixed
Status: newclosed

comment:3 Changed 5 years ago by pinchonn

Description: modified (diff)
Keywords: JP2KAK JPEG2000 added
Resolution: fixed
Status: closedreopened
Version: 1.8.01.8.1

comment:4 Changed 5 years ago by pinchonn

Description: modified (diff)
Version: 1.8.11.9.0

comment:5 Changed 5 years ago by GMaillet

I had the same problem with 16-bit unsigned images. Pending an official correction I fix the problem by using 32 bit kdu_line_buf for reversible GDT_UInt16 images and substract the 32768 constant in the file frmts/jp2kak/jp2kakdataset.cpp.

Changed 5 years ago by GMaillet

Attachment: jp2kakdataset.cpp added

patched file to fix this problem

comment:6 Changed 4 years ago by Even Rouault

Milestone: 2.0
Resolution: fixed
Status: reopenedclosed

trunk r26626 "JP2KAK: fix creation of unsigned int16 with reversible compression (patch by GMaillet, #4050)"

comment:7 Changed 3 years ago by Even Rouault

Milestone: 2.01.11.0
Note: See TracTickets for help on using tickets.