From patchwork Tue Jan 11 20:45:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 33244 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp4048454iog; Tue, 11 Jan 2022 12:49:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJyI+Dz2+/5a+0C0jzhWoEGDIrU9g3qPd9j4ddWPQwUA+a6TnPs7vMZKcUCn9SLY54Vs3ApB X-Received: by 2002:a17:907:3e0b:: with SMTP id hp11mr4915172ejc.584.1641934151843; Tue, 11 Jan 2022 12:49:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641934151; cv=none; d=google.com; s=arc-20160816; b=AgnJG6zsI5e/7ogja9HSRENXJFVFNOU3/t812mNUv/NZ/bjOYtmBcZ2b7v/5A3i0iR +fuADk9r1NVQZGpvv1Pja+uv0cAXBSR/6ikTC8h7G9A5ufWv06MqjwDJ7X1V6U9WXBm9 VLXpfwQO+gP08tDo4EZNkYkCeaT+l5pBLN8+qU6WcUXjNn+R6b6uXhrgMCHHQ0N9Cz1C yITHPv0XKvxVsS29fAccrjywj69ld6YfdcnDPb+ao8koO/z9amV9ljwS5dYD/XBBWZ/l bN246Esvs9YfGvE0XJ1uo274y0MMCn39Ywgirq3DxeKaFG2A3Qxtg4UAx5qNoSrUual3 nwbw== 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=J/IT66NWKNubez00hicfiDEHW1sRSvbCPj/N8FVcOaE=; b=lYiDUvPYID0ajFYI+NEYAtdE0YN54nqcCIiHLXhJlc5XqxAw4qM9eoTbcaMocqZ3QR f0HurG/AQmCjn6L3gHtOnkM/R7c0MrAps3k5BvH54o83zD8cb6CssNmYeesY0C5hVR29 XIzndcbUFddsyvC38+Vxg29a8O4CJFdBNHyRd7GTxs9jWFNuhlfAO73HHL4DyliyrjI2 GUzi2Jad/5G1zw7sFfsG0PhRS4ru/Jm3jB2qNZJA192ff5feUy2otMmKBhOHBEPh8NAg OqtNwNvbDoHHei+oOeWPgs9PI6aiEexSJRlrQ2ft6ThSKa3snOjF/+6xFa6pJ5Ei5/u5 BzJw== 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 l11si5867273ejo.781.2022.01.11.12.49.11; Tue, 11 Jan 2022 12:49:11 -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 10D6368A55A; Tue, 11 Jan 2022 22:47:43 +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 5F8A468AE87 for ; Tue, 11 Jan 2022 22:47:34 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id E8C6324017C for ; Tue, 11 Jan 2022 21:47:33 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 6B7zhhHyw_NX for ; Tue, 11 Jan 2022 21:47: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 3E8CC24062A for ; Tue, 11 Jan 2022 21:47:26 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 334E23A0BE6; Tue, 11 Jan 2022 21:47:25 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 11 Jan 2022 21:45:53 +0100 Message-Id: <20220111204610.14262-18-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220111204610.14262-1-anton@khirnov.net> References: <20220111204610.14262-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 18/35] lavc/libvpxenc: remove unneeded context variable 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: QiQRP9AiDyRM discard_hdr10_plus is 0 IFF hdr10_plus_fifo is non-NULL, so we can test for the latter and avoid an extra variable. --- libavcodec/libvpxenc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 55f587c490..6bb19289ff 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -127,7 +127,6 @@ typedef struct VPxEncoderContext { int tune_content; int corpus_complexity; int tpl_model; - int discard_hdr10_plus; AVFifoBuffer *hdr10_plus_fifo; /** * If the driver does not support ROI then warn the first time we @@ -899,7 +898,6 @@ static av_cold int vpx_init(AVCodecContext *avctx, #endif AVDictionaryEntry* en = NULL; - ctx->discard_hdr10_plus = 1; av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str()); av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config()); @@ -919,7 +917,6 @@ static av_cold int vpx_init(AVCodecContext *avctx, // Keep HDR10+ if it has bit depth higher than 8 and // it has PQ trc (SMPTE2084). if (enccfg.g_bit_depth > 8 && avctx->color_trc == AVCOL_TRC_SMPTE2084) { - ctx->discard_hdr10_plus = 0; ctx->hdr10_plus_fifo = av_fifo_alloc2(1, sizeof(FrameHDR10Plus), AV_FIFO_FLAG_AUTO_GROW); if (!ctx->hdr10_plus_fifo) @@ -1289,7 +1286,7 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame, } if (cx_frame->frame_number != -1) { VPxContext *ctx = avctx->priv_data; - if (!ctx->discard_hdr10_plus) { + if (ctx->hdr10_plus_fifo) { int err = copy_hdr10_plus_to_pkt(ctx->hdr10_plus_fifo, pkt); if (err < 0) return err; @@ -1704,7 +1701,7 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt, } } - if (!ctx->discard_hdr10_plus) { + if (ctx->hdr10_plus_fifo) { AVFrameSideData *hdr10_plus_metadata; // Add HDR10+ metadata to queue. hdr10_plus_metadata = av_frame_get_side_data(frame, AV_FRAME_DATA_DYNAMIC_HDR_PLUS);