Commit 567258be authored by Seungha Yang's avatar Seungha Yang 🐑 Committed by Nicolas Dufresne

h265parser: Add more profiles to known type

"High Throughput", "Multiview", "Scalable", "3D", "Screen Content Coding",
and "Scalable format range extensions" profiles can be supported
via h265parser APIs now.
parent 392f86ae
......@@ -2902,7 +2902,9 @@ gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal (guint8 out_quant[64],
typedef struct
{
GstH265Profile profile;
GstH265ProfileIDC profile_idc;
guint8 max_14bit_constraint_flag;
guint8 max_12bit_constraint_flag;
guint8 max_10bit_constraint_flag;
guint8 max_8bit_constraint_flag;
......@@ -2941,28 +2943,127 @@ get_format_range_extension_profile (GstH265ProfileTierLevel * ptl)
{
/* See Table A.2 for the definition of those formats */
FormatRangeExtensionProfile profiles[] = {
{GST_H265_PROFILE_MONOCHROME, 1, 1, 1, 1, 1, 1, 0, 0, TRUE, 0},
{GST_H265_PROFILE_MONOCHROME_12, 1, 0, 0, 1, 1, 1, 0, 0, TRUE, 1},
{GST_H265_PROFILE_MONOCHROME_16, 0, 0, 0, 1, 1, 1, 0, 0, TRUE, 2},
{GST_H265_PROFILE_MAIN_12, 1, 0, 0, 1, 1, 0, 0, 0, TRUE, 3},
{GST_H265_PROFILE_MAIN_422_10, 1, 1, 0, 1, 0, 0, 0, 0, TRUE, 4},
{GST_H265_PROFILE_MAIN_422_12, 1, 0, 0, 1, 0, 0, 0, 0, TRUE, 5},
{GST_H265_PROFILE_MAIN_444, 1, 1, 1, 0, 0, 0, 0, 0, TRUE, 6},
{GST_H265_PROFILE_MAIN_444_10, 1, 1, 0, 0, 0, 0, 0, 0, TRUE, 7},
{GST_H265_PROFILE_MAIN_444_12, 1, 0, 0, 0, 0, 0, 0, 0, TRUE, 8},
{GST_H265_PROFILE_MAIN_INTRA, 1, 1, 1, 1, 1, 0, 1, 0, FALSE, 9},
{GST_H265_PROFILE_MAIN_10_INTRA, 1, 1, 0, 1, 1, 0, 1, 0, FALSE, 10},
{GST_H265_PROFILE_MAIN_12_INTRA, 1, 0, 0, 1, 1, 0, 1, 0, FALSE, 11},
{GST_H265_PROFILE_MAIN_422_10_INTRA, 1, 1, 0, 1, 0, 0, 1, 0, FALSE, 12},
{GST_H265_PROFILE_MAIN_422_12_INTRA, 1, 0, 0, 1, 0, 0, 1, 0, FALSE, 13},
{GST_H265_PROFILE_MAIN_444_INTRA, 1, 1, 1, 0, 0, 0, 1, 0, FALSE, 14},
{GST_H265_PROFILE_MAIN_444_10_INTRA, 1, 1, 0, 0, 0, 0, 1, 0, FALSE, 15},
{GST_H265_PROFILE_MAIN_444_12_INTRA, 1, 0, 0, 0, 0, 0, 1, 0, FALSE, 16},
{GST_H265_PROFILE_MAIN_444_16_INTRA, 0, 0, 0, 0, 0, 0, 1, 0, FALSE, 17},
{GST_H265_PROFILE_MAIN_444_STILL_PICTURE, 1, 1, 1, 0, 0, 0, 1, 1, FALSE,
18},
{GST_H265_PROFILE_MAIN_444_16_STILL_PICTURE, 0, 0, 0, 0, 0, 0, 1, 1, FALSE,
19},
{GST_H265_PROFILE_MONOCHROME, GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 1, 1, 1, 1, 1, 1, 0, 0, TRUE, 0},
{GST_H265_PROFILE_MONOCHROME_10,
GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 1, 1, 0, 1, 1, 1, 0, 0, TRUE, 1},
{GST_H265_PROFILE_MONOCHROME_12,
GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 1, 0, 0, 1, 1, 1, 0, 0, TRUE, 2},
{GST_H265_PROFILE_MONOCHROME_16,
GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 0, 0, 0, 1, 1, 1, 0, 0, TRUE, 3},
{GST_H265_PROFILE_MAIN_12, GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 1, 0, 0, 1, 1, 0, 0, 0, TRUE, 4},
{GST_H265_PROFILE_MAIN_422_10, GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 1, 1, 0, 1, 0, 0, 0, 0, TRUE, 5},
{GST_H265_PROFILE_MAIN_422_12, GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 1, 0, 0, 1, 0, 0, 0, 0, TRUE, 6},
{GST_H265_PROFILE_MAIN_444, GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 1, 1, 1, 0, 0, 0, 0, 0, TRUE, 7},
{GST_H265_PROFILE_MAIN_444_10, GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 1, 1, 0, 0, 0, 0, 0, 0, TRUE, 8},
{GST_H265_PROFILE_MAIN_444_12, GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 1, 0, 0, 0, 0, 0, 0, 0, TRUE, 9},
{GST_H265_PROFILE_MAIN_INTRA, GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 1, 1, 1, 1, 1, 0, 1, 0, FALSE, 10},
{GST_H265_PROFILE_MAIN_10_INTRA,
GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 1, 1, 0, 1, 1, 0, 1, 0, FALSE, 11},
{GST_H265_PROFILE_MAIN_12_INTRA,
GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 1, 0, 0, 1, 1, 0, 1, 0, FALSE, 12},
{GST_H265_PROFILE_MAIN_422_10_INTRA,
GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 1, 1, 0, 1, 0, 0, 1, 0, FALSE, 13},
{GST_H265_PROFILE_MAIN_422_12_INTRA,
GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 1, 0, 0, 1, 0, 0, 1, 0, FALSE, 14},
{GST_H265_PROFILE_MAIN_444_INTRA,
GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 1, 1, 1, 0, 0, 0, 1, 0, FALSE, 15},
{GST_H265_PROFILE_MAIN_444_10_INTRA,
GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 1, 1, 0, 0, 0, 0, 1, 0, FALSE, 16},
{GST_H265_PROFILE_MAIN_444_12_INTRA,
GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 1, 0, 0, 0, 0, 0, 1, 0, FALSE, 17},
{GST_H265_PROFILE_MAIN_444_16_INTRA,
GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 0, 0, 0, 0, 0, 0, 1, 0, FALSE, 18},
{GST_H265_PROFILE_MAIN_444_STILL_PICTURE,
GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 1, 1, 1, 0, 0, 0, 1, 1, FALSE, 19},
{GST_H265_PROFILE_MAIN_444_16_STILL_PICTURE,
GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION,
0, 0, 0, 0, 0, 0, 0, 1, 1, FALSE, 20},
/* High Througput */
{GST_H265_PROFILE_HIGH_THROUGHPUT_444, GST_H265_PROFILE_IDC_HIGH_THROUGHPUT,
1, 1, 1, 1, 0, 0, 0, 0, 0, TRUE, 21},
{GST_H265_PROFILE_HIGH_THROUGHPUT_444_10,
GST_H265_PROFILE_IDC_HIGH_THROUGHPUT,
1, 1, 1, 0, 0, 0, 0, 0, 0, TRUE, 22},
{GST_H265_PROFILE_HIGH_THROUGHPUT_444_14,
GST_H265_PROFILE_IDC_HIGH_THROUGHPUT,
1, 0, 0, 0, 0, 0, 0, 0, 0, TRUE, 23},
{GST_H265_PROFILE_HIGH_THROUGHPUT_444_16_INTRA,
GST_H265_PROFILE_IDC_HIGH_THROUGHPUT,
0, 0, 0, 0, 0, 0, 0, 1, 0, FALSE, 24},
/* Screen content coding */
{GST_H265_PROFILE_SCREEN_EXTENDED_MAIN,
GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING,
1, 1, 1, 1, 1, 1, 0, 0, 0, TRUE, 25},
{GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_10,
GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING,
1, 1, 1, 0, 1, 1, 0, 0, 0, TRUE, 26},
{GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444,
GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING,
1, 1, 1, 1, 0, 0, 0, 0, 0, TRUE, 27},
{GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444_10,
GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING,
1, 1, 1, 0, 0, 0, 0, 0, 0, TRUE, 28},
/* identical to screen-extended-main-444 */
{GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444,
GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING,
1, 1, 1, 1, 0, 0, 0, 0, 0, TRUE, 29},
/* identical to screen-extended-main-444-10 */
{GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_10,
GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING,
1, 1, 1, 0, 0, 0, 0, 0, 0, TRUE, 30},
{GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_14,
GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING,
1, 0, 0, 0, 0, 0, 0, 0, 0, TRUE, 31},
/* Multiview Main */
{GST_H265_PROFILE_MULTIVIEW_MAIN, GST_H265_PROFILE_IDC_MULTIVIEW_MAIN,
0, 1, 1, 1, 1, 1, 0, 0, 0, TRUE, 32},
/* Scalable Main */
{GST_H265_PROFILE_SCALABLE_MAIN, GST_H265_PROFILE_IDC_SCALABLE_MAIN,
0, 1, 1, 1, 1, 1, 0, 0, 0, TRUE, 33},
{GST_H265_PROFILE_SCALABLE_MAIN_10, GST_H265_PROFILE_IDC_SCALABLE_MAIN,
0, 1, 1, 0, 1, 1, 0, 0, 0, TRUE, 34},
/* Scalable format range extensions */
{GST_H265_PROFILE_SCALABLE_MONOCHROME,
GST_H265_PROFILE_IDC_SCALABLE_FORMAT_RANGE_EXTENSION,
1, 1, 1, 1, 1, 1, 1, 0, 0, TRUE, 35},
{GST_H265_PROFILE_SCALABLE_MONOCHROME_12,
GST_H265_PROFILE_IDC_SCALABLE_FORMAT_RANGE_EXTENSION,
1, 1, 0, 0, 1, 1, 1, 0, 0, TRUE, 36},
{GST_H265_PROFILE_SCALABLE_MONOCHROME_16,
GST_H265_PROFILE_IDC_SCALABLE_FORMAT_RANGE_EXTENSION,
0, 0, 0, 0, 1, 1, 1, 0, 0, TRUE, 37},
{GST_H265_PROFILE_SCALABLE_MAIN_444,
GST_H265_PROFILE_IDC_SCALABLE_FORMAT_RANGE_EXTENSION,
1, 1, 1, 1, 0, 0, 0, 0, 0, TRUE, 38},
/* 3D Main */
{GST_H265_PROFILE_3D_MAIN, GST_H265_PROFILE_IDC_3D_MAIN,
0, 1, 1, 1, 1, 1, 0, 0, 0, TRUE, 39},
};
GstH265Profile result = GST_H265_PROFILE_INVALID;
guint i;
......@@ -2977,6 +3078,12 @@ get_format_range_extension_profile (GstH265ProfileTierLevel * ptl)
* Then pick the one having the least extra contraints. This allow us
* to match the closet profile if bitstream contains not standard
* constraints. */
if (p.max_14bit_constraint_flag != ptl->max_14bit_constraint_flag) {
if (p.max_14bit_constraint_flag)
continue;
extra_constraints++;
}
if (p.max_12bit_constraint_flag != ptl->max_12bit_constraint_flag) {
if (p.max_12bit_constraint_flag)
continue;
......@@ -3030,21 +3137,30 @@ get_format_range_extension_profile (GstH265ProfileTierLevel * ptl)
&& !ptl->lower_bit_rate_constraint_flag)
continue;
if (extra_constraints == 0 &&
(p.profile_idc == ptl->profile_idc
|| ptl->profile_compatibility_flag[ptl->profile_idc])) {
result = p.profile;
break;
}
m = g_new0 (FormatRangeExtensionProfileMatch, 1);
m->profile = &profiles[i];
m->extra_constraints = extra_constraints;
matches = g_list_prepend (matches, m);
}
if (matches) {
if (result == GST_H265_PROFILE_INVALID && matches) {
FormatRangeExtensionProfileMatch *m;
matches = g_list_sort (matches, (GCompareFunc) sort_fre_profile_matches);
m = matches->data;
result = m->profile->profile;
g_list_free_full (matches, g_free);
}
if (matches)
g_list_free_full (matches, g_free);
return result;
}
......@@ -3072,14 +3188,5 @@ gst_h265_profile_tier_level_get_profile (GstH265ProfileTierLevel * ptl)
|| ptl->profile_compatibility_flag[3])
return GST_H265_PROFILE_MAIN_STILL_PICTURE;
if (ptl->profile_idc == GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION
|| ptl->profile_compatibility_flag[4])
return get_format_range_extension_profile (ptl);
/* TODO:
* - GST_H265_PROFILE_IDC_HIGH_THROUGHPUT
* - GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING
*/
return GST_H265_PROFILE_INVALID;
return get_format_range_extension_profile (ptl);
}
......@@ -67,6 +67,26 @@ G_BEGIN_DECLS
* @GST_H265_PROFILE_MAIN_444_16_INTRA: Main Intra 4:4:4 16-bits profile (A.3.4)
* @GST_H265_PROFILE_MAIN_444_STILL_PICTURE: Main 4:4:4 Still Picture profile (A.3.4)
* @GST_H265_PROFILE_MAIN_444_16_STILL_PICTURE: Main 4:4:4 16-bits Still Picture profile (A.3.4)
* @GST_H265_PROFILE_MONOCHROME_10: Monochrome 10-bits profile (A.3.5) (Since: 1.18)
* @GST_H265_PROFILE_HIGH_THROUGHPUT_444: High Throughput 4:4:4 profile (A.3.6) (Since: 1.18)
* @GST_H265_PROFILE_HIGH_THROUGHPUT_444_10: High Throughput 4:4:4 10-bits profile (A.3.6) (Since: 1.18)
* @GST_H265_PROFILE_HIGH_THROUGHPUT_444_14: High Throughput 4:4:4 14-bits profile (A.3.6) (Since: 1.18)
* @GST_H265_PROFILE_HIGH_THROUGHPUT_444_16_INTRA: High Throughput 4:4:4 16-bits Intra profile (A.3.6) (Since: 1.18)
* @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN: Screen-Extended Main profile (A.3.7) (Since: 1.18)
* @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_10: Screen-Extended Main 10-bits profile (A.3.7) (Since: 1.18)
* @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444: Screen-Extended Main 4:4:4 profile (A.3.7) (Since: 1.18)
* @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444_10: Screen-Extended Main 4:4:4 10-bits profile (A.3.7) (Since: 1.18)
* @GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444: Screen-Extended High Throughput 4:4:4 profile (A.3.7) (Since: 1.18)
* @GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_10: Screen-Extended High Throughput 4:4:4 10-bits profile (A.3.7) (Since: 1.18)
* @GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_14: Screen-Extended High Throughput 4:4:4 14-bits profile (A.3.7) (Since: 1.18)
* @GST_H265_PROFILE_MULTIVIEW_MAIN: Multiview Main profile (G.11.1) (Since: 1.18)
* @GST_H265_PROFILE_SCALABLE_MAIN: Scalable Main profile (H.11.1) (Since: 1.18)
* @GST_H265_PROFILE_SCALABLE_MAIN_10: Scalable Main 10-bits profile (H.11.1) (Since: 1.18)
* @GST_H265_PROFILE_SCALABLE_MONOCHROME: Scalable Monochrome profile (H.11.1) (Since: 1.18)
* @GST_H265_PROFILE_SCALABLE_MONOCHROME_12: Scalable Monochrome 12-bits profile (H.11.1) (Since: 1.18)
* @GST_H265_PROFILE_SCALABLE_MONOCHROME_16: Scalable Monochrome 16-bits profile (H.11.1) (Since: 1.18)
* @GST_H265_PROFILE_SCALABLE_MAIN_444: Scalable Main 4:4:4 profile (H.11.1) (Since: 1.18)
* @GST_H265_PROFILE_3D_MAIN: 3D Main 4:4:4 profile (I.11.1) (Since: 1.18)
*
* H.265 Profiles.
*
......@@ -96,6 +116,26 @@ typedef enum {
GST_H265_PROFILE_MAIN_444_16_INTRA,
GST_H265_PROFILE_MAIN_444_STILL_PICTURE,
GST_H265_PROFILE_MAIN_444_16_STILL_PICTURE,
GST_H265_PROFILE_MONOCHROME_10,
GST_H265_PROFILE_HIGH_THROUGHPUT_444,
GST_H265_PROFILE_HIGH_THROUGHPUT_444_10,
GST_H265_PROFILE_HIGH_THROUGHPUT_444_14,
GST_H265_PROFILE_HIGH_THROUGHPUT_444_16_INTRA,
GST_H265_PROFILE_SCREEN_EXTENDED_MAIN,
GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_10,
GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444,
GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444_10,
GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444,
GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_10,
GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_14,
GST_H265_PROFILE_MULTIVIEW_MAIN,
GST_H265_PROFILE_SCALABLE_MAIN,
GST_H265_PROFILE_SCALABLE_MAIN_10,
GST_H265_PROFILE_SCALABLE_MONOCHROME,
GST_H265_PROFILE_SCALABLE_MONOCHROME_12,
GST_H265_PROFILE_SCALABLE_MONOCHROME_16,
GST_H265_PROFILE_SCALABLE_MAIN_444,
GST_H265_PROFILE_3D_MAIN,
} GstH265Profile;
/**
......@@ -105,7 +145,11 @@ typedef enum {
* @GST_H265_PROFILE_IDC_MAIN_STILL_PICTURE: Main Still Picture profile (A.3.4)
* @GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION: Format range extensions profile (A.3.5)
* @GST_H265_PROFILE_IDC_HIGH_THROUGHPUT: High throughput profiles (A.3.6)
* @GST_H265_PROFILE_IDC_MULTIVIEW_MAIN: Multiview Main profiles (G.11.1) (Since: 1.18)
* @GST_H265_PROFILE_IDC_SCALABLE_MAIN: Scalable Main and Scalable Main 10 profile (H.11.1) (Since: 1.18)
* @GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING: Screen content coding extensions profiles (A.3.7)
* @GST_H265_PROFILE_IDC_3D_MAIN: 3D Main profile (I.11.1) (Since: 1.18)
* @GST_H265_PROFILE_IDC_SCALABLE_FORMAT_RANGE_EXTENSION: Scalable Format range extensions profiles (H.11.1) (Since: 1.18)
*
* Valid values for the profile_idc field. This is different from
* #GstH265Profile as an extension idc can be used to encode a whole variety of
......@@ -118,7 +162,11 @@ typedef enum {
GST_H265_PROFILE_IDC_MAIN_STILL_PICTURE = 3,
GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION = 4,
GST_H265_PROFILE_IDC_HIGH_THROUGHPUT = 5,
GST_H265_PROFILE_IDC_MULTIVIEW_MAIN = 6,
GST_H265_PROFILE_IDC_SCALABLE_MAIN = 7,
GST_H265_PROFILE_IDC_3D_MAIN = 8,
GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING = 9,
GST_H265_PROFILE_IDC_SCALABLE_FORMAT_RANGE_EXTENSION = 10,
} GstH265ProfileIDC;
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment