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 17E7E496AF for ; Mon, 18 Mar 2024 21:22:15 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 264C168D360; Mon, 18 Mar 2024 23:22:13 +0200 (EET) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E74A868D2BD for ; Mon, 18 Mar 2024 23:22:06 +0200 (EET) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4141088f1c3so10388775e9.3 for ; Mon, 18 Mar 2024 14:22:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20230601.gappssmtp.com; s=20230601; t=1710796926; x=1711401726; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Zykypw65LvLNuhf8kPOBnkZQCkn5DhFW9RAQpUepflg=; b=RfY5VRiaoG83SCQVmwhxBof2vX+ijzJwfOq6z3kwlrn6phL3ypoEEEW57bmcdbcvkK IlqN+gBFiHRloapNcWOtb0BuT485QKJ9bvFac2m9vJWCTwxHGaoDPhMpVB7HtL7KPEbs xF8P5NUs4CCXrMah7trbt/MDDq1x12l99gxsYaTrHXQufQm+ezKFf5B5nYQ9YxnJ1Yq4 clFcJ38P1Qy8rP7YTgQl5U4EndilUhmXDtEJiImY+Vs7BLsBIReOt1dDhhgFJbaTjzzf kIjfMKEHGg3nHDSTfkIhFLOLyTSCBKtylPY6qCaGyuGq0wsxXYcf4WXkA4iQlbLl6ghq duWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710796926; x=1711401726; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Zykypw65LvLNuhf8kPOBnkZQCkn5DhFW9RAQpUepflg=; b=Vz0SYgDmSry4LOal3B8W9HBjqAAP80Sn0nmvFUKtkRn9xVneb4TPLepMWTmb0f45Fc gSpJu+jC0qPQEhAETpBAqxMM5LM8D4zK1m7JH9hWSJoqX3rttvrtEGSkcjC8pQB7faoP esp6jRXEtkFt1OKkwlUfoUx1ZhE1UIdZ8E0g7vqR4TUPISwaYLhW1cw/DmQT4+diM7Cd cobghEHAT2QWDnS0w57pzoO53UG+L5feA3pHxuX+xLJYGX5emKqtn48JlBQbmQEgJj2r IrOnII4LM/3PfR4EJBKsnmY5DNM5HCCSQ3oy1bg2AsUg9TQ0YYiyawjxELMH8Tx/vHgj 6N0A== X-Gm-Message-State: AOJu0Yw/ALyauYToXsINHFGyetNwC6jjFjue9ZSFGT2qxEOajA6EF9Wl IxSugqW36xRSJVgOtHREiMo095oDN56kTI5CHuCrNfzeG1KSwlRRyRFr42sMgkmDa0Nf1RGWmQF R X-Google-Smtp-Source: AGHT+IHHpghWfilKZNE98TRK12sNM2N2lOLUhBRNvM6lycDs5VUZW0KZvldPYngTlFjqfQYi5+dIeQ== X-Received: by 2002:a05:600c:4f11:b0:414:1eb:3010 with SMTP id l17-20020a05600c4f1100b0041401eb3010mr470256wmq.17.1710796926069; Mon, 18 Mar 2024 14:22:06 -0700 (PDT) Received: from [192.168.0.15] (cpc92302-cmbg19-2-0-cust1183.5-4.cable.virginm.net. [82.1.212.160]) by smtp.gmail.com with ESMTPSA id l5-20020a05600c1d0500b00412ea52b102sm19372965wms.34.2024.03.18.14.22.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Mar 2024 14:22:05 -0700 (PDT) Message-ID: <4cdd5a84-8547-48ea-b0e5-62ca20da39a3@jkqxz.net> Date: Mon, 18 Mar 2024 21:22:39 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20240318042111.21983-1-fei.w.wang@intel.com> <20240318042111.21983-2-fei.w.wang@intel.com> From: Mark Thompson In-Reply-To: <20240318042111.21983-2-fei.w.wang@intel.com> Subject: Re: [FFmpeg-devel] [PATCH v3 2/2] lavc/vaapi_encode_h265: Set general_*_constriaint flags with 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 18/03/2024 04:21, fei.w.wang-at-intel.com@ffmpeg.org wrote: > From: Fei Wang > > According to Table A.2 in spec. > > Signed-off-by: Fei Wang > --- > libavcodec/vaapi_encode_h265.c | 176 +++++++++++++++++++++++---------- > 1 file changed, 123 insertions(+), 53 deletions(-) > > diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c > index 43755e2188..5ed317ce11 100644 > --- a/libavcodec/vaapi_encode_h265.c > +++ b/libavcodec/vaapi_encode_h265.c > @@ -258,6 +258,124 @@ fail: > return err; > } > > +static int vaapi_encode_h265_init_ptl(AVCodecContext *avctx) > +{ > + VAAPIEncodeContext *ctx = avctx->priv_data; > + VAAPIEncodeH265Context *priv = avctx->priv_data; > + H265RawVPS *vps = &priv->raw_vps; > + H265RawProfileTierLevel *ptl = &vps->profile_tier_level; > + > + ptl->general_profile_space = 0; > + ptl->general_profile_idc = avctx->profile; > + ptl->general_tier_flag = priv->tier; > + > + ptl->general_profile_compatibility_flag[ptl->general_profile_idc] = 1; > + > + if (ptl->general_profile_compatibility_flag[1]) > + ptl->general_profile_compatibility_flag[2] = 1; > + if (ptl->general_profile_compatibility_flag[3]) { > + ptl->general_profile_compatibility_flag[1] = 1; > + ptl->general_profile_compatibility_flag[2] = 1; > + } > + > + ptl->general_progressive_source_flag = 1; > + ptl->general_interlaced_source_flag = 0; > + ptl->general_non_packed_constraint_flag = 1; > + ptl->general_frame_only_constraint_flag = 1; > + > + if (avctx->profile >= 4) { > + ptl->general_intra_constraint_flag = ctx->gop_size == 1; > + ptl->general_one_picture_only_constraint_flag = 0; > + ptl->general_lower_bit_rate_constraint_flag = 1; > + ptl->general_max_14bit_constraint_flag = 0; > + > + switch (ctx->va_profile) { > +#if VA_CHECK_VERSION(1, 2, 0) > + case VAProfileHEVCMain12: > + // Main 12 > + ptl->general_max_12bit_constraint_flag = 1; > + ptl->general_max_10bit_constraint_flag = 0; > + ptl->general_max_8bit_constraint_flag = 0; > + ptl->general_max_422chroma_constraint_flag = 1; > + ptl->general_max_420chroma_constraint_flag = 1; > + ptl->general_max_monochrome_constraint_flag = 0; > + break; > + case VAProfileHEVCMain422_10: > + // Main 4:2:2 10 > + ptl->general_max_12bit_constraint_flag = 1; > + ptl->general_max_10bit_constraint_flag = 1; > + ptl->general_max_8bit_constraint_flag = 0; > + ptl->general_max_422chroma_constraint_flag = 1; > + ptl->general_max_420chroma_constraint_flag = 0; > + ptl->general_max_monochrome_constraint_flag = 0; > + break; > + case VAProfileHEVCMain422_12: > + // Main 4:2:2 12 > + ptl->general_max_12bit_constraint_flag = 1; > + ptl->general_max_10bit_constraint_flag = 0; > + ptl->general_max_8bit_constraint_flag = 0; > + ptl->general_max_422chroma_constraint_flag = 1; > + ptl->general_max_420chroma_constraint_flag = 0; > + ptl->general_max_monochrome_constraint_flag = 0; > + break; > + case VAProfileHEVCMain444: > + // Main 4:4:4 > + ptl->general_max_12bit_constraint_flag = 1; > + ptl->general_max_10bit_constraint_flag = 1; > + ptl->general_max_8bit_constraint_flag = 1; > + ptl->general_max_422chroma_constraint_flag = 0; > + ptl->general_max_420chroma_constraint_flag = 0; > + ptl->general_max_monochrome_constraint_flag = 0; > + break; > + case VAProfileHEVCMain444_10: > + // Main 4:4:4 10 > + ptl->general_max_12bit_constraint_flag = 1; > + ptl->general_max_10bit_constraint_flag = 1; > + ptl->general_max_8bit_constraint_flag = 0; > + ptl->general_max_422chroma_constraint_flag = 0; > + ptl->general_max_420chroma_constraint_flag = 0; > + ptl->general_max_monochrome_constraint_flag = 0; > + break; > + case VAProfileHEVCMain444_12: > + // Main 4:4:4 12 > + ptl->general_max_12bit_constraint_flag = 1; > + ptl->general_max_10bit_constraint_flag = 0; > + ptl->general_max_8bit_constraint_flag = 0; > + ptl->general_max_422chroma_constraint_flag = 0; > + ptl->general_max_420chroma_constraint_flag = 0; > + ptl->general_max_monochrome_constraint_flag = 0; > + break; > +#endif > + default: > + av_log(avctx, AV_LOG_ERROR, "Unknown profile to init PTL.\n"); > + return AVERROR(EINVAL); > + } > + } Why is this an improvement over the current code which sets the constraint flags based on the actual content of the stream? Note the requirement in A.3.5 for decoder support: general_profile_idc is equal to 4 or general_profile_compatibility_flag[ 4 ] is equal to 1 for the bitstream, and the value of each constraint flag listed in Table A.2 is greater than or equal to the value(s) specified in the row of Table A.2 for the format range extensions profile for which the decoder conformance is evaluated. which says that decoders must be able to support streams which set additional constraint flags beyond those which are specified for a particular profile (in particular, an 8-bit 4:2:2 stream must be decodable by any decoder supporting either "Main 4:2:2 10" or "Main 4:4:4", so ideally it shouldn't be marked to require one of those in particular). Thanks, - Mark _______________________________________________ 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".