Browse Source

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 a53fbda9dc)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n2.8.6
Michael Niedermayer 10 years ago
parent
commit
f77b656b6e
2 changed files with 6 additions and 3 deletions
  1. +0
    -3
      libavcodec/mpeg12enc.c
  2. +6
    -0
      libavcodec/pthread_slice.c

+ 0
- 3
libavcodec/mpeg12enc.c View File

@@ -145,9 +145,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
{
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)
return -1;



+ 6
- 0
libavcodec/pthread_slice.c View File

@@ -193,6 +193,12 @@ int ff_slice_thread_init(AVCodecContext *avctx)
w32thread_init();
#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) {
int nb_cpus = av_cpu_count();
if (avctx->height)


Loading…
Cancel
Save