Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 13/17] avcodec/rl: Add analogue for ff_rl_init() without RLTable
Date: Sun, 23 Oct 2022 21:36:06 +0200
Message-ID: <AS8P250MB07445BE6F007BF611567DB908F2F9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AS8P250MB07449FCA4121B15E497ED55D8F2F9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/rl.c | 17 +++++++++++++++++
 libavcodec/rl.h | 10 ++++++++++
 2 files changed, 27 insertions(+)

diff --git a/libavcodec/rl.c b/libavcodec/rl.c
index 645a5362f7..3f8271d37e 100644
--- a/libavcodec/rl.c
+++ b/libavcodec/rl.c
@@ -24,6 +24,23 @@
 
 #include "rl.h"
 
+av_cold void ff_rl_init_level_run(uint8_t max_level[MAX_LEVEL + 1],
+                                  uint8_t index_run[MAX_RUN + 1],
+                                  const uint8_t table_run[/* n */],
+                                  const uint8_t table_level[/* n*/],
+                                  int n)
+{
+    memset(index_run, n, MAX_RUN + 1);
+    for (int i = 0; i < n; i++) {
+        int run   = table_run[i];
+        int level = table_level[i];
+        if (index_run[run] == n)
+            index_run[run] = i;
+        if (level > max_level[run])
+            max_level[run] = level;
+    }
+}
+
 av_cold void ff_rl_init(RLTable *rl,
                         uint8_t static_store[2][2 * MAX_RUN + MAX_LEVEL + 3])
 {
diff --git a/libavcodec/rl.h b/libavcodec/rl.h
index 07e3da5003..4380fda272 100644
--- a/libavcodec/rl.h
+++ b/libavcodec/rl.h
@@ -48,6 +48,16 @@ typedef struct RLTable {
     RL_VLC_ELEM *rl_vlc[32];       ///< decoding only
 } RLTable;
 
+/**
+ * Initialize max_level and index_run from table_run and table_level;
+ * this is equivalent to initializing RLTable.max_level[0] and
+ * RLTable.index_run[0] with ff_rl_init().
+ */
+void ff_rl_init_level_run(uint8_t max_level[MAX_LEVEL + 1],
+                          uint8_t index_run[MAX_RUN + 1],
+                          const uint8_t table_run[/* n */],
+                          const uint8_t table_level[/* n*/], int n);
+
 /**
  * Initialize index_run, max_level and max_run from n, last, table_vlc,
  * table_run and table_level.
-- 
2.34.1

_______________________________________________
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:[~2022-10-23 19:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-23 19:34 [FFmpeg-devel] [PATCH 01/17] avcodec/mpeg12dec: Remove redundant function call Andreas Rheinhardt
2022-10-23 19:35 ` [FFmpeg-devel] [PATCH 02/17] avformat/mux: Don't call ff_toupper4() unnecessarily Andreas Rheinhardt
2022-10-23 19:35 ` [FFmpeg-devel] [PATCH 03/17] avformat/mux: Constify validate_codec_tag() Andreas Rheinhardt
2022-10-23 19:35 ` [FFmpeg-devel] [PATCH 04/17] avcodec/mpeg12: Avoid indirection when accessing rl_vlc tables Andreas Rheinhardt
2022-10-23 19:35 ` [FFmpeg-devel] [PATCH 05/17] avcodec/mpeg12enc: Avoid unnecessary indirection Andreas Rheinhardt
2022-10-23 19:35 ` [FFmpeg-devel] [PATCH 06/17] avcodec/speedhqenc: " Andreas Rheinhardt
2022-10-23 19:36 ` [FFmpeg-devel] [PATCH 07/17] avcodec/mpeg12enc: Pass tables explicitly in ff_mpeg1_init_uni_ac_vlc Andreas Rheinhardt
2022-10-23 19:36 ` [FFmpeg-devel] [PATCH 08/17] avcodec/mpeg12enc: Don't initialize ff_rl_mpeg2 unnecessarily Andreas Rheinhardt
2022-10-23 19:36 ` [FFmpeg-devel] [PATCH 09/17] avcodec/mpeg12: Pass parameters explicitly in ff_init_2d_vlc_rl() Andreas Rheinhardt
2022-10-23 19:36 ` [FFmpeg-devel] [PATCH 10/17] avcodec/mpeg12data: Remove unused ff_rl_mpeg2 Andreas Rheinhardt
2022-10-23 19:36 ` [FFmpeg-devel] [PATCH 11/17] avcodec/mpeg12: Use ff_rl_mpeg1.table_(run|level) directly Andreas Rheinhardt
2022-10-23 19:36 ` [FFmpeg-devel] [PATCH 12/17] avcodec/speedhqdec: Use ff_rl_speedhq.table_(run|level) directly Andreas Rheinhardt
2022-10-23 19:36 ` Andreas Rheinhardt [this message]
2022-10-23 19:36 ` [FFmpeg-devel] [PATCH 14/17] avcodec/mpeg12enc: Don't initialize unused parts of RLTable Andreas Rheinhardt
2022-10-23 19:36 ` [FFmpeg-devel] [PATCH 15/17] avcodec/mpeg12data: Remove ff_rl_mpeg1 Andreas Rheinhardt
2022-10-23 19:36 ` [FFmpeg-devel] [PATCH 16/17] avcodec/speedhqenc: Don't initialize unused parts of RLTable Andreas Rheinhardt
2022-10-23 19:36 ` [FFmpeg-devel] [PATCH 17/17] avcodec/speedhq: Remove unused ff_rl_speedhq Andreas Rheinhardt
2022-10-25 21:39 ` [FFmpeg-devel] [PATCH 01/17] avcodec/mpeg12dec: Remove redundant function call 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=AS8P250MB07445BE6F007BF611567DB908F2F9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.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