mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
avcodec/mpeg12: Make initializing VLCs thread-safe
This automatically makes the eamad, eatqi, ipu and mdec decoders init-threadsafe; in addition to the actual mpeg[12]video decoders, of course. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
6e8fcd9c56
commit
902e16d183
@ -349,4 +349,5 @@ AVCodec ff_eamad_decoder = {
|
||||
.close = decode_end,
|
||||
.decode = decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
|
||||
};
|
||||
|
@ -189,4 +189,5 @@ AVCodec ff_eatqi_decoder = {
|
||||
.close = tqi_decode_end,
|
||||
.decode = tqi_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
|
||||
};
|
||||
|
@ -258,4 +258,5 @@ AVCodec ff_mdec_decoder = {
|
||||
.close = decode_end,
|
||||
.decode = decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
|
||||
};
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/timecode.h"
|
||||
#include "libavutil/thread.h"
|
||||
|
||||
#include "internal.h"
|
||||
#include "avcodec.h"
|
||||
@ -132,13 +133,8 @@ VLC ff_mb_ptype_vlc;
|
||||
VLC ff_mb_btype_vlc;
|
||||
VLC ff_mb_pat_vlc;
|
||||
|
||||
av_cold void ff_mpeg12_init_vlcs(void)
|
||||
static av_cold void mpeg12_init_vlcs(void)
|
||||
{
|
||||
static int done = 0;
|
||||
|
||||
if (!done) {
|
||||
done = 1;
|
||||
|
||||
INIT_VLC_STATIC(&ff_dc_lum_vlc, DC_VLC_BITS, 12,
|
||||
ff_mpeg12_vlc_dc_lum_bits, 1, 1,
|
||||
ff_mpeg12_vlc_dc_lum_code, 2, 2, 512);
|
||||
@ -164,7 +160,12 @@ av_cold void ff_mpeg12_init_vlcs(void)
|
||||
|
||||
INIT_2D_VLC_RL(ff_rl_mpeg1, 680, 0);
|
||||
INIT_2D_VLC_RL(ff_rl_mpeg2, 674, 0);
|
||||
}
|
||||
}
|
||||
|
||||
av_cold void ff_mpeg12_init_vlcs(void)
|
||||
{
|
||||
static AVOnce init_static_once = AV_ONCE_INIT;
|
||||
ff_thread_once(&init_static_once, mpeg12_init_vlcs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2899,7 +2899,8 @@ AVCodec ff_mpeg1video_decoder = {
|
||||
.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
|
||||
AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY |
|
||||
AV_CODEC_CAP_SLICE_THREADS,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP |
|
||||
FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
|
||||
.flush = flush,
|
||||
.max_lowres = 3,
|
||||
.update_thread_context = ONLY_IF_THREADS_ENABLED(mpeg_decode_update_thread_context),
|
||||
@ -2932,7 +2933,8 @@ AVCodec ff_mpeg2video_decoder = {
|
||||
.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
|
||||
AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY |
|
||||
AV_CODEC_CAP_SLICE_THREADS,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP |
|
||||
FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
|
||||
.flush = flush,
|
||||
.max_lowres = 3,
|
||||
.profiles = NULL_IF_CONFIG_SMALL(ff_mpeg2_video_profiles),
|
||||
@ -2976,7 +2978,8 @@ AVCodec ff_mpegvideo_decoder = {
|
||||
.close = mpeg_decode_end,
|
||||
.decode = mpeg_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP |
|
||||
FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
|
||||
.flush = flush,
|
||||
.max_lowres = 3,
|
||||
};
|
||||
@ -3139,5 +3142,5 @@ AVCodec ff_ipu_decoder = {
|
||||
.decode = ipu_decode_frame,
|
||||
.close = ipu_decode_end,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user