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 16EB54C53C
	for <ffmpegdev@gitmailbox.com>; Sat,  5 Apr 2025 07:38:22 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 59C7268B172;
	Sat,  5 Apr 2025 10:38:18 +0300 (EEST)
Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net
 [217.70.183.196])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 19A9E687D23
 for <ffmpeg-devel@ffmpeg.org>; Sat,  5 Apr 2025 10:38:12 +0300 (EEST)
Received: by mail.gandi.net (Postfix) with ESMTPSA id 709F443349
 for <ffmpeg-devel@ffmpeg.org>; Sat,  5 Apr 2025 07:38:11 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc;
 s=gm1; t=1743838691;
 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=sovwdQGHPrzG99H46F+mKGKK+K0KYVig8I9ptEwBzmQ=;
 b=DSLcRqCMFiVhLc7BXh0xHtDDOXEAYYKKWiVPFeB/Fu3/j7FBs7X6HXctUqdzDnlcePzg9F
 hNk157IgCmNNUrmqdJskG0iiVJV+gJGHXIurwZ4QlABIcBkreMiKi4v2SWXw1sMtk+ntJe
 xYomNzAgtab6jKXt4tVqRxcvN2G6zekcPxskFxiePfSiigcy/W0eweCZ3+xyxTXkMU0xEp
 D6tU6XffrBAwOBb8ACE6CCNHysG/uW8nimtbGToO0AEKxpDhdFVqKzVlgvNxqTTsMk4LYY
 pd0ehPV9yeBRgfxPMG1aH8Xa4AAK/MaPYP/0Ok9wWDKCavW4aSUgajGg4IBJeQ==
Date: Sat, 5 Apr 2025 09:38:10 +0200
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Message-ID: <20250405073810.GC4991@pb2>
References: <DU0P250MB07476D6A89F0D691F04EB7F68FAE2@DU0P250MB0747.EURP250.PROD.OUTLOOK.COM>
MIME-Version: 1.0
In-Reply-To: <DU0P250MB07476D6A89F0D691F04EB7F68FAE2@DU0P250MB0747.EURP250.PROD.OUTLOOK.COM>
X-GND-State: clean
X-GND-Score: -85
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduleefjeehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculdduhedmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpeeigeektdejudffjefhteegjedtgeettefggedthfejgfevhfetgeekjedtvdfhveenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg
X-GND-Sasl: michael@niedermayer.cc
Subject: Re: [FFmpeg-devel] [PATCH 01/23] avcodec/x86/vvc/dsp_init: Make put
 wrappers static
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="===============3502986853119449880=="
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/20250405073810.GC4991@pb2/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>


--===============3502986853119449880==
Content-Type: multipart/signed; micalg=pgp-sha512;
	protocol="application/pgp-signature"; boundary="6E78/ZZ7kqjB1wGl"
Content-Disposition: inline


--6E78/ZZ7kqjB1wGl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Apr 03, 2025 at 10:31:26PM +0200, Andreas Rheinhardt wrote:
> Patches attached.
>=20
> - Andreas

[...]

