From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 13/19] avcodec/msmpeg4dec: Factor initializing VLCs shared with VC-1 out Date: Mon, 31 Oct 2022 00:56:25 +0100 Message-ID: <GV1P250MB0737EE344D380A085C42C4508F349@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> (raw) In-Reply-To: <GV1P250MB0737EF25F056808CC9F6896C8F349@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> It will be useful in the following commits. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/msmpeg4data.c | 30 ++++++++++++++++++++++++++++++ libavcodec/msmpeg4data.h | 2 ++ libavcodec/msmpeg4dec.c | 18 +----------------- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/libavcodec/msmpeg4data.c b/libavcodec/msmpeg4data.c index 63f30ac544..7b54eea221 100644 --- a/libavcodec/msmpeg4data.c +++ b/libavcodec/msmpeg4data.c @@ -30,6 +30,10 @@ #include "h263data.h" #include "mpeg4videodata.h" #include "msmpeg4data.h" +#include "rl.h" +#include "vlc.h" +#include "libavutil/attributes.h" +#include "libavutil/thread.h" uint32_t ff_v2_dc_lum_table[512][2]; uint32_t ff_v2_dc_chroma_table[512][2]; @@ -38,6 +42,32 @@ VLC ff_msmp4_mb_i_vlc; VLC ff_msmp4_dc_luma_vlc[2]; VLC ff_msmp4_dc_chroma_vlc[2]; +static av_cold void msmp4_vc1_vlcs_init(void) +{ + INIT_VLC_STATIC(&ff_msmp4_dc_luma_vlc[0], MSMP4_DC_VLC_BITS, 120, + &ff_table0_dc_lum[0][1], 8, 4, + &ff_table0_dc_lum[0][0], 8, 4, 1158); + INIT_VLC_STATIC(&ff_msmp4_dc_chroma_vlc[0], MSMP4_DC_VLC_BITS, 120, + &ff_table0_dc_chroma[0][1], 8, 4, + &ff_table0_dc_chroma[0][0], 8, 4, 1118); + INIT_VLC_STATIC(&ff_msmp4_dc_luma_vlc[1], MSMP4_DC_VLC_BITS, 120, + &ff_table1_dc_lum[0][1], 8, 4, + &ff_table1_dc_lum[0][0], 8, 4, 1476); + INIT_VLC_STATIC(&ff_msmp4_dc_chroma_vlc[1], MSMP4_DC_VLC_BITS, 120, + &ff_table1_dc_chroma[0][1], 8, 4, + &ff_table1_dc_chroma[0][0], 8, 4, 1216); + + INIT_VLC_STATIC(&ff_msmp4_mb_i_vlc, MSMP4_MB_INTRA_VLC_BITS, 64, + &ff_msmp4_mb_i_table[0][1], 4, 2, + &ff_msmp4_mb_i_table[0][0], 4, 2, 536); +} + +av_cold void ff_msmp4_vc1_vlcs_init_once(void) +{ + static AVOnce init_static_once = AV_ONCE_INIT; + ff_thread_once(&init_static_once, msmp4_vc1_vlcs_init); +} + /* intra picture macroblock coded block pattern */ const uint16_t ff_msmp4_mb_i_table[64][2] = { { 0x1, 1 }, { 0x17, 6 }, { 0x9, 5 }, { 0x5, 5 }, diff --git a/libavcodec/msmpeg4data.h b/libavcodec/msmpeg4data.h index 4f904d7610..ccbfde36f7 100644 --- a/libavcodec/msmpeg4data.h +++ b/libavcodec/msmpeg4data.h @@ -48,6 +48,8 @@ typedef struct MVTable { } MVTable; FF_VISIBILITY_PUSH_HIDDEN +void ff_msmp4_vc1_vlcs_init_once(void); + #define MSMP4_MB_INTRA_VLC_BITS 9 extern VLC ff_msmp4_mb_i_vlc; #define MSMP4_DC_VLC_BITS 9 diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c index a7ba53f68e..2be8cf2bf6 100644 --- a/libavcodec/msmpeg4dec.c +++ b/libavcodec/msmpeg4dec.c @@ -316,19 +316,6 @@ static av_cold void msmpeg4_decode_init_static(void) mv->table_mv_bits, 1, 1, mv->table_mv_code, 2, 2, 2694); - INIT_VLC_STATIC(&ff_msmp4_dc_luma_vlc[0], MSMP4_DC_VLC_BITS, 120, - &ff_table0_dc_lum[0][1], 8, 4, - &ff_table0_dc_lum[0][0], 8, 4, 1158); - INIT_VLC_STATIC(&ff_msmp4_dc_chroma_vlc[0], MSMP4_DC_VLC_BITS, 120, - &ff_table0_dc_chroma[0][1], 8, 4, - &ff_table0_dc_chroma[0][0], 8, 4, 1118); - INIT_VLC_STATIC(&ff_msmp4_dc_luma_vlc[1], MSMP4_DC_VLC_BITS, 120, - &ff_table1_dc_lum[0][1], 8, 4, - &ff_table1_dc_lum[0][0], 8, 4, 1476); - INIT_VLC_STATIC(&ff_msmp4_dc_chroma_vlc[1], MSMP4_DC_VLC_BITS, 120, - &ff_table1_dc_chroma[0][1], 8, 4, - &ff_table1_dc_chroma[0][0], 8, 4, 1216); - INIT_VLC_STATIC(&v2_dc_lum_vlc, MSMP4_DC_VLC_BITS, 512, &ff_v2_dc_lum_table[0][1], 8, 4, &ff_v2_dc_lum_table[0][0], 8, 4, 1472); @@ -354,13 +341,10 @@ static av_cold void msmpeg4_decode_init_static(void) offset += ff_mb_non_intra_vlc[i].table_size; } - INIT_VLC_STATIC(&ff_msmp4_mb_i_vlc, MSMP4_MB_INTRA_VLC_BITS, 64, - &ff_msmp4_mb_i_table[0][1], 4, 2, - &ff_msmp4_mb_i_table[0][0], 4, 2, 536); - INIT_VLC_STATIC(&ff_inter_intra_vlc, INTER_INTRA_VLC_BITS, 4, &ff_table_inter_intra[0][1], 2, 1, &ff_table_inter_intra[0][0], 2, 1, 8); + ff_msmp4_vc1_vlcs_init_once(); } av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx) -- 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-30 23:58 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-30 23:41 [FFmpeg-devel] [PATCH 01/19] avcodec/vc1: Don't check for AVCodecContext.codec Andreas Rheinhardt 2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 02/19] avcodec/vc1: Remove always-false check Andreas Rheinhardt 2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 03/19] avcodec/vc1: Don't check for errors for complete VLC Andreas Rheinhardt 2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 04/19] avcodec/vc1: Don't use VLC to read bfraction Andreas Rheinhardt 2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 05/19] avcodec/vc1_parser: Set parse_only only once Andreas Rheinhardt 2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 06/19] avcodec/vc1_parser: Don't call ff_vc1_init_common() Andreas Rheinhardt 2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 07/19] avcodec/vc1: Move setting res_fasttx-IDCT functions to vc1dec.c Andreas Rheinhardt 2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 08/19] avcodec/vc1data: Remove duplicate defines Andreas Rheinhardt 2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 09/19] avcodec/vc1data: Remove declarations of inexistent arrays Andreas Rheinhardt 2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 10/19] avcodec/vc1data: Move VLC codes/lengths tables to a header Andreas Rheinhardt 2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 11/19] avcodec/vc1: Move ff_vc1_init_common() to vc1dec.c Andreas Rheinhardt 2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 12/19] avcodec/vc1_block: Don't duplicate #defines Andreas Rheinhardt 2022-10-30 23:56 ` Andreas Rheinhardt [this message] 2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 14/19] avcodec/vc1dec: Don't open and close decoder during init Andreas Rheinhardt 2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 15/19] avcodec/vc1dec: Factor (re)initializing code out Andreas Rheinhardt 2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 16/19] avcodec/vc1dec: Return early upon error Andreas Rheinhardt 2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 17/19] avcodec/msmpeg4data: Move data shared between msmpeg4 and VC-1 out Andreas Rheinhardt 2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 18/19] avcodec/vc1dec: Split VC-1 decoders from msmpeg4 Andreas Rheinhardt 2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 19/19] avcodec/vc1_block: Remove redundant write Andreas Rheinhardt 2022-11-03 2:57 ` [FFmpeg-devel] [PATCH 20/24] avcodec/mpegvideo_dec: Don't use MotionEstContext as scratch space Andreas Rheinhardt 2022-11-03 2:57 ` [FFmpeg-devel] [PATCH 21/24] avcodec/vc1dec: Remove VC-1 decoders->H.263 decoder dependency Andreas Rheinhardt 2022-11-03 2:57 ` [FFmpeg-devel] [PATCH 22/24] avcodec/h263dec: Move initializing qpel DSP context to mpeg4videodec.c Andreas Rheinhardt 2022-11-03 2:57 ` [FFmpeg-devel] [PATCH 23/24] avcodec/mpegvideo_enc: Move initializing QpelDSPCtx to mpeg4videoenc.c Andreas Rheinhardt 2022-11-03 2:57 ` [FFmpeg-devel] [PATCH 24/24] avcodec/motion_est: Remove unused field Andreas Rheinhardt 2022-11-05 17:18 ` [FFmpeg-devel] [PATCH 01/19] avcodec/vc1: Don't check for AVCodecContext.codec 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=GV1P250MB0737EE344D380A085C42C4508F349@GV1P250MB0737.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