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 528D146864 for ; Sun, 20 Aug 2023 17:45:21 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A295668C0A3; Sun, 20 Aug 2023 20:45:19 +0300 (EEST) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 422CB68BD48 for ; Sun, 20 Aug 2023 20:45:13 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 5982B60005 for ; Sun, 20 Aug 2023 17:45:12 +0000 (UTC) Date: Sun, 20 Aug 2023 19:45:11 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20230820174511.GD7802@pb2> References: <20230820151022.2204421-1-jc@kynesim.co.uk> <20230820151022.2204421-4-jc@kynesim.co.uk> <20230820171614.GC7802@pb2> MIME-Version: 1.0 In-Reply-To: <20230820171614.GC7802@pb2> X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH v1 3/6] swscale: Add explicit rgb24->yv12 conversion 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="===============1868797154080748841==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============1868797154080748841== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="OgvJsczody0nPmpz" Content-Disposition: inline --OgvJsczody0nPmpz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Aug 20, 2023 at 07:16:14PM +0200, Michael Niedermayer wrote: > On Sun, Aug 20, 2023 at 03:10:19PM +0000, John Cox wrote: > > Add a rgb24->yuv420p conversion. Uses the same code as the existing > > bgr24->yuv converter but permutes the conversion array to swap R & B > > coefficients. > >=20 > > Signed-off-by: John Cox > > --- > > libswscale/rgb2rgb.c | 5 +++++ > > libswscale/rgb2rgb.h | 7 +++++++ > > libswscale/rgb2rgb_template.c | 38 ++++++++++++++++++++++++++++++----- > > libswscale/swscale_unscaled.c | 24 +++++++++++++++++++++- > > 4 files changed, 68 insertions(+), 6 deletions(-) > >=20 > > diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c > > index 8707917800..de90e5193f 100644 > > --- a/libswscale/rgb2rgb.c > > +++ b/libswscale/rgb2rgb.c > > @@ -83,6 +83,11 @@ void (*ff_bgr24toyv12)(const uint8_t *src, uint8_t *= ydst, > > int width, int height, > > int lumStride, int chromStride, int srcStride, > > int32_t *rgb2yuv); > > +void (*ff_rgb24toyv12)(const uint8_t *src, uint8_t *ydst, > > + uint8_t *udst, uint8_t *vdst, > > + int width, int height, > > + int lumStride, int chromStride, int srcStride, > > + int32_t *rgb2yuv); > > void (*planar2x)(const uint8_t *src, uint8_t *dst, int width, int heig= ht, > > int srcStride, int dstStride); > > void (*interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint= 8_t *dst, > > diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h > > index 305b830920..f7a76a92ba 100644 > > --- a/libswscale/rgb2rgb.h > > +++ b/libswscale/rgb2rgb.h > > @@ -79,6 +79,9 @@ void rgb12to15(const uint8_t *src, uint8_t *dst, i= nt src_size); > > void ff_bgr24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst, > > uint8_t *vdst, int width, int height, int lumStr= ide, > > int chromStride, int srcStride, int32_t *rgb2yuv= ); > > +void ff_rgb24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst, > > + uint8_t *vdst, int width, int height, int lumStr= ide, > > + int chromStride, int srcStride, int32_t *rgb2yuv= ); > > =20 > > /** > > * Height should be a multiple of 2 and width should be a multiple of = 16. > > @@ -128,6 +131,10 @@ extern void (*ff_bgr24toyv12)(const uint8_t *src, = uint8_t *ydst, uint8_t *udst, > > int width, int height, > > int lumStride, int chromStride, int srcS= tride, > > int32_t *rgb2yuv); > > +extern void (*ff_rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8= _t *udst, uint8_t *vdst, > > + int width, int height, > > + int lumStride, int chromStride, int srcS= tride, > > + int32_t *rgb2yuv); > > extern void (*planar2x)(const uint8_t *src, uint8_t *dst, int width, i= nt height, > > int srcStride, int dstStride); > > =20 > > diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_templat= e.c > > index 8ef4a2cf5d..e57bfa6545 100644 > > --- a/libswscale/rgb2rgb_template.c > > +++ b/libswscale/rgb2rgb_template.c >=20 >=20 > > @@ -646,13 +646,14 @@ static inline void uyvytoyv12_c(const uint8_t *sr= c, uint8_t *ydst, > > * others are ignored in the C version. > > * FIXME: Write HQ version. > > */ > > -void ff_bgr24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst, > > +static void rgb24toyv12_x(const uint8_t *src, uint8_t *ydst, uint8_t *= udst, >=20 > this probably should be inline >=20 > also i see now "FIXME: Write HQ version." above here. Do you really want = to > add a low quality rgb24toyv12 ? > (it is vissible on the diagonal border (cyan / red )) in > ./ffmpeg -f lavfi -i testsrc=3Dsize=3D5632x3168 -pix_fmt yuv420p -vframe= s 1 -qscale 1 -strict -1 new.jpg >=20 > also on smaller sizes but for some reason its clearer on the big one zoo= med in 400% with gimp > (the gimp test was done with the whole patchset not after this patch) Also the reason why its LQ and looks like it does is because 1. half the RGB samples are ignored in computing the chroma samples 2. the chroma sample locations are ignored, the locations for yuv420 are re= aonable standard this needs some simple filter to get from a few RGB samples to the RGB samp= le co-located with ths UV sample before RGB->UV thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Everything should be made as simple as possible, but not simpler. -- Albert Einstein --OgvJsczody0nPmpz Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZOJRIwAKCRBhHseHBAsP q/0+AJ4iPXQ3Iy+p2zqvILSyiSyjA6nOIACeJlvlGUdFcRl72Wnx6Xa3iJgiz5c= =vaIs -----END PGP SIGNATURE----- --OgvJsczody0nPmpz-- --===============1868797154080748841== 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". --===============1868797154080748841==--