From patchwork Fri May 21 09:17:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 27874 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:b214:0:0:0:0:0 with SMTP id b20csp341168iof; Fri, 21 May 2021 02:20:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzv8uDZpi4vXsXy/zS+Ym8+o384rpDL/29Dit14n8yiqDk4FQIqvGWnPuvf0O97FSKdK6au X-Received: by 2002:a05:6402:15:: with SMTP id d21mr6817303edu.66.1621588836880; Fri, 21 May 2021 02:20: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 a6si4633906edk.546.2021.05.21.02.20.36; Fri, 21 May 2021 02:20: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=MH4Mgty8; 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 9AF05689DB3; Fri, 21 May 2021 12:18:23 +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-oln040092064107.outbound.protection.outlook.com [40.92.64.107]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9E0F3689CDF for ; Fri, 21 May 2021 12:18:20 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nd55QK0KHwXZ+I5ZKaPLrLUnoA96aN9g+jDvERjkktL+Tv76yZGVIB+1DsbsGrFDF9Asa0897aHywFXgUczdnj3WI62TJNwSWdjrkvy2Y5wMPqnT+JMW7OuybvcBjsWmXulZ0jc+/Z6N2xahGpAOVBc59cLiVQeadD/lyy/f5EtTQhR7gGq1hDPbusy2TW2SSwLsOh+ePg5ZS7F0WrA/qUDCfxwAwbHvWnPdi1Gx7SWUPTYqvHcBAvf+GrWpTuhoMXzQRV/xHZvLuZ3YNwURFXpmmzA5Qye+MAh/FhJcpqWEoREBjOvImJfjFOgYHJ53Ujn71nJXey28iqe8JPbkLA== 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=V6wRARWGlzU5MAdTpIHrOvjAaoPRMsz+6ZFdwnxNpfg=; b=X2362+TH7wITdSX+T8ils48jQ9JCtqMOq2u4rrUxlnF2xmXLki97v1ACkEByPXIch3O0hY6P8tBlNjYT3cbMd1owfkZEK+b42wqbDlwiVo8e3PL6a7wErrx/d3OFj65lvmnjZL7IZ8f0Xblb05LuyHHnZaFUZF75i9UVhPT0v5LCTWKxXdjtWLAM0SBiVP4S+gGjq2HayF+w4jWu/cjbml/+Nvjw5rAP+tkfd9ei1WB4F31GoV7LQlJXJjbO/zs7uHQeZsif9S8B06RPvM2niB7wKRuqA405hZlO52yM8LdFUMLRz+DSlrjLAUUm4NtEfrHYhebTFGZJtz+Z54vdeg== 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=V6wRARWGlzU5MAdTpIHrOvjAaoPRMsz+6ZFdwnxNpfg=; b=MH4Mgty80hYv+SCAZKanAx3W8ICsTDrmStP20Jtn732TStYJDOktakwGAyB/FMf9GMC93Iek2t4n/gtZAGv+XPaOGCtN8pGqT3uzjIEyAz4+U49mwDGfJAerosgupfUZtkryhVPNr1n9epP3BMsdyOdGKe2Tybozd/8lDP9MdXEnpIq4a5CM/Uz4D7qQ/+qJKFGTWfudPTvd4+w7VzJlOTQ28+QYFnrMAUt4SA520WdD5z7NBYQs0+4WXxS9iQQBNQc5/tYn5IHuda7RIIM1e41ita9M0Fc2412EKX5qLOHGKBpbvsK7ChqNjNGl0qpmPH+aShHMRGuXGaKKlErEvQ== Received: from VE1EUR01FT010.eop-EUR01.prod.protection.outlook.com (2a01:111:e400:7e19::44) by VE1EUR01HT162.eop-EUR01.prod.protection.outlook.com (2a01:111:e400:7e19::479) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25; Fri, 21 May 2021 09:18:18 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:7e19::41) by VE1EUR01FT010.mail.protection.outlook.com (2a01:111:e400:7e19::83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend Transport; Fri, 21 May 2021 09:18:18 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:177384F4BF11AE361876B0B0B78A8FCC59BF0711AE3747CC43243FE2E5AF80B4; UpperCasedChecksum:5E027FB4F17468ABA61BBA04A5052AD7CD3B5612DBA0A152EA1591EC18C43970; SizeAsReceived:7582; Count:48 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::f4cc:63fc:9cef:37fb]) by HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::f4cc:63fc:9cef:37fb%6]) with mapi id 15.20.4150.025; Fri, 21 May 2021 09:18:18 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 May 2021 11:17:19 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [JX/hqIzCIeDzIC3FIwYGQf0f2al38tJ+] X-ClientProxiedBy: PR0P264CA0070.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1d::34) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210521091742.184902-15-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.95.27) by PR0P264CA0070.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1d::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.23 via Frontend Transport; Fri, 21 May 2021 09:18:18 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 5ef6401b-2aba-44a7-ce68-08d91c395f0d X-MS-Exchange-SLBlob-MailProps: q+fD6XS3/UIohmq9k/yScywu9xPSfiUSNYz3t4mU9heRxxTk/dprnkGXMonEUdTqM5g6YIUa1GjTxjrrZoX/6Bd3zF7ypvoN3As7QsZWo/1femBV78CeJ7A4zBfUrK2tL0T3nJVJSavBR94xnsjzyE4Z5/9CMVFEmUvYIevVo8AyuQ0MqQk36DpCT4p8rMOZVuuGZiVcglXCndUiZnhUmzhYW/10tVh+SPtzhkPDAflTuiZ006Xj9FMkFgJZA7flb0h1I06s1s92T9sMgZD1+8PqO114HmxTH0KwLzyTFeDvmE7M5xjkPZrvwwBCihxiL3B18Foimn5XsgCzCvH+sT6oCVB42Wwmyocn21A31fK/3e3Tjt0W4Vd90G6RQmx5eTuNP4WZPSueMSrz3Mztven8LAY5S28TEqzOoA9YP8EtP2TRvmoVJKOcs+iQlm4t53D3jSpSHAYVegsxnR0nmDShbusvW1pr7xtQVWwXYKMO127M03ItjEz2Hj9eZgaYztzr2CKfzz9l030h05FcPAbfQIkJHs7qaXKb1ukWfS/bE5vKx75X8hpLrm/76J4uXgRaB50bv1PpN/U1QamhT9pnbzGMitagfZUuXxaGNuvEOdRYVx6lE74SXz0A4/ZjDi9TOY9yJB9E0P0Bzus9oxkPu9/KKwBNyWLUIOv5g8aXn7V1LykLpr4VaZvdYcsPzHCHQp+uKURbAB8FhD7MvA== X-MS-TrafficTypeDiagnostic: VE1EUR01HT162: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DPJq3s5076sDVS0p/84r+cZMKjrBTYjkq6+Vz85BlsOsm6Junv79TdivdhLeWn0GJhByIsfkg1fl/eYHaTtgl/Ge07zfZyWi3A+r8B9r0+KfMgXZdZwxeQ9XtneHFXAM5fej9+nlQgZQp7xbkqOt23alaU8yQc9G9E4KsoprJsY6lBmwZmdTqcAsFhcWvnFN4vd2nf4+TfKYlCUSVqioF3wRKrVEU4jYY5/8x6nuNTh+Ymt2eqeKje7GlJyWEmcxM2vhVGTSbtE4wfWhjWAxG91bvLiSAZv3G4xEvi6Kc/F8cKdhgw6SjWjzFxJVDxrd6t/WJsm/aqY/RXfQVutAdfzrL8t2ryHUEhsRY2uP1nCBUaHusUQ9OcFQOW6KRCtZ3YGcdPIBdiiShg1TfCiA6A== X-MS-Exchange-AntiSpam-MessageData: lbztkQhnGhVJb6jmBfxk6BIRarX+//eg/lM0bqFbWgcj17xsxA4csxxXanm6Y3K0K7TErBnQEfaEMUfYoHDKJZ1V8DH/VNimF98AzSfmoXV5rpQDzlZW2VQKIpwPrITsX23Y7HnW/xIOfyZtDMW05Q== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ef6401b-2aba-44a7-ce68-08d91c395f0d X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2021 09:18:18.5208 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: VE1EUR01FT010.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: VE1EUR01HT162 Subject: [FFmpeg-devel] [PATCH 16/39] avcodec/libx265: 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 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: 1GjzuFzTItGB Here the packet size is known before allocating the packet, so that supporting user-supplied buffers is trivial. Signed-off-by: Andreas Rheinhardt --- libavcodec/libx265.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index a1bd205201..90658d3d9e 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -32,6 +32,7 @@ #include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "avcodec.h" +#include "encode.h" #include "internal.h" #include "packet_internal.h" @@ -531,7 +532,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, for (i = 0; i < nnal; i++) payload += nal[i].sizeBytes; - ret = ff_alloc_packet2(avctx, pkt, payload, payload); + ret = ff_get_encode_buffer(avctx, pkt, payload, 0); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); return ret; @@ -687,6 +688,9 @@ AVCodec ff_libx265_encoder = { .long_name = NULL_IF_CONFIG_SMALL("libx265 H.265 / HEVC"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_HEVC, + .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | + AV_CODEC_CAP_OTHER_THREADS | + AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE, .init = libx265_encode_init, .init_static_data = libx265_encode_init_csp, .encode2 = libx265_encode_frame, @@ -694,8 +698,6 @@ AVCodec ff_libx265_encoder = { .priv_data_size = sizeof(libx265Context), .priv_class = &class, .defaults = x265_defaults, - .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS | - AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE, .caps_internal = FF_CODEC_CAP_AUTO_THREADS, .wrapper_name = "libx265", };