Opened 15 years ago

Closed 13 years ago

#1596 closed defect (fixed)

JP2 creation not opening resulting JP2 with same driver

Reported by: kyngchaos Owned by: Even Rouault
Priority: normal Milestone: 1.7.0
Component: default Version: unspecified
Severity: normal Keywords: jasper
Cc: Mateusz Łoskot


When creating a JP2 with any(?) of the JP2 drivers, the driver seems to want to open the resulting JP2. It may not use the same driver to do this, which can affect the processing time if the 2nd driver is slower at this. As an example (considering the default load order in gdalallregister(), and only the ECW and JasPer drivers built), the ECW JP2 driver is used to create a JP2 (-of JP2ECW), but after it's created the JasPer driver reads the JP2.

From Frank's email discussing the problem:

But one possibility is that the JPEG2000 driver is being used to reopen the file, and is loading the whole thing.

It is the nature of the GDALCreateCopy() function that it returns a handle to the resulting file. Most drivers implement this by GDALOpen()ing the file when they are done writing. I wonder if perhaps the JPEG2000 (JasPer) driver is getting used for this reopening in the slow case. I *think* it reads the whole image into memory on open so that could take a while.

Either the driver needs to make sure the same driver is used to open the file to do it's thing, or some other way than opening the file should be used to get that file handle (or at least it shouldn't read the whole file, that sounds totally unnecessary and wasteful).

Change History (3)

comment:1 by Mateusz Łoskot, 14 years ago

Cc: Mateusz Łoskot added
Keywords: jasper added

comment:2 by Even Rouault, 13 years ago

Owner: changed from warmerdam to Even Rouault

Fixed in trunk in r17906.

I've a patch ready for 1.6 branch as well, but I'd appreciate feedback before backporting (in particular I did a change in the JP2KAK driver, but I can't compile it not having Kakadu)

comment:3 by Even Rouault, 13 years ago

Milestone: 1.7.0
Resolution: fixed
Status: newclosed

Closing. Wouldn't make much sense to push that in 1.6.X at that point of the maintenance of the 1.6 branch.

Note: See TracTickets for help on using tickets.