|
|
@ -139,6 +139,15 @@ int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options){ |
|
|
|
av_log(avctx, AV_LOG_WARNING, |
|
|
|
av_log(avctx, AV_LOG_WARNING, |
|
|
|
"MJPEG CBR encoding works badly with frame multi-threading, consider " |
|
|
|
"MJPEG CBR encoding works badly with frame multi-threading, consider " |
|
|
|
"using -threads 1, -thread_type slice or a constant quantizer.\n"); |
|
|
|
"using -threads 1, -thread_type slice or a constant quantizer.\n"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (avctx->codec_id == AV_CODEC_ID_HUFFYUV || |
|
|
|
|
|
|
|
avctx->codec_id == AV_CODEC_ID_FFVHUFF) { |
|
|
|
|
|
|
|
// huffyuv doesnt support these with multiple frame threads currently
|
|
|
|
|
|
|
|
if (avctx->context_model > 0 || (avctx->flags & CODEC_FLAG_PASS1)) { |
|
|
|
|
|
|
|
avctx->thread_count = 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(!avctx->thread_count) { |
|
|
|
if(!avctx->thread_count) { |
|
|
|
avctx->thread_count = av_cpu_count(); |
|
|
|
avctx->thread_count = av_cpu_count(); |
|
|
|
avctx->thread_count = FFMIN(avctx->thread_count, MAX_THREADS); |
|
|
|
avctx->thread_count = FFMIN(avctx->thread_count, MAX_THREADS); |
|
|
@ -147,13 +156,6 @@ int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options){ |
|
|
|
if(avctx->thread_count <= 1) |
|
|
|
if(avctx->thread_count <= 1) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
|
|
if (avctx->codec_id == AV_CODEC_ID_HUFFYUV || |
|
|
|
|
|
|
|
avctx->codec_id == AV_CODEC_ID_FFVHUFF) { |
|
|
|
|
|
|
|
// huffyuv doesnt support these with multiple frame threads currently
|
|
|
|
|
|
|
|
if (avctx->context_model > 0 || (avctx->flags & CODEC_FLAG_PASS1)) |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(avctx->thread_count > MAX_THREADS) |
|
|
|
if(avctx->thread_count > MAX_THREADS) |
|
|
|
return AVERROR(EINVAL); |
|
|
|
return AVERROR(EINVAL); |
|
|
|
|
|
|
|
|
|
|
|