deinterlace: greedy, improve quality

scanlines->m1 = same line of the previous field
scanlines->t0 = line above of the current field
scanlines->b0 = line below of the current field
scanlines->mp = same line of the next field

Deinterlacing a field weaved frame:
When deinterlacing the top field, the next bottom field is available
(part of the same frame). but when deinterlacing the bottom field,
the next top field (part of the next frame) is not available and
scanlines->mp equals NULL.

In this case it's better to use greedy algorithm using the prevous field
(twice) rather then linear interpolation of the current field.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5331>
This commit is contained in:
Stijn Last 2023-09-15 09:12:25 +02:00 committed by Stijn Last
parent be9d9371b7
commit 4bda59f88d

View file

@ -74,7 +74,7 @@ deinterlace_greedy_interpolate_scanline_orc (GstDeinterlaceSimpleMethod * self,
{
guint max_comb = GST_DEINTERLACE_METHOD_GREEDY_L (self)->max_comb;
if (scanlines->m1 == NULL || scanlines->mp == NULL) {
if (scanlines->m1 == NULL) {
deinterlace_line_linear (out, scanlines->t0, scanlines->b0, size);
} else {
deinterlace_line_greedy (out, scanlines->m1, scanlines->t0, scanlines->b0,
@ -89,7 +89,7 @@ deinterlace_greedy_interpolate_scanline_orc_planar_u (GstDeinterlaceSimpleMethod
{
guint max_comb = GST_DEINTERLACE_METHOD_GREEDY_L (self)->max_comb;
if (scanlines->m1 == NULL || scanlines->mp == NULL) {
if (scanlines->m1 == NULL) {
deinterlace_line_linear (out, scanlines->t0, scanlines->b0, size);
} else {
deinterlace_line_greedy (out, scanlines->m1, scanlines->t0, scanlines->b0,
@ -104,7 +104,7 @@ deinterlace_greedy_interpolate_scanline_orc_planar_v (GstDeinterlaceSimpleMethod
{
guint max_comb = GST_DEINTERLACE_METHOD_GREEDY_L (self)->max_comb;
if (scanlines->m1 == NULL || scanlines->mp == NULL) {
if (scanlines->m1 == NULL) {
deinterlace_line_linear (out, scanlines->t0, scanlines->b0, size);
} else {
deinterlace_line_greedy (out, scanlines->m1, scanlines->t0, scanlines->b0,