deinterlace: Allow for 5 fields for interpolation

Add an extra field to the simple deinterlace implementation,
so that methods can potentially use 5 fields - the current
field, and 2 before and 2 after.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/444>
This commit is contained in:
Jan Schmidt 2020-01-03 02:33:25 +11:00 committed by GStreamer Merge Bot
parent 5468988223
commit 1c1bc56a3b
2 changed files with 17 additions and 10 deletions

View file

@ -377,7 +377,7 @@ gst_deinterlace_simple_method_deinterlace_frame_packed (GstDeinterlaceMethod *
if (framep)
frame_width = MIN (frame_width, GST_VIDEO_FRAME_PLANE_STRIDE (framep, 0));
g_assert (dm_class->fields_required <= 4);
g_assert (dm_class->fields_required <= 5);
frame1 =
(cur_field_idx + 1 <
@ -418,6 +418,9 @@ gst_deinterlace_simple_method_deinterlace_frame_packed (GstDeinterlaceMethod *
frame_width);
} else {
/* interpolating */
scanlines.tp2 = get_line (&lg, -2, 0, i, -1);
scanlines.bp2 = get_line (&lg, -2, 0, i, 1);
scanlines.ttp = get_line (&lg, -1, 0, i, -2);
scanlines.mp = get_line (&lg, -1, 0, i, 0);
scanlines.bbp = get_line (&lg, -1, 0, i, 2);
@ -532,6 +535,9 @@ static void
copy_scanline (self, LINE (dest, i), &scanlines, frame_width);
} else {
/* interpolating */
scanlines.tp2 = get_line (lg, -2, plane, i, -1);
scanlines.bp2 = get_line (lg, -2, plane, i, 1);
scanlines.ttp = get_line (lg, -1, plane, i, -2);
scanlines.mp = get_line (lg, -1, plane, i, 0);
scanlines.bbp = get_line (lg, -1, plane, i, 2);
@ -573,7 +579,7 @@ gst_deinterlace_simple_method_deinterlace_frame_planar (GstDeinterlaceMethod *
g_assert (self->copy_scanline_planar[0] != NULL);
g_assert (self->copy_scanline_planar[1] != NULL);
g_assert (self->copy_scanline_planar[2] != NULL);
g_assert (dm_class->fields_required <= 4);
g_assert (dm_class->fields_required <= 5);
for (i = 0; i < 3; i++) {
copy_scanline = self->copy_scanline_planar[i];
@ -599,7 +605,7 @@ gst_deinterlace_simple_method_deinterlace_frame_nv12 (GstDeinterlaceMethod *
g_assert (self->interpolate_scanline_packed != NULL);
g_assert (self->copy_scanline_packed != NULL);
g_assert (dm_class->fields_required <= 4);
g_assert (dm_class->fields_required <= 5);
for (i = 0; i < 2; i++) {
gst_deinterlace_simple_method_deinterlace_frame_planar_plane (self,

View file

@ -135,19 +135,20 @@ struct _GstDeinterlaceScanlineData {
const guint8 *tt0, *t0, *m0, *b0, *bb0;
const guint8 *tt1, *t1, *m1, *b1, *bb1;
const guint8 *tt2, *t2, *m2, *b2, *bb2;
const guint8 *tp2, *bp2;
gboolean bottom_field;
};
/*
* For interpolate_scanline the input is:
*
* | t-3 t-2 t-1 t t+1
* | Field 3 | Field 2 | Field 1 | Field 0 | Field -1
* | TT3 | | TT1 | | TTp
* | | T2 | | T0 |
* | M3 | | M1 | | Mp
* | | B2 | | B0 |
* | BB3 | | BB1 | | BBp
* | t-3 t-2 t-1 t t+1 t+2
* | Field 3 | Field 2 | Field 1 | Field 0 | Field -1 | Field -2
* | TT3 | | TT1 | | TTp |
* | | T2 | | T0 | | Tp2
* | M3 | | M1 | | Mp |
* | | B2 | | B0 | | Bp2
* | BB3 | | BB1 | | BBp |
*
* For copy_scanline the input is:
*