[FFmpeg-devel] [PATCH] libopenjpeg GRAY16 decoding

Michael Bradshaw mbradshaw at sorensonmedia.com
Mon Jan 30 22:32:32 CET 2012


On Mon, Jan 30, 2012 at 2:02 PM, Paul B Mahol <onemda at gmail.com> wrote:

> On 1/30/12, Michael Bradshaw <mbradshaw at sorensonmedia.com> wrote:
> > On Mon, Jan 30, 2012 at 1:18 PM, Paul B Mahol <onemda at gmail.com> wrote:
> >
> >> On 1/30/12, Michael Bradshaw <mbradshaw at sorensonmedia.com> wrote:
> >> > Hi, attached patch adds support for decoding GRAY16 video with
> >> libopenjpeg.
> >> >
> >>
> >> Unrelated to this but if libopenjpeg supports planar YUVA444 it will
> >> be interpreted as rgba.
> >
> >
> > That is true, and YUV444 is currently interpreted as RGB (now that you
> > mention it I'll have to add YUVA444 to the encoder sometime).  Currently
> > the decoder doesn't check for any pixel format flags.  Would it be
> > beneficial if I (or someone) made a patch for the decoder that would
> allow
> > the user to force a decoding pixel format (only if it's a potentially
> valid
> > match)?  The only case I can think of it being needed is in decoding
> YUV444
> > and YUVA444.
>
> Decoder should not lie, e.g. claiming picture is rgba when infact it is
> not,
> and this should be correctly implemented from the begining
>
The problem is that the pixel format must be guessed when decoding.  It is
not stored in the J2K frames themselves.  That is why YUV444 and RGB are
indistinguishable in the decoder.  The other pixel formats are guessed
according to the # of components and the subsampling of each component.


> If pixel format is not supported it should be explicitly checked and
> file ignored.
>
Decoding of each pixel format can be supported, it is just difficult to
determine which pixel format to interpret it as.

It is bad idea to do pixel conversion in decoder itself.
>
It wouldn't be pixel conversion.  More like pixel format suggestion.  If
someone tried to decode a YUV420 video as YUV444, then yes, I think the
decoder should say there is an error and abort.  But in cases where two
pixel formats look exactly the same a suggestion or hint may be useful.


More information about the ffmpeg-devel mailing list