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

Vilius Grigaliūnas vilius.grigaliunas at gmail.com
Tue Mar 3 11:04:10 CET 2015

On Tue, Mar 3, 2015 at 11:40 AM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Doesn't this break rgb48 images?

No, it does not break rgb48. They are not affected by this change. Due
to the way libopenjpeg_matches_pix_fmt is implemented, rgb48 can match
xyz12, but xyz12 can not match rgb48. So the order of formats matter,
it should be in increasing depth. With the previous format order xyz12
was never checked, because rgb48 would have been incorrectly selected

This line is the reason for this:
106: desc->comp[2].depth_minus1 + 1 >= image->comps[2].prec

Since 16 >= 12, rgb48 matches and xyz12 is not even considered. I do
not know, why >= is used here instead of ==, but I do not want to
change too much.

> Could you explain how I can reproduce your issue?

There is a sample in https://trac.ffmpeg.org/ticket/2586 but it is
black, so you wold not see the issue visually. But any digital cinema
file would do, like the ones produced by OpenDCP or DCP-o-matic.

The command line to reproduce is:

ffmpeg -c:v libopenjpeg -i fdfcde74_excerpt_000000-000023.mxf

Unpached ffmpeg displays pixel format as rgb48le, should be xyz12le.

More information about the ffmpeg-devel mailing list