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 7EFD646CAE
	for <ffmpegdev@gitmailbox.com>; Fri, 21 Mar 2025 22:22:59 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EC5FE687C1D;
	Sat, 22 Mar 2025 00:22:54 +0200 (EET)
Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net
 [217.70.183.193])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CB695687BE5
 for <ffmpeg-devel@ffmpeg.org>; Sat, 22 Mar 2025 00:22:47 +0200 (EET)
Received: by mail.gandi.net (Postfix) with ESMTPSA id 2082542E7E
 for <ffmpeg-devel@ffmpeg.org>; Fri, 21 Mar 2025 22:22:46 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc;
 s=gm1; t=1742595767;
 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=FGXS+bUnBwoPmdEUQ7is0Izb+9f8pwcKO0KxLEwdCns=;
 b=PjkrIIWTVjMT/q23Hf6urcv3dGpp5ZlKtKnIxAboNk85GKUW6LPfGDQ7p96TLBoKh6qywH
 pO1bnWhwzElDOCHjufQiQBbkSxDaxH5rgw327LM182LDarYiQTaA7kZCwenXvDjZNlUGsp
 ywLBoRwexVzausi06oEBn9d7WE1K/vViTSHJHOXMoHR/9e+ncA1/0rUHAZgAIRthRwA/Zu
 CS0xOJ288rRxxRFDnFKHnebD5EEwUvhUrDbk5SZpromoSePVFeGojG3hcln2BEMccSP79R
 0R+mO72eQEf0+mkn8xQ8ci74cqi4CtXwnparfHz62vJZaEn6YH+euC/4utkngA==
Date: Fri, 21 Mar 2025 23:22:45 +0100
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Message-ID: <20250321222245.GI4991@pb2>
References: <20250320223028.3469435-1-michael@niedermayer.cc>
 <5f802aaa-958b-49c3-9b4e-3b36e97b244c@lynne.ee>
 <20250321201349.GF4991@pb2> <20250321211250.GG4991@pb2>
 <20250321213658.GH4991@pb2>
MIME-Version: 1.0
In-Reply-To: <20250321213658.GH4991@pb2>
X-GND-State: clean
X-GND-Score: -70
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduhedvvdekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculdeftddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpeeigeektdejudffjefhteegjedtgeettefggedthfejgfevhfetgeekjedtvdfhveenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg
X-GND-Sasl: michael@niedermayer.cc
Subject: Re: [FFmpeg-devel] [PATCH] avcodec/ffv1: Implement 2D RLE for remap
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="===============2948695065980829639=="
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/20250321222245.GI4991@pb2/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>


--===============2948695065980829639==
Content-Type: multipart/signed; micalg=pgp-sha512;
	protocol="application/pgp-signature"; boundary="8B+rIQB1ci3Spmvc"
Content-Disposition: inline


--8B+rIQB1ci3Spmvc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Mar 21, 2025 at 10:36:58PM +0100, Michael Niedermayer wrote:
> On Fri, Mar 21, 2025 at 10:12:50PM +0100, Michael Niedermayer wrote:
> > Hi
> >=20
> > On Fri, Mar 21, 2025 at 09:13:49PM +0100, Michael Niedermayer wrote:
> > > On Fri, Mar 21, 2025 at 12:07:30AM +0100, Lynne wrote:
> > > > On 20/03/2025 23:30, Michael Niedermayer wrote:
> > > > > This performs about as good as the non LRU system for 16bit and
> > > > > better than then the LRU system for 16 converted to 32. So
> > > > > its basically performing best in all cases we have atm making
> > > > > the LRU system unneeded.
> > > >=20
> > > > Test on *real* 32-bit content, please. You can generate some by usi=
ng the
> > > > tonemap filter, or any of the others that support it.
> > >=20
> > > iam happy to test tonemap output but
> > > tonemap output is not "real content" either
> >=20
> > tested the previous LRU code and this with ACES_OT_VWG run through tone=
map
> > this still performs better than the previous LRU code.
>=20
> heres the test results,
> the try1 and try256 case try hardcoded mul values of 1 and 256, they
> perform worse than the automatically selected ones
> noremapstor simply does not store the remap table and thus shows how big =
that
> table is (its quite huge with the tonemap output)
> the rest shows that the LRU code performs worse in every tested case
> that gz file is just a sanity check to ensure that we arent writing tons
> of low entropy data.
>=20
> -rw-r----- 1 michael michael  694591360 Mar 21 21:57 float-303503-c1-m2-s=
40-tmf32-nolsb-retrrr-noremapstor.nut
> -rw-r----- 1 michael michael  916492722 Mar 21 21:54 float-303503-c1-m2-s=
40-tmf32-nolsb-retrrr.nut.gz
> -rw-r----- 1 michael michael  917135003 Mar 21 21:54 float-303503-c1-m2-s=
40-tmf32-nolsb-retrrr.nut
> -rw-r----- 1 michael michael  921698263 Mar 21 22:03 float-303503-c1-m2-s=
40-tmf32-nolsb-retrrr-try256.nut
> -rw-r----- 1 michael michael  921725671 Mar 21 22:04 float-303503-c1-m2-s=
40-tmf32-nolsb-retrrr-tryLRU.nut
> -rw-r----- 1 michael michael  921729598 Mar 21 22:01 float-303503-c1-m2-s=
40-tmf32-nolsb-retrrr-try1.nut
> -rw-r----- 1 michael michael  928459175 Mar 21 22:23 float-303503-c1-m2-s=
40-tmf32-nolsb-retrrr-try-linear.nut
> -rw-r----- 1 michael michael  932903780 Mar 21 22:22 float-303503-c1-m2-s=
40-tmf32-nolsb-retrrr-tryLRU-linear.nut
> -rw-r----- 1 michael michael 1100100630 Mar 21 22:24 float-303503-c1-m2-s=
40-tmf32-nolsb-retrrr-try-gamma.nut
> -rw-r----- 1 michael michael 1101005617 Mar 21 22:22 float-303503-c1-m2-s=
40-tmf32-nolsb-retrrr-tryLRU-gamma.nut
> -rw-r----- 1 michael michael 1150326564 Mar 21 22:23 float-303503-c1-m2-s=
40-tmf32-nolsb-retrrr-try-hable.nut
> -rw-r----- 1 michael michael 1153310394 Mar 21 22:22 float-303503-c1-m2-s=
40-tmf32-nolsb-retrrr-tryLRU-hable.nut

