summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorHe Junyan <junyan.he@intel.com>2020-07-31 18:22:46 +0800
committerHe Junyan <junyan.he@intel.com>2020-08-06 00:21:50 +0800
commit55769a16c769511e870444c0bb9b29e982bab0e2 (patch)
treea6c4ea4cb4bb77efa0853915bc56881dd5d292e8 /gst-libs
parent6e97062d35d3da4b91e9280f8ae2fb8e710e22c6 (diff)
libs: encoder: H265: Enable Main 12 profile support.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/375>
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder.c3
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_h265.c29
-rw-r--r--gst-libs/gst/vaapi/gstvaapiutils_h265.c3
3 files changed, 31 insertions, 4 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder.c b/gst-libs/gst/vaapi/gstvaapiencoder.c
index 22b0e248..83d26f0f 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder.c
@@ -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))
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
index 49745e46..85951daa 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
@@ -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) {
diff --git a/gst-libs/gst/vaapi/gstvaapiutils_h265.c b/gst-libs/gst/vaapi/gstvaapiutils_h265.c
index 06597bfc..b0efbf29 100644
--- a/gst-libs/gst/vaapi/gstvaapiutils_h265.c
+++ b/gst-libs/gst/vaapi/gstvaapiutils_h265.c
@@ -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: