Message ID | HE1PR0301MB2154E6B299D691A71ADF01868F5F9@HE1PR0301MB2154.eurprd03.prod.outlook.com |
---|---|
State | Accepted |
Headers | show
Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a11:4023:0:0:0:0 with SMTP id ky35csp2014613pxb; Thu, 29 Apr 2021 16:58:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUZuMzHEMzDMfq9l6Y/i6Tj28HBI8lNSx/vppFWvrjWxcCS1i3OyvXm3B16EX1sC03AGX0 X-Received: by 2002:a05:6402:5158:: with SMTP id n24mr2561244edd.74.1619740693036; Thu, 29 Apr 2021 16:58:13 -0700 (PDT) Return-Path: <ffmpeg-devel-bounces@ffmpeg.org> Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dy11si87091edb.47.2021.04.29.16.58.12; Thu, 29 Apr 2021 16:58:13 -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=bGKZXSHl; 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 7322E689F4F; Fri, 30 Apr 2021 02:58:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR06-VI1-obe.outbound.protection.outlook.com (mail-vi1eur06olkn2098.outbound.protection.outlook.com [40.92.17.98]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E6E6B689E94 for <ffmpeg-devel@ffmpeg.org>; Fri, 30 Apr 2021 02:57:59 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lDYVtTLmxpFrplootjr9C0dPbxXIdLDfUojkDLVPeeYbzoq9aLrR0M7qSzId1TpofUtaoRa+I3HyHfFFT2jW4uUZ/GONU+aeXN2nbynK0JSkOeaLeowP0s6bu/NPzOuh3GZcsx5U/+ixR8WQqswDy/QbzyEz9/kpCJ8qOfKyD0w8k4f7/JbMeA13U7W1wubn4W98Ppy8Rn+JeKZsvtkz1ZHjhnJrbwrGWbgTHdqUbJ/K/RjcGlzR2M61tbtCjnzxMv6196Trz7rTRE3hwtpZO7WQMzqAkDaUP8diR5EL2JfX00HkD1bnacLRud5ku+BQSCJPaH2V2EkmIkjMf61N1w== 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=4gWOvU0w30J//jpXRZUPKZLQTUrDWaNm95mxGZijgoM=; b=ofEFDTHV/tdmH7Dw8vQmOAmrjkpvTmGMIevvpbgjIVfzy2DIuxl8ANBih+xeLZefarM5ZOXXAEHVj+QfUmM8uiS9EVp8bqUJSl+//KMqW57XmDo+J8j4EIYSMXTlSWEm5epwH3iQx99E16QDMhfgGVVXZIA3+Gwyg4KwTknAVerJRytf2aGlj4uiE5m3cr610ejQrmWTz2Pe+sYnckXqKAYY3e1Ru8qeAmOd/65lsBuDiErJ2rvCBVKpSOrQWIdFzMY2JW1F32GczY1pgKuygDf7F7nfZulE2TAbdi8umIB1XypA2CGwx8B5JFNINyFIIjrjEFt+RP36qucY1RCZ5w== 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=4gWOvU0w30J//jpXRZUPKZLQTUrDWaNm95mxGZijgoM=; b=bGKZXSHlD6V6J5ALm0kRZ7ZvkYRYAgGo/UlvhQ2Nt2K3Gd/68HgLpe8KbY+84CGvkppz/ylJ21Jtid9FA81nlV23/uWwkSyyAMtBcf6/NvqvhlVNMHAEowqNc6ZOlVAgrIRFe0ROf0EEA4r1AU5nAKgchtstrr1ClHPmYD7EUGXSkFmVHVaKGMKagVOAkUC2cTmFXfXrua+dUpF8s6/N1WGgcAnJ+FVZ5hZ+Df5FLLZEAIDuKPmd65+AQBqWlH4bGENqAxd8MStbx+iLlRLJBchj2yJrFB9fpEBxOuCT728OtLgl9uYQvr0hRqcdTaAkVaPBDLB/1+yAaGgF78bkLg== Received: from AM7EUR06FT005.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc36::4a) by AM7EUR06HT053.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc36::62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.27; Thu, 29 Apr 2021 23:57:58 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:fc36::4c) by AM7EUR06FT005.mail.protection.outlook.com (2a01:111:e400:fc36::397) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.27 via Frontend Transport; Thu, 29 Apr 2021 23:57:58 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:37C3DB80FF7F0F68908DAC39A9FB9651A9A1BCD93E7CF5D1EE7B57A5BFD2BF2C; UpperCasedChecksum:93527F103BBDF7F2D813C8118A026886FDDEEA87285853C057E3E765CB7F8A8A; SizeAsReceived:7609; 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.027; Thu, 29 Apr 2021 23:57:58 +0000 From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Date: Fri, 30 Apr 2021 01:56:37 +0200 Message-ID: <HE1PR0301MB2154E6B299D691A71ADF01868F5F9@HE1PR0301MB2154.eurprd03.prod.outlook.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <HE1PR0301MB2154FA2BF76462B67F0D851C8F5F9@HE1PR0301MB2154.eurprd03.prod.outlook.com> References: <HE1PR0301MB2154FA2BF76462B67F0D851C8F5F9@HE1PR0301MB2154.eurprd03.prod.outlook.com> X-TMN: [yymu8FhQNhk2tWb8mMrZD8bzunVH1GI1] X-ClientProxiedBy: ZR0P278CA0088.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:22::21) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210429235717.2067041-5-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.193.248.86) by ZR0P278CA0088.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:22::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.27 via Frontend Transport; Thu, 29 Apr 2021 23:57:57 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: ff88c466-f235-4de2-4dde-08d90b6a9d33 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiQnJqnaHo6w7XTEhYoMxTOUqqC1aAam4bzntlwSzJ+E2IxE8Ij/uc+Wr5yS0eTUv0iYvAYoQ+qM6AETmkrcjVSvPP6UG9z07vCWQU065hinSaVnAikqz47rbMp05LQvaq8cubWqGuleOr7ZgyxgiD6ty/44fOVaBDnP5Y9rswgHLhNwN04rdkb5BtsIavesoftVKYFBcQ6hOR6/VmYXC04ompBTCDG+GTodftuWUDRSyWjkycvS9leGcDB2pdiycBV/Xe7T5Ax9mvXEyF+tpLheNY0jysN2BDEWW/bvZkX0TFMurjC6yv2xGfWgdAkNv4jjnLOehT5FVUC81YpcAq+biWtfowmLJnI6UzIuAQBoVaaCUR/9p2v9avlHo2TexeBB1HQTnEP09lNtaApJTj2FFzlwBBbxn+6QLZKTTeJQ//nnKyvUDGP33OaXch8Kzt2rcvwYIRHJvO5/98bgH7gQfi/D8Xs/M0iJ3O8TX6693SsxRbEncn3Wx0pK9r0K9weN8nDa0TlhoPdYY8A9RE4wQzObOOJzBAZwTklfu+gffd8caDCr24QqOY+F1uXPHM4XWvvS8/n84Mwe6uNLrn4I1V/djPbjn9TMSmSBKRrDX3biuxQYSgVQ/ClPmrs4yXg1UplF9vROr7OTfYRgVq+7KVGJVOID6j6mtRk1uflwm3oDxJRfPp5v8Z+tC8/zjeDOiCl0dIJbKszndIyYm1Go2gx6oWn/BfA1Cb9m1feriX51DALWdGZzd6eXjb7rkhE= X-MS-TrafficTypeDiagnostic: AM7EUR06HT053: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hRDuviKckEGPhK4SmsDMUUp9YK5R7hrdVh2vZnHEYk4OEPa6trvhdNMuf8HB3yyZjCGdeaSArqORPbkDsr48SPm4caIKGG949T8S18zL87mrKUWTVa+9ehEv0+VRXkzVqcU0ZBUv2xuQM2EAPlxNtwpCkavEs4k4Dl5eXCVPs9AkNZ3TH+9fMwWFaohcltxCw8ydf9M6+Eg175uTt+gTLrGehjJ9kyOjUETTKga+ER6KfV7xsKwBTNJVet8Gm6lW8ipO5vocV5m0H8GqIwT3HqlmkL0c6wto78pm2ZATmRMiwih/MTd6ZUa3SJcEccua8Csnuf+w+Gl0ca3D8ND6HR3oNnqXQYCam1papZx9YtgnG7DuCi2USckv/b6xOOXW43FnfBzIFKZb8qErgfircg== X-MS-Exchange-AntiSpam-MessageData: lEx8Rnm6A2D9JNfy9xWUxPQ5bOj1vlBN3+NoFxR+5hnpKiB5e9pG97KHQrSBxMqtYf46fTNRyoW5zdOhUkmDCR3DpTraUkpR3XnvlvceaGyug8RzgVLSGPFqFW3AbkQUGPFulN2p6INKlMd+RDG5BA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff88c466-f235-4de2-4dde-08d90b6a9d33 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2021 23:57:58.3539 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: AM7EUR06FT005.eop-eur06.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: AM7EUR06HT053 Subject: [FFmpeg-devel] [PATCH 06/46] avcodec/adxenc: Avoid copying packet data, allow user-supplied buffers X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org> List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe> List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel> List-Post: <mailto:ffmpeg-devel@ffmpeg.org> List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help> List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe> Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org> X-TUID: AeEfX/7kbXVD |
Series |
[FFmpeg-devel,01/46] avcodec/a64multienc: Avoid intermediate buffer
|
expand
|
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
diff --git a/libavcodec/adxenc.c b/libavcodec/adxenc.c index f507840a1a..fc31351330 100644 --- a/libavcodec/adxenc.c +++ b/libavcodec/adxenc.c @@ -22,6 +22,7 @@ #include "avcodec.h" #include "adx.h" #include "bytestream.h" +#include "encode.h" #include "internal.h" #include "put_bits.h" @@ -148,7 +149,7 @@ static int adx_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, if (!samples) { if (c->eof) return 0; - if ((ret = ff_alloc_packet2(avctx, avpkt, 18, 0)) < 0) + if ((ret = ff_get_encode_buffer(avctx, avpkt, 18, 0)) < 0) return ret; c->eof = 1; dst = avpkt->data; @@ -162,7 +163,7 @@ static int adx_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, } out_size = BLOCK_SIZE * avctx->channels + !c->header_parsed * HEADER_SIZE; - if ((ret = ff_alloc_packet2(avctx, avpkt, out_size, 0)) < 0) + if ((ret = ff_get_encode_buffer(avctx, avpkt, out_size, 0)) < 0) return ret; dst = avpkt->data; @@ -192,10 +193,10 @@ const AVCodec ff_adpcm_adx_encoder = { .long_name = NULL_IF_CONFIG_SMALL("SEGA CRI ADX ADPCM"), .type = AVMEDIA_TYPE_AUDIO, .id = AV_CODEC_ID_ADPCM_ADX, + .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, .priv_data_size = sizeof(ADXContext), .init = adx_encode_init, .encode2 = adx_encode_frame, - .capabilities = AV_CODEC_CAP_DELAY, .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, };
When the packet size is known in advance like here, one can avoid an intermediate buffer for the packet data by using ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/adxenc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)