[FFmpeg-cvslog] avcodec/vvc: Don't create new thread when thread_count is 1

Zhao Zhili git at videolan.org
Thu Jun 27 15:55:50 EEST 2024


ffmpeg | branch: master | Zhao Zhili <zhilizhao at tencent.com> | Mon Jun 24 12:47:44 2024 +0800| [6aeb084c395dd3240e203d7b6a053cbdfec2ac99] | committer: Nuo Mi

avcodec/vvc: Don't create new thread when thread_count is 1

Make its behavior consistent with other decoders, e.g., H.264/H.265.

Signed-off-by: Zhao Zhili <zhilizhao at tencent.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6aeb084c395dd3240e203d7b6a053cbdfec2ac99
---

 libavcodec/vvc/dec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
index a8a9a7c99d..a6b601b778 100644
--- a/libavcodec/vvc/dec.c
+++ b/libavcodec/vvc/dec.c
@@ -1022,7 +1022,7 @@ static av_cold int vvc_decode_init(AVCodecContext *avctx)
     static AVOnce init_static_once = AV_ONCE_INIT;
     const int cpu_count            = av_cpu_count();
     const int delayed              = FFMIN(cpu_count, VVC_MAX_DELAYED_FRAMES);
-    const int thread_count         = avctx->thread_count ? avctx->thread_count : delayed;
+    int thread_count               = avctx->thread_count ? avctx->thread_count : delayed;
     int ret;
 
     s->avctx = avctx;
@@ -1049,6 +1049,8 @@ static av_cold int vvc_decode_init(AVCodecContext *avctx)
             return ret;
     }
 
+    if (thread_count == 1)
+        thread_count = 0;
     s->executor = ff_vvc_executor_alloc(s, thread_count);
     if (!s->executor)
         return AVERROR(ENOMEM);



More information about the ffmpeg-cvslog mailing list