From patchwork Wed May 8 12:42:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Tomas_H=C3=A4rdin?= X-Patchwork-Id: 48669 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9c8f:b0:1af:cdee:28c5 with SMTP id mj15csp170224pzb; Wed, 8 May 2024 05:42:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVL4k6p9B7CTpsp37pimhga10zhRju63y7MYgNFm0yUllJk8ehHo4PIcx9wkpnB5aNJFiZ9ZwpteAgfbRkSUv0o+ffMymCZXmZCzQ== X-Google-Smtp-Source: AGHT+IGMkJd4MJlfXvMrqajt4bUSggLWHTT64tdWXIqgeyNTOyexITHuAVVYrtxl8Hy4XeBySMl5 X-Received: by 2002:a2e:740b:0:b0:2e0:eb96:7b53 with SMTP id 38308e7fff4ca-2e447cabeadmr15761091fa.44.1715172142748; Wed, 08 May 2024 05:42:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715172142; cv=none; d=google.com; s=arc-20160816; b=QiAwpg0eTfkIt+LSXKe9lTpiYhgUX4Rgf1h+wVeN8GZxeY78irIIz8X1oc9H+Y6+sZ UPTLzO9fE9xkkeK/ROkaQThnmxU8SKqNyhUfpQZIFZmfpmxm4/F80ws6dTB0ZPOFiPEt aNumXyegnIhqHAe2uOoZuYTGlBEMpIAuwnDq9U1vkZ2WBe30J3FtJS2Y+qbaIYTef3H1 uQvHO/FsSy0xMKfYQCGefw9K/Q2sIE0eOFNVbmwDdCrhwV3TpZvx/yKnO5cZJ/7l1TPY mbD2akQgBuFXz99NrmQ2T7wVYi38K91xqVgwHkwoQCjAO/cuNGMbv5ZVjkfLuKLXY/q/ O7qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:user-agent:date:to:from:message-id:delivered-to; bh=bAKIOoasv/gFpJF7CIHoVsF8DbUKb/Je5c6KM+UVpKM=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=WJghiW7H7kFWbzO6P7ml3jRCLhIK1Ykd2cF3WxerL4FreWtpyxHJFCfuagcaAo5MFt x0LheaBPHsF0impaY444eLUM57BSi1wNO6TzU2w1EPT4zEiOmyDTqhrRFqWAr2QKnpVk pnFZOHSgx83pZXYKZWIQNzY4EhfC0fXe9/48kmV0vayuZWz5oC372qHV7+gaU65WnupK rE+hDfol9ZV1xulLWix1nZfTYRh5yIksoX+rTBHhm5FMNM2h8Gz6J2JJw/oPWPguqMDL rlOEnP4ooKsEIA0Oww99iVtdXEROU8IFhEp7lJ91WRVSEGR7hHF7HKybkmxuVNOeEH+d BCVg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y33-20020a2ebba1000000b002e23dac448esi3552996lje.621.2024.05.08.05.42.22; Wed, 08 May 2024 05:42:22 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1C44968D624; Wed, 8 May 2024 15:42:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from glom.nmugroup.com (glom.nmugroup.com [193.183.80.6]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ADE3968D41E for ; Wed, 8 May 2024 15:42:09 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by glom.nmugroup.com (Postfix) with ESMTP id D8B355429937 for ; Wed, 8 May 2024 14:42:07 +0200 (CEST) Received: from [10.10.150.6] (unknown [134.65.164.34]) (Authenticated sender: git01) by glom.nmugroup.com (Postfix) with ESMTPSA id AD924542919F for ; Wed, 8 May 2024 14:42:07 +0200 (CEST) Message-ID: <5c0eea5911c9db73182395f873af8e86653ac765.camel@haerdin.se> From: Tomas =?iso-8859-1?q?H=E4rdin?= To: FFmpeg development discussions and patches Date: Wed, 08 May 2024 14:42:06 +0200 User-Agent: Evolution 3.46.4-2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] lavc/speedhqdec: Add AV_CODEC_CAP_FRAME_THREADS X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: m+WitRpWXt5+ 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 From d1a7f33a1c394142b6dc14d4e8392ad786f8ba52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= 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