[FFmpeg-devel] [PATCH] acvodec/lipopenjpeg: Improve XYZ color space detection

Vilius Grigaliūnas vilius.grigaliunas at gmail.com
Tue Mar 3 07:56:20 CET 2015

On Tue, Mar 3, 2015 at 4:35 AM, Michael Bradshaw <mjbshaw at gmail.com> wrote:
> You can use the -pix_fmt option to specify the pixel format of the source.
> The openjpeg decoder will try that pixel format first before iterating
> through its (prioritized) list of pixel formats. That should provide a way
> to work around this (until it's fixed).

First thing I tried, did not work: Option pixel_format not found.

>> On Tue, Mar 3, 2015 at 12:49 AM, Michael Bradshaw <mjbshaw at gmail.com>
> That's a good point. The downside is that it breaks autodetecting RGB in
> J2K/JPC (which don't have the color space info stored in the file format).
> Perhaps XYZ should be tried first if the file is a JP2 file (since openjpeg
> should have detected if it was RGB otherwise, so we can assume it's not
> RGB), and RGB should be tried first if it's a J2K file (since RGB is more
> common). That way, autodetecting RGB in J2K is not broken, and detecting XYZ
> in JP2 should work.
> Thoughts from anyone on this?

The problem with trying RGB before XYZ is that
libopenjpeg_matches_pix_fmt matches rgb48le before xyz12le is even
considered. But I see the problem with J2K files. Maybe I can improve
libopenjpeg_guess_pix_fmt so it handles all cases correctly.

> Okay, but it should go in a separate patch. Also, instead of doing two
> shifts, just add desc->comp[index].shift to adjust[index] (before the big
> main loop) so only one shift is needed each iteration.

OK, I will make this a separate patch.

More information about the ffmpeg-devel mailing list