diff mbox series

[FFmpeg-devel,1/3] lavc/speedhqdec: Add AV_CODEC_CAP_FRAME_THREADS

Message ID 5c0eea5911c9db73182395f873af8e86653ac765.camel@haerdin.se
State New
Headers show
Series [FFmpeg-devel,1/3] lavc/speedhqdec: Add AV_CODEC_CAP_FRAME_THREADS | expand

Commit Message

Tomas Härdin May 8, 2024, 12:42 p.m. UTC
Hi

On a 36-core machine (Intel(R) Xeon(R) Platinum 8124M CPU @ 3.00GHz)
with a 7 minute 125 Mbit/s 1080p sample and -thread_type frame -threads
36 this brings CPU utilization from 117% to 3174%, 58x realtime

Without -threads 36 the utilization is only 1601% due to it being 16 by
default..

/Tomas

Comments

James Almer May 8, 2024, 12:46 p.m. UTC | #1
On 5/8/2024 9:42 AM, Tomas Härdin wrote:
> Hi
> 
> On a 36-core machine (Intel(R) Xeon(R) Platinum 8124M CPU @ 3.00GHz)
> with a 7 minute 125 Mbit/s 1080p sample and -thread_type frame -threads
> 36 this brings CPU utilization from 117% to 3174%, 58x realtime
> 
> Without -threads 36 the utilization is only 1601% due to it being 16 by
> default..

Does this default make sense anymore? I think it was added for h264, but 
maybe it should be decoder dependent.

> 
> /Tomas
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Tomas Härdin May 8, 2024, 12:48 p.m. UTC | #2
ons 2024-05-08 klockan 09:46 -0300 skrev James Almer:
> On 5/8/2024 9:42 AM, Tomas Härdin wrote:
> > Hi
> > 
> > On a 36-core machine (Intel(R) Xeon(R) Platinum 8124M CPU @
> > 3.00GHz)
> > with a 7 minute 125 Mbit/s 1080p sample and -thread_type frame -
> > threads
> > 36 this brings CPU utilization from 117% to 3174%, 58x realtime
> > 
> > Without -threads 36 the utilization is only 1601% due to it being
> > 16 by
> > default..
> 
> Does this default make sense anymore? I think it was added for h264,
> but 
> maybe it should be decoder dependent.

It is only relevant for slice threading in h264, right? It certainly
doesn't make sense for any intra-only codec in frame threading mode

/Tomas
diff mbox series

Patch

From d1a7f33a1c394142b6dc14d4e8392ad786f8ba52 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
Date: Wed, 8 May 2024 14:17:18 +0200
Subject: [PATCH 1/3] lavc/speedhqdec: Add AV_CODEC_CAP_FRAME_THREADS

---
 libavcodec/speedhqdec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/speedhqdec.c b/libavcodec/speedhqdec.c
index d3605b0649..e54e25cb25 100644
--- a/libavcodec/speedhqdec.c
+++ b/libavcodec/speedhqdec.c
@@ -40,6 +40,7 @@ 
 #include "mpeg12data.h"
 #include "mpeg12vlc.h"
 #include "speedhq.h"
+#include "thread.h"
 
 #define MAX_INDEX (64 - 1)
 
@@ -433,7 +434,7 @@  static int speedhq_decode_frame(AVCodecContext *avctx, AVFrame *frame,
     avctx->coded_width = FFALIGN(avctx->width, 16);
     avctx->coded_height = FFALIGN(avctx->height, 16);
 
-    if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
+    if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) {
         return ret;
     }
     frame->flags |= AV_FRAME_FLAG_KEY;
@@ -649,5 +650,5 @@  const FFCodec ff_speedhq_decoder = {
     .priv_data_size = sizeof(SHQContext),
     .init           = speedhq_decode_init,
     FF_CODEC_DECODE_CB(speedhq_decode_frame),
-    .p.capabilities = AV_CODEC_CAP_DR1,
+    .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
 };
-- 
2.39.2