From patchwork Fri Aug 30 10:15:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 51248 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:4027:b0:48e:c0f8:d0de with SMTP id ky39csp360080vqb; Fri, 30 Aug 2024 05:20:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXGuGgpv8Pl80aU8cUfXc+R2LnuC0IlsEvc/6hDqNcCHqMzQYx9Ys6txXh66j86qdxHCtjTbE7twCzBO8iFtq2t@gmail.com X-Google-Smtp-Source: AGHT+IEfKXnZtU4tvDyofggMEEDdZs33996UlStYxBHFH5hJkV71yhCMVXyzpdBMeeEQV2ChRgsZ X-Received: by 2002:a2e:a545:0:b0:2f3:f4e2:869c with SMTP id 38308e7fff4ca-2f6108ad29dmr44496711fa.44.1725020414762; Fri, 30 Aug 2024 05:20:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725020414; cv=none; d=google.com; s=arc-20240605; b=SuwA/8UgF8ew+Zx8HwpOqQwLWgWzFzDfJclE70g3b7tzsTAdH3TAESaVcGjp+rqH/k btTLgsC9MqeJ2lAyOZ72gePW8vPjsK3QIsDka4/VVpgCYHM0F00iTOu4dLO7+101HERp lfG6fRu8VNaW1NapNXawGqaaS7UtdBsYEf+0krNZBEposSqVbaF6hPRfdh6Ffx36dHkj xo0qZpDIsBz+f1GO1Ato+2UFczzxa8PGs7ik/wQ2pYekThCVne7X7chqI2nxZxyNHsEl rCP+8re/5xmGtVnp7SfWN1fCPmK8O4w2EqcekHKu2X3O2Mz6DoSeSwwJngHvhYj9LvbD Dudw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=bqKFLR+V2pnxLfGr5U+zDRq1ISd2P66tjGSdbtaHMzQ=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=hf3oz4jOX6amgyUA8ZhBdwkVi8rV7i8mZhJ5wmyB9RFKpThNdDNFP2bOlUOv0ooaLS p+HnGrKTwqC3L6OCOSDl3FrTsuVIeigqqdalWU82okj92eQHE7aowzG1dr+38DVvQirD GqNJzS3ZWK1dqQIn/hJgtALaMuclQPu06PZuFq/PqDU+nnZeKXEiX9SaajfV5mI1EX8d 5uZDW6bVKwwph1Hvonu5kaztiL5WusBYjBvCzF3mUdqWuwSA18JBnuQLsxMGod9A+Fx+ 0c5kdFZx1KsaYUK4yjcVUaHDY4fFhODfDjomI2Da80RxETyNvle0BiqMdekKj6BBRsrf gOUA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=t5Z4Ok2L; 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 38308e7fff4ca-2f61518abb0si12542851fa.645.2024.08.30.05.20.14; Fri, 30 Aug 2024 05:20:14 -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=@haasn.xyz header.s=mail header.b=t5Z4Ok2L; 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 CBE0F68DC75; Fri, 30 Aug 2024 13:24:29 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B5D9A68DBCA for ; Fri, 30 Aug 2024 13:24:13 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1725013449; bh=I+77vsy/A8XtXB1zzf2JpBwljIP74Rsw11e1avpO0p4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t5Z4Ok2LOLSqTjIIgUasmaS6Fw5hk1Wiw2zpBGQnwqFsLwJxJjcV8r/PUaBdwpImG DIBZVStsOxh7jGUWSYjo98pQ2Uw6v7q+ZbRsTZZvtwQdq6iqSuropWJj19r2gqEcMD W2H+mweCRtSepMwZ/qLdswkh3NsfIYqf7ApOnqb8= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 4774C43F91; Fri, 30 Aug 2024 12:24:09 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Fri, 30 Aug 2024 12:15:29 +0200 Message-ID: <20240830102402.18149-7-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240830102402.18149-1-ffmpeg@haasn.xyz> References: <20240830102402.18149-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 06/17] avcodec/libvpxenc: switch to get_supported_config() 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: Niklas Haas Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: M4reUwW8vJXh From: Niklas Haas --- libavcodec/libvpxenc.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 1d5e9c33e8..228ede7c84 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -2088,13 +2088,25 @@ static const enum AVPixelFormat vp9_pix_fmts_highbd[] = { AV_PIX_FMT_NONE }; -static av_cold void vp9_init_static(FFCodec *codec) +static int vp9_get_supported_config(const AVCodecContext *avctx, + const AVCodec *codec, + enum AVCodecConfig config, + unsigned flags, const void **out, + int *out_num) { - vpx_codec_caps_t codec_caps = vpx_codec_get_caps(vpx_codec_vp9_cx()); - if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) - codec->p.pix_fmts = vp9_pix_fmts_highbd; - else - codec->p.pix_fmts = vp9_pix_fmts_highcol; + if (config == AV_CODEC_CONFIG_PIX_FORMAT) { + vpx_codec_caps_t codec_caps = vpx_codec_get_caps(vpx_codec_vp9_cx()); + if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) { + *out = vp9_pix_fmts_highbd; + *out_num = FF_ARRAY_ELEMS(vp9_pix_fmts_highbd) - 1; + } else { + *out = vp9_pix_fmts_highcol; + *out_num = FF_ARRAY_ELEMS(vp9_pix_fmts_highcol) - 1; + } + return 0; + } + + return ff_default_get_supported_config(avctx, codec, config, flags, out, out_num); } static const AVClass class_vp9 = { @@ -2124,6 +2136,6 @@ FFCodec ff_libvpx_vp9_encoder = { FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS, .defaults = defaults, - .init_static_data = vp9_init_static, + .get_supported_config = vp9_get_supported_config, }; #endif /* CONFIG_LIBVPX_VP9_ENCODER */