From patchwork Sun Jan 8 12:58:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 39918 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp2423369pzb; Sun, 8 Jan 2023 04:59:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXuAzm7vnS3nWluot8MB95Jao7mYXXMju9O1hGqOn69WU6UD6s+0aUpueV9aQsLq8Pdt4u0d X-Received: by 2002:a17:907:80ca:b0:7c1:20ff:c044 with SMTP id io10-20020a17090780ca00b007c120ffc044mr54110444ejc.27.1673182746590; Sun, 08 Jan 2023 04:59:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673182746; cv=none; d=google.com; s=arc-20160816; b=EmjJd+7SoN+UxUvOEGy9+buIJMWM3KdOyjacZUTQPOSLESS0araJ2u9g/yVYjzWlni zlmdrTFnyQwb+DKpkGNwiGIHEiuY7WsAgs5Hat8DNW5KuLclVdAyKWjSlIAeyOuVyoOp 4CKCppDYLl/cUYJ0n5JQwEjS6d6UKy9XlrhZ5YJZn3H2ZVoD4tgegE0zhqMwzpOYHsWd PLv5Hg3dDP5C1cdWPZwn1/Es+hgcuvoHQGW2qBZjNk4G45Tv8ISQEsGyK3uNOyxm/FRX FFf+3qcSD53Hnk3zmBarvRLwqitcf+QFxRf5bqeojVSnT72BPDHFxbyxENYmyU7zSALy /Usw== 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=nx3r4vgRFG7Q5tfew2HITf67PcwkVs1RmD+Nm670DW4=; b=OOsw8F5rkMnw1c08M+OfsOL5SHQkqH3FuBVA+Sr2Ur+cOFudSmH782g9IgELKnTZuM 5pOMxOrij44Pz5PKiuJoVmHWHzDGqHxcnd1EtnqxyeRug8UHIym7oGuKxFlMB+gJ0BMm p3DesR/5f5dprT4MessmEi4ceiLtEsLZUHrD8prN45qspjBlHWr1WHvZOac9TxzJIi8T D8IdZovsYuS8/NFwp31T6B3e6DAm5iE6LOTNKFgPzH3hpkZe3N6Jx37Kdh45W1zPUkV2 mIfu6ZzAAOPD2jq3WK2vnBZtD4MLuLGT2vT46M8DSeTGDOHsTaOiZeV8HdE4bkEp87pY UC6A== 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 oz35-20020a1709077da300b008327270a7fesi6922217ejc.538.2023.01.08.04.59.06; Sun, 08 Jan 2023 04:59:06 -0800 (PST) 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 320FB68BB4C; Sun, 8 Jan 2023 14:58:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CB87168BABF for ; Sun, 8 Jan 2023 14:58:35 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 69EC32406CA for ; Sun, 8 Jan 2023 13:58:34 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id j9TFQPXFE-Ns for ; Sun, 8 Jan 2023 13:58:33 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id C2D87240591 for ; Sun, 8 Jan 2023 13:58:33 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 61D4D3A034A for ; Sun, 8 Jan 2023 13:58:26 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sun, 8 Jan 2023 13:58:06 +0100 Message-Id: <20230108125811.17967-3-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230108125811.17967-1-anton@khirnov.net> References: <20230108125811.17967-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/8] lavfi/avfilter: avoid a redundant av_opt_set_dict2() call 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: wp6F1uobM83p Current code first sets AVFilterContext-level options, then aplies the leftover on the filter's private data. This is unnecessary, applying the options to AVFilterContext with the AV_OPT_SEARCH_CHILDREN flag accomplishes the same effect. --- libavfilter/avfilter.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index e5dd0cfdb0..689c91891e 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -887,7 +887,7 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) { int ret = 0; - ret = av_opt_set_dict(ctx, options); + ret = av_opt_set_dict2(ctx, options, AV_OPT_SEARCH_CHILDREN); if (ret < 0) { av_log(ctx, AV_LOG_ERROR, "Error applying generic filter options.\n"); return ret; @@ -902,14 +902,6 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) ctx->thread_type = 0; } - if (ctx->filter->priv_class) { - ret = av_opt_set_dict2(ctx->priv, options, AV_OPT_SEARCH_CHILDREN); - if (ret < 0) { - av_log(ctx, AV_LOG_ERROR, "Error applying options to the filter.\n"); - return ret; - } - } - if (ctx->filter->init) ret = ctx->filter->init(ctx); if (ret < 0)