From patchwork Sun Apr 25 22:28:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 27375 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:5014:0:0:0:0:0 with SMTP id e20csp3454750iob; Sun, 25 Apr 2021 15:29:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4DHCnlFWT5OKXjibuhvzx7x5D99H9Z3+rd8auvUpq4SVkLNv1ks4tq0KOZj8EyMluU45T X-Received: by 2002:aa7:ccd0:: with SMTP id y16mr17986892edt.101.1619389776590; Sun, 25 Apr 2021 15:29: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 rl17si11892652ejb.428.2021.04.25.15.29.35; Sun, 25 Apr 2021 15:29: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=QYcx8WOM; 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 86E8868812C; Mon, 26 Apr 2021 01:29:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-oln040092072098.outbound.protection.outlook.com [40.92.72.98]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 608666809E6 for ; Mon, 26 Apr 2021 01:29:26 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BCMxmCNebsOoYJH1TwJS2tM7LGSLgv3UUBaQc7J/U9LSABmDJXp+tyxsgF9FcedYgh2YhdLDUTTd/m+tbOaI/OXebt4qVJEvt/ytWH+4zKg7GrlJpdzdAwW7E4eKd5IKN7ArvlDeObIzo8BbtRTgZPg3TyFHsG8tMZrB0678pqTL/p5HCEh1ay9IbyQEDd/wfYCsMXKSBzwIcjvgLgPq2JxfyDxwvAeDIJLhXN9c9D0MAeCx9d6g1r53yqJnTJUcebe4x2eVE6LlprPDonoZnVucNFWiYMhCk81mo0aosExRuT2f5xOBf5ycHdXBvBABzM8XEceatcZ6U5T+6S5CYQ== 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=vMwD8YKMgTaeV8yAWeZ7he88RWwfXh70t0kD9oM2VWQ=; b=X7VbVz7Rql/IDScPeViT04OlUo8s9oYZ1B6saCgWQwk35KCG4JffT0jK4Wl58tGvGxHirR35AldjiMj+fR14bjIc41zhEV6A+aqYHo17XLb9OloKHMr5a9dzSWY2/zDtsFGNVAszsCCpdArboGyHCB3QkvKxzPXXC8lViinCZP2f6pC8A32rkh1H5b3d2+c3ZB60oPPkBSMCcDRjwgWgzACgFOHbBcwQ87bdSX4P1RDnLkeWrF+s8w9NfA9PIdOl1Az/xDXDthTBc50jiLKKDSnZdIi/QbdKXlfsqYJ1S6pwIKxqPvo/nAbbbwglReiG+FiQmf4pKQOaL4wLBY6gCw== 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=vMwD8YKMgTaeV8yAWeZ7he88RWwfXh70t0kD9oM2VWQ=; b=QYcx8WOMLhEjonLzmHmoiO25FjeetahaH9+fJpCPmQ4fbHEDQcnIcdGKdWdAhr1V2FbcrWjzz3tgCSOMUCN/DLR9x0JN2m/k76XoP9c9/cWdewOJWcMYDZ0JLiLFTz0S9Xlqhw/az55t7rqRNBc39+WqLMOT1HInB38Jxy7LfqYNY1dDALiyDjzZIRw+IZhmRKEa0Ul3cK/ebiuRmCBSdYKeMyplTron6jytGwAEScm00wvaQx6RYaiNbM0x5A4wxr1uMixIHlgeHHQGD+2B0YkdeZpxpz1gFKE2v9ed2O9iLK9kt4AN/XSlMOLtHGPDenVebWLgC6xW9bmURD7DNA== Received: from AM5EUR03FT006.eop-EUR03.prod.protection.outlook.com (2a01:111:e400:7e08::42) by AM5EUR03HT156.eop-EUR03.prod.protection.outlook.com (2a01:111:e400:7e08::233) 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:29:24 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:7e08::4a) by AM5EUR03FT006.mail.protection.outlook.com (2a01:111:e400:7e08::122) 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:29:24 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:28DE0FA5D70FCFC33176F7A4009D5454DABF47738B08E505FB482FA67237DB76; UpperCasedChecksum:061A631EC78DD286DA7E51296C9CA08A8ED7C5DCF46AC5DC85499561956DD5FE; SizeAsReceived:7385; 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.4065.026; Sun, 25 Apr 2021 22:29:24 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 26 Apr 2021 00:28:32 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 X-TMN: [08R3gesMDzxH0bo0PFT3+mUOPlCN+Y+N] X-ClientProxiedBy: ZR0P278CA0151.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:41::12) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210425222905.130614-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.193.248.86) by ZR0P278CA0151.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:41::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Sun, 25 Apr 2021 22:29:23 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 44aae075-69f0-4f37-b920-08d9083993f8 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNWJWQ5lR/nEnbarXZJSK/i4i6upxEzFgJTr9iZEFBWYAgLyKyZRY+fQXacdb+GyZLfNHRBf7leDNQJuwYjBCQwz+FdyeByw8rU/jqjQEDGPDqh5QLT1F6cgy7lECudf6M17U1bWEtSiFcdRY9gtfiZxyQIg4gqnr8V/5syuWBKkVPT2t+k6pnLz7xRRXkxGNeXT9X5MBEVJAi7a+Lfo9tpx9qFAs541bBXCx+MMgbCWD8yk8CZ2YjLgBmc7rJVFjG6BVZAULPcO0OF6JABG7sYPqbH+ePpkBIRmitPLLR1bADIjxH90/FxtKWGv8yOMq6rATs/6qs49kQFRNDLcb2urbZbKwDyNBIxfoSQZXwziByTOf76Y7Aqjz9PRbveI/QTX6qE6qg8b1bmS4KFu/yT4vcg3BOzok9I+6lwOvQmcFpqXHekt7GmfluG+Hq9T39keSaHmGe83Rju96HiCPofK/QxQF5wDW8uiDnS6sqYRJYn/jnX/8Kr0/PnuN5atMgW0olHbIAtsatFlZKRNkeDp4EVxBDzL9u+d+pLwOyVSXRK2Bww0MzjtghkLFBL+uckgCG4GaNuLowMXfAL/nZRibE2nFBIm3/DEMIpDgwu8yzWtzquflbFQOfTf8/INeW0XGVonKp+n6JiVQfWW/jWX+fWYLnQAbJLydrMriAgR+XY55PaeVUk+sKyCroLM8tS1fgzygesEMUfFIXVsNqafl0ff0HBLVwQ= X-MS-TrafficTypeDiagnostic: AM5EUR03HT156: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QRuUxvIAVytldBy08qsAWhcBAm5jyPbn96mmhb0uXWSHbNxzD5glReBRH0CuUQBPwihaGVP277j83c4Oka9Md+HrXCCuGh/wEfde7PFYc3CZZBWkwp2psaCLIg5W2NB6OS/EFiPlcn6X+bvJ3A7riUMBxdlREVp+HoK411cMFqToQ56jKfCKnIK4YrO5zmGYkNg2LZnOTpPtGMshI601x+ROXKHHT6DvIq1V2B3pH+zbY8fZmU+wy9zUzcwTmwWjo5fvYOAlG4gG1JB9Y3MtnkyZzIy5wfArTQiDXNxiMR3O2kq94ihR9QRYgh1OAGdLJho5RNbGuxlbRfu3HrGisYiqsbWVItVgBa6wSOE5Mw8jLudpR1IxD1ONifFHCLHttNImSN2x+n4KisMHcUdy7Q== X-MS-Exchange-AntiSpam-MessageData: dJK7C6sZcMFzy50TrmPUPSSKJOXYdlIShmSM3iVgQAkVkxx1ut3U9YyudxpN6ienwaOTjwHBqxXfwwMjXs0TdT0Dt0x7P334mfVXN6c7nddHp0smKNg6KcN8WlVLqNouQA680c30+hW+Edvs9lvPJw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 44aae075-69f0-4f37-b920-08d9083993f8 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2021 22:29:24.2733 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT006.eop-EUR03.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: AM5EUR03HT156 Subject: [FFmpeg-devel] [PATCH 01/34] avcodec/adpcmenc: 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: PZ+1N5XGd8cG When the packet size is known in advance like here, one can avoid an intermediate buffer for the packet data. Signed-off-by: Andreas Rheinhardt --- libavcodec/adpcmenc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c index 9dc77d519a..131e3b3910 100644 --- a/libavcodec/adpcmenc.c +++ b/libavcodec/adpcmenc.c @@ -598,7 +598,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, pkt_size = (frame->nb_samples * avctx->channels) / 2; else pkt_size = avctx->block_align; - if ((ret = ff_alloc_packet2(avctx, avpkt, pkt_size, 0)) < 0) + if ((ret = ff_alloc_packet2(avctx, avpkt, pkt_size, pkt_size)) < 0) return ret; dst = avpkt->data; @@ -933,7 +933,6 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, return AVERROR(EINVAL); } - avpkt->size = pkt_size; *got_packet_ptr = 1; return 0; }