From patchwork Sun Apr 25 22:34: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: 27384 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:5014:0:0:0:0:0 with SMTP id e20csp3459409iob; Sun, 25 Apr 2021 15:38:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz20jupMu5LEwtBCDWGHuVjRXAdIvGrN2QYVVLyrqJXD9WPWLH53u0k7jOBGcXNz7PIJr32 X-Received: by 2002:a17:906:5450:: with SMTP id d16mr15257804ejp.274.1619390319719; Sun, 25 Apr 2021 15:38:39 -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 k14si4901656eds.577.2021.04.25.15.38.39; Sun, 25 Apr 2021 15:38:39 -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=TMItGHJl; 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 A4B00689D24; Mon, 26 Apr 2021 01:35:52 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-oln040092064032.outbound.protection.outlook.com [40.92.64.32]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 033376898E0 for ; Mon, 26 Apr 2021 01:35:46 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bCxHRJMCsWv8//RwWnirtI3i+nYFdaOszBsEHiGoGFlOMdBNBKuvCQKbRvPqktIcug0n2sNMR7Mc0/59v/hHyWAxhqowWkkzKWUAcwfEr+Ozb6zA39qQ3+hvpHPppynyib2nYb7HUkpKb+lF48UOcbqa2vEl7vjTIcVeQXYodVzBEftyUePPv8Fb6HiDFlZnpzTcRdhE4MBBQynUG64oX3WBFvGaOEmUdT3swpTZQMjzkE1/JzONwhtOR4HsfiYjSy/IO8yGDta/zjoHKGxLV7U53tCHPyueOAyVl1YcWE4PbZRy36hnTMhPJnU/vvIsXKOLfbj/fQ/bPOLX8OOXiw== 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=Ekvmku8/E2ug8wONaTNe7/ww/OEv7Gshpj2svl0C7mc=; b=Cl8JY9wgDWl8z1b8ZwgCPm0FhDkkTdNGirT3WVvse9FAKd98BbQyG8Ooh4uw4dOok1q5GYhVWZ7NYSwVkkIp546v92stUrNaBvqOlVen6qJOJtRkWN9Tq31N0D5xagEJH8bYPv3SvrQ3hUpm9L43y54g9T6fiJ2yK6n5dv9pQeQAQEcIY2e1B+iblQP/0sDd1U+xy5YS0+dQEun+iaJcLtM+CtsYheyXnYd1lBzxafN8mM4vfqOCuFLvEGXpq0eMA68eYyDETaYVQD1mKu2TIYulcNzNN+tFaAMw+Cxl8svh+LpY+deZO7TlpTiDGLTuTsb48l0whJaUThFBen/tng== 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=Ekvmku8/E2ug8wONaTNe7/ww/OEv7Gshpj2svl0C7mc=; b=TMItGHJlsrvYoVrO4QjFeiFfU7GK+AaNwSi9P8lzHIIU3kLZm5O8Cl80pDzgSZze1oYt6P5hAYN70l8t4fIZm+y4jQilxrUbqbpUSW3sZQaKzRs3Foltvd9Ams92t325CnyEjHbYzo+UzHU1aAe5ae2uQ6q2Tu5PYZNAHQHCk8/oZ1XDc5JWv7P5OI8lMk+TGLvApJC/FmtfbXiH1DI2DGYlQglrr0MbGEUIUzVKDxADzwbNe1zgymCu+FZIY2MP4JTE08Bb0A8zQQezg7fQrbwLKaVwHNoGaguz+yF+PvS68goTfSIJs3kr8TaWAKjmVeI2Cq4bNKjFsHQBODIFfQ== Received: from HE1EUR01FT054.eop-EUR01.prod.protection.outlook.com (2a01:111:e400:7e18::4a) by HE1EUR01HT136.eop-EUR01.prod.protection.outlook.com (2a01:111:e400:7e18::260) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21; Sun, 25 Apr 2021 22:35:45 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:7e18::4b) by HE1EUR01FT054.mail.protection.outlook.com (2a01:111:e400:7e18::317) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21 via Frontend Transport; Sun, 25 Apr 2021 22:35:45 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:27FEFE9702A1925752102BE680AACBDB44BDA2A6C8E1224CF71EAE0E91399E1B; UpperCasedChecksum:E404773A85109FA847241DAB1B8102EFDC3B59E1A0EA8CF0F8C5CBEF7FE4CD08; SizeAsReceived:7583; Count:48 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.4065.026; Sun, 25 Apr 2021 22:35:45 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 26 Apr 2021 00:34:38 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [EWJxIYQF/lrBYkPSYmVV0BqmAIlWJFI/] X-ClientProxiedBy: ZR0P278CA0100.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:23::15) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210425223448.130684-23-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.193.248.86) by ZR0P278CA0100.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:23::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.22 via Frontend Transport; Sun, 25 Apr 2021 22:35:44 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: e2ec4753-4cfd-4b69-8a7b-08d9083a7731 X-MS-Exchange-SLBlob-MailProps: q+fD6XS3/UKBTepCewFwVSkfoADfkQpyvQJmww1KlXcr+VW7VMqeUH78vZxGkkrGrKcr5A80CMw0T79TczUHVtsKaBiBUcaYpfPwJQeyo6RcMRNoZVW8Rqry38Jx7J32s1VithqQLm5wFow9K8oin7I0mCjTQhgx0OuVouqfWtJU33nT3JhlngApAjErBqxWZwRU6WNGioXU3rc8bxjMma0KyRZKyEqzi5CD/Lu35RRRQLgSCDu/2OfJURTsAWfIoIsjgF9VqfIutVseaK3/GFBxu6a8rO9W4FHbgRugb75UaZjBgsm2/6Lo9wuwWy0VgVn15UD+XcMvqt6btKe7+nlOaGe/FuGLKVtoX3e52OHF7+WYlGSbLl+TKruVJG5HGeVPflJboiuL88IwS52jVT9IxNyieXSgdmbhmCOkfTlf0wgVa7zhqGFn/nYnjA67HT8+qody9lhn21rEeNdSKWoZ4hhNG6E1AKQHviyg3Jxaq3vV7H7b+o788vtJrvqsXSUxV6g7ekUUIiyF6zIxMw28sprX9woP9h1Dj2x1ajwUkLrjGndmqKpHf5bul/eAIwuMdzYvQbQP7ySO2YGjtAgNjOQ0UCdgxnbY81TfSlDR7lyc7LXfpEVFn97NuxzwRNW9y4DZUwKHM3PxjXHmjyRQZbU3BTICzKIvUvs0aJ7UIPuqorxW/YCdvG/GF5u5ltbj18kRNDiJXxgbVVXX1w== X-MS-TrafficTypeDiagnostic: HE1EUR01HT136: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k19PvrsKuDo+tdlpXR1qYhqZxZgrCf27/MkXvLPxzFBOXGOt8SURiA5vInVgzlCNQOhLfDYL60UxVyRJw+SsxzWO58Zwc/EDjDmsGt6EyPzBJaNsYl2vrNAcwqYAEx/7RojIvhR+LNdmVFTNe+x5bruG6+r+z++D6BX8PgJnhUomfNa3WzxqAnhHbxNxozBBMKSovpuSSueVuE+wDVLqgND/FGayB9UxZProcwvmAN00nvmowKk7M8MMeRA9fX0BmsOO7GlLKI6rp6sA5YcQOX8jS2uz3rGS631398DW7tveUlfJdjVgyqBe3bzjJRlvT8Gfsa9LqDVYyXEui+ANkrdurkyCgk3kLbOiVhEB2UVvhXUr9vtzE5i5n3z2CRc08xFf+WCqQsuyeFgeKohFUw== X-MS-Exchange-AntiSpam-MessageData: M3NqnG8bfgPuNrAMNb9PTe0o11rHic4p98L0XfjK1A390lP02LlvYNAA0TU0JFCrGqIA4YWrLVRGZz+lkC0zUnaE8HCdSnWB6MW163wbnc9ycxxTmxnFr4XXb/gXzyFEWzdmOfhwpGz1nCfz1E7MaA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e2ec4753-4cfd-4b69-8a7b-08d9083a7731 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2021 22:35:45.2695 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: HE1EUR01FT054.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: HE1EUR01HT136 Subject: [FFmpeg-devel] [PATCH 24/34] avcodec/zmbvenc: Avoid copying packet data 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: tJQ2Zc2gxKNj Here the packet size is known before allocating the packet because the encoder itself works with an internal buffer, so one can pass this information to ff_alloc_packet2() to avoid the implicit use of another intermediate buffer for the packet data. Signed-off-by: Andreas Rheinhardt --- libavcodec/zmbvenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/zmbvenc.c b/libavcodec/zmbvenc.c index 4b3416219b..8933d06ede 100644 --- a/libavcodec/zmbvenc.c +++ b/libavcodec/zmbvenc.c @@ -281,7 +281,7 @@ FF_ENABLE_DEPRECATION_WARNINGS } pkt_size = c->zstream.total_out + 1 + 6*keyframe; - if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size, 0)) < 0) + if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size, pkt_size)) < 0) return ret; buf = pkt->data;