From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 2FAC243311 for ; Wed, 1 Jun 2022 10:29:21 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A413B68B72B; Wed, 1 Jun 2022 13:29:18 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 274E268B6D0 for ; Wed, 1 Jun 2022 13:29:12 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id D31F2240175 for ; Wed, 1 Jun 2022 12:29:11 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id NQy8_4_yPgHZ for ; Wed, 1 Jun 2022 12:29:10 +0200 (CEST) Received: from lain.red.khirnov.net (lain.red.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.red.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id BBDA62400F5 for ; Wed, 1 Jun 2022 12:29:10 +0200 (CEST) Received: by lain.red.khirnov.net (Postfix, from userid 1000) id C522B1601B2; Wed, 1 Jun 2022 12:29:10 +0200 (CEST) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: References: Mail-Followup-To: FFmpeg development discussions and patches Date: Wed, 01 Jun 2022 12:29:10 +0200 Message-ID: <165407935077.13099.15492448313774204226@lain> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH] hevc: If hwccel avoid creation/use of s/w only arrays 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Quoting John Cox (2022-05-27 15:51:17) > Hwaccel doesn't use any of the block strength, pcm, slice address, etc. > arrays which can be >100k each for 4k video. Patch to avoid initial > allocation and zeroing at the start of every frame. On a Pi4 the memsets > can use 10% CPU on 4k 60Hz decode, this fixes that. > > Signed-off-by: John Cox > --- > libavcodec/hevc_refs.c | 35 +++++++++++++++++++++-------------- > libavcodec/hevcdec.c | 42 +++++++++++++++++++++++++++++------------- > 2 files changed, 50 insertions(+), 27 deletions(-) > > diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c > index f782ea6394..48b059ce45 100644 > --- a/libavcodec/hevcdec.c > +++ b/libavcodec/hevcdec.c > @@ -504,6 +504,16 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps, > if (!sps) > return 0; > > + // If hwaccel then we don't need all the s/w decode helper arrays > + if (s->avctx->hwaccel) { > + export_stream_params(s, sps); > + > + s->avctx->pix_fmt = pix_fmt; > + s->ps.sps = sps; > + s->ps.vps = (HEVCVPS*) s->ps.vps_list[s->ps.sps->vps_id]->data; This duplication is ugly. This code should be commutative, so you can either move it all above pic_arrays_init() and add an early return after, or move it all to the end and jump to it with goto. Otherwise looks reasonable. -- Anton Khirnov _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".