[FFmpeg-devel] [PATCH 3/3] avdevice/decklink: Add support for decoding 8-bit RGB formats.

Reuben Martin reuben.m at gmail.com
Thu Jul 23 04:57:28 CEST 2015


On Monday, July 20, 2015 05:52:25 PM you wrote:
> On 20 July 2015 at 17:41, Reuben Martin <reuben.m at gmail.com> wrote:
> > On Sunday, July 19, 2015 02:50:23 PM Chris Spencer wrote:
> >> On 19 July 2015 at 14:30, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> >> > Chris Spencer <spencercw <at> gmail.com> writes:
> >> >> > > +    } else if (cctx->pixel_format == AV_PIX_FMT_ARGB) {
> >> >> > > +        ctx->bmd_format = bmdFormat8BitARGB;
> >> >> > > +    } else if (cctx->pixel_format == AV_PIX_FMT_BGRA) {
> >> >> > > +        ctx->bmd_format = bmdFormat8BitBGRA;
> >> >> > > 
> >> >> > > +    } else if (ctx->bmd_format == bmdFormat8BitARGB) {
> >> >> > > +        st->codec->codec_id    = AV_CODEC_ID_RAWVIDEO;
> >> >> > > +        st->codec->pix_fmt     = AV_PIX_FMT_ARGB;
> >> >> > > +        st->codec->codec_tag   = MKTAG('A', 'R', 'G', 'B');
> >> >> > > +    } else if (ctx->bmd_format == bmdFormat8BitBGRA) {
> >> >> > > +        st->codec->codec_id    = AV_CODEC_ID_RAWVIDEO;
> >> >> > > +        st->codec->pix_fmt     = AV_PIX_FMT_BGRA;
> >> >> > > +        st->codec->codec_tag   = MKTAG('B', 'G', 'R', 'A');
> >> >> > 
> >> >> > I would have expected these to be AV_PIX_FMT_0RGB and
> >> >> > AV_PIX_FMT_BGR0.
> >> >> 
> >> >> The Blackmagic documentation is kind of strange on this
> >> >> one actually. For bmdFormat8BitBGRA it says "alpha
> >> >> channel is valid". For bmdFormat8BitBGRA it says "alpha
> >> >> channel may be valid". Not sure how best to deal with
> >> >> that to be honest.
> >> > 
> >> > Can you test?
> >> > Is there a theoretical possibility that the content
> >> > contains valid alpha? If yes, please use ARGB.
> >> > If not and if you can confirm that the alpha channel
> >> > is correctly set to 0xFF, then you may use ARGB but I
> >> > wonder what the usecase would be (and how probable it
> >> > is that a future driver would not set it to 0xFF).
> >> > The codec_tag looks wrong to me because it would be
> >> > 0x00 for AV_PIX_FMT_ARGB and AV_PIX_FMT_BGRA. I think
> >> > it should only be set if needed (for YV12 or similar).
> >> 
> >> Ok so with the HDMI input connected to my graphics card the alpha
> >> channel is zero with both ARGB and BGRA (which explains why I couldn't
> >> get the overlay filter to work with it now that I think about it). I
> >> will add bgr0 and 0rgb, but I wonder if it's worth leaving bgra and
> >> argb in, as the Blackmagic documentation seems to imply the alpha
> >> channel might be present in some situation.
> > 
> > Alpha channel is valid in the SDI spec, although not widely supported.
> > Perhaps this can be used in the SDI output from decklink “extream” models
> > that offer separate sync locked outputs for key and fill? I have access
> > to such a card if you would want that tested.
> 
> That's interesting, I didn't know that. What might be a useful test
> would be to output some ARGB/BGRA video with some data in the alpha
> channel on one output, connect it directly to the other input and
> check whether the alpha channel is preserved. If it is then it is
> probably worth allowing argb/bgra in addition to 0rgb/bgr0 in ffmpeg.
> 
> I don't have a card that can do that, so if you're able to test that
> would be super.
> 
I applied your patches to latest stable 2.7.2, but I just now realized that 
the additional pix formats are only applied to the capture interface, and not 
the playout interface. So I really have no means to test it. Is this a 
limitation of the SDK, or has the additional pix formats not yet been added to 
the playout interface?

-Reuben

** Just noticed this got lost from the official mailing list at some point. Re-
sending for ffdevel...


More information about the ffmpeg-devel mailing list