diff mbox series

[FFmpeg-devel,04/14] avcodec/mpegvideo_enc: Remove redundant checks for multithreading

Message ID AM7PR03MB66606FCD4B75E15EB72C574A8F7D9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit be736e42372ddb311ff6d7bf8898f67bf3a20793
Headers show
Series [FFmpeg-devel,01/14] avcodec/mjpegenc: Use custom close function directly | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Dec. 22, 2021, 3:25 a.m. UTC
The generic code ensures that only codecs with
the FF_CODEC_CAP_AUTO_THREADS internal cap ever have to
handle the case avctx->thread_count == 0 themselves;
moreover, it is also ensured generically that only codecs
that support some form of threading have thread_count set
to something else than one. So these checks are unnecessary.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mpegvideo_enc.c | 18 ------------------
 1 file changed, 18 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 7e45fd0ff3..23e8a41a86 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -607,24 +607,6 @@  av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
         return AVERROR(EINVAL);
     }
 
-    if (avctx->thread_count > 1         &&
-        s->codec_id != AV_CODEC_ID_MPEG4      &&
-        s->codec_id != AV_CODEC_ID_MPEG1VIDEO &&
-        s->codec_id != AV_CODEC_ID_MPEG2VIDEO &&
-        s->codec_id != AV_CODEC_ID_MJPEG      &&
-        (s->codec_id != AV_CODEC_ID_H263P)) {
-        av_log(avctx, AV_LOG_ERROR,
-               "multi threaded encoding not supported by codec\n");
-        return AVERROR_PATCHWELCOME;
-    }
-
-    if (avctx->thread_count < 1) {
-        av_log(avctx, AV_LOG_ERROR,
-               "automatic thread number detection not supported by codec, "
-               "patch welcome\n");
-        return AVERROR_PATCHWELCOME;
-    }
-
     if (s->b_frame_strategy && (avctx->flags & AV_CODEC_FLAG_PASS2)) {
         av_log(avctx, AV_LOG_INFO,
                "notice: b_frame_strategy only affects the first pass\n");