summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorHe Junyan <junyan.he@intel.com>2021-01-22 14:01:01 +0800
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-01-23 10:53:44 +0000
commit7196abf7a331fdbc619f0a441739f49bb95d86b2 (patch)
tree915133ab4fb68145e935f91519bfff1f868944d2 /gst
parent1029c84dbf6453833a62618e2dd0bff364b60cdb (diff)
downloadgstreamer-plugins-bad-7196abf7a331fdbc619f0a441739f49bb95d86b2.tar.gz
av1parse: Fix some issues in the src caps.
1. Add the mono_chrome to identify 4:0:0 chroma-format. 2. Correct the mapping between subsampling_x/y and chroma-format. There is no 4:4:0 format definition in AV1. And 4:4:4 should let both subsampling_x/y be equal to 0. 3. Send the chroma-format when the color space is not RGB. Fixes: #1502 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1974>
Diffstat (limited to 'gst')
-rw-r--r--gst/videoparsers/gstav1parse.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/gst/videoparsers/gstav1parse.c b/gst/videoparsers/gstav1parse.c
index 115b85a0a..297ab8fa6 100644
--- a/gst/videoparsers/gstav1parse.c
+++ b/gst/videoparsers/gstav1parse.c
@@ -103,6 +103,7 @@ struct _GstAV1Parse
gint height;
gint subsampling_x;
gint subsampling_y;
+ gboolean mono_chrome;
guint8 bit_depth;
gchar *colorimetry;
GstAV1Profile profile;
@@ -271,6 +272,7 @@ gst_av1_parse_reset (GstAV1Parse * self)
self->height = 0;
self->subsampling_x = -1;
self->subsampling_y = -1;
+ self->mono_chrome = FALSE;
self->profile = GST_AV1_PROFILE_UNDEFINED;
self->bit_depth = 0;
self->align = GST_AV1_PARSE_ALIGN_NONE;
@@ -560,18 +562,22 @@ gst_av1_parse_update_src_caps (GstAV1Parse * self, GstCaps * caps)
gst_base_parse_set_frame_rate (GST_BASE_PARSE (self), fps_n, fps_d, 0, 0);
}
- if (self->colorimetry
- && g_strcmp0 (self->colorimetry, GST_VIDEO_COLORIMETRY_SRGB)) {
+ /* When not RGB, the chroma format is needed. */
+ if (self->colorimetry == NULL ||
+ (g_strcmp0 (self->colorimetry, GST_VIDEO_COLORIMETRY_SRGB) != 0)) {
const gchar *chroma_format = NULL;
- if (self->subsampling_x == 1 && self->subsampling_y == 1)
- chroma_format = "4:2:0";
- else if (self->subsampling_x == 1 && self->subsampling_y == 0)
+ if (self->subsampling_x == 1 && self->subsampling_y == 1) {
+ if (!self->mono_chrome) {
+ chroma_format = "4:2:0";
+ } else {
+ chroma_format = "4:0:0";
+ }
+ } else if (self->subsampling_x == 1 && self->subsampling_y == 0) {
chroma_format = "4:2:2";
- else if (self->subsampling_x == 0 && self->subsampling_y == 1)
- chroma_format = "4:4:0";
- else if (self->subsampling_x == 1 && self->subsampling_y == 1)
+ } else if (self->subsampling_x == 0 && self->subsampling_y == 0) {
chroma_format = "4:4:4";
+ }
if (chroma_format)
gst_caps_set_simple (final_caps,
@@ -1010,16 +1016,19 @@ gst_av1_parse_handle_sequence_obu (GstAV1Parse * self, GstAV1OBU * obu)
}
}
- if (g_strcmp0 (self->colorimetry, GST_VIDEO_COLORIMETRY_SRGB)) {
- if (self->subsampling_x != seq_header.color_config.subsampling_x) {
- self->subsampling_x = seq_header.color_config.subsampling_x;
- self->update_caps = TRUE;
- }
+ if (self->subsampling_x != seq_header.color_config.subsampling_x) {
+ self->subsampling_x = seq_header.color_config.subsampling_x;
+ self->update_caps = TRUE;
+ }
- if (self->subsampling_y != seq_header.color_config.subsampling_y) {
- self->subsampling_y = seq_header.color_config.subsampling_y;
- self->update_caps = TRUE;
- }
+ if (self->subsampling_y != seq_header.color_config.subsampling_y) {
+ self->subsampling_y = seq_header.color_config.subsampling_y;
+ self->update_caps = TRUE;
+ }
+
+ if (self->mono_chrome != seq_header.color_config.mono_chrome) {
+ self->mono_chrome = seq_header.color_config.mono_chrome;
+ self->update_caps = TRUE;
}
if (self->bit_depth != seq_header.bit_depth) {