Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 01/23] avcodec/x86/vvc/dsp_init: Make put wrappers static
Date: Sat, 5 Apr 2025 09:38:10 +0200
Message-ID: <20250405073810.GC4991@pb2> (raw)
In-Reply-To: <DU0P250MB07476D6A89F0D691F04EB7F68FAE2@DU0P250MB0747.EURP250.PROD.OUTLOOK.COM>


[-- Attachment #1.1: Type: text/plain, Size: 3917 bytes --]

On Thu, Apr 03, 2025 at 10:31:26PM +0200, Andreas Rheinhardt wrote:
> Patches attached.
> 
> - 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-Avoid-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
> 
> 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.
> 
> 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 with
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

[...]

-- 
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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

  reply	other threads:[~2025-04-05  7:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-03 20:31 Andreas Rheinhardt
2025-04-05  7:38 ` Michael Niedermayer [this message]
2025-04-05 14:36   ` Michael Niedermayer
2025-04-15  0:54     ` Andreas Rheinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250405073810.GC4991@pb2 \
    --to=michael@niedermayer.cc \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git