After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 767844 - gstopenjpegdec fails to decode jp2 image
gstopenjpegdec fails to decode jp2 image
Status: RESOLVED INVALID
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-06-19 20:39 UTC by Aaron Boxer
Modified: 2016-06-20 20:59 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Aaron Boxer 2016-06-19 20:39:12 UTC
The following image fails to display

https://github.com/uclouvain/openjpeg-data/blob/master/input/conformance/file1.jp2

using the following pipeline:

uridecodebin uri=file:///path/to/file ! imagefreeze ! videoconvert ! ximagesink

with error from gstopenjpegdec:

Failed to decode openjpeg stream
Comment 1 Aaron Boxer 2016-06-19 20:45:26 UTC
Note: I am using openjpeg 2.1
Comment 2 Aaron Boxer 2016-06-19 20:46:09 UTC
The header is not being read.
Comment 3 Aaron Boxer 2016-06-19 21:19:55 UTC
Header is being read, but there is an error:

Tile size read from header is much larger than the number of bytes in the openjpeg stream.
Comment 4 Aaron Boxer 2016-06-19 22:01:23 UTC
My bad: using an inappropriate pipeline.

multifilesrc location=test.jp2 num-buffers=1 caps=image/jp2 !
openjpegdec ! imagefreeze ! videoconvert ! ximagesink

works fine.
Comment 5 Thiago Sousa Santos 2016-06-19 23:05:35 UTC
uridecodebin should be able to figure out the format and caps for you. It should work just like it works with your custom pipeline.
Comment 6 Thiago Sousa Santos 2016-06-19 23:06:50 UTC
Is this a duplicate of #767512 ?
Comment 7 Aaron Boxer 2016-06-20 00:19:02 UTC
(In reply to Thiago Sousa Santos from comment #6)
> Is this a duplicate of #767512 ?

Nope. 767512 is for an enhancement to the new j2k parser.
Comment 8 Aaron Boxer 2016-06-20 00:20:20 UTC
(In reply to Thiago Sousa Santos from comment #5)
> uridecodebin should be able to figure out the format and caps for you. It
> should work just like it works with your custom pipeline.

Thanks. The problem here is that openjpegdec assumes that the entire frame is available before it decodes. With the first pipeline, it looks like only 
4096 bytes was available, and the decoder errored out.
Comment 9 Aaron Boxer 2016-06-20 18:30:41 UTC
I'm going to close this again.  openjpegdec was designed with the assumption that it has the entire frame available. The fact that uridecodebin is not buffering the data in frame size chunks is not a bug.
Comment 10 Tim-Philipp Müller 2016-06-20 18:37:59 UTC
yes, you can specify blocksize=99999999 or such or use multifilesrc to make it read the entire input file in one go (in absence of a parser).
Comment 11 Aaron Boxer 2016-06-20 19:00:17 UTC
(In reply to Tim-Philipp Müller from comment #10)
> yes, you can specify blocksize=99999999 or such or use multifilesrc to make
> it read the entire input file in one go (in absence of a parser).

We now have a j2k parser: can uridecodebin be made to use this parser? Because then the pipeline would work.
Comment 12 Aaron Boxer 2016-06-20 19:01:14 UTC
it would work for raw codestream .j2k files
Comment 13 Tim-Philipp Müller 2016-06-20 20:59:37 UTC
The parser will be plugged if typefind can determine the type to a suitable extent (including all fields listed for the source caps in the template, ie. colorspace or sampling field).