troosh / openjpeg

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

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

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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. 

Original issue reported on code.google.com by stallma...@gmail.com on 25 Oct 2011 at 10:43

Attachments:

GoogleCodeExporter commented 9 years ago
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

Original comment by savmick...@gmail.com on 27 Oct 2011 at 1:14

Attachments:

GoogleCodeExporter commented 9 years ago
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. 

Original comment by stallma...@gmail.com on 27 Oct 2011 at 1:26

GoogleCodeExporter commented 9 years ago
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

Original comment by savmick...@gmail.com on 27 Oct 2011 at 1:41

GoogleCodeExporter commented 9 years ago
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?

Original comment by stallma...@gmail.com on 27 Oct 2011 at 2:03

GoogleCodeExporter commented 9 years ago
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

Original comment by savmick...@gmail.com on 27 Oct 2011 at 2:14

GoogleCodeExporter commented 9 years ago
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. 

Original comment by stallma...@gmail.com on 27 Oct 2011 at 10:21

GoogleCodeExporter commented 9 years ago
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

Original comment by savmick...@gmail.com on 28 Oct 2011 at 6:59

GoogleCodeExporter commented 9 years ago
I did a cut/paste of the SVN link you provided above. Is this not the correct 
link?

Original comment by stallma...@gmail.com on 28 Oct 2011 at 11:13

GoogleCodeExporter commented 9 years ago
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

Original comment by savmick...@gmail.com on 28 Oct 2011 at 4:18

GoogleCodeExporter commented 9 years ago
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!

Original comment by stallma...@gmail.com on 5 Nov 2011 at 1:46

GoogleCodeExporter commented 9 years ago
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. 

Original comment by stallma...@gmail.com on 6 Nov 2011 at 12:57

GoogleCodeExporter commented 9 years ago
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

Original comment by savmick...@gmail.com on 7 Nov 2011 at 10:31

GoogleCodeExporter commented 9 years ago

Original comment by savmick...@gmail.com on 9 Nov 2011 at 2:44