mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
deinterlace: Better alternate support
Improve line offset halving based on whether this field is top or bottom. Also handle the buffer state the same as mixed. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/866>
This commit is contained in:
parent
5f00810ee0
commit
4c4e1b580e
2 changed files with 27 additions and 3 deletions
|
@ -1029,7 +1029,8 @@ gst_deinterlace_get_buffer_state (GstDeinterlace * self, GstVideoFrame * frame,
|
|||
interlacing_mode = GST_VIDEO_INTERLACE_MODE_INTERLEAVED;
|
||||
|
||||
if (state) {
|
||||
if (interlacing_mode == GST_VIDEO_INTERLACE_MODE_MIXED) {
|
||||
if (interlacing_mode == GST_VIDEO_INTERLACE_MODE_MIXED ||
|
||||
interlacing_mode == GST_VIDEO_INTERLACE_MODE_ALTERNATE) {
|
||||
if (GST_VIDEO_FRAME_IS_RFF (frame)) {
|
||||
*state = GST_DEINTERLACE_BUFFER_STATE_RFF;
|
||||
} else if (GST_VIDEO_FRAME_IS_ONEFIELD (frame)) {
|
||||
|
|
|
@ -333,12 +333,35 @@ get_line (LinesGetter * lg, gint field_offset, guint plane, gint line,
|
|||
frame = lg->history[idx].frame;
|
||||
g_assert (frame);
|
||||
|
||||
/* Now frame already refers to the field we want, the correct one is taken
|
||||
* from the history */
|
||||
if (GST_VIDEO_FRAME_FLAG_IS_SET (frame, GST_VIDEO_FRAME_FLAG_TOP_FIELD) ||
|
||||
GST_VIDEO_FRAME_FLAG_IS_SET (frame, GST_VIDEO_FRAME_FLAG_BOTTOM_FIELD)) {
|
||||
/* Alternate frame containing a single field, adjust the line index */
|
||||
line /= 2;
|
||||
if (line_offset != 1)
|
||||
line_offset /= 2;
|
||||
switch (line_offset) {
|
||||
case -2:
|
||||
case 2:
|
||||
line_offset /= 2;
|
||||
break;
|
||||
case 1:
|
||||
/* the "next" line of a top field line is the same line of a bottom
|
||||
* field */
|
||||
if (!GST_VIDEO_FRAME_FLAG_IS_SET (frame, GST_VIDEO_FRAME_FLAG_TFF))
|
||||
line_offset = 0;
|
||||
break;
|
||||
case -1:
|
||||
/* the "previous" line of a bottom field line is the same line of a
|
||||
* top field */
|
||||
if (GST_VIDEO_FRAME_FLAG_IS_SET (frame, GST_VIDEO_FRAME_FLAG_TFF))
|
||||
line_offset = 0;
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
frame_height = GST_VIDEO_FRAME_COMP_HEIGHT (frame, plane);
|
||||
|
|
Loading…
Reference in a new issue