[FFmpeg-soc] [PATCH] updated! vf_overlay alpha patch and watermarking using PNG with alpha
Baptiste Coudurier
baptiste.coudurier at gmail.com
Wed May 12 02:27:44 CEST 2010
Hi Vitor,
On 12/08/2009 10:37 AM, Vitor Sessak wrote:
> Stefano Sabatini wrote:
>> On date Tuesday 2009-12-01 00:57:59 +0100, Stefano Sabatini encoded:
>>> On date Tuesday 2009-12-01 00:50:50 +0100, Vitor Sessak encoded:
>> [...]
>>> I'm fine with committing the patch to soc if tested, even better would
>>> be to try to push the filter to the main repo. Does someone want to
>>> volunteer for this?
>>
>> A somehow tinied-up version which can be used as a base for SVN
>> inclusion,
>
> Nice work!
>
>> I believe we should get rid of the blend parameter, also
>> the expression evaluation may stay in a successive commit.
>
> Do you have any idea of how to get rid of it? Are you planning to
> implement Michael's suggestion of calling swscale to convert one of the
> inputs to the right pixel format?
>
> A few comments...
>
>
> > static int query_formats(AVFilterContext *ctx)
> > {
> > OverlayContext *over = ctx->priv;
> >
> > if (over->blend) {
> > enum PixelFormat pix_fmts1[] = { PIX_FMT_YUV420P, PIX_FMT_NONE };
> > enum PixelFormat pix_fmts2[] = { PIX_FMT_YUVA420P, PIX_FMT_NONE };
>
> these can be const.
>
> > } else {
> > avfilter_default_query_formats(ctx);
>
> Are all lavfi formats supported?
>
> >
> > static void copy_blended( uint8_t *out, int out_linesize,
> > const uint8_t *in, int in_linesize,
> > const uint8_t *alpha, int alpha_linesize,
> > int w, int h, int hsub, int vsub)
> > {
> > int x, y;
> >
> > for (y = 0; y < h; y++) {
> > uint8_t *outp = out + y * out_linesize;
> > const uint8_t *inp = in + y * in_linesize;
> > const uint8_t *alphap = alpha + (y<<vsub) * alpha_linesize;
> >
> > for (x = 0; x < w; x++) {
> > *outp = (*outp * (0xff - *alphap) + *inp * *alphap) >> 8;
>
> Looks like some rounding could be useful.
Like:
outp = (*outp * (0xff - *alphap) + *inp * *alphap + 128) >> 8;
?
--
Baptiste COUDURIER
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer http://www.ffmpeg.org
More information about the FFmpeg-soc
mailing list