>  libavcodec/mjpegenc_huffman.c                    |   33 ++++++----------=
--
>  libavcodec/tests/mjpegenc_huffman.c              |    6 ++-
>  tests/ref/fate/jpg-icc                           |    6 +--
>  tests/ref/lavf/jpg                               |    4 +-
>  tests/ref/lavf/smjpeg                            |    4 +-
>  tests/ref/seek/vsynth_lena-mjpeg                 |   40 +++++++++++-----=
-------
>  tests/ref/vsynth/vsynth1-mjpeg                   |    4 +-
>  tests/ref/vsynth/vsynth1-mjpeg-422               |    4 +-
>  tests/ref/vsynth/vsynth1-mjpeg-444               |    4 +-
>  tests/ref/vsynth/vsynth1-mjpeg-huffman           |    4 +-
>  tests/ref/vsynth/vsynth1-mjpeg-trell             |    4 +-
>  tests/ref/vsynth/vsynth1-mjpeg-trell-huffman     |    4 +-
>  tests/ref/vsynth/vsynth2-mjpeg                   |    4 +-
>  tests/ref/vsynth/vsynth2-mjpeg-422               |    4 +-
>  tests/ref/vsynth/vsynth2-mjpeg-444               |    4 +-
>  tests/ref/vsynth/vsynth2-mjpeg-huffman           |    4 +-
>  tests/ref/vsynth/vsynth2-mjpeg-trell             |    4 +-
>  tests/ref/vsynth/vsynth2-mjpeg-trell-huffman     |    4 +-
>  tests/ref/vsynth/vsynth3-mjpeg                   |    4 +-
>  tests/ref/vsynth/vsynth3-mjpeg-422               |    4 +-
>  tests/ref/vsynth/vsynth3-mjpeg-444               |    4 +-
>  tests/ref/vsynth/vsynth3-mjpeg-huffman           |    4 +-
>  tests/ref/vsynth/vsynth3-mjpeg-trell             |    4 +-
>  tests/ref/vsynth/vsynth3-mjpeg-trell-huffman     |    4 +-
>  tests/ref/vsynth/vsynth_lena-mjpeg               |    4 +-
>  tests/ref/vsynth/vsynth_lena-mjpeg-422           |    4 +-
>  tests/ref/vsynth/vsynth_lena-mjpeg-444           |    4 +-
>  tests/ref/vsynth/vsynth_lena-mjpeg-huffman       |    4 +-
>  tests/ref/vsynth/vsynth_lena-mjpeg-trell         |    4 +-
>  tests/ref/vsynth/vsynth_lena-mjpeg-trell-huffman |    4 +-
>  30 files changed, 91 insertions(+), 98 deletions(-)
> 515cd8ef4364423e2e7ec04535f04b0580e97c78  0020-avcodec-mjpegenc_huffman-A=
void-AV_QSORT-to-sort-entr.patch
> From a17db6215a1600021c9d4a7d6c7923ac5816ea70 Mon Sep 17 00:00:00 2001
> From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> Date: Wed, 2 Apr 2025 15:06:43 +0200
> Subject: [PATCH 20/23] avcodec/mjpegenc_huffman: Avoid AV_QSORT to sort
>  entries by length
>=20
> It is unnecessary; all one needs to ensure that shorter codes
> precede longer ones is to get the number of codes for each
> length. Then the codes of length 1 occupy the first count[1]
> positions, the codes of length 2 the next count[2]...
> Doing so gives a 3.4% speedup of ff_mjpeg_encode_huffman_close()
> here; it also saves about 340B.
>=20
> The new code sorts codes of the same length in order of
> ascending symbol. The old code did not and therefore
> the FATE checksums needed to be updated. Due to MJPEG's
> 0xFF unescaping file sizes as well as file checksums
> needed to be updated; the decoded picture hashes stayed
> the same.

so theres a difference in size because of escaping differences
that implies the previous table was not optimal (by the definition
of smallest filesize)

have you considered to use this effect to reduce escaping overhead
further and thus improve compression further ?

for example one can build a variable length code that has no "all 1" code w=
ith
very little overhead. One also could maybe avoid codes that have
long runs of 1 over some threshold

The patch as is, is fine of course. Thats just an idea to improve
compression by another 0.1-0.3% or so

thx

[...]

--=20
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire

--6E78/ZZ7kqjB1wGl
Content-Type: application/pgp-signature; name="signature.asc"

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

iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZ/Dd2gAKCRBhHseHBAsP
q+FZAJ4mfptZ4zQmzley4Edop1K1NEYWmgCeI+fe9slJxL6prSNYAlvRt1gRRXE=
=IQUK
-----END PGP SIGNATURE-----

--6E78/ZZ7kqjB1wGl--

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

--===============3502986853119449880==--