jpegdec: Fix progressive/interlaced detection
authorSeungha Yang <seungha@centricular.com>
Thu, 22 Feb 2024 11:35:28 +0000 (20:35 +0900)
committerSeungha Yang <seungha@centricular.com>
Mon, 26 Feb 2024 14:21:44 +0000 (23:21 +0900)
If input height and parsed one are identical, do not consider it as interlaced

Fixing below pipeline:
gst-launch-1.0 videotestsrc ! video/x-raw,format=I420,width=640,height=10 \
  ! jpegenc ! jpegparse ! jpegdec ! videoconvert ! autovideosink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6181>

subprojects/gst-plugins-good/ext/jpeg/gstjpegdec.c

index e69589fcea59dde7f1ffc5f795ffb20859fa8c93..51bc2d14bf0ea04ced4e9de69db397479aafbbc8 100644 (file)
@@ -1406,7 +1406,8 @@ gst_jpeg_dec_handle_frame (GstVideoDecoder * bdec, GstVideoCodecFrame * frame)
   /* is it interlaced MJPEG? (we really don't want to scan the jpeg data
    * to see if there are two SOF markers in the packet to detect this) */
   if (gst_video_decoder_get_packetized (bdec) &&
-      dec->input_state && height > DCTSIZE &&
+      dec->input_state &&
+      dec->input_state->info.height != height && height > DCTSIZE &&
       dec->input_state->info.height > (2 * (height - DCTSIZE)) &&
       dec->input_state->info.height <= (height * 2)
       && dec->input_state->info.width == width) {