libs: encoder: H265: Enable Main 12 profile support.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/375>
This commit is contained in:
He Junyan 2020-07-31 18:22:46 +08:00
parent 6e97062d35
commit 55769a16c7
3 changed files with 31 additions and 4 deletions

View file

@ -669,7 +669,8 @@ is_chroma_type_supported (GstVaapiEncoder * encoder)
cip->chroma_type != GST_VAAPI_CHROMA_TYPE_YUV420_10BPP &&
cip->chroma_type != GST_VAAPI_CHROMA_TYPE_YUV444 &&
cip->chroma_type != GST_VAAPI_CHROMA_TYPE_YUV444_10BPP &&
cip->chroma_type != GST_VAAPI_CHROMA_TYPE_YUV422_10BPP)
cip->chroma_type != GST_VAAPI_CHROMA_TYPE_YUV422_10BPP &&
cip->chroma_type != GST_VAAPI_CHROMA_TYPE_YUV420_12BPP)
goto unsupported;
if (!get_config_attribute (encoder, VAConfigAttribRTFormat, &format))

View file

@ -383,6 +383,26 @@ bs_write_profile_tier_level (GstBitWriter * bs,
/* lower_bit_rate_constraint_flag */
WRITE_UINT32 (bs, 1, 1);
break;
case GST_VAAPI_PROFILE_H265_MAIN12:
/* max_12bit_constraint_flag */
WRITE_UINT32 (bs, 1, 1);
/* max_10bit_constraint_flag */
WRITE_UINT32 (bs, 0, 1);
/* max_8bit_constraint_flag */
WRITE_UINT32 (bs, 0, 1);
/* max_422chroma_constraint_flag */
WRITE_UINT32 (bs, 1, 1);
/* max_420chroma_constraint_flag */
WRITE_UINT32 (bs, 1, 1);
/* max_monochrome_constraint_flag */
WRITE_UINT32 (bs, 0, 1);
/* intra_constraint_flag */
WRITE_UINT32 (bs, 0, 1);
/* one_picture_only_constraint_flag */
WRITE_UINT32 (bs, 0, 1);
/* lower_bit_rate_constraint_flag */
WRITE_UINT32 (bs, 1, 1);
break;
default:
GST_WARNING ("do not support the profile: %s of range extensions",
gst_vaapi_profile_get_va_name (profile));
@ -1081,7 +1101,7 @@ ensure_profile (GstVaapiEncoderH265 * encoder)
const GstVideoFormat format =
GST_VIDEO_INFO_FORMAT (GST_VAAPI_ENCODER_VIDEO_INFO (encoder));
guint depth, chrome;
GstVaapiProfile profile_candidates[3];
GstVaapiProfile profile_candidates[4];
guint num, i;
g_assert (GST_VIDEO_FORMAT_INFO_IS_YUV (gst_video_format_get_info (format)));
@ -1106,8 +1126,11 @@ ensure_profile (GstVaapiEncoderH265 * encoder)
profile_candidates[num++] = GST_VAAPI_PROFILE_H265_MAIN;
if (depth <= 10)
profile_candidates[num++] = GST_VAAPI_PROFILE_H265_MAIN10;
/* Always add STILL_PICTURE as a candidate. */
profile_candidates[num++] = GST_VAAPI_PROFILE_H265_MAIN_STILL_PICTURE;
if (depth <= 12)
profile_candidates[num++] = GST_VAAPI_PROFILE_H265_MAIN12;
/* Always add STILL_PICTURE as a candidate for Main and Main10. */
if (depth <= 10)
profile_candidates[num++] = GST_VAAPI_PROFILE_H265_MAIN_STILL_PICTURE;
}
if (num == 0) {

View file

@ -43,6 +43,7 @@ static const struct map gst_vaapi_h265_profile_map[] = {
{ GST_VAAPI_PROFILE_H265_MAIN_444, "main-444" },
{ GST_VAAPI_PROFILE_H265_MAIN_444_10, "main-444-10" },
{ GST_VAAPI_PROFILE_H265_MAIN_422_10, "main-422-10" },
{ GST_VAAPI_PROFILE_H265_MAIN12, "main-12" },
{ 0, NULL }
/* *INDENT-ON* */
};
@ -342,6 +343,8 @@ gst_vaapi_utils_h265_get_profile_idc (GstVaapiProfile profile)
case GST_VAAPI_PROFILE_H265_MAIN_444:
/* Fall through */
case GST_VAAPI_PROFILE_H265_MAIN_444_10:
/* Fall through */
case GST_VAAPI_PROFILE_H265_MAIN12:
profile_idc = GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION;
break;
default: