From patchwork Thu Jul 20 15:42:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 4387 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.76 with SMTP id 73csp2305552vsb; Thu, 20 Jul 2017 08:43:01 -0700 (PDT) X-Received: by 10.28.230.8 with SMTP id d8mr2508640wmh.47.1500565381363; Thu, 20 Jul 2017 08:43:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500565381; cv=none; d=google.com; s=arc-20160816; b=VHagkAUZhFBnkPxyaujvcIPUz9yv0opgqmByY0ja9dlG3Oc6QV5HkYprYzngV33CZ9 Q6gx4tBkVF1pjYAtVMztzzJaygQ0LmHfXC2Fe8MShtHXFB5qQ0p4mX8eDG0tKMr3TNhr wptbw//k3xClYaeeW/IIHUMIwY/vR/Vvu7nUTlyvGJbcfEDpBDgIsl9KyYFxCEhc27br TGke/TBxcJ+W3fNVnBid1rFaCmmrFS48nvWVDZ+cJfHkvReRoH2Rk+t7HflKmpSSf2DW ZjM2n6DzqRJTP3X1ZF1viRSPcoOyxFAC24pdRSoSuWl4LZNvB76GoMoC2l1PSoFcHmVj 8gkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:user-agent :in-reply-to:mime-version:references:message-id:to:from:date :delivered-to:arc-authentication-results; bh=RYI2AzB7bCtycOooLsMvXeesxAjB2jobYw0FsuP+szs=; b=Raw5YqgHpmxSH7F8zEgsPs4lE1uQY2CXlL5DS0vEaZxmXLu14Fw4ay+a8q5JlRGpbh Jcl2/uXJiq29H54GiZypbuzCP/jVJJMwEMZ7RxRe5pq3hEReIjiirvhg/kO/MFd3r4iZ aUdf6mIipVVEgrhj/S8gYSchZEiEbbIAa/lxwAPbU/dpmhGDD21IVBd2HedFTiqzBc1t xwvUoRMnQMNMcFMDW5mUsCexhr3ShwxU4ypbgC55ZVd/5Wx9Caf4J+UqtpAAH5hfpcSS Alj7ifgViGN5SdF1FDZR5q6WbfWHpzW5sFTXPHzV+N1TkxbrcQ6gRyM0g+hcFzmw3Oi/ kyjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b37si6282323wrb.338.2017.07.20.08.43.00; Thu, 20 Jul 2017 08:43:01 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A5BD1689A1A; Thu, 20 Jul 2017 18:42:50 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef2.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 56DCA689891 for ; Thu, 20 Jul 2017 18:42:44 +0300 (EEST) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef2.ens.fr (8.13.6/1.01.28121999) with ESMTP id v6KFgpgE070616 for ; Thu, 20 Jul 2017 17:42:52 +0200 (CEST) Received: by phare.normalesup.org (Postfix, from userid 1001) id E9943E00D0; Thu, 20 Jul 2017 17:42:51 +0200 (CEST) Date: Thu, 20 Jul 2017 17:42:51 +0200 From: Nicolas George To: FFmpeg development discussions and patches Message-ID: <20170720154251.GA3800234@phare.normalesup.org> References: <20170719173245.GC3740@nb4> <20170719190049.17909-1-pegro@friiks.de> <20170720170611.691d94bb@fem-net.de> <20170720151152.GA3786430@phare.normalesup.org> <20170720154203.GA3798847@phare.normalesup.org> MIME-Version: 1.0 In-Reply-To: <20170720154203.GA3798847@phare.normalesup.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef2.ens.fr [129.199.96.32]); Thu, 20 Jul 2017 17:42:52 +0200 (CEST) Subject: Re: [FFmpeg-devel] [PATCH] fate: add vf_overlay test for main source with alpha channel X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Le duodi 2 thermidor, an CCXXV, Nicolas George a écrit : > the attached patch. Sorry. Regards, From e50bd258ac22d5758348eafa7203f264dd98f580 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Thu, 20 Jul 2017 17:35:44 +0200 Subject: [PATCH] lavfi/testsrc2: fix completely transparent alpha. Signed-off-by: Nicolas George --- libavfilter/vsrc_testsrc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c index c4a5ae3742..f94c3ed9dd 100644 --- a/libavfilter/vsrc_testsrc.c +++ b/libavfilter/vsrc_testsrc.c @@ -66,6 +66,9 @@ typedef struct TestSourceContext { /* only used by testsrc */ int nb_decimals; + /* only used by testsrc2 */ + int alpha; + /* only used by color */ FFDrawContext draw; FFDrawColor color; @@ -685,6 +688,7 @@ AVFilter ff_vsrc_testsrc = { static const AVOption testsrc2_options[] = { COMMON_OPTIONS + { "alpha", "set global alpha (opacity)", OFFSET(alpha), AV_OPT_TYPE_INT, {.i64 = 255}, 0, 255, FLAGS }, { NULL } }; @@ -735,6 +739,7 @@ static void test2_fill_picture(AVFilterContext *ctx, AVFrame *frame) { TestSourceContext *s = ctx->priv; FFDrawColor color; + unsigned alpha = s->alpha << 24; /* colored background */ { @@ -746,7 +751,8 @@ static void test2_fill_picture(AVFilterContext *ctx, AVFrame *frame) x2 = ff_draw_round_to_sub(&s->draw, 0, 0, x2); set_color(s, &color, ((i & 1) ? 0xFF0000 : 0) | ((i & 2) ? 0x00FF00 : 0) | - ((i & 4) ? 0x0000FF : 0)); + ((i & 4) ? 0x0000FF : 0) | + alpha); ff_fill_rectangle(&s->draw, &color, frame->data, frame->linesize, x, 0, x2 - x, frame->height); x = x2; @@ -763,7 +769,7 @@ static void test2_fill_picture(AVFilterContext *ctx, AVFrame *frame) g0 = av_rescale_q(s->pts, s->time_base, av_make_q(1, 128)); for (x = 0; x < s->w; x += dx) { g = (av_rescale(x, 6 * 256, s->w) + g0) % (6 * 256); - set_color(s, &color, color_gradient(g)); + set_color(s, &color, color_gradient(g) | alpha); y = y0 + av_rescale(x, s->h / 2, s->w); y %= 2 * (s->h - 16); if (y > s->h - 16) @@ -785,7 +791,7 @@ static void test2_fill_picture(AVFilterContext *ctx, AVFrame *frame) int c, i; for (c = 0; c < 3; c++) { - set_color(s, &color, 0xBBBBBB ^ (0xFF << (c << 3))); + set_color(s, &color, (0xBBBBBB ^ (0xFF << (c << 3))) | alpha); pos = av_rescale_q(s->pts, s->time_base, av_make_q(64 >> (c << 1), cycle)) % cycle; xh = pos < 1 * l ? pos : pos < 2 * l ? l : -- 2.13.2