mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-04 06:08:26 +02:00
avcodec/mpeg12enc: Move high resolution thread check to before initializing threads
Cleaner solution is welcome! Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit a53fbda9dc92273054a103db7539d2bb6e9632b2) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
8c2f006d10
commit
302f11e719
@ -144,9 +144,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
|||||||
{
|
{
|
||||||
MpegEncContext *s = avctx->priv_data;
|
MpegEncContext *s = avctx->priv_data;
|
||||||
|
|
||||||
if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO && avctx->height > 2800)
|
|
||||||
avctx->thread_count = 1;
|
|
||||||
|
|
||||||
if (ff_mpv_encode_init(avctx) < 0)
|
if (ff_mpv_encode_init(avctx) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -193,6 +193,12 @@ int ff_slice_thread_init(AVCodecContext *avctx)
|
|||||||
w32thread_init();
|
w32thread_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// We cannot do this in the encoder init as the threads are created before
|
||||||
|
if (av_codec_is_encoder(avctx->codec) &&
|
||||||
|
avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO &&
|
||||||
|
avctx->height > 2800)
|
||||||
|
thread_count = avctx->thread_count = 1;
|
||||||
|
|
||||||
if (!thread_count) {
|
if (!thread_count) {
|
||||||
int nb_cpus = av_cpu_count();
|
int nb_cpus = av_cpu_count();
|
||||||
if (avctx->height)
|
if (avctx->height)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user