jpeg2000parse: sub-sampling parse should take component into account

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1653>
This commit is contained in:
Aaron Boxer 2020-03-24 09:18:28 -04:00 committed by Stéphane Cerveau
parent 7edff6e746
commit b2a0fd9e96

View file

@ -57,19 +57,21 @@ gst_jpeg2000_parse_is_part_2 (guint16 rsiz)
static void static void
gst_jpeg2000_parse_get_subsampling (GstJPEG2000Sampling sampling, guint8 * dx, gst_jpeg2000_parse_get_subsampling (guint16 compno,
guint8 * dy) GstJPEG2000Sampling sampling, guint8 * dx, guint8 * dy)
{ {
*dx = 1; *dx = 1;
*dy = 1; *dy = 1;
if (sampling == GST_JPEG2000_SAMPLING_YBR422) { if (compno == 1 || compno == 2) {
*dx = 2; if (sampling == GST_JPEG2000_SAMPLING_YBR422) {
} else if (sampling == GST_JPEG2000_SAMPLING_YBR420) { *dx = 2;
*dx = 2; } else if (sampling == GST_JPEG2000_SAMPLING_YBR420) {
*dy = 2; *dx = 2;
} else if (sampling == GST_JPEG2000_SAMPLING_YBR410) { *dy = 2;
*dx = 4; } else if (sampling == GST_JPEG2000_SAMPLING_YBR410) {
*dy = 2; *dx = 4;
*dy = 2;
}
} }
} }
@ -590,7 +592,8 @@ gst_jpeg2000_parse_handle_frame (GstBaseParse * parse,
} }
if (sink_sampling != GST_JPEG2000_SAMPLING_NONE) { if (sink_sampling != GST_JPEG2000_SAMPLING_NONE) {
guint8 dx_caps, dy_caps; guint8 dx_caps, dy_caps;
gst_jpeg2000_parse_get_subsampling (sink_sampling, &dx_caps, &dy_caps); gst_jpeg2000_parse_get_subsampling (compno, sink_sampling, &dx_caps,
&dy_caps);
if (dx_caps != dx[compno] || dy_caps != dy[compno]) { if (dx_caps != dx[compno] || dy_caps != dy[compno]) {
GstJPEG2000Colorspace inferred_colorspace = GstJPEG2000Colorspace inferred_colorspace =
GST_JPEG2000_COLORSPACE_NONE; GST_JPEG2000_COLORSPACE_NONE;