From patchwork Fri May 21 09:17:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 27878 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:b214:0:0:0:0:0 with SMTP id b20csp342951iof; Fri, 21 May 2021 02:23:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzC/6PQAeiWNTwLWNaB9pBh0CJs5NvG3IQy4uDJZNvWCQHsMo5OLggFTpzj50SbJ22i3TPx X-Received: by 2002:aa7:c84a:: with SMTP id g10mr9940815edt.326.1621589016015; Fri, 21 May 2021 02:23:36 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id f12si5679114edx.197.2021.05.21.02.23.35; Fri, 21 May 2021 02:23:36 -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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b="RXfrKf/7"; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 867B968991B; Fri, 21 May 2021 12:19:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-oln040092075093.outbound.protection.outlook.com [40.92.75.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 88957689907 for ; Fri, 21 May 2021 12:19:10 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GeqkvmyF5XSXzPS9dmSZAiLWFiO7RrPE4YeQaIdG9nPJyuy4r+bF5zeBhdKdaIOtrR3uOt0bxXXKrVTLKXdNM8v1Xxyn0kSISaaIisvbJVuUKW1Oly8MYnvQvUalPnhhxIxMsxMBb+KWewo5zP2kRpqrwqYwrb1Ae1OB4pAK4SITqlVLxrblRM0/t6Gg86s5l7idB8kvtHVR7jZgxntOZ4nD9F7OjjITXk3Glpi1Ad8QiWpcmFsuQmeq04oWFkBAUmYFfVtjuLoOAR9s07/pwzteZL/ayOjgh4d5LVF3VaCi6pcP+NBM88F5MXIk/1FSerey4+tA0iP9k5F/6P30Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nZYxxTPqpJr1vm4dUSMAovzugEECt0rtVW9Rxrd1bdY=; b=if+g7lEXTEli9uN9Ug6MjUI2nSBbJGrd4DBbqcs4AjQ2rMCXbA8I3GIWJG+t27I7CBv9wa3w+WbHbsivxjfyc78Ttb82WIR6/QEnSTMjPil9Sjw6JbGE32S4D5wnAAwKvu+UilW6za7MrRf7zRbPq2nJHdICmnHjNr7/hmEUud11lIB+oYzVA5Z5y9ZTnz47jpXQdDhHtrqCY3LkzL9W0DfAMs9GFdmKZkgD/SdfbBSWJsOjA9Bu2tewL3DfTTRk/rY9VJ9JCFL6gmsIR9ILQhDDmzwD3z6OOLPezDsHtWW3nL8jZELfkuS6wtGeyO1QR/m9TKf5P4jhe5wyylE2bw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nZYxxTPqpJr1vm4dUSMAovzugEECt0rtVW9Rxrd1bdY=; b=RXfrKf/7sN2uen9iwTVClymu1isC3HlvLUtmu0KS+EiRbaHOF/cMxBwt9ddoDHxUvPIWmuR0H9Igpuufs3gEznKHiRE6ugH06sT/ojhJPzBTdE4aQ2qc6Ne1VWX9bfDmrGGWinEQDN0WbyQpi/mXV6I/FIqM7ixRl2bA5rVPzFhdoaUhnfnLS0hTjbroxFZ8+88584LkgzVBLZZOvKnSGIlehH7GDKdmOC7ft3XXQZfHsQKpf2qf0TijIxDxzQU1iyPuSfnCZ1Sw7d8kTprmG2Spi2lAUYQ2Xlge+57S1qyHYT46RdcwFU9KD0IKI8QAiUrmUmm7qXLV2IbywRRHZQ== Received: from DB3EUR04FT030.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0c::41) by DB3EUR04HT022.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0c::312) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25; Fri, 21 May 2021 09:19:10 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:7e0c::41) by DB3EUR04FT030.mail.protection.outlook.com (2a01:111:e400:7e0c::99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend Transport; Fri, 21 May 2021 09:19:10 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:FBBC7F47AE9E47C892E213F1222B35232B5332F73692CFF3FD5542BA67B4F6DE; UpperCasedChecksum:66CAE54F40D4D82A1D4CE14659BF9F3833D2DCDC480E949C273C97E1A140E9EF; SizeAsReceived:7780; Count:50 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::f4cc:63fc:9cef:37fb]) by HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::f4cc:63fc:9cef:37fb%6]) with mapi id 15.20.4150.025; Fri, 21 May 2021 09:19:10 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 May 2021 11:17:38 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [mozbNpY4YbnA0NaQbE/SXBYXd233roH9] X-ClientProxiedBy: PR0P264CA0070.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1d::34) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210521091742.184902-34-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.95.27) by PR0P264CA0070.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1d::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.23 via Frontend Transport; Fri, 21 May 2021 09:18:40 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 09689f23-5792-4fa3-48f7-08d91c396cb3 X-MS-Exchange-SLBlob-MailProps: q+fD6XS3/UIohmq9k/yScywu9xPSfiUShP71Z1YwQDJUUhfUm4p7OHxzVkw13+O9t4URNqNXAqaztbX8wHa0Ru+z2Ep9v10dECzxNpsFrocR4OKgCt84yQJsv2lLssXz82blX07ycFHY1s2Jw/MR17vCZXdgTpMiA8Hqpb7EM2xnbJYfHK798vOAStxWZy4EemTxXXJ58Hv6tH1O9It/aCNls2Uqcc+bRh11dhZnXl4rKjlJy1gvhRtiYrMLOJOLUr7ayo3Jm8y7p7fMjI0Sww5BNFA3fO4E3KIXgoyGHAddXCoEkS2P9LsBLAa0/RqHzHsWl4uo5TfuQhatVbHT0nvonOzWUh03GjbiANJIw6N3kWb94Gfo94ryChJ9jsBCsXDN5TO2Y3mWwMeMep6sa3fyNqaJkxgPNJDXjAE3h7W4NvBH1sGPIKWVd2VCBjYwYYmPIfg/3mVzKcau4adS/VCrOeX7Nmv2ZR31fDeMHb0BnfS/61nL3OsDqeFLdaoYk+1g+oqdYWz5++1liDoH91kRcH1Cz58yS15xPcivK3j36URXzZi5g+4Da59bA1HugufQBYmrzzuUpua4JWiP6no9pYNTQ1fTtVcu8XxDELwWFMiu1VnSAS9JP5aTrkiTHKg8gnilOPzKyu6qiw7s6anWxmgQ1FR3fXaNeJoJLIYpHcay6+Fhs/aGN9jww6uJh4HPQfIAVP+8kneQHXVbPQ== X-MS-TrafficTypeDiagnostic: DB3EUR04HT022: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JDZdBdw5k1+FmNi23LzjejktcA6fJ4vQZIav6h1F2dG6aiew53IXF91PlCkJhMkA8An/kMPpI57VcGlc+WjaG7p0rzSaG9550EVzRTx2sNxXQAhtbOWZLSxumKjUaIZgAAUlSmsAnyr+VGUiEPcIjoKwm9ZiA3/btAuVkBKUgbdJnUPyH/EAICzSEp5AKZTSc72jTUOFN6xX581uJlnDusv+3thNQK81rnfK6CjiaOm/JlorAkPnhVBTn/onNe9zzxGuUKN3l5Ki4NxcoFmh9QANQvmBqE+pzQCx9DkieLCE0KuVJyEhXn6+/3upIo6QoBW+P1Sj5G5WPXpt92ByiYTTjtajeLr6VhVLXtm5p6xGQkZyvhfQpXHmTdhMAaK3T1ss9Od8pUsZnBO+QaHdrQ== X-MS-Exchange-AntiSpam-MessageData: zfwsaw2jgISBe8rnqWG5psMQY05K9TomgbEl103NVuubxZiFQva78E/Nfw243L1hMTiwqNKaby/Yhz1eU4XIPft5aGPu80QoqzZXZ1IOcUWaFJ1pLdJwY8o8+sVgEZp9vwx+rvmJGjJDBjcu9wWCTA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 09689f23-5792-4fa3-48f7-08d91c396cb3 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2021 09:18:41.4117 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DB3EUR04FT030.eop-eur04.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3EUR04HT022 Subject: [FFmpeg-devel] [PATCH 35/39] avcodec/avcodec: Avoid redundant copies of options in avcodec_open2 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: +Hr8LnheEdKV It is no longer necessary now that ff_frame_thread_encoder_init() no longer receives an options dictionary. Signed-off-by: Andreas Rheinhardt --- libavcodec/avcodec.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index 6f61ae246d..a65109e799 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -135,7 +135,6 @@ static int64_t get_bit_rate(AVCodecContext *ctx) int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options) { int ret = 0; - AVDictionary *tmp = NULL; AVCodecInternal *avci; if (avcodec_is_open(avctx)) @@ -168,9 +167,6 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE) return AVERROR(EINVAL); - if (options) - av_dict_copy(&tmp, *options, 0); - lock_avcodec(codec); avci = av_mallocz(sizeof(*avci)); @@ -207,12 +203,12 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code av_opt_set_defaults(avctx->priv_data); } } - if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0) + if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, options)) < 0) goto free_and_end; } else { avctx->priv_data = NULL; } - if ((ret = av_opt_set_dict(avctx, &tmp)) < 0) + if ((ret = av_opt_set_dict(avctx, options)) < 0) goto free_and_end; if (avctx->codec_whitelist && av_match_list(codec->name, avctx->codec_whitelist, ',') <= 0) { @@ -372,15 +368,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code end: unlock_avcodec(codec); - if (options) { - av_dict_free(options); - *options = tmp; - } return ret; free_and_end: avcodec_close(avctx); - av_dict_free(&tmp); + av_dict_free(options); goto end; }