From patchwork Mon Apr 26 18:52:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 27434 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6109:0:0:0:0:0 with SMTP id v9csp351469iob; Mon, 26 Apr 2021 11:52:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEq/QTZ3bRgGZBeK6P/rStSpUKmyZFbdWScBG0eO6eAz+uXF3P25F9w36mWHKHgpURtA8W X-Received: by 2002:aa7:dc0b:: with SMTP id b11mr148604edu.124.1619463174892; Mon, 26 Apr 2021 11:52:54 -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 c30si586284edf.213.2021.04.26.11.52.53; Mon, 26 Apr 2021 11:52:54 -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=XSv74LVd; 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 55201689CDF; Mon, 26 Apr 2021 21:52:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074105.outbound.protection.outlook.com [40.92.74.105]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 03867689AF5 for ; Mon, 26 Apr 2021 21:52:41 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VyJs2viNSj2HLc0j7bWhoeE5vmrx5iKwS3hYsl1fh7nStSWqIEC4MNRF0DnpbOHnNLmVknCjgVCmoI4exzHF+txmNqcA7nDJtYkedjmssn3OVRrbHLt/FSHCdbD58WJCYuf2LIHZOQz9N93Ugv03DHq3wHnp8myv1aNDQGDxM08Csz7pQpCkGNpSY4oXimAtgOHHhy14ODcNxNefxo3UDnjLZrHRkqr1dUqOfu9voLwgHb9+C1qwhsFtvo9AYdzzCkBwifwCcrQ4MNI4NgKZcfrOwocEdj0ZWpRfmbrdAsxdEXQy5cP2lL3IFEcpXufQoCHJVCuYSsHvOQ1scwq/qw== 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=7JLXt3P2/x9MGCwa9OhSfmxpl+hQF+wQOlQCk14d4UQ=; b=PqsAQ9LnX413rzB9WZ0RHzG81Sol6+vl5+0V4P70I/V5MUn9eYjZN2PsmEsAb74K3lkiCV5boAnVvYNmXD8RAFvph5IGrg7bFz7ZwBGsNunD48X5K4Sb10WJN2Qx+qhv0q7SLKe2VGqpt8IsbXmQItgILdlpblUaZsZN85CM7OTVubKtMRVIYAKszXQxEZlvD3muYJ5oRUdOBvzWmqslrhIct+XPMGESYCFiEiFGd42aXVBoTRqVEPAWfESDMfgW1aDaioQ+jXhoAJbAK013M2RuqPLX56iqtyy9WwOCSn3lb71yHz0zOt/ZG0cKgJ4sRSxI48jmSZU5DITJdTYjKQ== 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=7JLXt3P2/x9MGCwa9OhSfmxpl+hQF+wQOlQCk14d4UQ=; b=XSv74LVdRXkvz9joCPioK1nMIJit7HEJdl88HF2nB9nJAomZbMQ6AgkqcnQ7vIYd+9izQEKUb5fG2YZAZEeEsJI1erU+w20WL8wMuh16AhO8mq95Uvr5w0YAf7cSFX2a27CNbxem/NpjUjaVIiSbmxDrPSAmswGpEtpN4vbC7TgUqxwt3QZKG5bPzkVst6npgi9oKstEvGoFpo/JSTFn5qjMYP3a3ZwzWQLS9upm20/gztpmW5f7QHlrKgk1njKmGecdRoIq4Ty7YCrHSt2hwl9K+uCGCX0l79FHselew8qeji23VcW+yqA3GzGmJ/0Pja+HP8CdHT7mKzcmFS5Wiw== Received: from DB3EUR04FT028.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0c::41) by DB3EUR04HT077.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0c::424) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21; Mon, 26 Apr 2021 18:52:40 +0000 Received: from VI1PR0301MB2159.eurprd03.prod.outlook.com (2a01:111:e400:7e0c::40) by DB3EUR04FT028.mail.protection.outlook.com (2a01:111:e400:7e0c::200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21 via Frontend Transport; Mon, 26 Apr 2021 18:52:40 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:0C13F0AAC8D6B6B32A95928EB811592B988E3EC586D1778055EB478C72252A45; UpperCasedChecksum:7F57F8297486FAD4B067D4EDAD56D45DCAC121D6D86C811A1917C8CA71630600; SizeAsReceived:7357; Count:45 Received: from VI1PR0301MB2159.eurprd03.prod.outlook.com ([fe80::9574:7cdc:6be4:137f]) by VI1PR0301MB2159.eurprd03.prod.outlook.com ([fe80::9574:7cdc:6be4:137f%5]) with mapi id 15.20.4065.026; Mon, 26 Apr 2021 18:52:40 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 26 Apr 2021 20:52:31 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 X-TMN: [PWvwkQlxOgEXiCkoyd5HGm1KSgG28pOA] X-ClientProxiedBy: AM0PR02CA0124.eurprd02.prod.outlook.com (2603:10a6:20b:28c::21) To VI1PR0301MB2159.eurprd03.prod.outlook.com (2603:10a6:800:26::20) X-Microsoft-Original-Message-ID: <20210426185231.784430-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.193.248.86) by AM0PR02CA0124.eurprd02.prod.outlook.com (2603:10a6:20b:28c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21 via Frontend Transport; Mon, 26 Apr 2021 18:52:39 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 45 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: f0d94a7e-06c4-4570-8ca5-08d908e4778f X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNUZz984a26XPKideXvfWlY8c+6y7wpKp8L4UW+aFDuyzeuHnsvWxBN25xgrJXh+vKUwe4T/moWDwr2EIEpGCEMvtUK7qKi0uvU00AMFmuVg8kDmiwEaQiL453oL9BI8zW3G1kI71uwBoxDtfmaaLMxVncgLKFYbXIbkZSzAsTen4xbZUA+tOYQsVb8mlHtH30F57TGWOH+txg20eKb/2Zm1OcpEmxVpkYuBSLz+WjwdMhssdYPXaezJUvVJjrK4kwGc+6HWd3oCPC2RGQzQ1dADHyInef8Ab1bJoe9r2Wi6u7ho2DAhbIv0emhzZ+dLGPZmbVKJNyNaU+ncunHYTzXENutsBf+Gx5lCvxXdh4zpBwq+R3f+NA6B2o3nkHH3yIY+1Cd7WtovI8st+mj6hTP6mvk5DrooBkK+DDMMquYGIClv9hQRJqvgHeK94e1MQmDVbs6yDVJBpx74LqvjBYbHY4KjTV13ZYiP+OylQ2iha6yAqIxAosk/LNc3dpOhZj+qSryntIospBYp8ncS5beznjI5A8Lol7eIQ84qqmo8RZgNRW3GWRY/S33yPxnnZaAKUNMSPxgzQLw2Pw5Cat+ODLw70w/14HmgFpL+R+hlAQY5NW/bLIqjCz06ddgXRJXjhFLtaKfL+2hk43SqEjmto65EjjOqHlsf0FlaUBa4ADmzP0lvfL/7YL0DRuXypx418H0ZiWV1FZJNjxvCXxgF6uprLJFUbCI= X-MS-TrafficTypeDiagnostic: DB3EUR04HT077: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ta3nUX28WkvKropfvSoq7pLOUKyBNV7f1p8C0rmxCkYEN0rf4uLQZcnjNXesENqkiIp7hH+lXOMUnezIXbMD9O9K8cwHANM9wvOrQ1Irm/XOa/JjZa5dlqxGGupTj8xc3BvunQNvcclcqyRa0yW6A7eponwodwhHW47ymaHwcBaQmZaxSWIiJpL8+jnnsWw7/piVyHgdrbfhHIx+TI6WoGTiGBZgnsk839a7uz2EJgWPzUMiEzEqgVpdvO/Uxr9IFWAo9s+HT2f4YVK/qzo87+n4VdYMfz2K0Jlj7iOXAkDWSkkdtA9ywPO+LHVOOQQICeNKNj68k02jnIAglLnAKTFWcqzwxRHX9uKlytVLOs5Sir5irF9cFyvkgGoPh735v+2tXP2LlvzxM1DeKzVEUg== X-MS-Exchange-AntiSpam-MessageData: i8+54kxKZWOjjs7iMDKVorWjFV4uYQ0ky1AOkJWjo9UfZ2bT9q9FF9xlS8kQrtk8x4Pv1W8iroJYh3FH59FSqd6RwKw61LrCwymk0fDEemPSN47Q38mUPwAMYF4lBnXiEIK11u57i2vdg1g8uD2iKg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0d94a7e-06c4-4570-8ca5-08d908e4778f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2021 18:52:40.4156 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DB3EUR04FT028.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: DB3EUR04HT077 Subject: [FFmpeg-devel] [PATCH] avcodec/encode: Zero padding in ff_get_encode_buffer() 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: ZTFvGRI9yU+r The documentation of the get_encode_buffer() callback does not require to zero the padding; therefore we do it in ff_get_encode_buffer(). This also constitutes an implicit check for whether the buffer is actually allocated with padding. The memset in avcodec_default_get_encode_buffer() is now redundant and has been removed. Signed-off-by: Andreas Rheinhardt --- libavcodec/encode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/encode.c b/libavcodec/encode.c index 9a4140f91a..75129c8646 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -74,7 +74,6 @@ int avcodec_default_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, in return ret; } avpkt->data = avpkt->buf->data; - memset(avpkt->data + avpkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE); return 0; } @@ -98,6 +97,7 @@ int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, i ret = AVERROR(EINVAL); goto fail; } + memset(avpkt->data + avpkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE); ret = 0; fail: