diff options
author | He Junyan <junyan.he@intel.com> | 2021-06-03 22:12:04 +0800 |
---|---|---|
committer | GStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2021-06-23 06:33:40 +0000 |
commit | 310ffc17a8406359af60762f42b5a66cc14f8c3f (patch) | |
tree | 71d74e8655ffd8ee3d1b8bfcc416ecf2237e7601 /gst-libs | |
parent | 9f02c3fa4ccf66d0258608ce9eda3051706a835e (diff) |
libs: encoder: mpeg2: Add highP level for 1080@50p/60p.
The MPEG2 spec has amendment 3 to introduce a new level highP, which
is used for 1080@50p/60p streams. We need to add this level to avoid
encoding failure because of the level check.
Fix: #306
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/432>
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiutils_mpeg2.c | 8 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiutils_mpeg2.h | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiutils_mpeg2.c b/gst-libs/gst/vaapi/gstvaapiutils_mpeg2.c index baba0723..04993c8a 100644 --- a/gst-libs/gst/vaapi/gstvaapiutils_mpeg2.c +++ b/gst-libs/gst/vaapi/gstvaapiutils_mpeg2.c @@ -51,6 +51,7 @@ static const struct map gst_vaapi_mpeg2_level_map[] = { { GST_VAAPI_LEVEL_MPEG2_MAIN, "main" }, { GST_VAAPI_LEVEL_MPEG2_HIGH_1440, "high-1440" }, { GST_VAAPI_LEVEL_MPEG2_HIGH, "high" }, + { GST_VAAPI_LEVEL_MPEG2_HIGHP, "highP" }, { 0, NULL } /* *INDENT-ON* */ }; @@ -67,6 +68,9 @@ static const GstVaapiMPEG2LevelLimits gst_vaapi_mpeg2_level_limits[] = { 0x06, 1440, 1152, 60, 47001600, 60000, 7340032 }, { GST_VAAPI_LEVEL_MPEG2_HIGH, 0x04, 1920, 1152, 60, 62668800, 80000, 9781248 }, + /* Amendment 3: New level for 1080@50p/60p */ + { GST_VAAPI_LEVEL_MPEG2_HIGHP, + 0x02, 1920, 1152, 60, 125337600, 80000, 9781248 }, { 0, } }; /* *INDENT-ON* */ @@ -215,7 +219,7 @@ gst_vaapi_utils_mpeg2_get_level_from_string (const gchar * str) const gchar * gst_vaapi_utils_mpeg2_get_level_string (GstVaapiLevelMPEG2 level) { - if (level < GST_VAAPI_LEVEL_MPEG2_LOW || level > GST_VAAPI_LEVEL_MPEG2_HIGH) + if (level < GST_VAAPI_LEVEL_MPEG2_LOW || level > GST_VAAPI_LEVEL_MPEG2_HIGHP) return NULL; return gst_vaapi_mpeg2_level_map[level - GST_VAAPI_LEVEL_MPEG2_LOW].name; } @@ -225,7 +229,7 @@ gst_vaapi_utils_mpeg2_get_level_string (GstVaapiLevelMPEG2 level) const GstVaapiMPEG2LevelLimits * gst_vaapi_utils_mpeg2_get_level_limits (GstVaapiLevelMPEG2 level) { - if (level < GST_VAAPI_LEVEL_MPEG2_LOW || level > GST_VAAPI_LEVEL_MPEG2_HIGH) + if (level < GST_VAAPI_LEVEL_MPEG2_LOW || level > GST_VAAPI_LEVEL_MPEG2_HIGHP) return NULL; return &gst_vaapi_mpeg2_level_limits[level - GST_VAAPI_LEVEL_MPEG2_LOW]; } diff --git a/gst-libs/gst/vaapi/gstvaapiutils_mpeg2.h b/gst-libs/gst/vaapi/gstvaapiutils_mpeg2.h index 64e38d1c..997011df 100644 --- a/gst-libs/gst/vaapi/gstvaapiutils_mpeg2.h +++ b/gst-libs/gst/vaapi/gstvaapiutils_mpeg2.h @@ -33,6 +33,7 @@ G_BEGIN_DECLS * @GST_VAAPI_LEVEL_MPEG2_MAIN: Main level. * @GST_VAAPI_LEVEL_MPEG2_HIGH_1440: High-1440 level. * @GST_VAAPI_LEVEL_MPEG2_HIGH: High level. + * @GST_VAAPI_LEVEL_MPEG2_HIGHP: HighP level. * * The set of all levels for #GstVaapiLevelMPEG2. */ @@ -41,6 +42,7 @@ typedef enum { GST_VAAPI_LEVEL_MPEG2_MAIN, GST_VAAPI_LEVEL_MPEG2_HIGH_1440, GST_VAAPI_LEVEL_MPEG2_HIGH, + GST_VAAPI_LEVEL_MPEG2_HIGHP, } GstVaapiLevelMPEG2; /* Returns a relative score for the supplied GstVaapiProfile */ |