Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Christophe Gisquet <christophe.gisquet@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 4/7] proresdec2: offset VLCs by 1 to avoid 1 add
Date: Fri,  8 Sep 2023 10:15:05 +0200
Message-ID: <20230908081508.510-4-christophe.gisquet@gmail.com> (raw)
In-Reply-To: <20230908081508.510-1-christophe.gisquet@gmail.com>

Pretty harmless, but not much gained either.
---
 libavcodec/proresdec2.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index 91c689d9ef..e3cef402d7 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -152,7 +152,9 @@ static av_cold void init_vlcs(void)
         switch_val  = (switch_bits+1) << rice_order;
 
         // Values are actually transformed, but this is more a wrapping
-        for (ac = 0; ac <1<<AC_BITS; ac++) {
+        ac_codes[0] = 0;
+        ac_bits[0] = 0;
+        for (ac = 0; ac < (1<<AC_BITS)-1; ac++) {
             int exponent, bits, val = ac;
             unsigned int code;
 
@@ -169,8 +171,8 @@ static av_cold void init_vlcs(void)
                 code = 1;
             }
             if (bits > max_bits) max_bits = bits;
-            ac_bits [ac] = bits;
-            ac_codes[ac] = code;
+            ac_bits [ac+1] = bits;
+            ac_codes[ac+1] = code;
         }
 
         ff_free_vlc(ac_vlc+i);
@@ -609,7 +611,6 @@ static av_always_inline int decode_ac_coeffs(AVCodecContext *avctx, GetBitContex
         }
 
         level = get_vlc2(gb, tbl->table, PRORES_LEV_BITS, 3);
-        level += 1;
 
         i = pos >> log2_block_count;
 
-- 
2.42.0

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

  parent reply	other threads:[~2023-09-08  8:15 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-08  8:15 [FFmpeg-devel] [PATCH 1/7] proresdec2: port and fix for cached reader Christophe Gisquet
2023-09-08  8:15 ` [FFmpeg-devel] [PATCH 2/7] proresdec2: store precomputed EC parameters Christophe Gisquet
2023-09-08  8:39   ` Andreas Rheinhardt
2023-09-08  8:15 ` [FFmpeg-devel] [PATCH 3/7] proresdec2: use VLC for level instead of EC switch Christophe Gisquet
2023-09-08  8:44   ` Andreas Rheinhardt
2023-09-08  9:58     ` Andreas Rheinhardt
2023-09-10 15:28       ` Christophe Gisquet
2023-09-10 15:41         ` Andreas Rheinhardt
2023-09-10 15:56           ` Christophe Gisquet
2023-09-08  8:15 ` Christophe Gisquet [this message]
2023-09-08  8:15 ` [FFmpeg-devel] [PATCH 5/7] proresdec2: use VLC for small runs and levels Christophe Gisquet
2023-09-08  8:15 ` [FFmpeg-devel] [PATCH 6/7] proresdec2: remove a useless DC codebook entry Christophe Gisquet
2023-09-08  9:08   ` Andreas Rheinhardt
2023-09-08  8:15 ` [FFmpeg-devel] [PATCH 7/7] prores: use VLC LUTs Christophe Gisquet
2023-09-08  9:20   ` Andreas Rheinhardt
2023-09-08  9:58     ` Christophe Gisquet
2023-09-08  8:20 ` [FFmpeg-devel] [PATCH 1/7] proresdec2: port and fix for cached reader Christophe Gisquet
2023-09-08  8:30   ` Andreas Rheinhardt
2023-09-08  8:34     ` Andreas Rheinhardt
2023-09-11 20:54   ` Christophe Gisquet
2023-09-08  8:36 ` Andreas Rheinhardt
2023-09-08 21:00 ` Michael Niedermayer

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=20230908081508.510-4-christophe.gisquet@gmail.com \
    --to=christophe.gisquet@gmail.com \
    --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