summaryrefslogtreecommitdiff
path: root/libavcodec/msmpeg4data.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-10-30 13:24:10 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-11-06 17:41:26 +0100
commit83dfc21a212cc0b03d1db17df072bfe7c4a3333a (patch)
treebf4c612518664c32a9e2749446128949d2e15b35 /libavcodec/msmpeg4data.c
parent8f7bf45895ced0b19295ba3d93470afa7d810f28 (diff)
downloadffmpeg-83dfc21a212cc0b03d1db17df072bfe7c4a3333a.tar.gz
avcodec/msmpeg4dec: Factor initializing VLCs shared with VC-1 out
It will be useful in the following commits. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/msmpeg4data.c')
-rw-r--r--libavcodec/msmpeg4data.c30
1 files changed, 30 insertions, 0 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 },