and of course my testing had a bug, i set the wrong remap mode

-rw-r----- 1 michael michael  694591360 Mar 21 21:57 float-303503-c1-m2-s40=
-tmf32-nolsb-retrrr-noremapstor.nut
-rw-r----- 1 michael michael  915326963 Mar 21 22:55 float-303503-c1-m3-s40=
-tmf32-nolsb-retrrr-tryLRU.nut
-rw-r----- 1 michael michael  917135003 Mar 21 21:54 float-303503-c1-m2-s40=
-tmf32-nolsb-retrrr.nut
-rw-r----- 1 michael michael  921698263 Mar 21 22:03 float-303503-c1-m2-s40=
-tmf32-nolsb-retrrr-try256.nut
-rw-r----- 1 michael michael  921729598 Mar 21 22:01 float-303503-c1-m2-s40=
-tmf32-nolsb-retrrr-try1.nut
-rw-r----- 1 michael michael  922576142 Mar 21 22:54 float-303503-c1-m3-s40=
-tmf32-nolsb-retrrr-tryLRU-linear.nut
-rw-r----- 1 michael michael  928459175 Mar 21 22:23 float-303503-c1-m2-s40=
-tmf32-nolsb-retrrr-try-linear.nut
-rw-r----- 1 michael michael 1100100630 Mar 21 22:24 float-303503-c1-m2-s40=
-tmf32-nolsb-retrrr-try-gamma.nut
-rw-r----- 1 michael michael 1114541572 Mar 21 22:52 float-303503-c1-m3-s40=
-tmf32-nolsb-retrrr-tryLRU-gamma.nut
-rw-r----- 1 michael michael 1150326564 Mar 21 22:23 float-303503-c1-m2-s40=
-tmf32-nolsb-retrrr-try-hable.nut
-rw-r----- 1 michael michael 1157209215 Mar 21 22:52 float-303503-c1-m3-s40=
-tmf32-nolsb-retrrr-tryLRU-hable.nut

so for the linear and none tonemaps, LRU is 0.2% and 0.6% better, for the o=
thers its worse.
That said, for the 2D RLE only 1 mul value and only powers of 2 of that is =
searched.

That said, we can try other algorithms. My main goal ATM is though to keep
things simple, ideally 1 simple algorithm.
Both the LRU/RLE and 2d RLE algorithms are quite simple
the 2d RLE is very simple on the decoder side and on the encoder side its t=
he
encoders choice is it wants to optimize the parameters or just treat it like
a normal RLE
also the 2d RLE allows us to tune the step (=3Dmul) for the whole range whi=
ch
allows storing various lower than 32 bit floating point formats efficiently
(thats tested and confirmed with that float16 input)
and we can also store a step per exponent which should allow storing fixed
point formats efficiently. (thats not tested)
For true float32 that value is just 1 and its just RLE. (which we confirmed
to work too now)

The same remap system can also be used with non float data like 16bit integ=
ers
where the mul value would allow very compact removial of any fixed pattern
in the LSB while allowing efficient coding of exceptions.

How much better than this simple way of storing the remap table can we do?
I dont know, maybe i have a new idea when i wake up tomorrow :)
but ATM i like it as its simple and seems to work well for its simplicity

thx

[...]

--=20
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

What does censorship reveal? It reveals fear. -- Julian Assange

--8B+rIQB1ci3Spmvc
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZ93msgAKCRBhHseHBAsP
qzeuAKCC0fYtQX7ic8yrgFvsJ1y60wLzugCfWsP8c/h7ADlW3g97irwy9vF+yzY=
=fc8c
-----END PGP SIGNATURE-----

--8B+rIQB1ci3Spmvc--

--===============2948695065980829639==
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".

--===============2948695065980829639==--