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

Chris Spencer spencercw at gmail.com
Sun Jul 19 15:50:23 CEST 2015


On 19 July 2015 at 14:30, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Chris Spencer <spencercw <at> gmail.com> writes:
>
>> > > -On Windows, you need to run the IDL files
>> > > through  <at> command{widl}.
>> > > +On Windows, you need to run the IDL files
>> > > through  <at> command{midl}.
>> >
>> > Is this intended?
>>
>> Yes, widl doesn't exist. The tool is called midl.
>
> Then please send a separate patch.

Ok.

>> > > +    } 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.

I don't really know what the codec_tag does; I just copied the values
from raw.c. What do I need to do with these?

Thanks,

Chris


More information about the ffmpeg-devel mailing list