From patchwork Fri Jul 23 08:03:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Guan X-Patchwork-Id: 29029 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5d:965a:0:0:0:0:0 with SMTP id d26csp1201377ios; Fri, 23 Jul 2021 01:31:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzP8BjvAVAo5HjS94793y2WOdg13R/FOJ8GflKxDSo5H5R0+mPQXq3Y8Ps1HpICLv/9bkFO X-Received: by 2002:a17:907:d09:: with SMTP id gn9mr3632215ejc.447.1627029089970; Fri, 23 Jul 2021 01:31:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627029089; cv=none; d=google.com; s=arc-20160816; b=FbWR4fe7hHFJp5lKOeQgK0SReJFm00T+mfZQfKB3TfWsX513CfOLVIoTfyahcuSo/q Rbflzlx9gUsRObUBoQJ9rudSm+m7c1R8U4BGp9uuXEPaAwmPCxZycGfwN7/6vNd0Z0d0 7AV0365aE7mvu33RBghULuS6pAtbgPkvwly4RQnoTuVv+Xqp/F0gF2FnkKrd3Re7e5eY 5ly+IqacDVn8oHtDgYTBqGQczTT/mHg7keKAjb41stvP+e/wBUqVLc0frdbOVX+Y3I+/ 61qvUIs5mEvwrXpruOJO5ltbbsWR123B/BVkLmnoCnBfWYThu5a6oq6pB0/A5kZ0Iwyx OsUA== 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=JS/DC1q38L2HTHhjk8glcQOgPy/PwZa9UpKej5AbUp0=; b=Wg5gV3j0HFDcdtmpooUxmEy0aGedxlWgPI34rYZuAcucxq9MbcdSnH1vWtnyts78Mn 7q+VPtcUdydHkt4uO3o2VXe/MakQArvzijywUGGNXKAJJCgFnRT6zn+8TyMFGW24dUo0 vcoKdECD5wZk2PkABmS9RdfRdPco/5FiblJtqkfE2i7+FoKzhMmvqPio0FXfNHxneag9 fOuGAV8wXB3mKlrfdFGUVtGfI3oYRtEeopfePfnNOrSmamBojTc2Vk4/490o1dIlvYPC RsKy2y0AVoqIHLnCw4PiCdfNrv2BRIz9FxSFuC5fMpqE7bu+K1sEmOVTvJ0FPZiTV0a3 JcJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=Zd3Bq36k; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i8si40531743ejj.636.2021.07.23.01.31.20; Fri, 23 Jul 2021 01:31:29 -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=@gmail.com header.s=20161025 header.b=Zd3Bq36k; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DB5DE68A9BB; Fri, 23 Jul 2021 11:31:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-il1-f179.google.com (mail-il1-f179.google.com [209.85.166.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 434F168A7E5 for ; Fri, 23 Jul 2021 11:31:10 +0300 (EEST) Received: by mail-il1-f179.google.com with SMTP id r1so840571iln.6 for ; Fri, 23 Jul 2021 01:31:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lXsnp6ZFK9A2W41lGhmNQEd+PvRdLhE/ELOtuh8ofTQ=; b=Zd3Bq36kgXsN1DfXS5Lb1/Womj4J1ijx8XbANewmEi3KEwpmcndoy4GDxoIzmzVWMI VfF/EMnYjiDPln79CnYiVXd2mrr1RMRjd4x4rxS2RhLee6msAbScp4C43E53JO8Mgn21 7qU2Fxo5cjgjMRJTJMJqMYQDcoBqBSND9Hch0JG60mPr9r48iCadW9pxFdcGNnLhOxvt MSmaC1aBGGdaoXLmds7r2N/Jbfjw7lte4YIE7ZhI+iBS9Rj1kipW2qjp/VIbXjNJ7MG9 NxYCX2pPFTGLCj9fghLLOVJbLXVfW017qZVAd0+ZG6Z0204HHdpwY2utbVUIbrJ1y4Af pc6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lXsnp6ZFK9A2W41lGhmNQEd+PvRdLhE/ELOtuh8ofTQ=; b=stFuxKX8og03ft8584+9PCz89XvAiS0qmp+Xk1NYErI2TuGI46ULTp6+TAWxnBzsh+ 2EYTQ/4ZY6hsi3F33W5LvqLnuk7PS4/4ooqPrT/V6wXd+9UhCV3j7JSqNrQ+7zLrFZVj fGTh49Wc+oNAxxdWzw1WZVWFtexMt49BQHhmN+9YDRUEtKWSRJYYhp1dVea0Ij2YTBO/ itu+WV7n1urqMyk6AO/IbsfFkyUQmXKpwGQ5d+oD3VEtIJZOL+0Pi/fhqTQS1tUv4Rc4 7jHCGK2psJOML0oWK3EpJo9RZF4gd8TPRo78gW6fuRqHqunkU4nV5FvCYXPFFk80LVDn RzOw== X-Gm-Message-State: AOAM5335ONP8ouUeucWTJf9T0K0MB6gVX8SWydvoQD8EziAhSEnPKo8m GzUBjTnf9Ah0YTEkl3lVXoKu4aePU+lAtg== X-Received: by 2002:a65:5684:: with SMTP id v4mr3801796pgs.388.1627027462384; Fri, 23 Jul 2021 01:04:22 -0700 (PDT) Received: from localhost.localdomain ([116.6.234.145]) by smtp.gmail.com with ESMTPSA id t1sm13256819pgp.42.2021.07.23.01.04.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Jul 2021 01:04:21 -0700 (PDT) From: Hao Guan To: ffmpeg-devel@ffmpeg.org Date: Fri, 23 Jul 2021 16:03:37 +0800 Message-Id: <20210723080337.18077-1-hguandl@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: References: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc.c: Add trc for iec61966-2-1 when available 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: Hao Guan Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: HmAJ29tBHgp1 Signed-off-by: Hao Guan --- Notes: I have checked out the code about other functions introduced after macOS 10.13 and noticed that the availability is checked during configure. Therefore I add the check for sRGB function too. It should compile now. configure | 2 ++ libavcodec/videotoolboxenc.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/configure b/configure index bb6b096414..644d9f3537 100755 --- a/configure +++ b/configure @@ -2325,6 +2325,7 @@ TYPES_LIST=" kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ kCVImageBufferTransferFunction_ITU_R_2100_HLG kCVImageBufferTransferFunction_Linear + kCVImageBufferTransferFunction_sRGB socklen_t struct_addrinfo struct_group_source_req @@ -6278,6 +6279,7 @@ enabled videotoolbox && { check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ "-framework CoreVideo" check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_ITU_R_2100_HLG "-framework CoreVideo" check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_Linear "-framework CoreVideo" + check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_sRGB "-framework CoreVideo" } check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 4eaabed5d8..4cba781e9b 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -977,6 +977,11 @@ static int get_cv_transfer_function(AVCodecContext *avctx, *transfer_fnc = kCVImageBufferTransferFunction_ITU_R_2100_HLG; break; #endif +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_SRGB + case AVCOL_TRC_IEC61966_2_1: + *transfer_fnc = kCVImageBufferTransferFunction_sRGB; + break; +#endif case AVCOL_TRC_GAMMA22: gamma = 2.2;