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)) {
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);