From patchwork Tue Aug 2 16:54:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 37090 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1649:b0:8b:613a:194d with SMTP id no9csp3256631pzb; Tue, 2 Aug 2022 09:54:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR5hg3wBfpPbs4wXOUGeYIppmVqDGSJMs8QN/L1DqARlQRVpBrHemC90xDinC/CkPZBH7mum X-Received: by 2002:aa7:c713:0:b0:43d:40ff:5f16 with SMTP id i19-20020aa7c713000000b0043d40ff5f16mr17905022edq.256.1659459293186; Tue, 02 Aug 2022 09:54:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659459293; cv=none; d=google.com; s=arc-20160816; b=vPkfWDiJ7PMmw9SbE5eGSs0+7yxI1yEyZ13PpqH/x7B1EMVY5mgxMtKeEtJK0zhbQ/ p3eU472koYJRw288b079lW+l4U5eRFoDSL7w9EuSItJGTboLAxircBwDfp/SSHJCF6cl hSCJh6IQn14vbAxCsHoYdYO4rmh5AseauvBcS36+5sARlYmYSdsY9goNolUCDPvH+ZAS l7+pz3tKXoTQnWAOdzV+aflqV5X6dt6gTsHY9XTWhMb6z6wl2PqZqDVBzAluUVjnDh+U MbhPf1ceymm5pCZxCszSc1SpuyffuNUdNiDo7TXJ5QPRWoFlxKXtu+mZPUCcC5Ei73ms R4Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=eL06woqLGnjg61nx7bDXUzQjfJofYGi58izYUKwq81A=; b=ARVVyZVyerrAGt6rfWd/PzNpN6IIkKn2OaELkQzjJVINjjrtSCmDQ8ShZJrw+VYr2t Wz96ug4LiFOdU54dmqtkBRxVziAiDMC1icSJF62q8nauUOBot8p/hQ/tSM6tAAekFMf5 CP/nuVMj0Dhg47wmrEu6nTmJZd1JlvuGmXggZG6+X4xWsYe+ShOrmf4C1UuUIg8hlO55 PGQqmSdUg0AD+Yc9U0q9dEZ7A2wVpTCzkVPOfWpt61aZaftpbijn8APSkYTjnQ7GQLK1 Cn6graw5u/5eNQqAmrZaCynRBlnLZL3yC/20UrOC5BZzNd/3uAQ7SVgQtyWNGZjpZXNQ Iubw== 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 v18-20020a056402349200b0043c8ac1ad11si15433941edc.618.2022.08.02.09.54.52; Tue, 02 Aug 2022 09:54:53 -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 7C91468BA07; Tue, 2 Aug 2022 19:54:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ECB0268BA07 for ; Tue, 2 Aug 2022 19:54:25 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 272GsNNt017560 for ; Tue, 2 Aug 2022 18:54:24 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id D6F4FEB5BC; Tue, 2 Aug 2022 18:54:23 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 2 Aug 2022 18:54:15 +0200 Message-Id: <20220802165421.137563-1-george@nsup.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Tue, 02 Aug 2022 18:54:24 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 1/7] lavu/pixfmt: summarize yuv naming conventions X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: YPDBP5WkAiKm Signed-off-by: Nicolas George --- libavutil/pixfmt.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) Identical to the one I posted last week. diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 2d3927cc3f..3d0f92ed4d 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -60,6 +60,23 @@ * For all the 8 bits per pixel formats, an RGB32 palette is in data[1] like * for pal8. This palette is filled in automatically by the function * allocating the picture. + * + * @par + * Summary of the naming conventions for YUV formats: + * 444 422 440 420 411 410 + * ╋━╋━╋━╋━╋ ╋━┿━╋━┿━╋ ╋━╋━╋━╋━╋ ╋━┿━╋━┿━╋ ╋━┿━┿━┿━╋ ╋━┿━┿━┿━╋ + * ╋━╋━╋━╋━╋ ╋━┿━╋━┿━╋ ╂─╂─╂─╂─╂ ╂─┼─╂─┼─╂ ╋━┿━┿━┿━╋ ╂─┼─┼─┼─╂ + * ╋━╋━╋━╋━╋ ╋━┿━╋━┿━╋ ╋━╋━╋━╋━╋ ╋━┿━╋━┿━╋ ╋━┿━┿━┿━╋ ╂─┼─┼─┼─╂ + * ╋━╋━╋━╋━╋ ╋━┿━╋━┿━╋ ╂─╂─╂─╂─╂ ╂─┼─╂─┼─╂ ╋━┿━┿━┿━╋ ╂─┼─┼─┼─╂ + * ╋━╋━╋━╋━╋ ╋━┿━╋━┿━╋ ╋━╋━╋━╋━╋ ╋━┿━╋━┿━╋ ╋━┿━┿━┿━╋ ╋━┿━┿━┿━╋ + * where + * ┼─┼ = luma pixel ╋━╋ = chroma pixel + * ┼─┼ ╋━╋ + * + * yuv4ab → + * log2_chroma_w = log₂(4/a) + * log2_chroma_h = b == a ? 0 : b == 0 ? log2_chroma_w : unused + * i.e. a = horizontally, number of luma pixels for four chroma pixels */ enum AVPixelFormat { AV_PIX_FMT_NONE = -1, From patchwork Tue Aug 2 16:54:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 37089 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1649:b0:8b:613a:194d with SMTP id no9csp3256582pzb; Tue, 2 Aug 2022 09:54:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR623w3L8p0nAqkHQE6BsuMs2/Tgq5PzbvAhE7TJk3MPOHSTi21mJvvNAU1LxVjxndcrtnrr X-Received: by 2002:a05:6402:331f:b0:43d:931c:6945 with SMTP id e31-20020a056402331f00b0043d931c6945mr12072618eda.199.1659459285266; Tue, 02 Aug 2022 09:54:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659459285; cv=none; d=google.com; s=arc-20160816; b=M+bYhIRei/h8h6nrqqz7QZCL6GUlkU1o/UFtbKWeNxkb7vh0nJIvNFmPlzgUNTJag5 cKwU1PIp+GjYcKCQDHCF7tq7p7EHhysbONW0FR3/4owp7TpJIvLLU6N/C2ORT3JCFl+c nMnS4EHTuM6Cwrq3CibUomwv4BuV57VGgZHZ+AiYls5NZ/FlG/1qo+60HBr02GKIPBjR lJOwrE2RDoI8hUTr+v87MOmsd13HFVqIj0jhLacwv2H6SMoE5le0+eV2oO39vR81+h+x BW5ewb+K3242tSRxCEnNS0lt8mZmfMurOmuDCzFU7lJ2zIvTWW1QH3KjFxC8zhYy2sw9 KdDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=nedzHDfKTMTvla6FshcDingPKWvMcgdXVy/3j769WnI=; b=kM31WueGp3zk1VDPkD0NmaRbL8MHDrlL5ZjqXxUaxcIypnwTIEwCuucMMcfw42vRW4 LfKKmpZSu3jfyvoEYtEOWtJ46mvFAEjRwqFdTKMvvy6XusMmgSHNxJYlN0LX4HRFMQ/0 vU42orKyntTkEiB8R5DkdB9pDQ0GTL1dIGN5OUxdjMNaivmEwwuflwvqoq+O3KB+oBhy LCx6cCXBoTdV8tCUkpgunMuU/TS43pBkTYfwk/gOAzRoghORaIHggTpsq9ZSC8zbDW3o 3qun1tTGwyIubwtzrHOWUg5v31cjgA45vqCsquNNUC270pFcmynUZq2vOiKjsvR7iaZH AFOQ== 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 r17-20020a05640251d100b0043d81c2b085si2922143edd.224.2022.08.02.09.54.45; Tue, 02 Aug 2022 09:54:45 -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 B6A0068BA7A; Tue, 2 Aug 2022 19:54:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E96FC68B9FD for ; Tue, 2 Aug 2022 19:54:25 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 272GsOma017564 for ; Tue, 2 Aug 2022 18:54:25 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id D9ACDEB5BC; Tue, 2 Aug 2022 18:54:24 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 2 Aug 2022 18:54:16 +0200 Message-Id: <20220802165421.137563-2-george@nsup.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220802165421.137563-1-george@nsup.org> References: <20220802165421.137563-1-george@nsup.org> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Tue, 02 Aug 2022 18:54:25 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 2/7] lavfi/graphdump: add plain listing output X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: eD7qEkpa5D1s Signed-off-by: Nicolas George --- libavfilter/avfilter.h | 5 ++- libavfilter/graphdump.c | 79 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 80 insertions(+), 4 deletions(-) Identical to the one posted months ago. diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 2e8197c9a6..ad38f1bdc2 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -1163,7 +1163,10 @@ int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const * Dump a graph into a human-readable string representation. * * @param graph the graph to dump - * @param options formatting options; currently ignored + * @param options formatting options; can be NULL, empty + * or "f=aa" for clumsy ascii-art drawing, + * or "f=tech" for plain listing; + * other values silently ignored * @return a string, or NULL in case of memory allocation failure; * the string must be freed using av_free */ diff --git a/libavfilter/graphdump.c b/libavfilter/graphdump.c index 80f7bf6c98..992183a882 100644 --- a/libavfilter/graphdump.c +++ b/libavfilter/graphdump.c @@ -27,6 +27,9 @@ #include "avfilter.h" #include "internal.h" +#define FORMAT_AA 0 +#define FORMAT_TECH 1 + static int print_link_prop(AVBPrint *buf, AVFilterLink *link) { const char *format; @@ -62,7 +65,51 @@ static int print_link_prop(AVBPrint *buf, AVFilterLink *link) return buf->len; } -static void avfilter_graph_dump_to_buf(AVBPrint *buf, AVFilterGraph *graph) +static inline const char *fcname(const AVFilterContext *filter) +{ + return filter->name ? filter->name : ""; +} + +static void dump_tech(AVBPrint *buf, AVFilterGraph *graph) +{ + unsigned i, j; + + for (i = 0; i < graph->nb_filters; i++) { + AVFilterContext *filter = graph->filters[i]; + + if (i) + av_bprintf(buf, "\n"); + av_bprintf(buf, "Filter: %s (%s)\n", fcname(filter), filter->filter->name); + + for (j = 0; j < filter->nb_inputs; j++) { + AVFilterPad *pad = &filter->input_pads[j]; + AVFilterLink *link = filter->inputs[j]; + AVFilterPad *ppad = link->srcpad; + AVFilterContext *peer = link->src; + + av_bprintf(buf, " in %d: %s ← %s.%d:%s ", + j, pad->name, + fcname(peer), FF_OUTLINK_IDX(link), ppad->name); + print_link_prop(buf, link); + av_bprintf(buf, "\n"); + } + + for (j = 0; j < filter->nb_outputs; j++) { + AVFilterPad *pad = &filter->output_pads[j]; + AVFilterLink *link = filter->outputs[j]; + AVFilterPad *ppad = link->dstpad; + AVFilterContext *peer = link->dst; + + av_bprintf(buf, " out %d: %s → %s.%d:%s ", + j, pad->name, + fcname(peer), FF_INLINK_IDX(link), ppad->name); + print_link_prop(buf, link); + av_bprintf(buf, "\n"); + } + } +} + +static void dump_ascii_art(AVBPrint *buf, AVFilterGraph *graph) { unsigned i, j, x, e; @@ -154,17 +201,43 @@ static void avfilter_graph_dump_to_buf(AVBPrint *buf, AVFilterGraph *graph) } } +static void avfilter_graph_dump_to_buf(AVBPrint *buf, AVFilterGraph *graph, const char *options) +{ + unsigned format = FORMAT_AA; + + /* For a very long time, options was ignored. + Having a string for that task was a mistake, but it is not important. + It is not worth a proper parsing. + */ + if (options && *options) { + if (!strcmp("f=aa", options)) { + format = FORMAT_AA; + } else if (!strcmp("f=tech", options)) { + format = FORMAT_TECH; + } + /* ignore other values */ + } + switch (format) { + case FORMAT_AA: + dump_ascii_art(buf, graph); + break; + case FORMAT_TECH: + dump_tech(buf, graph); + break; + } +} + char *avfilter_graph_dump(AVFilterGraph *graph, const char *options) { AVBPrint buf; char *dump = NULL; av_bprint_init(&buf, 0, AV_BPRINT_SIZE_COUNT_ONLY); - avfilter_graph_dump_to_buf(&buf, graph); + avfilter_graph_dump_to_buf(&buf, graph, options); dump = av_malloc(buf.len + 1); if (!dump) return NULL; av_bprint_init_for_buffer(&buf, dump, buf.len + 1); - avfilter_graph_dump_to_buf(&buf, graph); + avfilter_graph_dump_to_buf(&buf, graph, options); return dump; } From patchwork Tue Aug 2 16:54:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 37088 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1649:b0:8b:613a:194d with SMTP id no9csp3256528pzb; Tue, 2 Aug 2022 09:54:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uv32QS7iUbRl6bFoLZwK0GG8LvJ6wXNsXroUlOyb2DvL1TtrwmNZZNXXrhZnG0c2bU5e2k X-Received: by 2002:a17:906:ee8e:b0:730:3646:d178 with SMTP id wt14-20020a170906ee8e00b007303646d178mr16303827ejb.426.1659459277066; Tue, 02 Aug 2022 09:54:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659459277; cv=none; d=google.com; s=arc-20160816; b=kHBm1VZDMot1gxJBTVCNS/kjWTLiHN9xo8Se5QcYD75k45EPrHcPVfzCFXi6GsxVs+ 8zrJXpn+CtsQUAbJyi2scLpxISP5RjdXL8a2NzxKxNstUttzO4Lq16PPU/0yuJC23t7q Dphzz7yrPUoGP3/RnGbEA3YTrFKSVeSZ2iUQe4j6eFyIPScBSvaxIqsNdVpc2XgEMB8O tsNmi6Ul3e7URJDW1h34/3p2pNvdRTfsqiZbcPm9PERnXf6FZnnyL6XLUHz3UO2vAQb/ y2rSG2YUB8ZZ3JXV3avlNakIgUedTYlYMB+Im0Pw7IV54TZSDZUhs/DixiPg+GS6V2GA vXMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=+N+QY5q1OK5SNWpW+84bftOGtyAaGP4NAYkgMmDnaB4=; b=f4m1l1rS51b7X2f0KQrjk2DFdNYDqpHzkDukHCz9A99TEwu8lFaAOzd1vC/NjHIH6l zS+cRkyo83/gZi/l1C2+SWibgFqJIwy+60IYK3ujXetaA7ijdTi7lD5fqVGMnr8MJyeP qUa+IdRYbyeWk33GuNraoiWRMv1pIBOJsLu5uqpMAQimGTnbfoEj4phVhdQpSxUgr8nQ gJNaw6PfZwgUpG5IRtw/4WFrl2C53n29DyVBS4xDOROW/5hi8ovA7vxrMSzvaB1yHW7Q wDW/T3byFI+J6hX4h1bk+sxrpIpyPAyZT305aaeto3MgvPhrBCVUSn0rIydqtZ0JiyQb 1kYg== 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 s2-20020a17090699c200b00730a07ef039si2252653ejn.423.2022.08.02.09.54.36; Tue, 02 Aug 2022 09:54:37 -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 9EFE568BA44; Tue, 2 Aug 2022 19:54:33 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E67FC68B9C6 for ; Tue, 2 Aug 2022 19:54:26 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 272GsPx7017569 for ; Tue, 2 Aug 2022 18:54:26 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id D83E0EB5BC; Tue, 2 Aug 2022 18:54:25 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 2 Aug 2022 18:54:17 +0200 Message-Id: <20220802165421.137563-3-george@nsup.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220802165421.137563-1-george@nsup.org> References: <20220802165421.137563-1-george@nsup.org> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Tue, 02 Aug 2022 18:54:26 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 3/7] fftools: add -lavfi_dump option X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: 6ESWPQbNrq25 Signed-off-by: Nicolas George --- doc/ffmpeg.texi | 4 ++++ fftools/ffmpeg.h | 1 + fftools/ffmpeg_filter.c | 14 ++++++++++++++ fftools/ffmpeg_opt.c | 3 +++ 4 files changed, 22 insertions(+) Identical to the one posted months ago. diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 2fb0bc8ffa..1a342846c2 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1902,6 +1902,10 @@ The default is the number of available CPUs. Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or outputs. Equivalent to @option{-filter_complex}. +@anchor{lavfi_dump option} +@item -lavfi_dump (@emph{global}) +Dump the filter graphs and their negotiated formats to standard output. + @item -filter_complex_script @var{filename} (@emph{global}) This option is similar to @option{-filter_complex}, the only difference is that its argument is the name of the file from which a complex filtergraph diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 6417db03bd..d2ec8ea257 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -654,6 +654,7 @@ extern char *filter_nbthreads; extern int filter_complex_nbthreads; extern int vstats_version; extern int auto_conversion_filters; +extern int dump_filtergraphs; extern const AVIOInterruptCB int_cb; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index f9ae76f76d..973de34b5f 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1070,6 +1070,20 @@ int configure_filtergraph(FilterGraph *fg) avfilter_graph_set_auto_convert(fg->graph, AVFILTER_AUTO_CONVERT_NONE); if ((ret = avfilter_graph_config(fg->graph, NULL)) < 0) goto fail; + if (dump_filtergraphs) { + char *dump = avfilter_graph_dump(fg->graph, "f=tech"); + if (!dump) + return AVERROR(ENOMEM); + if (simple) { + OutputStream *ost = fg->outputs[0]->ost; + printf("Dump of filter graph for output #%d:%d:", ost->file_index, ost->index); + } else { + printf("Dump of complex filter graph #%d:", fg->index); + } + printf("\n\n%s\n", dump); + av_free(dump); + fflush(stdout); + } fg->is_meta = graph_is_meta(fg->graph); diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index a96bcf9b8a..6404412f5a 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -178,6 +178,7 @@ char *filter_nbthreads; int filter_complex_nbthreads = 0; int vstats_version = 2; int auto_conversion_filters = 1; +int dump_filtergraphs = 0; int64_t stats_period = 500000; @@ -3947,6 +3948,8 @@ const OptionDef options[] = { "number of threads for -filter_complex" }, { "lavfi", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex }, "create a complex filtergraph", "graph_description" }, + { "lavfi_dump", OPT_BOOL | OPT_EXPERT, { &dump_filtergraphs }, + "dump filter graphs to standard output" }, { "filter_complex_script", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex_script }, "read complex filtergraph description from a file", "filename" }, { "auto_conversion_filters", OPT_BOOL | OPT_EXPERT, { &auto_conversion_filters }, From patchwork Tue Aug 2 16:54:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 37091 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1649:b0:8b:613a:194d with SMTP id no9csp3256691pzb; Tue, 2 Aug 2022 09:55:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR4l2VBIy85vSgvKNNuOsq83EXFgC+QLL+UTXmy4jhYpBdOD5MR/sM94sME0rJR25S+wRFVO X-Received: by 2002:a17:907:2bf9:b0:730:7a66:71a3 with SMTP id gv57-20020a1709072bf900b007307a6671a3mr8866761ejc.623.1659459301517; Tue, 02 Aug 2022 09:55:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659459301; cv=none; d=google.com; s=arc-20160816; b=c2SkxiILkPo4Wj/iiOjoQ8KSlcaIApyqz195lcy0BIbsW4H4JnWV1rVyN07D0GEQOf WKJav0oqkLl1kuhyDNCny2pEQN3v3Oxa21W8IOoM6JNHuJu9fBa31v9yOz66wHXCf40T IqUa2Vpcs24T1PAb47FvXngOu2C1r6pzKxmmKLGRJBbpgFVkIrLKQcQTO1Uc4vtvXaNa xG+Xt/7gOhZrwtUDctBKRet5modL1GBGiDLGXD/0bOVlMDO8PuU7WS7NmDdpFJfU3qhe jv8BhbzpP06hgqvjsLtYuQIqulgeDAs1GJooZa38JaLa22XN8zqXoIayecAXpIRumzdn i5pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=SS1FW22R/eNPX0HNKbQUOU2NM98pzbxRGkWBdpDRsAQ=; b=KQJSaHfGejXUM0rtZhmAlVhX3GQUcZSvH87/xwWtdEbCpFYJHGrKiU8FwU7ZTvSGrM mi8B8vK9kiJGVtHJIZJKPzcOtX/W2HCBBIZS0FmWJ+zqrsZjMu3cjWy7i+NWpZzAMzim jq/Y4TOdpGHKwck+7HKZv4NTU0JdnBc+DMnzZWLGTOh9JyiVQ3+Knugl+yP5bErX7z/E gKmfJ8RCxfyaWoQz9p57IlnyOs8j7bMcU0vGxOztZFGiVhZGt8v8UgZ7ifvzxv4WxlXb laKgec9ikGPs+MWVNaYebHIXiNJRRxJvz+vTrR7atPsj4thFbA8jhPShUbKq159QQE04 d9Yw== 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 rl24-20020a170907217800b0072b53e95011si10471393ejb.265.2022.08.02.09.55.01; Tue, 02 Aug 2022 09:55: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 7890868BA82; Tue, 2 Aug 2022 19:54:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9090868BA07 for ; Tue, 2 Aug 2022 19:54:27 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 272GsQvf017574 for ; Tue, 2 Aug 2022 18:54:27 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id D43C9EB5BC; Tue, 2 Aug 2022 18:54:26 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 2 Aug 2022 18:54:18 +0200 Message-Id: <20220802165421.137563-4-george@nsup.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220802165421.137563-1-george@nsup.org> References: <20220802165421.137563-1-george@nsup.org> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Tue, 02 Aug 2022 18:54:27 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 4/7] lavfi/(a)format: factor finding the delimiter X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: /jPcZXSt8YR6 Signed-off-by: Nicolas George --- libavfilter/af_aformat.c | 8 +++++--- libavfilter/internal.h | 9 +++++++++ libavfilter/vf_format.c | 9 ++++----- 3 files changed, 18 insertions(+), 8 deletions(-) Identical to the one posted months ago. diff --git a/libavfilter/af_aformat.c b/libavfilter/af_aformat.c index a14e4c1240..addabafbfa 100644 --- a/libavfilter/af_aformat.c +++ b/libavfilter/af_aformat.c @@ -65,10 +65,12 @@ do { \ char *next, *cur = str; \ int ret; \ \ - while (cur) { \ + if (!cur) \ + break; \ + while (*cur) { \ type fmt; \ - next = strchr(cur, '|'); \ - if (next) \ + next = ff_formats_list_find_delimiter(cur); \ + if (*next) \ *next++ = 0; \ \ if ((fmt = get_fmt(cur)) == none) { \ diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 0f8da367d0..6dbe7ecee0 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -405,4 +405,13 @@ int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, int ff_filter_init_hw_frames(AVFilterContext *avctx, AVFilterLink *link, int default_pool_size); +/** + * Find the next delimiter in a string of formats. + * The delimiter is '|' or the end of the string. + */ +static inline char *ff_formats_list_find_delimiter(const char *str) +{ + return (char *)str + strcspn(str, "|"); +} + #endif /* AVFILTER_INTERNAL_H */ diff --git a/libavfilter/vf_format.c b/libavfilter/vf_format.c index 24b1c9ca61..b3f168a531 100644 --- a/libavfilter/vf_format.c +++ b/libavfilter/vf_format.c @@ -69,10 +69,9 @@ static av_cold int init(AVFilterContext *ctx) /* count the formats */ cur = s->pix_fmts; - while ((cur = strchr(cur, '|'))) { + while (*(cur = ff_formats_list_find_delimiter(cur))) { nb_formats++; - if (*cur) - cur++; + cur++; } s->formats = av_malloc_array(nb_formats + 1, sizeof(*s->formats)); @@ -82,8 +81,8 @@ static av_cold int init(AVFilterContext *ctx) /* parse the list of formats */ cur = s->pix_fmts; for (i = 0; i < nb_formats; i++) { - sep = strchr(cur, '|'); - if (sep) + sep = ff_formats_list_find_delimiter(cur); + if (*sep) *sep++ = 0; if ((ret = ff_parse_pixel_format(&s->formats[i], cur, ctx)) < 0) From patchwork Tue Aug 2 16:54:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 37092 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1649:b0:8b:613a:194d with SMTP id no9csp3256768pzb; Tue, 2 Aug 2022 09:55:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uJ1tRR6pBYyg7WmS27PeX6mOXAwZGb/y/dGVZCDTKU1pT9HYatCKvt6GkTHaTMb0geEyUh X-Received: by 2002:a17:907:6ea7:b0:72f:2cf2:9aef with SMTP id sh39-20020a1709076ea700b0072f2cf29aefmr16846942ejc.215.1659459310493; Tue, 02 Aug 2022 09:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659459310; cv=none; d=google.com; s=arc-20160816; b=qLm4kyIh5YpDKn1TMo+Fya3K/HPEH/tlrJUJwyGd0Hg85gkCmIcGYrRtA8cyppEZLS GFhMkzLqDPSH+OfBr7abb/Z4SUqDTh9ZanX4gNoJL/fR4tOjP9mQvs1cQLwRN19k7MD3 Nxyh3dP2M9yiwUpo+xqv3BXQIKKWhOL2NyfFRy08jVDHv9FMlhhMeidIYhtQEa+nIqIA nlDwhnHecne31CbxEAov7HgQQ07wMgAerV/HMQefNPHXEghsmH87C4kOPEGMn/NVpl+l WKvsB2/vnUdpqb+EudAyJxkI3pPxWGKMCRYrhKCax3Ai8yLV00k+SznTUY2XRCVEq6WX Fq7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=TttxJqEZeyaVeb0yNzfa0wSDqJQWGeCxSgbifguVTp4=; b=bt22zUXu/ebSkouxKhgw/+/9Qwt/l2u/ayF6xTom3M7JyurRsMeOnY8mDAcfRrlg1A 8nETbkS62LETA5Vw4S6zobHTs9D6kzeMR/KqeAMUDg9ICqwlDu2FEZyrdcNJHupqvdrt J4+5DS+a4ISfforOqgiJNacmmvYjALUnW+02IGbbsdjisNC4t5GFsCV4wPQqM2+InXyf XOGnOQtmRcMcXJqlKCu8Ai1QqBIOnvJpfpzEGJD1PcwMSBdGThFAkRnb8i6rOSERB/IU J59ji/Cuw8Fc5tX9IsY1Bq26MYMj4YHZKROprGMx4EFSvOZ6xqXEgUDy1R12m/674cS6 /5UQ== 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 dd20-20020a1709069b9400b007306d5d304fsi964244ejc.803.2022.08.02.09.55.09; Tue, 02 Aug 2022 09:55:10 -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 6C4CF68BADE; Tue, 2 Aug 2022 19:54:37 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8E05868BA34 for ; Tue, 2 Aug 2022 19:54:28 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 272GsRCM017577 for ; Tue, 2 Aug 2022 18:54:28 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id CF7F5EB5BC; Tue, 2 Aug 2022 18:54:27 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 2 Aug 2022 18:54:19 +0200 Message-Id: <20220802165421.137563-5-george@nsup.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220802165421.137563-1-george@nsup.org> References: <20220802165421.137563-1-george@nsup.org> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Tue, 02 Aug 2022 18:54:28 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 5/7] lavfi/(a)format: support slash as a delimiter X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: FtfyS+dnDb7y Unlike pipe, slash does not require escaping. Signed-off-by: Nicolas George --- doc/filters.texi | 8 ++++---- libavfilter/internal.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) Identical to the one posted months ago. diff --git a/doc/filters.texi b/doc/filters.texi index 4a5412c91d..e334ac0e16 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -1693,13 +1693,13 @@ It accepts the following parameters: @table @option @item sample_fmts, f -A '|'-separated list of requested sample formats. +A '|'- or '/'-separated list of requested sample formats. @item sample_rates, r -A '|'-separated list of requested sample rates. +A '|'- or '/'-separated list of requested sample rates. @item channel_layouts, cl -A '|'-separated list of requested channel layouts. +A '|'- or '/'-separated list of requested channel layouts. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils} for the required syntax. @@ -13379,7 +13379,7 @@ It accepts the following parameters: @table @option @item pix_fmts -A '|'-separated list of pixel format names, such as +A '|'- or '/'-separated list of pixel format names, such as "pix_fmts=yuv420p|monow|rgb24". @end table diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 6dbe7ecee0..cfb748f7db 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -411,7 +411,7 @@ int ff_filter_init_hw_frames(AVFilterContext *avctx, AVFilterLink *link, */ static inline char *ff_formats_list_find_delimiter(const char *str) { - return (char *)str + strcspn(str, "|"); + return (char *)str + strcspn(str, "|/"); } #endif /* AVFILTER_INTERNAL_H */ From patchwork Tue Aug 2 16:54:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 37093 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1649:b0:8b:613a:194d with SMTP id no9csp3256842pzb; Tue, 2 Aug 2022 09:55:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1siCpru3eL2U8RhB3yJV4rX8YP3uBXAJ6eqpZ+qa6t0RSKlATU5dkOj1tv1E19Y4SifKQLj X-Received: by 2002:a17:907:6d99:b0:72e:e7b4:e9cc with SMTP id sb25-20020a1709076d9900b0072ee7b4e9ccmr16390059ejc.315.1659459319131; Tue, 02 Aug 2022 09:55:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659459319; cv=none; d=google.com; s=arc-20160816; b=xEROFy3xHmxGW3AqVYO/XUIA6Tj08wmSWVAbw/JG6POAP1R/n+mniSCzJ9S2h4v24d NtGmr0SIzkn4m1izT2L8M27nbwpCOoelKqFAF8HH5B6SmeCZS7h6n8XArQwHBmfUkNh/ +SjYt84RB+hH0jcjT1fe8Pe5MeqZ0VKBbdhyzYpud+f+O28jRZamm7expKqbpqU0wBQy Tc0hk3kDa9LjMQWt5bWWfzjfvt2FbpSnhcagfssto7OU2DZ4hdBuMTxi1T5a8i++d4Xu 2KYlBer1gquvVQ+ER75FXDr2F7P9cZkiaefk0+xbONllnWTVDbSPpfBQsny3s5IBeFan YSiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=ZnSDtbVbz0LF/7a46o/eZYqOl8FYEt8S+AfpQkN1yMA=; b=TCVnxPRBPAkIM+QLL1FT0e5Y4I4siCRpwTN/5+lYoU3jhkQV18Trozv38BInhEzV+C szEOqVale1xoekpA0Bpoasgmg3gzmIJDTe82LqIWCaK8U1nhYja8kGVs0VcTZHvbru5b 64WN5FmVysS0ACBYRCGtS87Pd7OraM5wmL5jtiGT8AQycTfwKYSHb6UGlieG1U4ZQFz4 T84GMTWPFw56xLYXynxa5VDPw9yw/WEG2XRGGMK26pX5zceUnBN7Wc71sW9Tn4DsUOSG ho7Q+b0RHZoJUP1TCuCZpolM0VTMBnIgvSK8PbJ/mI7993YI+xVQPcT8Fk0l/Lq0RHh2 QOUQ== 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 sg7-20020a170907a40700b00730726b348fsi6611861ejc.196.2022.08.02.09.55.18; Tue, 02 Aug 2022 09:55:19 -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 86A5268BAEE; Tue, 2 Aug 2022 19:54:38 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9052D68BA71 for ; Tue, 2 Aug 2022 19:54:29 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 272GsSx7017581 for ; Tue, 2 Aug 2022 18:54:29 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id CBB4BEB5BC; Tue, 2 Aug 2022 18:54:28 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 2 Aug 2022 18:54:20 +0200 Message-Id: <20220802165421.137563-6-george@nsup.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220802165421.137563-1-george@nsup.org> References: <20220802165421.137563-1-george@nsup.org> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Tue, 02 Aug 2022 18:54:29 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 6/7] lavi/pixdesc: add comments about pixel format scoring X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: 0KCcunKYRJtE Signed-off-by: Nicolas George --- libavutil/pixdesc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 6e57a82cb6..923a61b0ab 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2866,6 +2866,7 @@ static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt, else nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components); + // Penalty for losing depth for (i = 0; i < nb_components; i++) { int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : (dst_desc->comp[i].depth - 1); if (src_desc->comp[i].depth - 1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) { @@ -2874,6 +2875,7 @@ static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt, } } + // Penalty for subsampling if (consider & FF_LOSS_RESOLUTION) { if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w) { loss |= FF_LOSS_RESOLUTION; @@ -2890,6 +2892,7 @@ static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt, } } + // Penalty for changing colorspace if(consider & FF_LOSS_COLORSPACE) switch(dst_color) { case FF_COLOR_RGB: @@ -2920,15 +2923,18 @@ static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt, if(loss & FF_LOSS_COLORSPACE) score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth - 1, src_desc->comp[0].depth - 1); + // Penalty for changing chroma if (dst_color == FF_COLOR_GRAY && src_color != FF_COLOR_GRAY && (consider & FF_LOSS_CHROMA)) { loss |= FF_LOSS_CHROMA; score -= 2 * 65536; } + // Penalty for losing alpha if (!pixdesc_has_alpha(dst_desc) && (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))) { loss |= FF_LOSS_ALPHA; score -= 65536; } + // Penalty for using a palette if (dst_pix_fmt == AV_PIX_FMT_PAL8 && (consider & FF_LOSS_COLORQUANT) && (src_pix_fmt != AV_PIX_FMT_PAL8 && (src_color != FF_COLOR_GRAY || (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))))) { loss |= FF_LOSS_COLORQUANT; From patchwork Tue Aug 2 16:54:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 37094 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1649:b0:8b:613a:194d with SMTP id no9csp3256927pzb; Tue, 2 Aug 2022 09:55:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR6i+i2hxB4Bp9obbBwDsCAB0Pc3aNdvde8g7pI6ZJIpEFC0NYZfyHv7GG1dtO8GHm4L76ct X-Received: by 2002:a17:907:2c62:b0:730:6202:c3a4 with SMTP id ib2-20020a1709072c6200b007306202c3a4mr10892403ejc.52.1659459328790; Tue, 02 Aug 2022 09:55:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659459328; cv=none; d=google.com; s=arc-20160816; b=hUDGr4XyYuyJxB7LxXudvTSZw/tS0cvV8pkKmIs5JPH/06QuodblDwzg0jPaD2jKYc 66zKyqaAKCYUj5uvpeuyZFEgljtWy8StuRWHKxTCuw1HZqoJRqVz0hMoLJf1lVsV+Id6 JZy7VPX6MOpX/QIkdU6lhx+tp4DBcD0tN/WefXF+W5OdXeRBf7e4Bn3lzHe6cV9QSLhT 7vSMwuLOf6z4YmiMIH+zSHmBPVC1VGJI/UYcsSDA5Y+qEDnq+EuZlPzrKzDL+TdQnO10 kkK1mj5dGpXrWn4OX50eBEq9Des3Djt40b450n3XjLxIkfezsmCG03EoG46lsSrGUEXs nkRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=w7YLfaiVuisZMqXZoVcg62bxBYPJay9xGPWq8w2hnHA=; b=LPtqcWgTdReAFZ+q+H6yERwR/ftUtZY/xmK0Y04rladnHqf0s4eY3FfALtCUFDORkS EfknZ46e/1VIkrRe2hg2xY/+Cm8LT4Qt55GPNCxc8p5Wa7kOpSUcM54vXe+tnaBqV0AT /97wi04qEMOFCo3YS+JZj4Y50IB4p9Rrgf2PljmhJlgjYIdYurQzouLDNjhZ12F7ehl4 3r2L8IfTaUJX7hn/zkiVKXkt9/sdQk2RDNu57e6WKMu832qM07N+RZn5EZHCUBm0u6IN 4IZxF253psrAc59mS2vFQb9nryiZ1n3bcPCEcKUe9oSv0AM2pvyMXo6VQbav2d3GybXr uzdQ== 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 he8-20020a1709073d8800b00711d89b831esi7015001ejc.721.2022.08.02.09.55.28; Tue, 02 Aug 2022 09:55:28 -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 81D6768BAF1; Tue, 2 Aug 2022 19:54:39 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D36C968BA82 for ; Tue, 2 Aug 2022 19:54:30 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 272GsU1s017586 for ; Tue, 2 Aug 2022 18:54:30 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id 1CEDBEB5BC; Tue, 2 Aug 2022 18:54:30 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 2 Aug 2022 18:54:21 +0200 Message-Id: <20220802165421.137563-7-george@nsup.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220802165421.137563-1-george@nsup.org> References: <20220802165421.137563-1-george@nsup.org> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Tue, 02 Aug 2022 18:54:30 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 7/7] tests: add coverage for libavfilter's format negotiation X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: p/cD5zKJaD/E Added coverage for the video part of pick_format(). Signed-off-by: Nicolas George --- Only video for now, I would like to push before working on audio. Audio is easier because there are fewer formats. But audio is also harder because I need to test cases where format incompatibilities detected in two places for different aspects. Once I have good coverage, I can reorganise the negotiation process without risking breaking cases that were previously fixed. Note: the tests are very fast, since they only init the graph and do not filter anything. tests/Makefile | 1 + tests/fate-run.sh | 4 + tests/fate/libavfilter.mak | 86 +++++++++++++++++++ tests/ref/fate/libavfilter-negotiation-alpha | 20 +++++ ...avfilter-negotiation-alpha-over-chroma-rgb | 20 +++++ ...avfilter-negotiation-alpha-over-chroma-yuv | 20 +++++ .../libavfilter-negotiation-avoid-subsample | 20 +++++ .../fate/libavfilter-negotiation-chroma-rgb | 20 +++++ .../fate/libavfilter-negotiation-chroma-yuv | 20 +++++ .../libavfilter-negotiation-chroma-yuv420 | 20 +++++ ...ibavfilter-negotiation-chroma1-over-depth1 | 20 +++++ ...ilter-negotiation-chroma2-over-colorspace8 | 20 +++++ ...libavfilter-negotiation-colorspace-rgb-yuv | 20 +++++ ...libavfilter-negotiation-colorspace-yuv-rgb | 20 +++++ ...vfilter-negotiation-colorspace8-over-alpha | 20 +++++ .../fate/libavfilter-negotiation-depth-rgb | 20 +++++ .../fate/libavfilter-negotiation-depth-yuv | 20 +++++ ...libavfilter-negotiation-depth1-over-depth2 | 20 +++++ .../libavfilter-negotiation-depth2-over-alpha | 20 +++++ .../fate/libavfilter-negotiation-palette-rgb | 20 +++++ .../fate/libavfilter-negotiation-palette-yuv | 20 +++++ 21 files changed, 451 insertions(+) create mode 100644 tests/fate/libavfilter.mak create mode 100644 tests/ref/fate/libavfilter-negotiation-alpha create mode 100644 tests/ref/fate/libavfilter-negotiation-alpha-over-chroma-rgb create mode 100644 tests/ref/fate/libavfilter-negotiation-alpha-over-chroma-yuv create mode 100644 tests/ref/fate/libavfilter-negotiation-avoid-subsample create mode 100644 tests/ref/fate/libavfilter-negotiation-chroma-rgb create mode 100644 tests/ref/fate/libavfilter-negotiation-chroma-yuv create mode 100644 tests/ref/fate/libavfilter-negotiation-chroma-yuv420 create mode 100644 tests/ref/fate/libavfilter-negotiation-chroma1-over-depth1 create mode 100644 tests/ref/fate/libavfilter-negotiation-chroma2-over-colorspace8 create mode 100644 tests/ref/fate/libavfilter-negotiation-colorspace-rgb-yuv create mode 100644 tests/ref/fate/libavfilter-negotiation-colorspace-yuv-rgb create mode 100644 tests/ref/fate/libavfilter-negotiation-colorspace8-over-alpha create mode 100644 tests/ref/fate/libavfilter-negotiation-depth-rgb create mode 100644 tests/ref/fate/libavfilter-negotiation-depth-yuv create mode 100644 tests/ref/fate/libavfilter-negotiation-depth1-over-depth2 create mode 100644 tests/ref/fate/libavfilter-negotiation-depth2-over-alpha create mode 100644 tests/ref/fate/libavfilter-negotiation-palette-rgb create mode 100644 tests/ref/fate/libavfilter-negotiation-palette-yuv diff --git a/tests/Makefile b/tests/Makefile index d9c509a415..c4e01a26e9 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -202,6 +202,7 @@ include $(SRC_PATH)/tests/fate/imf.mak include $(SRC_PATH)/tests/fate/indeo.mak include $(SRC_PATH)/tests/fate/libavcodec.mak include $(SRC_PATH)/tests/fate/libavdevice.mak +include $(SRC_PATH)/tests/fate/libavfilter.mak include $(SRC_PATH)/tests/fate/libavformat.mak include $(SRC_PATH)/tests/fate/libavutil.mak include $(SRC_PATH)/tests/fate/libswresample.mak diff --git a/tests/fate-run.sh b/tests/fate-run.sh index 4008bcbc16..53dcbb563b 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -571,6 +571,10 @@ venc_data(){ run tools/venc_data_dump${EXECSUF} ${file} ${stream} ${frames} ${threads} ${thread_type} } +lavfi_dump(){ + run ffmpeg${PROGSUF}${EXECSUF} -lavfi_dump -lavfi "$@" -f null - +} + null(){ : } diff --git a/tests/fate/libavfilter.mak b/tests/fate/libavfilter.mak new file mode 100644 index 0000000000..b7d3786942 --- /dev/null +++ b/tests/fate/libavfilter.mak @@ -0,0 +1,86 @@ +NEGO_PIXFMT = lavfi_dump testsrc2=d=0,format=$(1),scale,format=$(2) + +# avfiltergraph.c : pick_format() → pixdesc.c : get_pix_fmt_score() : losing alpha +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-alpha +fate-libavfilter-negotiation-alpha: CMD = $(call NEGO_PIXFMT,rgba,yuv444p/yuva444p) + +# avfiltergraph.c : pick_format() → pixdesc.c : get_pix_fmt_score() : subsampling +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-avoid-subsample +fate-libavfilter-negotiation-avoid-subsample: CMD = $(call NEGO_PIXFMT,yuv444p,yuv420p10le/yuva444p10le) + +# avfiltergraph.c : pick_format() → pixdesc.c : get_pix_fmt_score() : losing depth (yuv) +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-depth-yuv +fate-libavfilter-negotiation-depth-yuv: CMD = $(call NEGO_PIXFMT,yuv444p10le,yuv444p9le/yuva444p12le) + +# avfiltergraph.c : pick_format() → pixdesc.c : get_pix_fmt_score() : losing depth (rgb) +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-depth-rgb +fate-libavfilter-negotiation-depth-rgb: CMD = $(call NEGO_PIXFMT,rgb24,rgb555le/rgb48le) + +# avfiltergraph.c : pick_format() → pixdesc.c : get_pix_fmt_score() : changing colorspace (yuv → rgb) +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-colorspace-yuv-rgb +fate-libavfilter-negotiation-colorspace-yuv-rgb: CMD = $(call NEGO_PIXFMT,yuv444p,rgb24/yuv444p9) + +# avfiltergraph.c : pick_format() → pixdesc.c : get_pix_fmt_score() : changing colorspace (rgb → yuv) +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-colorspace-rgb-yuv +fate-libavfilter-negotiation-colorspace-rgb-yuv: CMD = $(call NEGO_PIXFMT,rgb24,yuv444p/rgb0) + +# avfiltergraph.c : pick_format() → pixdesc.c : get_pix_fmt_score() : losing chroma (yuv) +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-chroma-yuv +fate-libavfilter-negotiation-chroma-yuv: CMD = $(call NEGO_PIXFMT,yuv444p,gray8/rgb24) + +# avfiltergraph.c : pick_format() → pixdesc.c : get_pix_fmt_score() : losing chroma (rgb) +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-chroma-rgb +fate-libavfilter-negotiation-chroma-rgb: CMD = $(call NEGO_PIXFMT,rgb24,gray8/yuv444p) + +# avfiltergraph.c : pick_format() → pixdesc.c : get_pix_fmt_score() : avoid palette (yuv) +# FIXME yuv → pal8 always loses depth +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-palette-yuv +fate-libavfilter-negotiation-palette-yuv: CMD = $(call NEGO_PIXFMT,yuv444p,pal8/rgb24) + +# avfiltergraph.c : pick_format() → pixdesc.c : get_pix_fmt_score() : avoid palette (rgb) +# FIXME rgb → pal8 always loses depth +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-palette-rgb +fate-libavfilter-negotiation-palette-rgb: CMD = $(call NEGO_PIXFMT,rgb24,pal8/yuv444p) + +# avfiltergraph.c : pick_format() → pixdesc.c : get_pix_fmt_score() : yuv420 exception +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-chroma-yuv420 +fate-libavfilter-negotiation-chroma-yuv420: CMD = $(call NEGO_PIXFMT,yuv444p,yuv422p/yuv420p) + +# avfiltergraph.c : pick_format() → pixdesc.c : get_pix_fmt_score() : chroma subsampling -1 > depth -1 +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-chroma1-over-depth1 +fate-libavfilter-negotiation-chroma1-over-depth1: CMD = $(call NEGO_PIXFMT,yuv444p10le,yuv444p9le/yuv440p10le) + +# FIXME depth -1 > chroma subsampling -2 → impossible to test without triggering the exception for 420 + +# avfiltergraph.c : pick_format() → pixdesc.c : get_pix_fmt_score() : depth -1 > depth -2 +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-depth1-over-depth2 +fate-libavfilter-negotiation-depth1-over-depth2: CMD = $(call NEGO_PIXFMT,yuv444p10le,yuv444p/yuv444p9le) + +# FIXME chroma subsampling -2 > depth -2 → impossible to test without triggering the exception for 420 + +# avfiltergraph.c : pick_format() → pixdesc.c : get_pix_fmt_score() : chroma subsampling -2 > colorspace 8 +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-chroma2-over-colorspace8 +fate-libavfilter-negotiation-chroma2-over-colorspace8: CMD = $(call NEGO_PIXFMT,yuv444p,rgb24/yuv411p) + +# avfiltergraph.c : pick_format() → pixdesc.c : get_pix_fmt_score() : depth -2 > lose alpha +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-depth2-over-alpha +fate-libavfilter-negotiation-depth2-over-alpha: CMD = $(call NEGO_PIXFMT,yuva444p10le,yuv444p10le/yuva444p) + +# avfiltergraph.c : pick_format() → pixdesc.c : get_pix_fmt_score() : colorspace 8 > lose alpha +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-colorspace8-over-alpha +fate-libavfilter-negotiation-colorspace8-over-alpha: CMD = $(call NEGO_PIXFMT,yuva444p,yuv444p/rgba) + +# avfiltergraph.c : pick_format() → pixdesc.c : get_pix_fmt_score() : lose alpha > lose chroma +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-alpha-over-chroma-yuv +fate-libavfilter-negotiation-alpha-over-chroma-yuv: CMD = $(call NEGO_PIXFMT,yuva444p,gray8a/yuv444p) + +# avfiltergraph.c : pick_format() → pixdesc.c : get_pix_fmt_score() : lose alpha > lose chroma +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-alpha-over-chroma-rgb +fate-libavfilter-negotiation-alpha-over-chroma-rgb: CMD = $(call NEGO_PIXFMT,rgba,gray8a/rgb24) + +FATE_LIBAVFILTER_NEGOTIATION-$(call ALLYES, TESTSRC2_FILTER FORMAT_FILTER SCALE_FILTER) += $(FATE_LIBAVFILTER_NEGOTIATION_VIDEO) +FATE_LIBAVFILTER-yes += $(FATE_LIBAVFILTER_NEGOTIATION-yes) + +fate-libavfilter: $(FATE_LIBAVFILTER-yes) +fate-libavfilter-negotiation: $(FATE_LIBAVFILTER_NEGOTIATION-yes) +FATE_FFMPEG += $(FATE_LIBAVFILTER-yes) diff --git a/tests/ref/fate/libavfilter-negotiation-alpha b/tests/ref/fate/libavfilter-negotiation-alpha new file mode 100644 index 0000000000..00175f65cb --- /dev/null +++ b/tests/ref/fate/libavfilter-negotiation-alpha @@ -0,0 +1,20 @@ +Dump of complex filter graph #0: + +Filter: Parsed_testsrc2_0 (testsrc2) + out 0: default → Parsed_format_1.0:default [320x240 1:1 rgba] + +Filter: Parsed_format_1 (format) + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 rgba] + out 0: default → Parsed_scale_2.0:default [320x240 1:1 rgba] + +Filter: Parsed_scale_2 (scale) + in 0: default ← Parsed_format_1.0:default [320x240 1:1 rgba] + out 0: default → Parsed_format_3.0:default [320x240 1:1 yuva444p] + +Filter: Parsed_format_3 (format) + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 yuva444p] + out 0: default → out_0_0.0:default [320x240 1:1 yuva444p] + +Filter: out_0_0 (buffersink) + in 0: default ← Parsed_format_3.0:default [320x240 1:1 yuva444p] + diff --git a/tests/ref/fate/libavfilter-negotiation-alpha-over-chroma-rgb b/tests/ref/fate/libavfilter-negotiation-alpha-over-chroma-rgb new file mode 100644 index 0000000000..38d4670ac4 --- /dev/null +++ b/tests/ref/fate/libavfilter-negotiation-alpha-over-chroma-rgb @@ -0,0 +1,20 @@ +Dump of complex filter graph #0: + +Filter: Parsed_testsrc2_0 (testsrc2) + out 0: default → Parsed_format_1.0:default [320x240 1:1 rgba] + +Filter: Parsed_format_1 (format) + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 rgba] + out 0: default → Parsed_scale_2.0:default [320x240 1:1 rgba] + +Filter: Parsed_scale_2 (scale) + in 0: default ← Parsed_format_1.0:default [320x240 1:1 rgba] + out 0: default → Parsed_format_3.0:default [320x240 1:1 rgb24] + +Filter: Parsed_format_3 (format) + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 rgb24] + out 0: default → out_0_0.0:default [320x240 1:1 rgb24] + +Filter: out_0_0 (buffersink) + in 0: default ← Parsed_format_3.0:default [320x240 1:1 rgb24] + diff --git a/tests/ref/fate/libavfilter-negotiation-alpha-over-chroma-yuv b/tests/ref/fate/libavfilter-negotiation-alpha-over-chroma-yuv new file mode 100644 index 0000000000..fecb493f88 --- /dev/null +++ b/tests/ref/fate/libavfilter-negotiation-alpha-over-chroma-yuv @@ -0,0 +1,20 @@ +Dump of complex filter graph #0: + +Filter: Parsed_testsrc2_0 (testsrc2) + out 0: default → Parsed_format_1.0:default [320x240 1:1 yuva444p] + +Filter: Parsed_format_1 (format) + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 yuva444p] + out 0: default → Parsed_scale_2.0:default [320x240 1:1 yuva444p] + +Filter: Parsed_scale_2 (scale) + in 0: default ← Parsed_format_1.0:default [320x240 1:1 yuva444p] + out 0: default → Parsed_format_3.0:default [320x240 1:1 yuv444p] + +Filter: Parsed_format_3 (format) + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 yuv444p] + out 0: default → out_0_0.0:default [320x240 1:1 yuv444p] + +Filter: out_0_0 (buffersink) + in 0: default ← Parsed_format_3.0:default [320x240 1:1 yuv444p] + diff --git a/tests/ref/fate/libavfilter-negotiation-avoid-subsample b/tests/ref/fate/libavfilter-negotiation-avoid-subsample new file mode 100644 index 0000000000..eafb6f04b2 --- /dev/null +++ b/tests/ref/fate/libavfilter-negotiation-avoid-subsample @@ -0,0 +1,20 @@ +Dump of complex filter graph #0: + +Filter: Parsed_testsrc2_0 (testsrc2) + out 0: default → Parsed_format_1.0:default [320x240 1:1 yuv444p] + +Filter: Parsed_format_1 (format) + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 yuv444p] + out 0: default → Parsed_scale_2.0:default [320x240 1:1 yuv444p] + +Filter: Parsed_scale_2 (scale) + in 0: default ← Parsed_format_1.0:default [320x240 1:1 yuv444p] + out 0: default → Parsed_format_3.0:default [320x240 1:1 yuva444p10le] + +Filter: Parsed_format_3 (format) + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 yuva444p10le] + out 0: default → out_0_0.0:default [320x240 1:1 yuva444p10le] + +Filter: out_0_0 (buffersink) + in 0: default ← Parsed_format_3.0:default [320x240 1:1 yuva444p10le] + diff --git a/tests/ref/fate/libavfilter-negotiation-chroma-rgb b/tests/ref/fate/libavfilter-negotiation-chroma-rgb new file mode 100644 index 0000000000..f317cc85cd --- /dev/null +++ b/tests/ref/fate/libavfilter-negotiation-chroma-rgb @@ -0,0 +1,20 @@ +Dump of complex filter graph #0: + +Filter: Parsed_testsrc2_0 (testsrc2) + out 0: default → Parsed_format_1.0:default [320x240 1:1 rgb24] + +Filter: Parsed_format_1 (format) + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 rgb24] + out 0: default → Parsed_scale_2.0:default [320x240 1:1 rgb24] + +Filter: Parsed_scale_2 (scale) + in 0: default ← Parsed_format_1.0:default [320x240 1:1 rgb24] + out 0: default → Parsed_format_3.0:default [320x240 1:1 yuv444p] + +Filter: Parsed_format_3 (format) + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 yuv444p] + out 0: default → out_0_0.0:default [320x240 1:1 yuv444p] + +Filter: out_0_0 (buffersink) + in 0: default ← Parsed_format_3.0:default [320x240 1:1 yuv444p] + diff --git a/tests/ref/fate/libavfilter-negotiation-chroma-yuv b/tests/ref/fate/libavfilter-negotiation-chroma-yuv new file mode 100644 index 0000000000..ff3e54aa84 --- /dev/null +++ b/tests/ref/fate/libavfilter-negotiation-chroma-yuv @@ -0,0 +1,20 @@ +Dump of complex filter graph #0: + +Filter: Parsed_testsrc2_0 (testsrc2) + out 0: default → Parsed_format_1.0:default [320x240 1:1 yuv444p] + +Filter: Parsed_format_1 (format) + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 yuv444p] + out 0: default → Parsed_scale_2.0:default [320x240 1:1 yuv444p] + +Filter: Parsed_scale_2 (scale) + in 0: default ← Parsed_format_1.0:default [320x240 1:1 yuv444p] + out 0: default → Parsed_format_3.0:default [320x240 1:1 rgb24] + +Filter: Parsed_format_3 (format) + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 rgb24] + out 0: default → out_0_0.0:default [320x240 1:1 rgb24] + +Filter: out_0_0 (buffersink) + in 0: default ← Parsed_format_3.0:default [320x240 1:1 rgb24] + diff --git a/tests/ref/fate/libavfilter-negotiation-chroma-yuv420 b/tests/ref/fate/libavfilter-negotiation-chroma-yuv420 new file mode 100644 index 0000000000..f93f15d1b1 --- /dev/null +++ b/tests/ref/fate/libavfilter-negotiation-chroma-yuv420 @@ -0,0 +1,20 @@ +Dump of complex filter graph #0: + +Filter: Parsed_testsrc2_0 (testsrc2) + out 0: default → Parsed_format_1.0:default [320x240 1:1 yuv444p] + +Filter: Parsed_format_1 (format) + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 yuv444p] + out 0: default → Parsed_scale_2.0:default [320x240 1:1 yuv444p] + +Filter: Parsed_scale_2 (scale) + in 0: default ← Parsed_format_1.0:default [320x240 1:1 yuv444p] + out 0: default → Parsed_format_3.0:default [320x240 1:1 yuv420p] + +Filter: Parsed_format_3 (format) + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 yuv420p] + out 0: default → out_0_0.0:default [320x240 1:1 yuv420p] + +Filter: out_0_0 (buffersink) + in 0: default ← Parsed_format_3.0:default [320x240 1:1 yuv420p] + diff --git a/tests/ref/fate/libavfilter-negotiation-chroma1-over-depth1 b/tests/ref/fate/libavfilter-negotiation-chroma1-over-depth1 new file mode 100644 index 0000000000..01e3e0df56 --- /dev/null +++ b/tests/ref/fate/libavfilter-negotiation-chroma1-over-depth1 @@ -0,0 +1,20 @@ +Dump of complex filter graph #0: + +Filter: Parsed_testsrc2_0 (testsrc2) + out 0: default → Parsed_format_1.0:default [320x240 1:1 yuv444p10le] + +Filter: Parsed_format_1 (format) + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 yuv444p10le] + out 0: default → Parsed_scale_2.0:default [320x240 1:1 yuv444p10le] + +Filter: Parsed_scale_2 (scale) + in 0: default ← Parsed_format_1.0:default [320x240 1:1 yuv444p10le] + out 0: default → Parsed_format_3.0:default [320x240 1:1 yuv440p10le] + +Filter: Parsed_format_3 (format) + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 yuv440p10le] + out 0: default → out_0_0.0:default [320x240 1:1 yuv440p10le] + +Filter: out_0_0 (buffersink) + in 0: default ← Parsed_format_3.0:default [320x240 1:1 yuv440p10le] + diff --git a/tests/ref/fate/libavfilter-negotiation-chroma2-over-colorspace8 b/tests/ref/fate/libavfilter-negotiation-chroma2-over-colorspace8 new file mode 100644 index 0000000000..9c78d1cf94 --- /dev/null +++ b/tests/ref/fate/libavfilter-negotiation-chroma2-over-colorspace8 @@ -0,0 +1,20 @@ +Dump of complex filter graph #0: + +Filter: Parsed_testsrc2_0 (testsrc2) + out 0: default → Parsed_format_1.0:default [320x240 1:1 yuv444p] + +Filter: Parsed_format_1 (format) + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 yuv444p] + out 0: default → Parsed_scale_2.0:default [320x240 1:1 yuv444p] + +Filter: Parsed_scale_2 (scale) + in 0: default ← Parsed_format_1.0:default [320x240 1:1 yuv444p] + out 0: default → Parsed_format_3.0:default [320x240 1:1 yuv411p] + +Filter: Parsed_format_3 (format) + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 yuv411p] + out 0: default → out_0_0.0:default [320x240 1:1 yuv411p] + +Filter: out_0_0 (buffersink) + in 0: default ← Parsed_format_3.0:default [320x240 1:1 yuv411p] + diff --git a/tests/ref/fate/libavfilter-negotiation-colorspace-rgb-yuv b/tests/ref/fate/libavfilter-negotiation-colorspace-rgb-yuv new file mode 100644 index 0000000000..8e69fb572a --- /dev/null +++ b/tests/ref/fate/libavfilter-negotiation-colorspace-rgb-yuv @@ -0,0 +1,20 @@ +Dump of complex filter graph #0: + +Filter: Parsed_testsrc2_0 (testsrc2) + out 0: default → Parsed_format_1.0:default [320x240 1:1 rgb24] + +Filter: Parsed_format_1 (format) + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 rgb24] + out 0: default → Parsed_scale_2.0:default [320x240 1:1 rgb24] + +Filter: Parsed_scale_2 (scale) + in 0: default ← Parsed_format_1.0:default [320x240 1:1 rgb24] + out 0: default → Parsed_format_3.0:default [320x240 1:1 rgb0] + +Filter: Parsed_format_3 (format) + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 rgb0] + out 0: default → out_0_0.0:default [320x240 1:1 rgb0] + +Filter: out_0_0 (buffersink) + in 0: default ← Parsed_format_3.0:default [320x240 1:1 rgb0] + diff --git a/tests/ref/fate/libavfilter-negotiation-colorspace-yuv-rgb b/tests/ref/fate/libavfilter-negotiation-colorspace-yuv-rgb new file mode 100644 index 0000000000..00a4b25599 --- /dev/null +++ b/tests/ref/fate/libavfilter-negotiation-colorspace-yuv-rgb @@ -0,0 +1,20 @@ +Dump of complex filter graph #0: + +Filter: Parsed_testsrc2_0 (testsrc2) + out 0: default → Parsed_format_1.0:default [320x240 1:1 yuv444p] + +Filter: Parsed_format_1 (format) + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 yuv444p] + out 0: default → Parsed_scale_2.0:default [320x240 1:1 yuv444p] + +Filter: Parsed_scale_2 (scale) + in 0: default ← Parsed_format_1.0:default [320x240 1:1 yuv444p] + out 0: default → Parsed_format_3.0:default [320x240 1:1 yuv444p9le] + +Filter: Parsed_format_3 (format) + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 yuv444p9le] + out 0: default → out_0_0.0:default [320x240 1:1 yuv444p9le] + +Filter: out_0_0 (buffersink) + in 0: default ← Parsed_format_3.0:default [320x240 1:1 yuv444p9le] + diff --git a/tests/ref/fate/libavfilter-negotiation-colorspace8-over-alpha b/tests/ref/fate/libavfilter-negotiation-colorspace8-over-alpha new file mode 100644 index 0000000000..7376f40526 --- /dev/null +++ b/tests/ref/fate/libavfilter-negotiation-colorspace8-over-alpha @@ -0,0 +1,20 @@ +Dump of complex filter graph #0: + +Filter: Parsed_testsrc2_0 (testsrc2) + out 0: default → Parsed_format_1.0:default [320x240 1:1 yuva444p] + +Filter: Parsed_format_1 (format) + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 yuva444p] + out 0: default → Parsed_scale_2.0:default [320x240 1:1 yuva444p] + +Filter: Parsed_scale_2 (scale) + in 0: default ← Parsed_format_1.0:default [320x240 1:1 yuva444p] + out 0: default → Parsed_format_3.0:default [320x240 1:1 rgba] + +Filter: Parsed_format_3 (format) + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 rgba] + out 0: default → out_0_0.0:default [320x240 1:1 rgba] + +Filter: out_0_0 (buffersink) + in 0: default ← Parsed_format_3.0:default [320x240 1:1 rgba] + diff --git a/tests/ref/fate/libavfilter-negotiation-depth-rgb b/tests/ref/fate/libavfilter-negotiation-depth-rgb new file mode 100644 index 0000000000..aa8c9a3a5c --- /dev/null +++ b/tests/ref/fate/libavfilter-negotiation-depth-rgb @@ -0,0 +1,20 @@ +Dump of complex filter graph #0: + +Filter: Parsed_testsrc2_0 (testsrc2) + out 0: default → Parsed_format_1.0:default [320x240 1:1 rgb24] + +Filter: Parsed_format_1 (format) + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 rgb24] + out 0: default → Parsed_scale_2.0:default [320x240 1:1 rgb24] + +Filter: Parsed_scale_2 (scale) + in 0: default ← Parsed_format_1.0:default [320x240 1:1 rgb24] + out 0: default → Parsed_format_3.0:default [320x240 1:1 rgb48le] + +Filter: Parsed_format_3 (format) + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 rgb48le] + out 0: default → out_0_0.0:default [320x240 1:1 rgb48le] + +Filter: out_0_0 (buffersink) + in 0: default ← Parsed_format_3.0:default [320x240 1:1 rgb48le] + diff --git a/tests/ref/fate/libavfilter-negotiation-depth-yuv b/tests/ref/fate/libavfilter-negotiation-depth-yuv new file mode 100644 index 0000000000..b4570fbd22 --- /dev/null +++ b/tests/ref/fate/libavfilter-negotiation-depth-yuv @@ -0,0 +1,20 @@ +Dump of complex filter graph #0: + +Filter: Parsed_testsrc2_0 (testsrc2) + out 0: default → Parsed_format_1.0:default [320x240 1:1 yuv444p10le] + +Filter: Parsed_format_1 (format) + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 yuv444p10le] + out 0: default → Parsed_scale_2.0:default [320x240 1:1 yuv444p10le] + +Filter: Parsed_scale_2 (scale) + in 0: default ← Parsed_format_1.0:default [320x240 1:1 yuv444p10le] + out 0: default → Parsed_format_3.0:default [320x240 1:1 yuva444p12le] + +Filter: Parsed_format_3 (format) + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 yuva444p12le] + out 0: default → out_0_0.0:default [320x240 1:1 yuva444p12le] + +Filter: out_0_0 (buffersink) + in 0: default ← Parsed_format_3.0:default [320x240 1:1 yuva444p12le] + diff --git a/tests/ref/fate/libavfilter-negotiation-depth1-over-depth2 b/tests/ref/fate/libavfilter-negotiation-depth1-over-depth2 new file mode 100644 index 0000000000..dc6aff0817 --- /dev/null +++ b/tests/ref/fate/libavfilter-negotiation-depth1-over-depth2 @@ -0,0 +1,20 @@ +Dump of complex filter graph #0: + +Filter: Parsed_testsrc2_0 (testsrc2) + out 0: default → Parsed_format_1.0:default [320x240 1:1 yuv444p10le] + +Filter: Parsed_format_1 (format) + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 yuv444p10le] + out 0: default → Parsed_scale_2.0:default [320x240 1:1 yuv444p10le] + +Filter: Parsed_scale_2 (scale) + in 0: default ← Parsed_format_1.0:default [320x240 1:1 yuv444p10le] + out 0: default → Parsed_format_3.0:default [320x240 1:1 yuv444p9le] + +Filter: Parsed_format_3 (format) + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 yuv444p9le] + out 0: default → out_0_0.0:default [320x240 1:1 yuv444p9le] + +Filter: out_0_0 (buffersink) + in 0: default ← Parsed_format_3.0:default [320x240 1:1 yuv444p9le] + diff --git a/tests/ref/fate/libavfilter-negotiation-depth2-over-alpha b/tests/ref/fate/libavfilter-negotiation-depth2-over-alpha new file mode 100644 index 0000000000..96867239f8 --- /dev/null +++ b/tests/ref/fate/libavfilter-negotiation-depth2-over-alpha @@ -0,0 +1,20 @@ +Dump of complex filter graph #0: + +Filter: Parsed_testsrc2_0 (testsrc2) + out 0: default → Parsed_format_1.0:default [320x240 1:1 yuva444p10le] + +Filter: Parsed_format_1 (format) + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 yuva444p10le] + out 0: default → Parsed_scale_2.0:default [320x240 1:1 yuva444p10le] + +Filter: Parsed_scale_2 (scale) + in 0: default ← Parsed_format_1.0:default [320x240 1:1 yuva444p10le] + out 0: default → Parsed_format_3.0:default [320x240 1:1 yuva444p] + +Filter: Parsed_format_3 (format) + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 yuva444p] + out 0: default → out_0_0.0:default [320x240 1:1 yuva444p] + +Filter: out_0_0 (buffersink) + in 0: default ← Parsed_format_3.0:default [320x240 1:1 yuva444p] + diff --git a/tests/ref/fate/libavfilter-negotiation-palette-rgb b/tests/ref/fate/libavfilter-negotiation-palette-rgb new file mode 100644 index 0000000000..f317cc85cd --- /dev/null +++ b/tests/ref/fate/libavfilter-negotiation-palette-rgb @@ -0,0 +1,20 @@ +Dump of complex filter graph #0: + +Filter: Parsed_testsrc2_0 (testsrc2) + out 0: default → Parsed_format_1.0:default [320x240 1:1 rgb24] + +Filter: Parsed_format_1 (format) + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 rgb24] + out 0: default → Parsed_scale_2.0:default [320x240 1:1 rgb24] + +Filter: Parsed_scale_2 (scale) + in 0: default ← Parsed_format_1.0:default [320x240 1:1 rgb24] + out 0: default → Parsed_format_3.0:default [320x240 1:1 yuv444p] + +Filter: Parsed_format_3 (format) + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 yuv444p] + out 0: default → out_0_0.0:default [320x240 1:1 yuv444p] + +Filter: out_0_0 (buffersink) + in 0: default ← Parsed_format_3.0:default [320x240 1:1 yuv444p] + diff --git a/tests/ref/fate/libavfilter-negotiation-palette-yuv b/tests/ref/fate/libavfilter-negotiation-palette-yuv new file mode 100644 index 0000000000..ff3e54aa84 --- /dev/null +++ b/tests/ref/fate/libavfilter-negotiation-palette-yuv @@ -0,0 +1,20 @@ +Dump of complex filter graph #0: + +Filter: Parsed_testsrc2_0 (testsrc2) + out 0: default → Parsed_format_1.0:default [320x240 1:1 yuv444p] + +Filter: Parsed_format_1 (format) + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 yuv444p] + out 0: default → Parsed_scale_2.0:default [320x240 1:1 yuv444p] + +Filter: Parsed_scale_2 (scale) + in 0: default ← Parsed_format_1.0:default [320x240 1:1 yuv444p] + out 0: default → Parsed_format_3.0:default [320x240 1:1 rgb24] + +Filter: Parsed_format_3 (format) + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 rgb24] + out 0: default → out_0_0.0:default [320x240 1:1 rgb24] + +Filter: out_0_0 (buffersink) + in 0: default ← Parsed_format_3.0:default [320x240 1:1 rgb24] +