From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 9C73045154 for ; Tue, 10 Jan 2023 10:47:27 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 921DF680677; Tue, 10 Jan 2023 12:47:24 +0200 (EET) Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EF18868B1FD for ; Tue, 10 Jan 2023 12:47:17 +0200 (EET) Received: by mail-ed1-f42.google.com with SMTP id v6so16864920edd.6 for ; Tue, 10 Jan 2023 02:47:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=vQJc72HjOm3BIkaSBr0EmUIRavW6iru6wp8YYaVK6jc=; b=DOrCvy76ipZD4gA/IFYeH8bsOJQrJie7fHOO7zX3KIg8fHhk50urqqDHmA4C5DOSsB O1iA4xbsDC4nQwwuvH1gaUDUYJmNpgi472aQwWeTsMPYg2Rn7VNlFF8Rqe1jqZD3ZkPE LyU+xrLNqVJHqmGbJxpvJlMu7bOTpT2XmV2FqcEPJTosANHyyL9nHsnRNwtQ/S9NW2uh SLr4gZJ85UU5Lc7r7qtsyAozEGGlI7QltlaWyGkiu7hmft7ouSk9iJhAPoRMMOKEhXiS Q+ssieUu0+xWvLzNCuHVDYW/DvhCqUanH/uz2tzrjaQ8+uYqDwuos/s07PuJXcb+WiFP nO5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vQJc72HjOm3BIkaSBr0EmUIRavW6iru6wp8YYaVK6jc=; b=o+NTpvPi4cekoTq7OWS6GFk/H8csCTRux/nWoK9dvQqNFRYWIS75Ghl7zWAGjdT9rx zG8Ff1gX7JdmcBY11SpfkhLC++PM3RTP1zuWRdJMiNHMuI45qh58CPRmwjEqxFTICBhZ +tq3A3NwpYAMQZJ6OUAWbFPIgah6NhfTfi+ENZlyUjwE2MJ/+2SO4AdCeVLoEeeaPGI+ rpkX0+uUFC9+60g7NicPQJZoktKXB8HnP76KjpS5oQfzRYdSCPWa7tyJDhw8kJl/SC7H 1l/aJ7oIbHHBUiXLXWBusnwUU7XTeIyuEU3xhqSnmyJBbrjq72VShv1bS4PTD6Cmb+ER yayg== X-Gm-Message-State: AFqh2kpXWVYa01u+VQL+drK2eQDi8+mvWGXz6i3zTAbbQY2zPE5vo7Of 60DhBgGWX2rDemf/AfmQ0vbvOcGHVhTwd6HN114C27R6XkXXTQ== X-Google-Smtp-Source: AMrXdXuaGYinxB25jCLd2qj5cIaNCnlM6g+imKIGY652u5ijDxgILXSEHUONGf2GujjPfyaPXetMwmWng9fMKy3qIl8= X-Received: by 2002:a05:6402:6cb:b0:493:77c5:6851 with SMTP id n11-20020a05640206cb00b0049377c56851mr1747360edy.328.1673347636965; Tue, 10 Jan 2023 02:47:16 -0800 (PST) MIME-Version: 1.0 References: <20230105104151.2055-1-Dmitriy.Ovchinnikov@amd.com> In-Reply-To: <20230105104151.2055-1-Dmitriy.Ovchinnikov@amd.com> From: "mypopy@gmail.com" Date: Tue, 10 Jan 2023 18:47:05 +0800 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH v3] lavc/libvpx: remove thread limit 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Thu, Jan 5, 2023 at 6:42 PM Dmitrii Ovchinnikov wrote: > > From: Dmitrii Ovchinnikov > > This change improves the performance and multicore > scalability of the vp9 codec for streaming single-pass encoded videos. The > current thread limit for ffmpeg codecs is 16 (MAX_AUTO_THREADS in > pthread_internal.h) due to a limitation in H.264 codec that prevents more > than 16 threads being used. > > Increasing the thread limit to 64 for vp9 improves > the performance for encoding 4K raw videos for streaming by up to 47% > compared to 16 threads, and from 20-30% for 32 threads, with the same quality > as measured by the VMAF score. > > Did not need to add a check for limit in libvpx as it is already present > in libvpx/vp9/vp9_cx_iface.c: > RANGE_CHECK_HI(cfg, g_threads, 64); > As demonstrated by following message when -threads is set to anything more than 64 > [libvpx-vp9 @ 0x30ed380] Additional information: g_threads out of range [..64] > > --- > libavcodec/libvpxdec.c | 2 +- > libavcodec/libvpxenc.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c > index 9cd2c56caf..19407092d0 100644 > --- a/libavcodec/libvpxdec.c > +++ b/libavcodec/libvpxdec.c > @@ -88,7 +88,7 @@ static av_cold int vpx_init(AVCodecContext *avctx, > const struct vpx_codec_iface *iface) > { > struct vpx_codec_dec_cfg deccfg = { > - .threads = FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), 16) > + .threads = avctx->thread_count ? avctx->thread_count : av_cpu_count() > }; > > av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str()); > diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c > index 9aa5510c28..0627e13973 100644 > --- a/libavcodec/libvpxenc.c > +++ b/libavcodec/libvpxenc.c > @@ -942,7 +942,7 @@ static av_cold int vpx_init(AVCodecContext *avctx, > enccfg.g_timebase.num = avctx->time_base.num; > enccfg.g_timebase.den = avctx->time_base.den; > enccfg.g_threads = > - FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), 16); > + avctx->thread_count ? avctx->thread_count : av_cpu_count(); > enccfg.g_lag_in_frames= ctx->lag_in_frames; > Do you check the change with the old version libvpx? as I know, older versions libvpx setting the number of threads higher than 16 will cause a crash, so I think at least a version check needs to be added > if (avctx->flags & AV_CODEC_FLAG_PASS1) > -- > 2.38.1.windows.1 _______________________________________________ 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".