RealmeIP / openjpeg

Automatically exported from code.google.com/p/openjpeg
Other
0 stars 0 forks source link

Problem with LAB images? #234

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1.I rendered the PDF 
http://www.eci.org/_media/downloads/altona_test_suite/eci_altona-test-suite-v2_t
echnical2_x4.pdf with poppler and the openjpeg library (bot released 2.0.0 and 
svn trunk), but I wasn't able to render two of the jp2 compressed images. 
2. Then I extract all the images of that PDF and opened the .jp2 image files 
with Adobe Photoshop, all of them with success.
3. Then I used opj_decompress with the extacted .jp2 files. I could decompress 
all beside the two attached images. The difference to the images I could 
decompress is that these both images are in LAB colorspace (according what 
Photoshop says!) 

What is the expected output? What do you see instead?

Even if opj_decompress will not be able to convert these two images to PGM, the 
library should not refuse such images. poppler would be able to read LAB images 
but cannot convert them because it doesn't get the image data from openjpeg.

What version of the product are you using? On what operating system?

openjpeg 2.0.0 and svn trunk on Ubuntu 12.0.4

Please provide any additional information below.

The error message for both images with opj_decompress is:
[ERROR] Bad BPCC header box (bad size)
ERROR -> opj_decompress: failed to read the header

Original issue reported on code.google.com by thomas.f...@gmail.com on 3 Sep 2013 at 1:01

Attachments:

GoogleCodeExporter commented 8 years ago
The problem is in jp2.c in this code fragment:

    if (jp2->meth == 1) {
        if (p_colr_header_size != 7) {
            opj_event_msg(p_manager, EVT_ERROR, "Bad BPCC header box (bad size)\n");
            return OPJ_FALSE;
        }

        opj_read_bytes(p_colr_header_data,&jp2->enumcs ,4);         /* EnumCS */
    }

The problem is that p_colr_header_size is 35 (I think some additional values 
for LAB). If I comment the return

    if (jp2->meth == 1) {
        if (p_colr_header_size != 7) {
            opj_event_msg(p_manager, EVT_ERROR, "Bad BPCC header box (bad size)\n");
//          return OPJ_FALSE;
        }

        opj_read_bytes(p_colr_header_data,&jp2->enumcs ,4);         /* EnumCS */

everything works like a charme

Original comment by thomas.f...@gmail.com on 4 Sep 2013 at 12:56

GoogleCodeExporter commented 8 years ago
According to http://www.jpeg.org/public/15444-2annexm.pdf the 
p_colr_header_size of 35 is correct for ecumcs=14, because CieLAB has here 7 
additional 32 bit values following the enumcs entry.

Original comment by thomas.f...@gmail.com on 4 Sep 2013 at 1:27

GoogleCodeExporter commented 8 years ago

Original comment by mathieu.malaterre on 25 Feb 2014 at 3:48

GoogleCodeExporter commented 8 years ago
This issue has been fixed in r2464. Closing.

Original comment by mathieu.malaterre on 26 Feb 2014 at 4:35