From patchwork Wed Oct 19 22:47:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Degawa X-Patchwork-Id: 38827 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp602815pzb; Wed, 19 Oct 2022 15:49:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6erlR25SEPTJQWDifmsQnsp+pRmjck6LZmTAlG4bbghot0U8jew/bUUSNwdnts0lHnylNs X-Received: by 2002:a05:6402:42c7:b0:45c:a6f1:c0af with SMTP id i7-20020a05640242c700b0045ca6f1c0afmr9358915edc.75.1666219791873; Wed, 19 Oct 2022 15:49:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666219791; cv=none; d=google.com; s=arc-20160816; b=KOPGHEoZnOQBlfURP5BrfemT+7cWZi+qU56DCDMMnh7A9Z3ps1I4OnODKnR3Q7p4Lr Qm/STvF0Rc2akKyy4CZ9Kqy8M6NIdqy4lUSHf/0QBf9BWOO7us3gp6EthTed82uknNnq AdDma37uA3KvQX2N6JdGRbtIG8jSF6/1plFkofcINq85g/Uow6Nj12mWckHFFttKwahP JcYKoDdGzXvGoYyq0lUffJoGGrdfzDu3jPEVopTZ2Op72NQAuyUCSDzqsgInLZ28Ojok YvvMtDQhfQQozkzx5GteO0VhUAU2Pa5AFeuPv3EOtcDsEOo90z16W58Nk0j9y3ISXRW8 oSBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=758TJHOl54BTTlZ2v9l26IWC8TOREW9vYpznfJEJK0A=; b=vEu0iBH/3XvcbxXF8rE/2LXY7NZ7KDRCCQ02SE0xPvMfjBpXlkKOkUk/F67XwyDuh+ 2+zpYKxKCsZILTmpsp8P1mRGW61sNkHM8cEHN67XS0jFq95Bnmj3rIp5YmIfZCmTJsw7 R3JfSmdcS+YrsfGqweEuHyzIQcO/0Uzy+hQEeOcplL/JHkQjPjs3ft9qStlOxb72gb+G 1sMXtOAAfLHXj3bjOYegWOeysEFw/fe1uind18w3Tz4MkzgbJEgIcJrkLkDmrtAanxNg tyP0WJUJJRVdq/hrRRt5QY/aUsxUJsE9BWY2lLpSchmm7qT/Lxpb33bbrowk61cR5l1g 39xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@randomderp.com header.s=default header.b=huDy2eo3; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=randomderp.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l15-20020a170906794f00b0078333d9f17bsi16834913ejo.819.2022.10.19.15.49.50; Wed, 19 Oct 2022 15:49:51 -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; dkim=neutral (body hash did not verify) header.i=@randomderp.com header.s=default header.b=huDy2eo3; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=randomderp.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 60E5068BD63; Thu, 20 Oct 2022 01:49:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from degawa.com (174-127-109-95.slc.westdc.net [174.127.109.95]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 51DDA68BCAA for ; Thu, 20 Oct 2022 01:49:39 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=randomderp.com; s=default; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=FzUTvRG5r0+PBsZRs5M+oDNJ/NmrDmWKcqlmRbiOCfE=; b=huDy2eo3u1J4AKl+NvuDnbSSad WdhuJ50jJ6Q+ngtCctr1DBkRqTNAqRBIWCvxCXUhCiH1vlqOVH+7d1Ek8yXbDBCR5UXTxKMyWaa+t Wl7GlNh1H+JQNtPoRCeYJHQv8MBLMqM9CgsWSscIsI6k0g7e/+N1PiREbCKecO/mCHUEDtBhRTLHH V58LKnYyuuOAr4RVMvrSuEfLov82bLUOyHTNEo5b9lw6B1xUX62J5XjNcubkPBX+Tx1AS/27EEKqI LFrT8NpihbkxvsUclfLNAU1acg7HtanPkwk3ISYUqBBXLqCOmJqm7XL14Xy+PF2GOZWdFJO/q30HM 35oUv0yA==; Received: from c-75-64-74-17.hsd1.tn.comcast.net ([75.64.74.17]:49782 helo=localhost.localdomain) by slmp-550-1.slc.westdc.net with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1olHsX-0002CA-G5; Wed, 19 Oct 2022 16:49:35 -0600 From: Christopher Degawa To: ffmpeg-devel@ffmpeg.org Date: Wed, 19 Oct 2022 17:47:11 -0500 Message-Id: <20221019224712.194658-1-ccom@randomderp.com> X-Mailer: git-send-email 2.38.0 MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - slmp-550-1.slc.westdc.net X-AntiAbuse: Original Domain - ffmpeg.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - randomderp.com X-Get-Message-Sender-Via: slmp-550-1.slc.westdc.net: authenticated_id: ccom/from_h X-Authenticated-Sender: slmp-550-1.slc.westdc.net: ccom@randomderp.com X-Source: X-Source-Args: X-Source-Dir: Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/libsvtav1: remove compressed_ten_bit_format and simplify alloc_buffer 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 Cc: Christopher Degawa Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: x3SdxzdEXTBa From: Christopher Degawa compressed_ten_bit_format has been deprecated upstream and has no effect and can be removed. Plus, technically it was never used in the first place since it would require the app (ffmpeg) to set it and do additional processing of the input frames. Also simplify alloc_buffer by removing calculations relating to the non-existant processing. Signed-off-by: Christopher Degawa --- libavcodec/libsvtav1.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c index 2f5634cee0..28da206cf8 100644 --- a/libavcodec/libsvtav1.c +++ b/libavcodec/libsvtav1.c @@ -124,16 +124,12 @@ static int svt_print_error(void *log_ctx, EbErrorType err, static int alloc_buffer(EbSvtAv1EncConfiguration *config, SvtContext *svt_enc) { - const int pack_mode_10bit = - (config->encoder_bit_depth > 8) && (config->compressed_ten_bit_format == 0) ? 1 : 0; - const size_t luma_size_8bit = - config->source_width * config->source_height * (1 << pack_mode_10bit); - const size_t luma_size_10bit = - (config->encoder_bit_depth > 8 && pack_mode_10bit == 0) ? luma_size_8bit : 0; + const size_t luma_size = config->source_width * config->source_height * + (config->encoder_bit_depth > 8 ? 2 : 1); EbSvtIOFormat *in_data; - svt_enc->raw_size = (luma_size_8bit + luma_size_10bit) * 3 / 2; + svt_enc->raw_size = luma_size * 3 / 2; // allocate buffer for in and out svt_enc->in_buf = av_mallocz(sizeof(*svt_enc->in_buf)); From patchwork Wed Oct 19 22:47:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Degawa X-Patchwork-Id: 38828 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp603033pzb; Wed, 19 Oct 2022 15:50:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6iEB8cKPCEFmbqtQm2tj5tL88+PM8JidFk7e1dHZxErlgCykEJi3oIgmoF0nvuPmGb9z4G X-Received: by 2002:a17:907:3f04:b0:741:4bf4:fe42 with SMTP id hq4-20020a1709073f0400b007414bf4fe42mr8806884ejc.664.1666219837940; Wed, 19 Oct 2022 15:50:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666219837; cv=none; d=google.com; s=arc-20160816; b=U4pDqRw37Vv+3OQDE61W2qBnKhl95Qu84hS/HV77YYogEPf/GZ1mctrtxfPnxzoV0q JbkiTI/+ynx5a8zVbgijTMWKrQWiwzyjtdmwfjI5EF5JlP5N8HWJr4ybBeqkFV10xDdp ucamjJ82nUXS8Qecl7A0cloTulq4Tw5wHD9zVSDLBHA8R8tR8wURt6G8fKr8cJF55uFH appIq1x14OC459rg8KyIzKRQjrbsqO/ogocR7Kz4EGkVh6lC2fXK+vO9uh52izwjX0bM gCQSvcz/Q6CIzCOYkTm4pzvlx6aKCKpxbp2oNwuZyahLB5+StX8Ntz4JqYCo5IdY9V8D ORfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=o4cM8yEmn5mGwSEmTblpt3wgq0OzaQ2p7VUDZykOKFI=; b=ZV7tc6Zg+9fRFCKWlISWn5nV7VWY9j36E2p5p+YcOJR/wwgljREIG5Ut2sgc6dKyWJ 6mCqO5P6WyN3EiZciOWNtjtAf54s3YsQLaVnwn3TwVJHxaUe+OHe1nb60Ba7PlxVQlHV FipTmM/JCm6Mzj3daD/Y8/H07DfEyzXq4/pzClwlXhLHztaGIhTskchA1izQTKZoh3u4 th3aMHOeK3+BIgazJ202Z8bPxoq5+864MFEiZDSQeZuUrBoY6Fm7M1TnHgclBveh8gqs g7iKvW6E49dauMhk+bzyHW7jYd6I+r/wxiVygAvdO62M2oIQp8IYfvMOvxtAROFxUfG8 wrYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@randomderp.com header.s=default header.b="f/i+EwfL"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=randomderp.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g12-20020a056402114c00b00451e0d930dfsi13663625edw.497.2022.10.19.15.50.37; Wed, 19 Oct 2022 15:50:37 -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; dkim=neutral (body hash did not verify) header.i=@randomderp.com header.s=default header.b="f/i+EwfL"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=randomderp.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7A8FD68BD9E; Thu, 20 Oct 2022 01:50:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from degawa.com (174-127-109-95.slc.westdc.net [174.127.109.95]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E567268B76F for ; Thu, 20 Oct 2022 01:50:28 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=randomderp.com; s=default; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=oex2wVFVt41PoGzOfdX6ZFEkZkMh+FBMDdET+K14NEg=; b=f/i+EwfLB2y123CA0rB2LKKXbq w9GiUnyoWvUjUb7PBu19glGfn4Z2xwnx/a2m5QNMx4u9+qcHtyrhKjukisisY8ygu1j59KEq/A1ak C+9t9dByKMrEj7dR4SsLtjuLj1tvIb9/T0R03pCM+eJBL1xeCmZVbac4E21vF2T21CV1y5rLpNXPM DYxyLkjDtFYt30+6W/F0h2/FsmOmQoG7sqVwPZ+YU5oA2O4QQ1QpqHDS0+zIdomqpM/8RxIK9+2vR XHL4yAq4WJeSUG7PA+AtT/BlsZAVy9Xe6BaNzkXvdEZtnibZ1ntWmpQkNrS3SEieAn55d2oNBz3ty DxfY0eYQ==; Received: from c-75-64-74-17.hsd1.tn.comcast.net ([75.64.74.17]:49782 helo=localhost.localdomain) by slmp-550-1.slc.westdc.net with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1olHtM-0002CA-AN; Wed, 19 Oct 2022 16:50:26 -0600 From: Christopher Degawa To: ffmpeg-devel@ffmpeg.org Date: Wed, 19 Oct 2022 17:47:12 -0500 Message-Id: <20221019224712.194658-2-ccom@randomderp.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019224712.194658-1-ccom@randomderp.com> References: <20221019224712.194658-1-ccom@randomderp.com> MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - slmp-550-1.slc.westdc.net X-AntiAbuse: Original Domain - ffmpeg.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - randomderp.com X-Get-Message-Sender-Via: slmp-550-1.slc.westdc.net: authenticated_id: ccom/from_h X-Authenticated-Sender: slmp-550-1.slc.westdc.net: ccom@randomderp.com X-Source: X-Source-Args: X-Source-Dir: Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/libsvtav1: replace vbv_bufsize with maximum_buffer_size_ms 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 Cc: Christopher Degawa Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 5WL7tBEAj60k From: Christopher Degawa svt-av1 v1.2.0 has deprecated vbv_bufsize in favor of using - maximum_buffer_size_ms (--buf-sz) - starting_buffer_level_ms (--buf-initial-sz) - optimal_buffer_level_ms (--buf-optimal-sz) and vbv_bufsize has not been in use since svt-av1 v0.8.6 Signed-off-by: Christopher Degawa --- libavcodec/libsvtav1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c index 28da206cf8..74dad9892b 100644 --- a/libavcodec/libsvtav1.c +++ b/libavcodec/libsvtav1.c @@ -179,7 +179,7 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param, param->min_qp_allowed = avctx->qmin; } param->max_bit_rate = avctx->rc_max_rate; - param->vbv_bufsize = avctx->rc_buffer_size; + param->maximum_buffer_size_ms = avctx->rc_buffer_size * 1000 / avctx->bit_rate; if (svt_enc->crf > 0) { param->qp = svt_enc->crf; @@ -296,7 +296,7 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param, avctx->bit_rate = param->rate_control_mode > 0 ? param->target_bit_rate : 0; avctx->rc_max_rate = param->max_bit_rate; - avctx->rc_buffer_size = param->vbv_bufsize; + avctx->rc_buffer_size = param->maximum_buffer_size_ms * avctx->bit_rate / 1000; if (avctx->bit_rate || avctx->rc_max_rate || avctx->rc_buffer_size) { AVCPBProperties *cpb_props = ff_add_cpb_side_data(avctx);