Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decode error on the attached JPEG...works in KDU and with JASPER...please help! #101

Closed
gcode-importer opened this issue Oct 25, 2011 · 13 comments

Comments

@gcode-importer
Copy link

Originally reported on Google Code with ID 101

What steps will reproduce the problem?
1. Try to decode the attached image with OpenJPEG 


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

Decode error. 

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

Linux RHEL 5.7. Latest version of Open JPEG (downloaded and buit on Oct 21, 2011)

Please provide any additional information below.

This file will open with KDU, Fast stone and Jasper. It was produced from an ADV212.


Reported by stallman65 on 2011-10-25 22:43:52


- _Attachment: [test2.jp2](https://storage.googleapis.com/google-code-attachments/openjpeg/issue-101/comment-0/test2.jp2)_
@gcode-importer
Copy link
Author

Hi,

Which version did you use, trunk or branch 1.5 ?

With the last trunk version and the 1.5 with Ubuntu 10.4, I can decode the jp2 file
(see the attachments). 

Could you submit an experimental of your platform to the dashboard ?

Mickael

Reported by savmickael on 2011-10-27 13:14:06


- _Attachment: test2.png
![test2.png](https://storage.googleapis.com/google-code-attachments/openjpeg/issue-101/comment-1/test2.png)_

@gcode-importer
Copy link
Author

I am running Redhat Enterprise Linux 5.7 (latest patches) and I downloaded and built


openjpeg_v1_4_sources_r697.tgz

I get decode errors when running the tools and I also get the same decode error when
I call the api directly in my code. Here is the code snippet (mostly taken from the
sample code provided). The primary difference is I get chunks of the frame over a udp
socket which I assemble into a QByteArray. I know I'm reassembling the packets correctly
because the .jp2 I posted is the frame serialized to a file: 

    /* set decoding parameters to default values */
      opj_set_default_decoder_parameters(parameters);

    /* read the input file and put it in memory */

    src = (unsigned char*) frame->data();

    /* JPEG-2000 codestream */

    /* get a decoder handle */
    dinfo = opj_create_decompress(CODEC_JP2);

    /* setup the decoder decoding parameters using user parameters */

    opj_setup_decoder(dinfo, parameters);

    /* open a byte stream */
    cio = opj_cio_open((opj_common_ptr)dinfo, src, frame->size()+1);

    /* decode the stream and fill the image structure */
    image = opj_decode(dinfo, cio);
    if (!image) qDebug (QString ("image decode error").toAscii());

    /* close the byte stream */
    opj_cio_close(cio);

frame is a QByteArray which contains the entire frame data. 

Reported by stallman65 on 2011-10-27 13:26:14

@gcode-importer
Copy link
Author

What is the output of j2k_to_image tools with test2.jp2 file ?
Could you please try with the last version of the openjpeg branches 1.5 via a svn checkout
?

Mickaël

Reported by savmickael on 2011-10-27 13:41:32

@gcode-importer
Copy link
Author

j2k_to_image -i test.jp2 -o test.bmp

ERROR -> j2k_to_image: failed to decode image!

I can certainly try the latest 1.5. Should I just do a svn checkout or is there a tarball
somewhere I can grab?

Reported by stallman65 on 2011-10-27 14:03:25

@gcode-importer
Copy link
Author

ok
No info, bad news

I could use it 
svn checkout http://openjpeg.googlecode.com/svn/branches/openjpeg-1.5 
and try to decode with it. I hope it will give us more details...

Mickael

Reported by savmickael on 2011-10-27 14:14:30

@gcode-importer
Copy link
Author

I was able to compile under ubuntu as well...Redhat is giving me fits about needing
a bunch of newer versions of various tools to compile. My question is this: do I need
to change any of the above source code? I noticed a bunch of new _v2 methods but they
appear to be related to the type of input stream. 

Reported by stallman65 on 2011-10-27 22:21:08

@gcode-importer
Copy link
Author

You must not used the trunk version, it must be considered as quite unstable.

Use the branch 1.5,which is the next release and which don't use _v2 function which
break API.

Try with 1.5 please.

Mickael

Reported by savmickael on 2011-10-28 06:59:33

@gcode-importer
Copy link
Author

I did a cut/paste of the SVN link you provided above. Is this not the correct link?

Reported by stallman65 on 2011-10-28 11:13:36

@gcode-importer
Copy link
Author

It is the right place but in this version you must not see _v2 suffix version. 
With this version you could use the same api as in your previous code

Mickael

Reported by savmickael on 2011-10-28 16:18:09

@gcode-importer
Copy link
Author

It seems to work just fine under Ubuntu but not under Redhat. I compiled it under both
operating systems from SVN. The output from Redhat is: 

[ERROR] 0000584e: expected a marker instead of 0
[ERROR] Failed to decode J2K image
ERROR -> j2k_to_image: failed to decode image!

Reported by stallman65 on 2011-11-05 13:46:48

@gcode-importer
Copy link
Author

I have been able to resolve the problem but I'm not sure if it is a OpenJPEG issue or
an issue with how the ADV212 is sending data. The solution is that the image producer
is end all packets on a 32 bit boundary. This leads to padding at the end of the frame.
I was able to strip off the padding and all is well. Not sure what the JPEG2K spec
says about this but I suspect it requires the frame to end with an EOC marker. 

Reported by stallman65 on 2011-11-06 12:57:55

@gcode-importer
Copy link
Author

Hi,

Yes we need the EOC merker.
This is why you get the error about expected marker.

I hope you can use openjpeg although this problem from ADV212.

Best
Mickael

Reported by savmickael on 2011-11-07 10:31:22

@gcode-importer
Copy link
Author

Reported by savmickael on 2011-11-09 14:44:53

  • Status changed: Invalid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant