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 38192445D3 for ; Mon, 19 Sep 2022 14:34:46 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7B21A68BC89; Mon, 19 Sep 2022 17:34:44 +0300 (EEST) Received: from relay8-d.mail.gandi.net (unknown [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2DD7E68BC54 for ; Mon, 19 Sep 2022 17:34:38 +0300 (EEST) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 4104C1BF212 for ; Mon, 19 Sep 2022 14:34:36 +0000 (UTC) Date: Mon, 19 Sep 2022 16:34:35 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20220919143435.GI2088045@pb2> References: MIME-Version: 1.0 In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH v2 2/2] swscale/output: Don't call av_pix_fmt_desc_get() in a loop 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: multipart/mixed; boundary="===============8380711842670111815==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============8380711842670111815== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xZdiZ9E8vSzGEnb8" Content-Disposition: inline --xZdiZ9E8vSzGEnb8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 16, 2022 at 04:55:39PM +0200, Andreas Rheinhardt wrote: > Up until now, libswscale/output.c used a macro to write > an output pixel which involved a call to av_pix_fmt_desc_get() > to find out whether the input pixel format is BE or LE > despite this being known at compile-time (there are templates > per pixfmt). Even worse, these calls are made in a loop, > so that e.g. there are eight calls to av_pix_fmt_desc_get() > for every pixel processed in yuv2rgba64_X_c_template() > for 64bit RGB formats. >=20 > This commit modifies these macros to ensure that isBE() > is evaluated at compile-time. This saved 41184B of .text > for me (GCC 11.2, -O3). Of course, it also improved performance. > E.g. ffmpeg_g -f lavfi -i testsrc2,format=3Dyuva420p -pix_fmt rgba64le \ > -threads 1 -t 1:00 -f null - (which uses yuv2rgba64le_X_c, > which is an invocation of yuv2rgba64_X_c_template() mentioned above), > performance improved from 95589 to 41387 decicycles for one call > to yuv2packedX; for the be variant the numbers went down from > 76087 to 43024 decicycles. >=20 > Signed-off-by: Andreas Rheinhardt > --- > libswscale/output.c | 100 +++++++++++++++++++++++++------------------- > 1 file changed, 58 insertions(+), 42 deletions(-) This looks alot better than before thx PS: i still think that broader support for compile time evaluation of=20 "pure" functions would be usefull. Ideally with minimal mess on the source side, more on the build tool side [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When you are offended at any man's fault, turn to yourself and study your own failings. Then you will forget your anger. -- Epictetus --xZdiZ9E8vSzGEnb8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCYyh98wAKCRBhHseHBAsP qzv4AJ92z+89Roh5QTF2mJxji21yR1eSswCfebr8HBTfoYiszfglpED0ZdzRJhk= =yXvK -----END PGP SIGNATURE----- --xZdiZ9E8vSzGEnb8-- --===============8380711842670111815== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============8380711842670111815==--