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 C359C44DC0 for ; Tue, 22 Nov 2022 19:42:58 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7202068B1C7; Tue, 22 Nov 2022 21:42:56 +0200 (EET) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8A0C168037B for ; Tue, 22 Nov 2022 21:42:49 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 8E9381C0004 for ; Tue, 22 Nov 2022 19:42:48 +0000 (UTC) Date: Tue, 22 Nov 2022 20:42:47 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20221122194247.GG710311@pb2> References: <20221121221146.426-1-mindmark@gmail.com> <20221121221146.426-2-mindmark@gmail.com> MIME-Version: 1.0 In-Reply-To: <20221121221146.426-2-mindmark@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH v4 1/4] swscale/input: add rgbaf32 input support 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="===============1932184229090543465==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============1932184229090543465== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="7lMq7vMTJT4tNk0a" Content-Disposition: inline --7lMq7vMTJT4tNk0a Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 21, 2022 at 02:11:43PM -0800, mindmark@gmail.com wrote: > From: Mark Reid >=20 > --- > libswscale/input.c | 120 +++++++++++++++++++++++++++++++++++++++++++++ > libswscale/utils.c | 6 +++ > 2 files changed, 126 insertions(+) >=20 > diff --git a/libswscale/input.c b/libswscale/input.c > index d5676062a2..a305be5ac2 100644 > --- a/libswscale/input.c > +++ b/libswscale/input.c > @@ -1284,6 +1284,96 @@ static void rgbaf16##endian_name##ToA_c(uint8_t *_= dst, const uint8_t *_src, cons > rgbaf16_funcs_endian(le, 0) > rgbaf16_funcs_endian(be, 1) > =20 > +#define rdpx(src) (is_be ? av_int2float(AV_RB32(&src)): av_int2float(AV_= RL32(&src))) > + > +static av_always_inline void rgbaf32ToUV_endian(uint16_t *dstU, uint16_t= *dstV, int is_be, > + const float *src, int wi= dth, > + int32_t *rgb2yuv, int co= mp) > +{ > + int32_t ru =3D rgb2yuv[RU_IDX], gu =3D rgb2yuv[GU_IDX], bu =3D rgb2y= uv[BU_IDX]; > + int32_t rv =3D rgb2yuv[RV_IDX], gv =3D rgb2yuv[GV_IDX], bv =3D rgb2y= uv[BV_IDX]; > + int i; > + for (i =3D 0; i < width; i++) { > + int r =3D lrintf(av_clipf(65535.0f * rdpx(src[i*comp+0]), 0.0f, = 65535.0f)); > + int g =3D lrintf(av_clipf(65535.0f * rdpx(src[i*comp+1]), 0.0f, = 65535.0f)); > + int b =3D lrintf(av_clipf(65535.0f * rdpx(src[i*comp+2]), 0.0f, = 65535.0f)); > + > + dstU[i] =3D (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) = >> RGB2YUV_SHIFT; > + dstV[i] =3D (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) = >> RGB2YUV_SHIFT; > + } > +} > + > +static av_always_inline void rgbaf32ToY_endian(uint16_t *dst, const floa= t *src, int is_be, > + int width, int32_t *rgb2y= uv, int comp) > +{ > + int32_t ry =3D rgb2yuv[RY_IDX], gy =3D rgb2yuv[GY_IDX], by =3D rgb2y= uv[BY_IDX]; > + int i; > + for (i =3D 0; i < width; i++) { > + int r =3D lrintf(av_clipf(65535.0f * rdpx(src[i*comp+0]), 0.0f, = 65535.0f)); > + int g =3D lrintf(av_clipf(65535.0f * rdpx(src[i*comp+1]), 0.0f, = 65535.0f)); > + int b =3D lrintf(av_clipf(65535.0f * rdpx(src[i*comp+2]), 0.0f, = 65535.0f)); > + > + dst[i] =3D (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >>= RGB2YUV_SHIFT; > + } > +} I thought you would post a patchset that in the end has 1 lrintf/av_clipf for a function like this not 3 Just asking as you arent saying this is temporary in this set nor why its left liek this nor does it include the factorization of these operations thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have never wished to cater to the crowd; for what I know they do not approve, and what they approve I do not know. -- Epicurus --7lMq7vMTJT4tNk0a Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCY30mMAAKCRBhHseHBAsP q7ZeAJ9ihBkP/aeHmsqqbHOTLGAWXlS8CACeMFU/llAOCfrW+MJ1yJjWvky8GIo= =AfJl -----END PGP SIGNATURE----- --7lMq7vMTJT4tNk0a-- --===============1932184229090543465== 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". --===============1932184229090543465==--