From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 07/17] avcodec/mpeg12enc: Pass tables explicitly in ff_mpeg1_init_uni_ac_vlc
Date: Sun, 23 Oct 2022 21:36:00 +0200
Message-ID: <AS8P250MB0744B80591CE835D0DA04D448F2F9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AS8P250MB07449FCA4121B15E497ED55D8F2F9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>
This will allow to remove ff_rl_mpeg2 soon and remove
all uses of RLTable in MPEG-1/2/SpeedHQ later.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpeg12enc.c | 19 ++++++++++++-------
libavcodec/mpeg12vlc.h | 3 ++-
libavcodec/speedhqenc.c | 3 ++-
3 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 5d991ac99e..e0775d6b96 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -94,7 +94,10 @@ typedef struct MPEG12EncContext {
#define A53_MAX_CC_COUNT 0x1f
#endif /* CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER */
-av_cold void ff_mpeg1_init_uni_ac_vlc(const RLTable *rl, uint8_t *uni_ac_vlc_len)
+av_cold void ff_mpeg1_init_uni_ac_vlc(const int8_t max_level[],
+ const uint8_t index_run[],
+ const uint16_t table_vlc[][2],
+ uint8_t uni_ac_vlc_len[])
{
int i;
@@ -107,16 +110,16 @@ av_cold void ff_mpeg1_init_uni_ac_vlc(const RLTable *rl, uint8_t *uni_ac_vlc_len
int len, code;
int alevel = FFABS(level);
- if (alevel > rl->max_level[0][run])
+ if (alevel > max_level[run])
code = 111; /* rl->n */
else
- code = rl->index_run[0][run] + alevel - 1;
+ code = index_run[run] + alevel - 1;
if (code < 111) { /* rl->n */
/* length of VLC and sign */
- len = rl->table_vlc[code][1] + 1;
+ len = table_vlc[code][1] + 1;
} else {
- len = rl->table_vlc[111 /* rl->n */][1] + 6;
+ len = table_vlc[MPEG12_RL_NB_ELEMS][1] + 6;
if (alevel < 128)
len += 8;
@@ -1078,8 +1081,10 @@ static av_cold void mpeg12_encode_init_static(void)
ff_rl_init(&ff_rl_mpeg1, mpeg12_static_rl_table_store[0]);
ff_rl_init(&ff_rl_mpeg2, mpeg12_static_rl_table_store[1]);
- ff_mpeg1_init_uni_ac_vlc(&ff_rl_mpeg1, uni_mpeg1_ac_vlc_len);
- ff_mpeg1_init_uni_ac_vlc(&ff_rl_mpeg2, uni_mpeg2_ac_vlc_len);
+ ff_mpeg1_init_uni_ac_vlc(ff_rl_mpeg1.max_level[0], ff_rl_mpeg1.index_run[0],
+ ff_mpeg1_vlc_table, uni_mpeg1_ac_vlc_len);
+ ff_mpeg1_init_uni_ac_vlc(ff_rl_mpeg2.max_level[0], ff_rl_mpeg2.index_run[0],
+ ff_mpeg2_vlc_table, uni_mpeg2_ac_vlc_len);
/* build unified dc encoding tables */
for (int i = -255; i < 256; i++) {
diff --git a/libavcodec/mpeg12vlc.h b/libavcodec/mpeg12vlc.h
index c810697370..5a04834bee 100644
--- a/libavcodec/mpeg12vlc.h
+++ b/libavcodec/mpeg12vlc.h
@@ -67,6 +67,7 @@ extern RL_VLC_ELEM ff_mpeg2_rl_vlc[];
void ff_init_2d_vlc_rl(const RLTable *rl, RL_VLC_ELEM rl_vlc[],
unsigned static_size, int flags);
-void ff_mpeg1_init_uni_ac_vlc(const RLTable *rl, uint8_t *uni_ac_vlc_len);
+void ff_mpeg1_init_uni_ac_vlc(const int8_t max_level[], const uint8_t index_run[],
+ const uint16_t table_vlc[][2], uint8_t uni_ac_vlc_len[]);
#endif /* AVCODEC_MPEG12VLC_H */
diff --git a/libavcodec/speedhqenc.c b/libavcodec/speedhqenc.c
index 58b5e858a8..44ee62b9c2 100644
--- a/libavcodec/speedhqenc.c
+++ b/libavcodec/speedhqenc.c
@@ -88,7 +88,8 @@ static av_cold void speedhq_init_static_data(void)
speedhq_chr_dc_uni[i + 255] = bits + (code << 8);
}
- ff_mpeg1_init_uni_ac_vlc(&ff_rl_speedhq, uni_speedhq_ac_vlc_len);
+ ff_mpeg1_init_uni_ac_vlc(ff_rl_speedhq.max_level[0], ff_rl_speedhq.index_run[0],
+ ff_speedhq_vlc_table, uni_speedhq_ac_vlc_len);
}
av_cold int ff_speedhq_encode_init(MpegEncContext *s)
--
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".
next prev 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 ` Andreas Rheinhardt [this message]
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 ` [FFmpeg-devel] [PATCH 13/17] avcodec/rl: Add analogue for ff_rl_init() without RLTable Andreas Rheinhardt
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=AS8P250MB0744B80591CE835D0DA04D448F2F9@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