[FFmpeg-devel] [PATCH 1/2] avfilter/vf_colorkey: Add colorkey video filter

Timo Rothenpieler timo at rothenpieler.org
Thu Jun 11 19:55:37 CEST 2015

>> +static int offset_r(int fmt)
> You can use the info in AVPixFmtDescriptor for these.

Didn't know about that, will look into it.

>> +    default:
>> +        return 0;
> av_assert0(!"reached"); for the default case.


>> +    frame->format = convert_format(frame->format);
> I am not sure this is legal. It would probably be wiser to allocate a new
> frame.

It should be fine, since the frame is made writeable and has noone else
using it. The memory layout of those pixel formats is 100% the same.

>> +    outlink->format = convert_format(avctx->inputs[0]->format);
> This is really not legal. You need to return EAGAIN from query_formats()
> until the input format is known.

Ah, so that's how it's supposed to be done!
So basicaly, i check if convert_format(avctx->inputs[0]->format) ==
avctx->outputs[0]->in_formats, and if not, return EAGAIN?

> Or you can solve both problems at once by requiring alpha on the input
> format and not doing any format change at all. I find that solution is the
> best.

Yeah, but that would insert another swscaler, and i'm not sure how well
it handles the conversion, but it propably adds another memcpy.
If it handles it without any overhead, that would propably be better.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150611/7cac0c57/attachment.asc>

More information about the ffmpeg-devel mailing list