On 15/06/18 04:59, Xiang, Haihao wrote: > On Fri, 2018-06-08 at 00:43 +0100, Mark Thompson wrote: >> Set profile compatibility/constraint flags properly (including the >> constraint flags used for RExt profiles, as all streams we can currently >> generate are RExt-compatible), and use that to add support for the "Main >> Intra" and "Main 10 Intra" RExt subprofiles (for which we can re-use the >> existing Main and Main10 VAAPI profiles). >> --- >> libavcodec/Makefile | 2 +- >> libavcodec/vaapi_encode_h265.c | 71 +++++++++++++++++++++++++++++++++------ >> --- >> 2 files changed, 57 insertions(+), 16 deletions(-) >> >> ... >> diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c >> index 97bb9cef6c..2cee19be68 100644 >> --- a/libavcodec/vaapi_encode_h265.c >> +++ b/libavcodec/vaapi_encode_h265.c >> ... >> @@ -289,19 +312,35 @@ static int >> vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) >> vps->vps_max_sub_layers_minus1 = 0; >> vps->vps_temporal_id_nesting_flag = 1; >> >> - vps->profile_tier_level = (H265RawProfileTierLevel) { >> - .general_profile_space = 0, >> - .general_profile_idc = avctx->profile, >> - .general_tier_flag = 0, >> + ptl->general_profile_space = 0; >> + ptl->general_profile_space = 0; > > A duplicate line.
Removed. >> + ptl->general_profile_idc = avctx->profile; >> + ptl->general_tier_flag = 0; >> >> - .general_progressive_source_flag = 1, >> - .general_interlaced_source_flag = 0, >> - .general_non_packed_constraint_flag = 1, >> - .general_frame_only_constraint_flag = 1, >> + if (chroma_format == 1) { >> + ptl->general_profile_compatibility_flag[1] = bit_depth == 8; >> + ptl->general_profile_compatibility_flag[2] = bit_depth <= 10; >> + } >> + ptl->general_profile_compatibility_flag[4] = 1; >> >> - .general_level_idc = avctx->level, >> - }; >> - >> vps->profile_tier_level.general_profile_compatibility_flag[avctx->profile >> & 31] = 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; >> + >> + ptl->general_max_12bit_constraint_flag = bit_depth <= 12; >> + ptl->general_max_10bit_constraint_flag = bit_depth <= 10; >> + ptl->general_max_8bit_constraint_flag = bit_depth == 8; >> + >> + ptl->general_max_422chroma_constraint_flag = chroma_format <= 2; >> + ptl->general_max_420chroma_constraint_flag = chroma_format <= 1; >> + ptl->general_max_monochrome_constraint_flag = chroma_format == 0; >> + >> + ptl->general_intra_constraint_flag = ctx->gop_size == 1; >> + >> + ptl->general_lower_bit_rate_constraint_flag = 1; >> + >> + ptl->general_level_idc = avctx->level; >> >> vps->vps_sub_layer_ordering_info_present_flag = 0; >> vps->vps_max_dec_pic_buffering_minus1[0] = (ctx->b_per_p > 0) + 1; >> @@ -343,7 +382,7 @@ static int >> vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) >> >> sps->sps_seq_parameter_set_id = 0; >> >> - sps->chroma_format_idc = 1; // YUV 4:2:0. >> + sps->chroma_format_idc = chroma_format; >> sps->separate_colour_plane_flag = 0; >> >> sps->pic_width_in_luma_samples = ctx->surface_width; >> @@ -362,9 +401,8 @@ static int >> vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) >> sps->conformance_window_flag = 0; >> } >> >> - sps->bit_depth_luma_minus8 = >> - avctx->profile == FF_PROFILE_HEVC_MAIN_10 ? 2 : 0; >> - sps->bit_depth_chroma_minus8 = sps->bit_depth_luma_minus8; >> + sps->bit_depth_luma_minus8 = bit_depth - 8; >> + sps->bit_depth_chroma_minus8 = bit_depth - 8; >> >> sps->log2_max_pic_order_cnt_lsb_minus4 = 8; >> >> ... Thanks, - Mark _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel