From patchwork Fri Jun 9 11:14:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 42024 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c526:b0:117:ac03:c9de with SMTP id gm38csp1054787pzb; Fri, 9 Jun 2023 04:21:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ57tMhkw0zVoCNmdFGV3JWF+/WoQn86QvDUPZxH6xKBlNOlHSYmPMHpknH4ryxdsg6jb6BJ X-Received: by 2002:a17:907:6e23:b0:970:e80:e29a with SMTP id sd35-20020a1709076e2300b009700e80e29amr1322897ejc.68.1686309682773; Fri, 09 Jun 2023 04:21:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686309682; cv=none; d=google.com; s=arc-20160816; b=tNktIYXC90YNwV1w7akBOf+GGWeV3G9Q0emFr0XNsaSI8IyyeDR1rM6SiYAyikwFBw D09q61hTU2lxN5E3qwYJ09qVAlkICb3nP0YO53F9MQafK1OiL87Nz3tZvq9+REHk1VLE D3CUyAbT4mZkrGrQPC+h03TtCucvJlYKqmgpKOIpW3lrFYkWJbGdVvr7kk8yYb67O1k+ cM+Ejvhi8modcXMITJJV50qQz7u3WJe+2gp324nF3y9yO0D56IzQnMhjiuO78ixDdlj6 eKWtnv0mt9MlKoiZVvw5Ffp933+5EzT+qTqTVf/EMbiORGkbZrS21qFbjpftsglppyya giZg== 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:date:to:from:message-id :dkim-signature:delivered-to; bh=833BCDtdKTESkSvZSXrJDCe5Ok8Xyt0Lc6WVbijWFes=; b=lRkJn3jSQKbcpD9Fo2XCib3Z937DBjJo+m7pnONSV0I/N8P5/m3HN3ZqEzjCI4AZrI MjayJcz4Tfnk269N40XprKq83ScFO99RSBrS39uoAYIwWIhcLkDbHcGbOc0gGOKzUi7Q VooQm9Hg6R2rAAJA4faDp2lzImxOHRdCdlrVw1WlXoaVv1fLZo/N1w0xtZyBVpc/3EeQ zsmS7mrlO5xkRdQN/8NNLqqKPElL6gp24YNKrmDMwU5/LhOYOXFOLyTBAP9VLDOKbq4I M8ybLDdChpXTiU/MEGrQzIOJWwujnb9HVG8HpsPT7tksh0hh8gRD3lwGdYP7pPdvsIij iThg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=YJLUnvLh; 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=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y6-20020a170906070600b00977cfcc13f1si1319210ejb.568.2023.06.09.04.21.22; Fri, 09 Jun 2023 04:21: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; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=YJLUnvLh; 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=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 494D668C315; Fri, 9 Jun 2023 14:21:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out162-62-57-87.mail.qq.com (out162-62-57-87.mail.qq.com [162.62.57.87]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0FE1668C0FB for ; Fri, 9 Jun 2023 14:21:11 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1686309669; bh=dlx1s38ZnpcfRJFZOMAyRAKymVWz8KAmFRHiJWnQ8f0=; h=From:To:Cc:Subject:Date; b=YJLUnvLhQvZxn/1x1VdURGbXeSHAHk/tMi+UJixMu61AfK6mKNqguaK1L/OsYvqF0 BOmZaAAG+TbTBRB74lpHHdZLWz5oxC8qFy8h2DR598LOeyOmwoHLRPOWHE9cPSbt1D YyETabEq+AzGpdTTycrUlPlpX3xbMx/BGqI74ZAE= Received: from ZHILIZHAO-MB2.tencent.com ([113.108.77.55]) by newxmesmtplogicsvrszb9-0.qq.com (NewEsmtp) with SMTP id 3C02EA18; Fri, 09 Jun 2023 19:15:00 +0800 X-QQ-mid: xmsmtpt1686309300tcbgdmdxf Message-ID: X-QQ-XMAILINFO: NrI1OKqG5KOqz8bZWjMMFQ3ONWcQrqWUL/CH2pHY1PVMxBeDlmGlQeJLFFsDy/ Iw+WrCaL5iorM7lAkPCXe3DdtJidByO2vmsGSF7p6Z22YTZRBXw0E/vxm9HsBxGb/FWhQx/rFNiw zpchO9jXbnEZ54N3cQ8qvIHX2ggSfUYQiKqnf19mT1H1G34zifN+w/YJ2CRdx8Sl/VIRxmFhnIEB 63zyvHX1V21Tm9UJwQ2lf/euxka+zCtPYu05Tlsi2a0HAV2G90Q81KJ8udx449VzlYU7fILyoRDL yqYDsFAUc/7AlmOIgmYKj00+2/vXIFVTuKea3OwgiYa4CXf6IxXPrPHRqpytzu0dvSL/g0brA+cC I2D0iULBRwe3/N0SCYjqiKxI/uPBmRiRysfeXoavuhQQK2cnnTqD45ZxA29XvWsxNMVuu8+OQs8R SwivQpIMFHdHsGwRVEYjpgqzdzVZyOXCKW2O/+9TIHKItfYIZqxz/7Ak80HFo+5YuS9zmnLtftB2 /EFV0cwHwDKssTM8eoELMZuOCR3bP8yR/9UR0fU/K1WV/K3wTNhp21oaChYmxR92gi7qyB0iNTOJ C7Lidcn9up56Tkbmmf6f+1ekIHt+TRtnjo3zmgFkc+901tkOU/CqPGNsPneSjXQvXYPJVp5Zaaws KnJyxkAizID5cluaiD9YDcq8OyThHitpfXmoy8SdNEv42/or+nWu8X6MHbZBbkxRedj/DzYzEPde 7sL59mebMStsXEzIplcez0cczVpkpPnQgcgRXc7wac1EBj3OtPVInpB060jOXklfkQaZzEr+pTrM IvXZV1pZKth9lgNyRvmXuSUQIm4dp/Bgu/xvW0F/Qq1CUldrtCVMbmLSnWkBMCoqO4rbqaOQal5t pyG25sAkYRVYvOSa7NmNZ5yUY8G4rSiZwv5p8+/c3F3w5wwKahA1Lb0r2wiGtSnWXW6unwqeHhFs c+fbUdug3c0bd8h/bA6JrM2Bq9t+r9leGZVP3etz60ujxg4pyGSQ== From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Fri, 9 Jun 2023 19:14:53 +0800 X-OQ-MSGID: <20230609111455.17989-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/videotoolboxenc: use int as the type of profile 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: GewjW7WDqby3 From: Zhao Zhili Other than save a few bytes, it also has the benefit to show the AV_OPT_TYPE_CONST value in help, e.g., -profile E..V....... Profile (from 0 to INT_MAX) (default 0) baseline 66 E..V....... Baseline Profile ... --- libavcodec/videotoolboxenc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 9719e0bf54..26485a3dea 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -252,7 +252,7 @@ typedef struct VTEncContext { int64_t first_pts; int64_t dts_delta; - int64_t profile; + int profile; int level; int entropy; int realtime; @@ -443,7 +443,7 @@ static int count_nalus(size_t length_code_size, } static CMVideoCodecType get_cm_codec_type(AVCodecContext *avctx, - int64_t profile, + int profile, double alpha_quality) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt == AV_PIX_FMT_VIDEOTOOLBOX ? avctx->sw_pix_fmt : avctx->pix_fmt); @@ -470,7 +470,7 @@ static CMVideoCodecType get_cm_codec_type(AVCodecContext *avctx, return MKBETAG('a','p','4','x'); // kCMVideoCodecType_AppleProRes4444XQ default: - av_log(avctx, AV_LOG_ERROR, "Unknown profile ID: %"PRId64", using auto\n", profile); + av_log(avctx, AV_LOG_ERROR, "Unknown profile ID: %d, using auto\n", profile); case FF_PROFILE_UNKNOWN: if (desc && ((desc->flags & AV_PIX_FMT_FLAG_ALPHA) || @@ -735,7 +735,7 @@ static bool get_vt_h264_profile_level(AVCodecContext *avctx, CFStringRef *profile_level_val) { VTEncContext *vtctx = avctx->priv_data; - int64_t profile = vtctx->profile; + int profile = vtctx->profile; if (profile == AUTO_PROFILE && vtctx->level) { //Need to pick a profile if level is not auto-selected. @@ -864,7 +864,7 @@ static bool get_vt_hevc_profile_level(AVCodecContext *avctx, CFStringRef *profile_level_val) { VTEncContext *vtctx = avctx->priv_data; - int64_t profile = vtctx->profile; + int profile = vtctx->profile; *profile_level_val = NULL; @@ -2891,7 +2891,7 @@ static const enum AVPixelFormat prores_pix_fmts[] = { #define OFFSET(x) offsetof(VTEncContext, x) static const AVOption h264_options[] = { - { "profile", "Profile", OFFSET(profile), AV_OPT_TYPE_INT64, { .i64 = AUTO_PROFILE }, 0, INT_MAX, VE, "profile" }, + { "profile", "Profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = AUTO_PROFILE }, 0, INT_MAX, VE, "profile" }, { "baseline", "Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_BASELINE }, INT_MIN, INT_MAX, VE, "profile" }, { "constrained_baseline", "Constrained Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_CONSTRAINED_BASELINE }, INT_MIN, INT_MAX, VE, "profile" }, { "main", "Main Profile", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_MAIN }, INT_MIN, INT_MAX, VE, "profile" }, @@ -2948,7 +2948,7 @@ const FFCodec ff_h264_videotoolbox_encoder = { }; static const AVOption hevc_options[] = { - { "profile", "Profile", OFFSET(profile), AV_OPT_TYPE_INT64, { .i64 = AUTO_PROFILE }, 0, INT_MAX, VE, "profile" }, + { "profile", "Profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = AUTO_PROFILE }, 0, INT_MAX, VE, "profile" }, { "main", "Main Profile", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_HEVC_MAIN }, INT_MIN, INT_MAX, VE, "profile" }, { "main10", "Main10 Profile", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_HEVC_MAIN_10 }, INT_MIN, INT_MAX, VE, "profile" }, @@ -2985,7 +2985,7 @@ const FFCodec ff_hevc_videotoolbox_encoder = { }; static const AVOption prores_options[] = { - { "profile", "Profile", OFFSET(profile), AV_OPT_TYPE_INT64, { .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, FF_PROFILE_PRORES_XQ, VE, "profile" }, + { "profile", "Profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, FF_PROFILE_PRORES_XQ, VE, "profile" }, { "auto", "Automatically determine based on input format", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, VE, "profile" }, { "proxy", "ProRes 422 Proxy", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_PRORES_PROXY }, INT_MIN, INT_MAX, VE, "profile" }, { "lt", "ProRes 422 LT", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_PRORES_LT }, INT_MIN, INT_MAX, VE, "profile" },