This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit af70b24692e9b72548d96896e01fbd31193b7af5
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Sun Dec 14 16:47:12 2025 +0100
Commit:     Andreas Rheinhardt <[email protected]>
CommitDate: Sun Dec 14 21:05:57 2025 +0100

    avcodec/libsvtjpegxs{dec,enc}: Don't call av_cpu_count() multiple times
    
    (Like the old code, the new code limits the number of threads to 64,
    even when the user explicitly set a higher thread count. I don't know
    whether it is intentional to apply this limit even when the user
    explicitly supplied the number of threads.)
    
    Reviewed-by: James Almer <[email protected]>
    Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavcodec/libsvtjpegxsdec.c | 3 ++-
 libavcodec/libsvtjpegxsenc.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libsvtjpegxsdec.c b/libavcodec/libsvtjpegxsdec.c
index 56beff9edb..2499f32059 100644
--- a/libavcodec/libsvtjpegxsdec.c
+++ b/libavcodec/libsvtjpegxsdec.c
@@ -248,7 +248,8 @@ static av_cold int svt_jpegxs_dec_init(AVCodecContext* 
avctx)
     else
         svt_dec->decoder.proxy_mode = proxy_mode_full;
 
-    svt_dec->decoder.threads_num = FFMIN(avctx->thread_count ? 
avctx->thread_count : av_cpu_count(), 64);
+    int thread_count = avctx->thread_count ? avctx->thread_count : 
av_cpu_count();
+    svt_dec->decoder.threads_num = FFMIN(thread_count, 64);
     svt_dec->decoder.use_cpu_flags = CPU_FLAGS_ALL;
 
     return 0;
diff --git a/libavcodec/libsvtjpegxsenc.c b/libavcodec/libsvtjpegxsenc.c
index 6b10a32d33..9daf226c9d 100644
--- a/libavcodec/libsvtjpegxsenc.c
+++ b/libavcodec/libsvtjpegxsenc.c
@@ -187,7 +187,8 @@ static av_cold int svt_jpegxs_enc_init(AVCodecContext* 
avctx) {
 
     set_pix_fmt(avctx, &svt_enc->encoder);
 
-    svt_enc->encoder.threads_num = FFMIN(avctx->thread_count ? 
avctx->thread_count : av_cpu_count(), 64);
+    int thread_count = avctx->thread_count ? avctx->thread_count : 
av_cpu_count();
+    svt_enc->encoder.threads_num = FFMIN(thread_count, 64);
 
     int log_level = av_log_get_level();
     svt_enc->encoder.verbose = log_level < AV_LOG_DEBUG ? VERBOSE_ERRORS :

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to