[FFmpeg-devel] [PATCH] avfilter/vf_overlay: add premultiplied alpha mode

Paul B Mahol onemda at gmail.com
Sat Dec 2 12:33:44 EET 2017


On 12/2/17, Marton Balint <cus at passwd.hu> wrote:
>
>
> On Sat, 2 Dec 2017, Paul B Mahol wrote:
>
>> On 12/2/17, Marton Balint <cus at passwd.hu> wrote:
>>>
>>>
>>> On Fri, 1 Dec 2017, Paul B Mahol wrote:
>>>
>>>> Signed-off-by: Paul B Mahol <onemda at gmail.com>
>>>> ---
>>>> doc/filters.texi         |   4 ++
>>>> libavfilter/vf_overlay.c | 160
>>>> ++++++++++++++++++++++++++++++++++++++++-------
>>>> 2 files changed, 140 insertions(+), 24 deletions(-)
>>>>
>>>> diff --git a/doc/filters.texi b/doc/filters.texi
>>>> index f7c371592f..0699728b7e 100644
>>>> --- a/doc/filters.texi
>>>> +++ b/doc/filters.texi
>>>> @@ -11328,6 +11328,10 @@ Default value is @samp{yuv420}.
>>>>
>>>> @item repeatlast
>>>> See @ref{framesync}.
>>>> +
>>>> + at item alpha
>>>> +Set format of alpha, it can be @var{straight} or @var{premultiplied}.
>>>> +Default is @var{straight}.
>>>> @end table
>>>
>>> Does this mean that not only overlay, but input and output is also
>>> considered as premultiplied? Maybe better to clarify this in the docs.
>>
>> I done it for overlay only alpha. For rest I'm little confused what needs
>> doing.
>
> Ok, then just write in the docs:
>
> "Set format of alpha of the overlaid video."

Fixed locally, thanks!

>
>>
>>>
>>> Have you measured the slowdown caused by the extra condition in the pixel
>>> blending code? If it is more than 1-2%, then some DEFINE magic (or
>>> making the blend_image functions inline?) would be better IMHO.
>>
>> It should already be inlined. Thats why there are so many functions.
>
> Not all of them, blend_image_packed_rgb misses an av_always_inline.
>

Fixed locally, thanks!


More information about the ffmpeg-devel mailing list