From patchwork Thu Apr 15 02:02:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 26916 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 8AA7244A0C1 for ; Thu, 15 Apr 2021 05:03:18 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5E65A68A329; Thu, 15 Apr 2021 05:03:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-oln040092066011.outbound.protection.outlook.com [40.92.66.11]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 103EF689D2E for ; Thu, 15 Apr 2021 05:03:12 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cq6tZfTxQw3gJsR/pzXXTnREPpm9fsihVA/GKCVokUbN+SYtOQAIgMmJTGcx5LM8y6fH4ntkkq6Y++wwRFEVlabpXDonsHWx0lYy8GR1lBmGxx22JTUzW3xHC+Xkds4fJ3NKidzJ87OAH0TMLhTwli24dPyMGjQRNrAzKiPncUvwn3Z9R04JdidIgPQyXX/x3GsjOwK8kjlQaupP4mJCS00kL6HuRrT2pD3Wa4huJ/CBXpDB2r3AVs/8u+UTnyiakrEgANRfruX2RCl8e+dn3g8ZQK16gdOriLuVP/5HfCv/PfjaJXuRAtLzs9G4xCfEc9ah8A2pfT3Bz5TfCvFwuA== 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=1YrNASzxr5zDd1xKZpQHZEQv6EYpQGY37hfV5b6SArk=; b=KS0cMG2d+sdihd8BNjrqthbP9zGDH0X0nSxNfezX9GVJNJPTvXpOQMDPYFkTXQ7En6dDsE6u6nMBRcbMDmpsvgm4QraDJj3N56gj5ppox0yEPw9+Zx9bouSEIFMASkb7hX1eMrs0jaNaB0UME7c3FRmN4Nv/LXrAgEzLeX6GnkvTky1U3dBYBPxNrSG+3nfejbULSqY+nfWAHwF9Z6B+nVzoM+/1fau2tGRSNdqV7p4GU1oGzFJQgh7hiJEQ81PXf1lKSEM9hlXTe0JUYpiTuVUhUb2HQafCdd+bji2rv8U18vK46rAExzfFfUlOzjYRFKZ23cHdHyKGkvVLcLB49w== 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=1YrNASzxr5zDd1xKZpQHZEQv6EYpQGY37hfV5b6SArk=; b=Z+v6R4mhP60dJzdjhYoVU9uQdYwKRRye/RZ13SB1G7RHHMJ1v1XE8natX+hHD1eVRvLD9is1OA4tC8DF19cw8o4cGzYgXXCs8+9I1BTHswJZJZMtH1quXGSrBtTDlXGLhl8Djbit7SXoqhJ/d4T+3OGDi6ytN7Lt7PP5Bmw6gr0iPhC+7mPq8SusSSVPzs6vbWOzPgxVnJz6/mrigyFjNXyGjGlo5hrpIsoUVP80dYKYzl3AVy84JnIIaoJB9Tohz+nNhto8DQWvIV9i8VmkO+QK3ueo6g5dsHLEGkrzS74kRNGaDztrM41uiYNYM00ELi8ayNx4Zo7KK7+HTQywjA== Received: from DB5EUR01FT021.eop-EUR01.prod.protection.outlook.com (2a01:111:e400:7e1a::48) by DB5EUR01HT101.eop-EUR01.prod.protection.outlook.com (2a01:111:e400:7e1a::449) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16; Thu, 15 Apr 2021 02:03:10 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:7e1a::42) by DB5EUR01FT021.mail.protection.outlook.com (2a01:111:e400:7e1a::245) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16 via Frontend Transport; Thu, 15 Apr 2021 02:03:10 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:4ED6A781D918D2145A099C5B8A937DF111F53377C4667F454FA811CE907DF9D5; UpperCasedChecksum:85406B26660E4858ADC40CA6C84ACF66C11D3D06E5EEA411056F9FCF65E9F4D7; SizeAsReceived:7399; Count:46 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::45bb:c44f:2b75:23b7]) by HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::45bb:c44f:2b75:23b7%5]) with mapi id 15.20.4042.018; Thu, 15 Apr 2021 02:02:52 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Apr 2021 04:02:35 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 X-TMN: [P7UpnhKD/cEv5ngSZH9DKvtF7frvbIwy] X-ClientProxiedBy: PR0P264CA0100.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:19::16) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210415020239.1410801-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.137.96) by PR0P264CA0100.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:19::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16 via Frontend Transport; Thu, 15 Apr 2021 02:02:51 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 2292f707-7383-4e5a-da06-08d8ffb29348 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiTEEqEyiKFNUcsVK4T7qzgRjnA9VFaK/eqZVwmzEF2B6vU0tkqFw14x2Q8fnLFrTKSOMt2vwL5CdwCJbzxAApRNPer5DY1pHxO0uf5H/xrjzhZCnPqgjfIx+xD/KPlijtz3eBHQBTByH/+cl3/F7b3SOriU6KSz6eMBxs+W2qyw0BfEyvSUJN9AjaN22NxeEaMOka+kE3gw8Wn7mGG+7VJ43jAf2bbQ8kLu2NsstugzU98h3CpmnxKUY6BId6zG++imS9PV9IedlSJV0TvQOggmj4im75eoaPGoHZ/x7RqvMXo37AMMPyRuPgipNy0oyAcm2dbND6gRczNDgvrGkBlU3LY2KB7eSh10iYC76K1BS4XmANUu7R/pOl0ErJsXZawaLljbZU6f9sU/d0Pq8mGCgv/oQtAQcARMR6B9wPKZqioo0j4O0yTCbB1Ci5I56WSaOMotkBky4KUGJMKce6J4IDM2I6P+rFGKrQ7R8LHtCqSEGqOGSBIj3GWIMgXluCGBZ8SjcybqMMZNwLBd/RgOHRf3B7MQ5amdvscHCq0DjHVSaY9sZ+ffn2d2tBjwh6aPs2ZF0Lzeq/AbI77err66KGacovRFnbg15YYfjV6MlmwjjuemWEjPRhTo/gS2fpkkATYwgxobcTdFJuNR3ON++gADYAiE4PNdTNoJtHpQWBIGwX0W2edt6EVej56Elu0GVOK2NZHAeQ0C7e4NW9AmB8F67nb8wnl3tajVGki5IBHVC8hhQRSrmcYHhwAtsfM= X-MS-TrafficTypeDiagnostic: DB5EUR01HT101: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 71Z57aCK5ar5nfN6IEXzod1h4W4EOf0kaaJRy6WQ1Mkewk46ssoL+dy3iSuxLYKkrrILScQqaEzztjuLl5O/OPCNS7KiaElae84D8Zje3c+WKwrQJJsCeHbkVkWgRqe04YEDRCp05+QVJkn7/AHzKdLPLh7WHx2DDQA0dxOkNFGHs16ppVQ8YJww4cR8Kcbk46IUPhO3EAHl+3CMkh+DviydBAyCFatm+Ak7S1EKu9z2xWjArX0f5BIg6OEg+PQpNDOodvAyOtfZLyUHy4p3HHIsEllNZXbrmwR9p/7CH5QVJsExgK4uMtFJ2zElXjqwrGG8LGvLmF8Rtfd+4n17z3Y7e28aGgd4wyAAr4RFVnsCCxZ/6IYWwyUWB2CmShmdHm4C/K9RwPBYwhuBEN0b6A== X-MS-Exchange-AntiSpam-MessageData: zsrOoPiT9bUAbQRkzbmvb1NWwcHQLCylZFCLjln2kLFLF1f3HL3Ooe55iM8ps61JkWH9G3PHECMbzHzHm/s45gpFAWrrfuTHf3f90UOjBGZvxUBN6UkWVD9XwPx6tzcvvIJ21WmhdHei5xtStYJiyg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2292f707-7383-4e5a-da06-08d8ffb29348 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2021 02:02:52.1528 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DB5EUR01FT021.eop-EUR01.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: DB5EUR01HT101 Subject: [FFmpeg-devel] [PATCH 1/5] avcodec: Remove redundant freeing of extradata of encoders X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" AVCodecContext.extradata is freed generically by libavformat for encoders, so it is unnecessary for an encoder to do it on its own. Signed-off-by: Andreas Rheinhardt --- libavcodec/flacenc.c | 2 -- libavcodec/huffyuvenc.c | 1 - libavcodec/lclenc.c | 1 - libavcodec/libfdk-aacenc.c | 1 - libavcodec/libkvazaar.c | 3 --- libavcodec/libopusenc.c | 2 -- libavcodec/libspeexenc.c | 1 - libavcodec/libtheoraenc.c | 1 - libavcodec/libvorbisenc.c | 1 - libavcodec/libx264.c | 1 - libavcodec/libxavs.c | 1 - libavcodec/libxvid.c | 1 - libavcodec/mpegvideo_enc.c | 2 -- libavcodec/opusenc.c | 1 - libavcodec/vorbisenc.c | 2 -- 15 files changed, 21 deletions(-) diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index 05a85d830f..32b2465279 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -1455,8 +1455,6 @@ static av_cold int flac_encode_close(AVCodecContext *avctx) av_freep(&s->md5_buffer); ff_lpc_end(&s->lpc_ctx); } - av_freep(&avctx->extradata); - avctx->extradata_size = 0; return 0; } diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 2882433db5..7e5c8f7fac 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -1038,7 +1038,6 @@ static av_cold int encode_end(AVCodecContext *avctx) ff_huffyuv_common_end(s); - av_freep(&avctx->extradata); av_freep(&avctx->stats_out); return 0; diff --git a/libavcodec/lclenc.c b/libavcodec/lclenc.c index 4fe52b40da..fbf65e5428 100644 --- a/libavcodec/lclenc.c +++ b/libavcodec/lclenc.c @@ -161,7 +161,6 @@ static av_cold int encode_end(AVCodecContext *avctx) { LclEncContext *c = avctx->priv_data; - av_freep(&avctx->extradata); deflateEnd(&c->zstream); return 0; diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c index 6494c11ddc..692508eaa3 100644 --- a/libavcodec/libfdk-aacenc.c +++ b/libavcodec/libfdk-aacenc.c @@ -112,7 +112,6 @@ static int aac_encode_close(AVCodecContext *avctx) if (s->handle) aacEncClose(&s->handle); - av_freep(&avctx->extradata); ff_af_queue_close(&s->afq); return 0; diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c index 4432649853..286d97a318 100644 --- a/libavcodec/libkvazaar.c +++ b/libavcodec/libkvazaar.c @@ -156,9 +156,6 @@ static av_cold int libkvazaar_close(AVCodecContext *avctx) ctx->api->config_destroy(ctx->config); } - if (avctx->extradata) - av_freep(&avctx->extradata); - return 0; } diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c index 70d17f802b..6c7ec4db3c 100644 --- a/libavcodec/libopusenc.c +++ b/libavcodec/libopusenc.c @@ -432,7 +432,6 @@ static av_cold int libopus_encode_init(AVCodecContext *avctx) fail: opus_multistream_encoder_destroy(enc); - av_freep(&avctx->extradata); return ret; } @@ -538,7 +537,6 @@ static av_cold int libopus_encode_close(AVCodecContext *avctx) ff_af_queue_close(&opus->afq); av_freep(&opus->samples); - av_freep(&avctx->extradata); return 0; } diff --git a/libavcodec/libspeexenc.c b/libavcodec/libspeexenc.c index 6a37dbc76c..9ea35a763f 100644 --- a/libavcodec/libspeexenc.c +++ b/libavcodec/libspeexenc.c @@ -318,7 +318,6 @@ static av_cold int encode_close(AVCodecContext *avctx) speex_encoder_destroy(s->enc_state); ff_af_queue_close(&s->afq); - av_freep(&avctx->extradata); return 0; } diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c index 16966ed433..8a7b80e174 100644 --- a/libavcodec/libtheoraenc.c +++ b/libavcodec/libtheoraenc.c @@ -365,7 +365,6 @@ static av_cold int encode_close(AVCodecContext* avc_context) th_encode_free(h->t_state); av_freep(&h->stats); av_freep(&avc_context->stats_out); - av_freep(&avc_context->extradata); avc_context->extradata_size = 0; return 0; diff --git a/libavcodec/libvorbisenc.c b/libavcodec/libvorbisenc.c index bf94764954..9d36457328 100644 --- a/libavcodec/libvorbisenc.c +++ b/libavcodec/libvorbisenc.c @@ -196,7 +196,6 @@ static av_cold int libvorbis_encode_close(AVCodecContext *avctx) av_fifo_freep(&s->pkt_fifo); ff_af_queue_close(&s->afq); - av_freep(&avctx->extradata); av_vorbis_parse_free(&s->vp); diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 4ddc4973a4..4535d23848 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -508,7 +508,6 @@ static av_cold int X264_close(AVCodecContext *avctx) { X264Context *x4 = avctx->priv_data; - av_freep(&avctx->extradata); av_freep(&x4->sei); av_freep(&x4->reordered_opaque); diff --git a/libavcodec/libxavs.c b/libavcodec/libxavs.c index a83b93b836..62f7e9dfa7 100644 --- a/libavcodec/libxavs.c +++ b/libavcodec/libxavs.c @@ -228,7 +228,6 @@ static av_cold int XAVS_close(AVCodecContext *avctx) { XavsContext *x4 = avctx->priv_data; - av_freep(&avctx->extradata); av_freep(&x4->sei); av_freep(&x4->pts_buffer); diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c index cb9135436a..a74a2c1dd2 100644 --- a/libavcodec/libxvid.c +++ b/libavcodec/libxvid.c @@ -883,7 +883,6 @@ static av_cold int xvid_encode_close(AVCodecContext *avctx) x->encoder_handle = NULL; } - av_freep(&avctx->extradata); if (x->twopassbuffer) { av_freep(&x->twopassbuffer); av_freep(&x->old_twopassbuffer); diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 7909a5630a..6435c0f668 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1032,8 +1032,6 @@ av_cold int ff_mpv_encode_end(AVCodecContext *avctx) s->out_format == FMT_MJPEG) ff_mjpeg_encode_close(s); - av_freep(&avctx->extradata); - for (i = 0; i < FF_ARRAY_ELEMS(s->tmp_frames); i++) av_frame_free(&s->tmp_frames[i]); diff --git a/libavcodec/opusenc.c b/libavcodec/opusenc.c index 8bc9e9dc4a..5822482bbf 100644 --- a/libavcodec/opusenc.c +++ b/libavcodec/opusenc.c @@ -614,7 +614,6 @@ static av_cold int opus_encode_end(AVCodecContext *avctx) ff_af_queue_close(&s->afq); ff_opus_psy_end(&s->psyctx); ff_bufqueue_discard_all(&s->bufqueue); - av_freep(&avctx->extradata); return 0; } diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c index 1b0ab3cadb..091338b41e 100644 --- a/libavcodec/vorbisenc.c +++ b/libavcodec/vorbisenc.c @@ -1254,8 +1254,6 @@ static av_cold int vorbis_encode_close(AVCodecContext *avctx) ff_af_queue_close(&venc->afq); ff_bufqueue_discard_all(&venc->bufqueue); - av_freep(&avctx->extradata); - return 0 ; }