codecparsers: introduce h265 level enum

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5644>
This commit is contained in:
Stéphane Cerveau 2023-10-19 21:21:51 +02:00 committed by GStreamer Marge Bot
parent 8cd8eeff20
commit fdc3db68cd
3 changed files with 46 additions and 21 deletions

View file

@ -430,6 +430,31 @@ typedef enum
GST_H265_QUANT_MATIX_32X32 = 3
} GstH265QuantMatrixSize;
/**
* GstH265Level:
*
* H.265 level
*
* Since: 1.24
*/
typedef enum
{
GST_H265_LEVEL_L1 = 30,
GST_H265_LEVEL_L2 = 60,
GST_H265_LEVEL_L2_1 = 63,
GST_H265_LEVEL_L3 = 90,
GST_H265_LEVEL_L3_1 = 93,
GST_H265_LEVEL_L4 = 120,
GST_H265_LEVEL_L4_1 = 123,
GST_H265_LEVEL_L5 = 150,
GST_H265_LEVEL_L5_1 = 153,
GST_H265_LEVEL_L5_2 = 156,
GST_H265_LEVEL_L6 = 180,
GST_H265_LEVEL_L6_1 = 183,
GST_H265_LEVEL_L6_2 = 186,
} GstH265Level;
typedef struct _GstH265Parser GstH265Parser;
typedef struct _GstH265NalUnit GstH265NalUnit;

View file

@ -437,20 +437,20 @@ typedef struct
/* *INDENT-OFF* */
/* Table A.8 - General tier and level limits */
static const GstH265LevelLimits level_limits[] = {
/* level idc MaxLumaPs */
{ "1", 30, 36864 },
{ "2", 60, 122880 },
{ "2.1", 63, 245760 },
{ "3", 90, 552960 },
{ "3.1", 93, 983040 },
{ "4", 120, 2228224 },
{ "4.1", 123, 2228224 },
{ "5", 150, 8912896 },
{ "5.1", 153, 8912896 },
{ "5.2", 156, 8912896 },
{ "6", 180, 35651584 },
{ "6.1", 183, 35651584 },
{ "6.2", 186, 35651584 },
/* level idc MaxLumaPs */
{ "1", GST_H265_LEVEL_L1, 36864 },
{ "2", GST_H265_LEVEL_L2, 122880 },
{ "2.1", GST_H265_LEVEL_L2_1, 245760 },
{ "3", GST_H265_LEVEL_L3, 552960 },
{ "3.1", GST_H265_LEVEL_L3_1, 983040 },
{ "4", GST_H265_LEVEL_L4, 2228224 },
{ "4.1", GST_H265_LEVEL_L4_1, 2228224 },
{ "5", GST_H265_LEVEL_L5, 8912896 },
{ "5.1", GST_H265_LEVEL_L5_1, 8912896 },
{ "5.2", GST_H265_LEVEL_L5_2, 8912896 },
{ "6", GST_H265_LEVEL_L6, 35651584 },
{ "6.1", GST_H265_LEVEL_L6_1, 35651584 },
{ "6.2", GST_H265_LEVEL_L6_2, 35651584 },
};
/* *INDENT-ON* */

View file

@ -1645,25 +1645,25 @@ get_level_string (guint8 level_idc)
return digit_to_string (level_idc / 30);
else {
switch (level_idc) {
case 63:
case GST_H265_LEVEL_L2_1:
return "2.1";
break;
case 93:
case GST_H265_LEVEL_L3_1:
return "3.1";
break;
case 123:
case GST_H265_LEVEL_L4_1:
return "4.1";
break;
case 153:
case GST_H265_LEVEL_L5_1:
return "5.1";
break;
case 156:
case GST_H265_LEVEL_L5_2:
return "5.2";
break;
case 183:
case GST_H265_LEVEL_L6_1:
return "6.1";
break;
case 186:
case GST_H265_LEVEL_L6_2:
return "6.2";
break;
default: