jpegparse: avi1 tag can be progressive

AVI1 tag in APP0 is trivalue: 0 not interleaved, 1 odd, 2 even.

So if avi1 is zero then the frame is progressive.

Also, this patch adds a couple log messages.

Fixes: #3414
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6445>
This commit is contained in:
Víctor Manuel Jáquez Leal 2024-03-26 15:32:24 +01:00 committed by GStreamer Marge Bot
parent 46355e31d7
commit ababe13f1c

View file

@ -405,6 +405,7 @@ gst_jpeg_parse_sof (GstJpegParse * parse, GstJpegSegment * seg)
&& parse->height < ((parse->orig_height * 3) / 4)) { && parse->height < ((parse->orig_height * 3) / 4)) {
parse->interlace_mode = GST_VIDEO_INTERLACE_MODE_INTERLEAVED; parse->interlace_mode = GST_VIDEO_INTERLACE_MODE_INTERLEAVED;
} else if (parse->avid) { } else if (parse->avid) {
/* if no container info, let's suppose it doubles its height */
if (parse->orig_height == 0) if (parse->orig_height == 0)
parse->orig_height = 2 * hdr.height; parse->orig_height = 2 * hdr.height;
parse->interlace_mode = GST_VIDEO_INTERLACE_MODE_INTERLEAVED; parse->interlace_mode = GST_VIDEO_INTERLACE_MODE_INTERLEAVED;
@ -531,11 +532,11 @@ gst_jpeg_parse_app0 (GstJpegParse * parse, GstJpegSegment * seg)
if (!gst_byte_reader_get_uint8 (&reader, &unit)) if (!gst_byte_reader_get_uint8 (&reader, &unit))
return FALSE; return FALSE;
parse->avid = TRUE; parse->avid = (unit > 0); /* otherwise is not interleaved */
parse->field = unit == 1 ? 0 : 1;
/* TODO: update caps for interlaced MJPEG */ /* TODO: update caps for interlaced MJPEG */
GST_DEBUG_OBJECT (parse, "MJPEG interleaved field: %d", unit); GST_DEBUG_OBJECT (parse, "MJPEG interleaved field: %s", unit == 0 ?
"not interleaved" : unit % 2 ? "Odd" : "Even");
return TRUE; return TRUE;
} }
@ -820,6 +821,7 @@ gst_jpeg_parse_finish_frame (GstJpegParse * parse, GstBaseParseFrame * frame,
GST_WARNING_OBJECT (parse, "Potentially invalid picture"); GST_WARNING_OBJECT (parse, "Potentially invalid picture");
} }
GST_TRACE_OBJECT (parse, "Finish frame %" GST_PTR_FORMAT, frame->buffer);
ret = gst_base_parse_finish_frame (bparse, frame, size); ret = gst_base_parse_finish_frame (bparse, frame, size);
gst_jpeg_parse_reset (parse); gst_jpeg_parse_reset (parse);