From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 06/17] avcodec/speedhqenc: Avoid unnecessary indirection Date: Sun, 23 Oct 2022 21:35:59 +0200 Message-ID: <AS8P250MB0744880A67D4A24B7075316A8F2F9@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/speedhq.c | 4 ++-- libavcodec/speedhq.h | 7 +++++++ libavcodec/speedhqenc.c | 8 ++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/libavcodec/speedhq.c b/libavcodec/speedhq.c index ee37573789..2d6e8ca949 100644 --- a/libavcodec/speedhq.c +++ b/libavcodec/speedhq.c @@ -24,7 +24,7 @@ #include "speedhq.h" /* AC codes: Very similar but not identical to MPEG-2. */ -static const uint16_t speedhq_vlc[123][2] = { +const uint16_t ff_speedhq_vlc_table[SPEEDHQ_RL_NB_ELEMS + 2][2] = { {0x0001, 2}, {0x0003, 3}, {0x000E, 4}, {0x0007, 5}, {0x0017, 5}, {0x0028, 6}, {0x0008, 6}, {0x006F, 7}, {0x001F, 7}, {0x00C4, 8}, {0x0044, 8}, {0x005F, 8}, @@ -101,7 +101,7 @@ static const uint8_t speedhq_run[121] = { RLTable ff_rl_speedhq = { 121, 121, - speedhq_vlc, + ff_speedhq_vlc_table, speedhq_run, speedhq_level, }; diff --git a/libavcodec/speedhq.h b/libavcodec/speedhq.h index 94879eda65..78f11ac6ab 100644 --- a/libavcodec/speedhq.h +++ b/libavcodec/speedhq.h @@ -21,9 +21,16 @@ #ifndef AVCODEC_SPEEDHQ_H #define AVCODEC_SPEEDHQ_H +#include <stdint.h> #include "rl.h" #include "libavutil/attributes_internal.h" +#define SPEEDHQ_RL_NB_ELEMS 121 + +FF_VISIBILITY_PUSH_HIDDEN +extern const uint16_t ff_speedhq_vlc_table[SPEEDHQ_RL_NB_ELEMS + 2][2]; + extern RLTable attribute_visibility_hidden ff_rl_speedhq; +FF_VISIBILITY_POP_HIDDEN #endif /* AVCODEC_SPEEDHQ_H */ diff --git a/libavcodec/speedhqenc.c b/libavcodec/speedhqenc.c index 6cf40aac2d..58b5e858a8 100644 --- a/libavcodec/speedhqenc.c +++ b/libavcodec/speedhqenc.c @@ -222,11 +222,11 @@ static void encode_block(MpegEncContext *s, int16_t *block, int n) if (alevel <= ff_rl_speedhq.max_level[0][run]) { code = ff_rl_speedhq.index_run[0][run] + alevel - 1; /* store the VLC & sign at once */ - put_bits_le(&s->pb, ff_rl_speedhq.table_vlc[code][1] + 1, - ff_rl_speedhq.table_vlc[code][0] + (sign << ff_rl_speedhq.table_vlc[code][1])); + put_bits_le(&s->pb, ff_speedhq_vlc_table[code][1] + 1, + ff_speedhq_vlc_table[code][0] | (sign << ff_speedhq_vlc_table[code][1])); } else { /* escape seems to be pretty rare <5% so I do not optimize it; - * the values correspond to ff_rl_speedhq.table_vlc[121] */ + * the values correspond to ff_speedhq_vlc_table[121] */ put_bits_le(&s->pb, 6, 32); /* escape: only clip in this case */ put_bits_le(&s->pb, 6, run); @@ -235,7 +235,7 @@ static void encode_block(MpegEncContext *s, int16_t *block, int n) last_non_zero = i; } } - /* end of block; the values correspond to ff_rl_speedhq.table_vlc[122] */ + /* end of block; the values correspond to ff_speedhq_vlc_table[122] */ put_bits_le(&s->pb, 4, 6); } -- 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:36 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 ` Andreas Rheinhardt [this message] 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 ` [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=AS8P250MB0744880A67D4A24B7075316A8F2F9@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