mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 06:16:36 +00:00
jpegdec: Fix decoding of streams that don't signal exactly twice the height
... and also progressive streams.
This commit is contained in:
parent
09ee89f4c4
commit
aae7fcc0b5
1 changed files with 10 additions and 2 deletions
|
@ -1220,12 +1220,13 @@ gst_jpeg_dec_handle_frame (GstVideoDecoder * bdec, GstVideoCodecFrame * frame)
|
||||||
/* is it interlaced MJPEG? (we really don't want to scan the jpeg data
|
/* 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) */
|
* to see if there are two SOF markers in the packet to detect this) */
|
||||||
if (gst_video_decoder_get_packetized (bdec) &&
|
if (gst_video_decoder_get_packetized (bdec) &&
|
||||||
|
dec->input_state->info.height > height &&
|
||||||
dec->input_state->info.height <= (height * 2)
|
dec->input_state->info.height <= (height * 2)
|
||||||
&& dec->input_state->info.width == width) {
|
&& dec->input_state->info.width == width) {
|
||||||
GST_LOG_OBJECT (dec,
|
GST_LOG_OBJECT (dec,
|
||||||
"looks like an interlaced image: "
|
"looks like an interlaced image: "
|
||||||
"input width/height of %dx%d with JPEG frame width/height of %dx%d",
|
"input width/height of %dx%d with JPEG frame width/height of %dx%d",
|
||||||
dec->input_state->info.height, dec->input_state->info.width, width,
|
dec->input_state->info.width, dec->input_state->info.height, width,
|
||||||
height);
|
height);
|
||||||
output_height = dec->input_state->info.height;
|
output_height = dec->input_state->info.height;
|
||||||
height = dec->input_state->info.height / 2;
|
height = dec->input_state->info.height / 2;
|
||||||
|
@ -1301,8 +1302,15 @@ gst_jpeg_dec_handle_frame (GstVideoDecoder * bdec, GstVideoCodecFrame * frame)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (dec,
|
||||||
|
"got for second field of interlaced image: "
|
||||||
|
"input width/height of %dx%d with JPEG frame width/height of %dx%d",
|
||||||
|
dec->input_state->info.width, dec->input_state->info.height,
|
||||||
|
dec->cinfo.output_width, dec->cinfo.output_height);
|
||||||
|
|
||||||
if (dec->cinfo.output_width != GST_VIDEO_INFO_WIDTH (&state->info) ||
|
if (dec->cinfo.output_width != GST_VIDEO_INFO_WIDTH (&state->info) ||
|
||||||
dec->cinfo.output_height * 2 > GST_VIDEO_INFO_HEIGHT (&state->info) ||
|
GST_VIDEO_INFO_HEIGHT (&state->info) <= dec->cinfo.output_height ||
|
||||||
|
GST_VIDEO_INFO_HEIGHT (&state->info) > (dec->cinfo.output_height * 2) ||
|
||||||
field2_format != GST_VIDEO_INFO_FORMAT (&state->info)) {
|
field2_format != GST_VIDEO_INFO_FORMAT (&state->info)) {
|
||||||
GST_WARNING_OBJECT (dec, "second field has different format than first");
|
GST_WARNING_OBJECT (dec, "second field has different format than first");
|
||||||
gst_video_frame_unmap (&vframe);
|
gst_video_frame_unmap (&vframe);
|
||||||
|
|
Loading…
Reference in a new issue