aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/frame_thread_encoder.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-02-15 15:14:46 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-02-15 15:14:46 +0100
commitf7459bcfc5b54554f95616214696b2a9d189d7fa (patch)
tree04f5dfdcb89cbf29bef9bccae2595b3cc5f0a275 /libavcodec/frame_thread_encoder.c
parent59279bf21fb037978626e348f58e7abb5b7fa2d7 (diff)
downloadffmpeg-f7459bcfc5b54554f95616214696b2a9d189d7fa.tar.gz
avcodec/frame_thread_encoder: restructure huffyuv checks
This makes them similar to the other checks Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/frame_thread_encoder.c')
-rw-r--r--libavcodec/frame_thread_encoder.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/libavcodec/frame_thread_encoder.c b/libavcodec/frame_thread_encoder.c
index 786599679d..05a7c6b43f 100644
--- a/libavcodec/frame_thread_encoder.c
+++ b/libavcodec/frame_thread_encoder.c
@@ -139,6 +139,15 @@ int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options){
av_log(avctx, AV_LOG_WARNING,
"MJPEG CBR encoding works badly with frame multi-threading, consider "
"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) {
avctx->thread_count = av_cpu_count();
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)
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)
return AVERROR(EINVAL);