diff options
author | He Junyan <junyan.he@hotmail.com> | 2020-04-02 15:14:15 +0800 |
---|---|---|
committer | He Junyan <junyan.he@hotmail.com> | 2020-04-02 23:01:46 +0800 |
commit | 026c01875cb8370568e0a76edfe77e4e25e568f7 (patch) | |
tree | 15be1cc00fb99285e082897ba99f37f52f51ee11 /gst-libs/gst | |
parent | 80b6e006bc1d269bedcb8426325ee969f5708317 (diff) |
libs: encoder: h265: Support MAIN 4:4:4 10 profile.
Using Y410 as the input of the encoder can generate main_444_10 bit
streams.
Diffstat (limited to 'gst-libs/gst')
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiencoder.c | 3 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiencoder_h265.c | 25 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiprofile.c | 2 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiutils_h265.c | 3 |
4 files changed, 31 insertions, 2 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder.c b/gst-libs/gst/vaapi/gstvaapiencoder.c index 5709ba69..d989bde6 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder.c @@ -667,7 +667,8 @@ is_chroma_type_supported (GstVaapiEncoder * encoder) if (cip->chroma_type != GST_VAAPI_CHROMA_TYPE_YUV420 && cip->chroma_type != GST_VAAPI_CHROMA_TYPE_YUV422 && 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 && + cip->chroma_type != GST_VAAPI_CHROMA_TYPE_YUV444_10BPP) 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 3f43297a..8599321d 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c @@ -305,7 +305,8 @@ bs_write_profile_tier_level (GstBitWriter * bs, /* additional indications specified for general_profile_idc from 4~10 */ if (seq_param->general_profile_idc == 4) { /* In A.3.5, Format range extensions profiles. - Just support main444 profile now, may add more profiles when needed. */ + Just support main444 and main444-10 profile now, may add more profiles + when needed. */ switch (profile) { case GST_VAAPI_PROFILE_H265_MAIN_444: /* max_12bit_constraint_flag */ @@ -327,6 +328,26 @@ bs_write_profile_tier_level (GstBitWriter * bs, /* lower_bit_rate_constraint_flag */ WRITE_UINT32 (bs, 1, 1); break; + case GST_VAAPI_PROFILE_H265_MAIN_444_10: + /* max_12bit_constraint_flag */ + WRITE_UINT32 (bs, 1, 1); + /* max_10bit_constraint_flag */ + WRITE_UINT32 (bs, 1, 1); + /* max_8bit_constraint_flag */ + WRITE_UINT32 (bs, 0, 1); + /* max_422chroma_constraint_flag */ + WRITE_UINT32 (bs, 0, 1); + /* max_420chroma_constraint_flag */ + WRITE_UINT32 (bs, 0, 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)); @@ -1087,6 +1108,8 @@ ensure_profile (GstVaapiEncoderH265 * encoder) profile = GST_VAAPI_PROFILE_H265_MAIN10; else if (format == GST_VIDEO_FORMAT_VUYA) profile = GST_VAAPI_PROFILE_H265_MAIN_444; + else if (format == GST_VIDEO_FORMAT_Y410) + profile = GST_VAAPI_PROFILE_H265_MAIN_444_10; encoder->profile = profile; encoder->profile_idc = gst_vaapi_utils_h265_get_profile_idc (profile); diff --git a/gst-libs/gst/vaapi/gstvaapiprofile.c b/gst-libs/gst/vaapi/gstvaapiprofile.c index 3105b906..7f0c94cb 100644 --- a/gst-libs/gst/vaapi/gstvaapiprofile.c +++ b/gst-libs/gst/vaapi/gstvaapiprofile.c @@ -339,6 +339,8 @@ gst_vaapi_profile_from_codec_data_h265 (GstBuffer * buffer) return GST_VAAPI_PROFILE_H265_MAIN_422_10; case 5: return GST_VAAPI_PROFILE_H265_MAIN_444; + case 6: + return GST_VAAPI_PROFILE_H265_MAIN_444_10; } return 0; } diff --git a/gst-libs/gst/vaapi/gstvaapiutils_h265.c b/gst-libs/gst/vaapi/gstvaapiutils_h265.c index a276a7ba..a7e23839 100644 --- a/gst-libs/gst/vaapi/gstvaapiutils_h265.c +++ b/gst-libs/gst/vaapi/gstvaapiutils_h265.c @@ -41,6 +41,7 @@ static const struct map gst_vaapi_h265_profile_map[] = { { GST_VAAPI_PROFILE_H265_MAIN10, "main-10" }, { GST_VAAPI_PROFILE_H265_MAIN_STILL_PICTURE, "main-still-picture" }, { GST_VAAPI_PROFILE_H265_MAIN_444, "main-444" }, + { GST_VAAPI_PROFILE_H265_MAIN_444_10, "main-444-10" }, { 0, NULL } /* *INDENT-ON* */ }; @@ -267,6 +268,8 @@ gst_vaapi_utils_h265_get_profile_idc (GstVaapiProfile profile) case GST_VAAPI_PROFILE_H265_MAIN_422_10: /* Fall through */ case GST_VAAPI_PROFILE_H265_MAIN_444: + /* Fall through */ + case GST_VAAPI_PROFILE_H265_MAIN_444_10: profile_idc = GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION; break; default: |