From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <ffmpeg-devel-bounces@ffmpeg.org> Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 3F1194E7A5 for <ffmpegdev@gitmailbox.com>; Sun, 16 Mar 2025 00:13:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3B72168DF45; Sun, 16 Mar 2025 02:13:52 +0200 (EET) Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3959B68CD87 for <ffmpeg-devel@ffmpeg.org>; Sun, 16 Mar 2025 02:13:45 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id 72FBE44168 for <ffmpeg-devel@ffmpeg.org>; Sun, 16 Mar 2025 00:13:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1742084024; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=V+LAzFIsNbXeYNA0iI3TvQT27a3s2vmz27BHJBxfz/Y=; b=fBV6FQcO4VtzGdyzEzH8SF5Oxu+x9kaDarT/+A8S3h+vYlAZnlYYypvOgL0WOG5BmBGXyV LnSX8OJfFya/gdJd3WZhWDMgiACVE6hvBh3Cno7QzMS0WXQjaCjqDZlCM2aExYa2PbuzpK m4WdULysE2f9bKEovc9rKCSRAvx1hY+bFWoIkyOd3FIocFuxWg8OeKyz8oZX5pMVFDz9Qp nV3uuoPRNKQM8gWgYdA4TMGECT2ifsPZeNBHSXHwXulnoIEEw6sYJssPHrxRdSKEgSwA6T DkDNVE5Azc2+fPwDvxDf2ZFTcooTtfIj59cFxZ7xhYZcw0gzmvAXH1cUq4JM9Q== Date: Sun, 16 Mar 2025 01:13:43 +0100 From: Michael Niedermayer <michael@niedermayer.cc> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Message-ID: <20250316001343.GT4991@pb2> References: <20241226193325.288834126EE@natalya.videolan.org> <20250126182659.GE2768425@pb2> <20250313235425.GC4991@pb2> <20250314010930.GB892569@haasn.xyz> <20250314214422.GB518999@haasn.xyz> MIME-Version: 1.0 In-Reply-To: <20250314214422.GB518999@haasn.xyz> X-GND-State: clean X-GND-Score: -75 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddufeehudefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculddvhedmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpeegvddujeffkeehffetgfdthfefudffheejheetgffghefflefgteffueehhfevheenucffohhmrghinhepvhhiuggvohhlrghnrdhorhhgnecukfhppeeguddrieeirdeijedruddufeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeguddrieeirdeijedruddufedphhgvlhhopehlohgtrghlhhhoshhtpdhmrghilhhfrhhomhepmhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtpdhnsggprhgtphhtthhopedupdhrtghpthhtohepfhhfmhhpvghgqdguvghvvghlsehffhhmphgvghdrohhrgh X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [FFmpeg-cvslog] swscale: use 16-bit intermediate precision for RGB/XYZ conversion X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org> List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe> List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel> List-Post: <mailto:ffmpeg-devel@ffmpeg.org> List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help> List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe> Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Content-Type: multipart/mixed; boundary="===============6003045170843048173==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org> Archived-At: <https://master.gitmailbox.com/ffmpegdev/20250316001343.GT4991@pb2/> List-Archive: <https://master.gitmailbox.com/ffmpegdev/> List-Post: <mailto:ffmpegdev@gitmailbox.com> --===============6003045170843048173== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="03Sczpz478BQcZQP" Content-Disposition: inline --03Sczpz478BQcZQP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi On Fri, Mar 14, 2025 at 09:44:22PM +0100, Niklas Haas wrote: > On Fri, 14 Mar 2025 01:09:30 +0100 Niklas Haas <ffmpeg@haasn.xyz> wrote: > > On Fri, 14 Mar 2025 00:54:25 +0100 Michael Niedermayer <michael@niederm= ayer.cc> wrote: > > > Hi > > > > > > On Sun, Jan 26, 2025 at 07:26:59PM +0100, Michael Niedermayer wrote: > > > > On Thu, Dec 26, 2024 at 07:33:23PM +0000, Niklas Haas wrote: > > > > > ffmpeg | branch: master | Niklas Haas <git@haasn.dev> | Mon Dec 1= 6 14:49:39 2024 +0100| [af6d52eec66961f6a502b0f2f390c12226d087cd] | committ= er: Niklas Haas > > > > > > > > > > swscale: use 16-bit intermediate precision for RGB/XYZ conversion > > > > > > > > > > The current logic uses 12-bit linear light math, which is woefull= y insufficient > > > > > and leads to nasty postarization artifacts. This patch simply swi= tches the > > > > > internal logic to 16-bit precision. > > > > > > > > > > This raises the memory requirement of these tables from 32 kB to = 272 kB. > > > > > > > > > > All relevant FATE tests updated for improved accuracy. > > > > > > > > > > Fixes: #4829 > > > > > Signed-off-by: Niklas Haas <git@haasn.dev> > > > > > Sponsored-by: Sovereign Tech Fund > > > > > > > > > > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=3Dcommit;h=3Da= f6d52eec66961f6a502b0f2f390c12226d087cd > > > > > --- > > > > > > > > this breaks on x86-32 > > > > > > ping > > > > > > the fate tests for a major architecture are broken since this > > > This impacts future bisections over that range for example > > > > My bad, missed this email for some reason. > > > > Will investigate and fix tomorrow. >=20 > So, I found the bug, but I don't know how to fix it properly. >=20 > The problem is that tha XYZ/RGB conversion tables are calculated using ex= cess > precision from the x87 FPU. This results in slightly different rounding b= ehavior > in exactly one case (i =3D=3D 3415). >=20 > Fixing this requires setting -mfpmath=3Dsse at compile time. Strangely, I= was > not able to force the compiler to discard the excess precision even with > forcing -fexcess-precision=3Dstandard and storing every single subexpress= ion to > a `volatile double`. >=20 > How do we deal with such cases generally? I can think of several options,= such > as hard-coding the table values (unappealing), or somehow using integer m= ath > (very unappealing, how do we calculate an integer power without massive l= oss > of precision?) if its one case, would a if(i =3D=3D 3415) abcd=3D 12345.98765 fix it ? do i understand correctly that you want to compute pow(i / 4095.0, xyzgamma) or something like that without floats ? exp(log(i/4095) * xyzgamma) is a classic one, here you just need a fixed point implemenattion of log and exp see log16 and exp16 from tests/tiny_psnr.c, maybe they are neough or could serve as examples for higher precission ones thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 2 "100% positive feedback" - "All either got their money back or didnt compla= in" "Best seller ever, very honest" - "Seller refunded buyer after failed scam" --03Sczpz478BQcZQP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZ9YXtAAKCRBhHseHBAsP q4BwAJsHPbk/e63AcJVKF+X0y3+/9F8/VwCcCfLRPCylWkIA4HZaedYjFiTlCfs= =fElA -----END PGP SIGNATURE----- --03Sczpz478BQcZQP-- --===============6003045170843048173== 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". --===============6003045170843048173==--