From patchwork Thu Mar 24 13:11:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danil Chapovalov X-Patchwork-Id: 34948 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:ab0:5fda:0:0:0:0:0 with SMTP id g26csp1128109uaj; Thu, 24 Mar 2022 06:12:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyE/eLxIDBFr407pFAQ3zVA1EIBHWEjeuJPf0WREEJHoVmxYOUXuE3MOx7Pw5DEqk6JG8vH X-Received: by 2002:a17:907:97c9:b0:6db:ab53:1fdf with SMTP id js9-20020a17090797c900b006dbab531fdfmr5768867ejc.406.1648127572001; Thu, 24 Mar 2022 06:12:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648127571; cv=none; d=google.com; s=arc-20160816; b=ck+gx+0g5GQdsoDjlsIg75+Z5gy4x5edFzWokFhuj3aIa/FFiYD+MbS1aNZP9AtFq5 4WcoShWWRKqaDItT9Swc4uJp2exGDoDc/m1wfliL1v9WE3H0gWU0TDi+1aRh4rc55LAx TYOpjztDrMg1X/9tzMG4e1GmYymBK3ynPICKuwMuaShY/fOiLo3WEuiwUUeKy0o9szoB 5+I4GqOHHkJGNEkM40mrSerbAGeId/mGycL8EHEjs/P8amUqOEueJQh2HwR/Dt7YvcC1 fxlqREvJ5pOM0GefXgKBcTK9vWstRndnzsSoKPFNxyAGiOqxJZcboBrQmnWXDz+cCJ2M Lvrg== 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:to:from:references:mime-version :message-id:in-reply-to:date:dkim-signature:delivered-to; bh=VIUt4OSNzbwoPXAeelstqVhdzaNFeHZOfsqs9O28QqU=; b=JXfDQM1QIqyVt9rrD0HMz6P3MkAykD7YfV6Bkh+h5cNtDhLinXShVYGbK6EW1Js375 +kEvBRcXdD2LPpHoeIgqCuoLk/NkMqniNt0tA0x/SOZxt5q6QFkp+JXC9HVEcGjdkvm0 p+f2Pb9tvswNckQ0Mdl07K78daHpupmzEWdw0cNegwyimosJboI/shAXP1I6lkYNeFC/ gfPNvpjKHhlNSh3s/+4u2pBTjA5TmeRQ1Ffn00FXA5ZOuLMNgs/M7jpKI4Pl1XdPtTGW JdO51+RdawBOaZi3izCRq3evWr5HGCkrilubr/yFBAz4Vwj8q1Zw+eGXamd1lhoTXKQL erfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@google.com header.s=20210112 header.b=caT7aWk3; 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 d24-20020a1709067a1800b006df76385ca8si14062374ejo.328.2022.03.24.06.12.40; Thu, 24 Mar 2022 06:12: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=@google.com header.s=20210112 header.b=caT7aWk3; 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 3C15768B1AC; Thu, 24 Mar 2022 15:12:36 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f202.google.com (mail-lj1-f202.google.com [209.85.208.202]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 54851680545 for ; Thu, 24 Mar 2022 15:12:29 +0200 (EET) Received: by mail-lj1-f202.google.com with SMTP id a23-20020a05651c031700b00247fd91c2b5so1801664ljp.21 for ; Thu, 24 Mar 2022 06:12:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=qBz6ky0X4WZvvn7SVo5dF+uZ9yeisVSSKGUq5ViUXNI=; b=caT7aWk3ij43BqUD8nM4QqwTJ0SCsURuAZ8TECAAcjRE8tlI/E6HS+ev7f/pKSwkdV zHpw5RGC709JrKHFdOeTrU+2pNjsNxEFyum+/KOvTLli5q6h0i/zRdD0/+fZ1m2OSy9B 4shxwiDVm1zSlusDGk2GL0q9RJzPhr1GRsLds48+Tpv9vs9mT+S0yk5NUPEXJb5o3ZJn e0bRTYRUtWFhPZwXLDCizN5ja05RJQFG0IZuXsMYFJ8/WwHaa/cw4+0cLMmMpU/NKstU W5LzK/AN5ZOxhRywRn8/X+QQ837DKU4fX8FodRbnhzgy/z+DPfawuIO07j1voBY4v+IO /NfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=qBz6ky0X4WZvvn7SVo5dF+uZ9yeisVSSKGUq5ViUXNI=; b=akqOXdZBElklDGvFitTIPtnEibcQpBA5StOc8fX3VL/HtIJOeweO/fMYe9hSzWC7sq sO29pmMOzjgf6lHobK77K7sQwmZUOCZo4mylx0JqNrfUQpe8gPP32YEH/MVanLkgmZhx G8eqAXxejwRHv6WrWPImuZ7VVKLTre3MUNy2KgGA8XhJf7w+NXDu4ath9O0WFkd6fOxn D7O9dnyas/rlIsaDTQp/J0mtLl+FDydSbtThJXTE1sIIOvsuuvZl80gMu9dlGGXNI1Gw AvOdJi0P3TqxRcMsGYRZHDz9n3hyIhaZmNEuhG5KJ/njiiLH7ms3bNlAYyW7KJb0qF67 po9w== X-Gm-Message-State: AOAM532LoUIGdJuOyb0Hf+DfCyAwg82sPuQkudbjQ7wYDSQBcJtte0f/ fxlMKesnPrM9lrObhQii738GOlkHuCvq7mCUB+85sUujRcbOtPPK0UJDcVglIvRezAl8zgzqSRj hUvi0Fqdi+z2saMG8SxoviXmwYTExW13LSE40XVt9TMG1zLxfphAlsFKQ/p3lb4SWDZPtA2s= X-Received: from danilchap1.sto.corp.google.com ([2620:0:1043:12:5425:9c6f:f3e5:b674]) (user=danilchap job=sendgmr) by 2002:ac2:494d:0:b0:44a:1e3b:ef6a with SMTP id o13-20020ac2494d000000b0044a1e3bef6amr3726062lfi.436.1648127548112; Thu, 24 Mar 2022 06:12:28 -0700 (PDT) Date: Thu, 24 Mar 2022 14:11:16 +0100 In-Reply-To: <20220316120759.2292546-1-danilchap@google.com> Message-Id: <20220324131116.825587-1-danilchap@google.com> Mime-Version: 1.0 References: <20220316120759.2292546-1-danilchap@google.com> X-Mailer: git-send-email 2.35.1.894.gb6a874cedc-goog From: Danil Chapovalov To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] avcodec/libvpxenc: enable dynamic max quantizer parameter reconfiguration 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: Danil Chapovalov Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: LuxcqivtmdsH --- libavcodec/libvpxenc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index dff1d06b0e..463a658bb0 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -1625,6 +1625,12 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt, vpx_svc_layer_id_t layer_id; int layer_id_valid = 0; + if (avctx->qmax >= 0 && enccfg->rc_max_quantizer != avctx->qmax) { + struct vpx_codec_enc_cfg cfg = *enccfg; + cfg.rc_max_quantizer = avctx->qmax; + vpx_codec_enc_config_set(&ctx->encoder, &cfg); + } + if (frame) { const AVFrameSideData *sd = av_frame_get_side_data(frame, AV_FRAME_DATA_REGIONS_OF_INTEREST); rawimg = &ctx->rawimg;