From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 57D2E451EC for ; Thu, 12 Oct 2023 12:50:08 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 20DF968C9C1; Thu, 12 Oct 2023 15:49:58 +0300 (EEST) Received: from out203-205-221-235.mail.qq.com (out203-205-221-235.mail.qq.com [203.205.221.235]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E01BF68C901 for ; Thu, 12 Oct 2023 15:49:48 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1697114977; bh=bodWwb9Mu63Y79+aaeEthUsNhi/uu4jwzzx4K3RFATQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MFyt/4sYy5VnSlE2CzifLipHJbRQKnlxAW/+kRFlH1LkfzVRjBIWYKmsu7TZeopqx 439R+W7JrEP2hIuI8Ldhf+CRN9MiKOpjXauPusOaffC3YR12lDsX/h4FulUabzpO1O B7A8bWCOkpZTKCw+O8bEJLX3c01xfqKORtJSoWaE= Received: from ZHILIZHAO-MB1.tencent.com ([119.147.10.203]) by newxmesmtplogicsvrsza12-0.qq.com (NewEsmtp) with SMTP id C63ACE9D; Thu, 12 Oct 2023 20:49:35 +0800 X-QQ-mid: xmsmtpt1697114976t5p5mbe83 Message-ID: X-QQ-XMAILINFO: NDgMZBR9sMmap5x83GE3KucRC+p6ek8CW/1i3Sbd5SHmue7Ngu+yzb+X0vJ/WO weWOWgYpKfqePFlkVvL36OYDlfXIyt7jnA159I/jkQ0d6mLZqJ0OORP80br6n9obD3V9JbT+Lz9q zALDvFuYOa7eEeVNQO25UCCyuDYsC0ppGicpc8mrRSkssfRlz1U3gUNXfbIsfmxNPLaM/+p6CvnA FgBB4OMTiYW+RuptJAmsoZBS45ijtK85BzM9S2K+8h96ApFHUSovE4D9/gCH2mvPXG2FNx7a0j4S eqCOcT+q8qEr0jRogLztnraMHnam1TZhu0GVc4RlzJaDnNzwiL+6cxVm989TXlyz2kaNUaXZdgrQ GyhVuWglk5a6H0rIt4GlGWl3YvpoqhgVMURDXhEi4okNGQkmy0ivZQc9QVEwmcl4n6XDj7XZw1AJ CMt5rImKHGT7xj+raOvbV2NihCuYaHoDFIt+uJtcvXvxfoaTaYKMo6/XF5Vk03P5HA7mknKBazMZ kezLGFZEk2K/ieIYHxyJUQ6N8yBdbc5IEHwkNF7I5OZ4hPYKOeB0eB6aa9u2CgebMUm2xp84oHoN 0S5UZH9/jFCaWCCWzH4+J268BMtSEfIRgIFbh0ywOtfFvAXkvufMwU5Bjy8rFL/pON1OBfD13PQr 8fjfsTeeqKhV/lxpQ+pdL30qxNfKOSiAUgZiFHQpC5HNSUgZGBo0LSjuZl65J55WNmWtFUcaMpMO VdVaLAwg+cSlQqGcZIdHKpg5V2KdKCAnA/RIRNSu05lCKmGFa4Aqcb5ucdpEfVdj723GUlsYV0oy JnfW6c5dExQMC7M2tF73tQDsN98Gqd90GQRpEKqKlXXAKVTa8K4Phh6IRsHEkkSxDTqhnqUmeUpd Q5PX0vzuyppSzUy/pdnHkI3YYXAARa/VQSG6IqNlt8Wyhw1pphkRkjfmQXXhshvP1nySju98cUwz ZClJ/Bf087pcC+mdVORsmWafbmY3MJMwAjn5WzV0DjZFn8MbLlOw== X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Thu, 12 Oct 2023 20:49:34 +0800 X-OQ-MSGID: <20231012124934.27842-2-quinkblack@foxmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231012124934.27842-1-quinkblack@foxmail.com> References: <20231012124934.27842-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/videotoolboxenc: Check and set hevc 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Zhao Zhili 1. If user don't specify the profile, set it to main10 when pixel format is 10 bits. Before the patch, videotoolbox output main profile bitstream with 10 bit input, which can be confusing. 2. Warning when user set profile to main explicitly with 10 bit input. It works, but not the best choice. 3. Reject main 10 profile with 8 bit input, it doesn't work. --- libavcodec/videotoolboxenc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index b685bf4cc4..b0e827d14a 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -894,17 +894,35 @@ static bool get_vt_hevc_profile_level(AVCodecContext *avctx, { VTEncContext *vtctx = avctx->priv_data; int profile = vtctx->profile; + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get( + avctx->pix_fmt == AV_PIX_FMT_VIDEOTOOLBOX ? avctx->sw_pix_fmt + : avctx->pix_fmt); + int bit_depth = desc ? desc->comp[0].depth : 0; *profile_level_val = NULL; switch (profile) { case AV_PROFILE_UNKNOWN: + // Set profile automatically if user don't specify + if (bit_depth == 10) { + *profile_level_val = + compat_keys.kVTProfileLevel_HEVC_Main10_AutoLevel; + break; + } return true; case AV_PROFILE_HEVC_MAIN: + if (bit_depth > 0 && bit_depth != 8) + av_log(avctx, AV_LOG_WARNING, + "main profile with %d bit input\n", bit_depth); *profile_level_val = compat_keys.kVTProfileLevel_HEVC_Main_AutoLevel; break; case AV_PROFILE_HEVC_MAIN_10: + if (bit_depth > 0 && bit_depth != 10) { + av_log(avctx, AV_LOG_ERROR, + "Invalid main10 profile with %d bit input\n", bit_depth); + return false; + } *profile_level_val = compat_keys.kVTProfileLevel_HEVC_Main10_AutoLevel; break; -- 2.42.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".