summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHe Junyan <junyan.he@hotmail.com>2020-01-02 21:02:40 +0800
committerHe Junyan <junyan.he@hotmail.com>2020-01-08 17:48:22 +0800
commit9bfc8240b48dd5f40847fd347e69898625d52b19 (patch)
treef3b5f13d72ca2ecd405a8049566878033ab322fa
parent742d7e17e659c2c87388f21f62ea419aba57247a (diff)
libs: encoder: modify 265 SPS header's profile compatibility flag.
Make the SPS profile compatibility flags more precisely conform to the HEVC Spec.
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_h265.c52
1 files changed, 44 insertions, 8 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
index c1d6e1fc..c7bfed9e 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
@@ -236,19 +236,53 @@ bs_write_profile_tier_level (GstBitWriter * bs,
const VAEncSequenceParameterBufferHEVC * seq_param)
{
guint i;
+
/* general_profile_space */
WRITE_UINT32 (bs, 0, 2);
/* general_tier_flag */
WRITE_UINT32 (bs, seq_param->general_tier_flag, 1);
/* general_profile_idc */
WRITE_UINT32 (bs, seq_param->general_profile_idc, 5);
- /* general_profile_compatibility_flag[32] */
- for (i = 0; i < 32; i++) {
- if (i == 1 || i == 2)
- WRITE_UINT32 (bs, 1, 1);
- else
- WRITE_UINT32 (bs, 0, 1);
+
+ /* general_profile_compatibility_flag[0] */
+ WRITE_UINT32 (bs, 0, 1);
+ /* general_profile_compatibility_flag[1] */
+ if (seq_param->general_profile_idc == 1 /* Main profile */
+ /* In A.3.4, NOTE: When general_profile_compatibility_flag[ 3 ] is equal
+ to 1, general_profile_compatibility_flag[ 1 ] and
+ general_profile_compatibility_flag[ 2 ] should also be equal to 1. */
+ || seq_param->general_profile_idc == 3 /* Main Still Picture profile */
+ ) {
+ WRITE_UINT32 (bs, 1, 1);
+ } else {
+ WRITE_UINT32 (bs, 0, 1);
}
+ /* general_profile_compatibility_flag[2] */
+ if (
+ /* In A.3.2, NOTE: When general_profile_compatibility_flag[ 1 ] is equal
+ to 1, general_profile_compatibility_flag[ 2 ] should also be equal to
+ 1. */
+ seq_param->general_profile_idc == 1 /* Main profile */
+ || seq_param->general_profile_idc == 2 /* Main 10 profile */
+ /* In A.3.4, NOTE: When general_profile_compatibility_flag[ 3 ] is equal
+ to 1, general_profile_compatibility_flag[ 1 ] and
+ general_profile_compatibility_flag[ 2 ] should also be equal to 1. */
+ || seq_param->general_profile_idc == 3 /* Main Still Picture profile */
+ ) {
+ WRITE_UINT32 (bs, 1, 1);
+ } else {
+ WRITE_UINT32 (bs, 0, 1);
+ }
+ /* general_profile_compatibility_flag[3] */
+ if (seq_param->general_profile_idc == 3) {
+ WRITE_UINT32 (bs, 1, 1);
+ } else {
+ WRITE_UINT32 (bs, 0, 1);
+ }
+
+ /* general_profile_compatibility_flag[4~32] */
+ WRITE_UINT32 (bs, 0, 28);
+
/* general_progressive_source_flag */
WRITE_UINT32 (bs, 1, 1);
/* general_interlaced_source_flag */
@@ -257,9 +291,11 @@ bs_write_profile_tier_level (GstBitWriter * bs,
WRITE_UINT32 (bs, 0, 1);
/* general_frame_only_constraint_flag */
WRITE_UINT32 (bs, 1, 1);
- /* general_reserved_zero_44bits */
- for (i = 0; i < 44; i++)
+ /* general_reserved_zero_43bits */
+ for (i = 0; i < 43; i++)
WRITE_UINT32 (bs, 0, 1);
+ /* general_inbld_flag */
+ WRITE_UINT32 (bs, 0, 1);
/* general_level_idc */
WRITE_UINT32 (bs, seq_param->general_level_idc, 8);