[MPlayer-dev-eng] [PATCH]Implement bob-deinterlacing for VDPAU

Carl Eugen Hoyos cehoyos at rainbow.studorg.tuwien.ac.at
Mon Feb 23 01:56:53 CET 2009


Hi!

Attached is a first patch to implement bob-deinterlacing with vdpau. The 
patch is also needed (but not sufficient) for advanced deinterlacing.
Testing the patch with V.VOB shows that resualts are different from -vf 
field.
OSD has to be improved...

Please comment, Carl Eugen
-------------- next part --------------
Index: libvo/vo_vdpau.c
===================================================================
--- libvo/vo_vdpau.c	(revision 28701)
+++ libvo/vo_vdpau.c	(working copy)
@@ -139,6 +139,7 @@
 static int                                pullup;
 static float                              denoise;
 static float                              sharpen;
+static int                                top_field_first;
 
 static VdpDecoder                         decoder;
 static int                                decoder_max_refs;
@@ -167,6 +168,7 @@
 
 static void video_to_output_surface(void)
 {
+    int i;
     VdpTime dummy;
     VdpStatus vdp_st;
     VdpOutputSurface output_surface = output_surfaces[surface_num];
@@ -178,15 +180,22 @@
                                                              &dummy);
     CHECK_ST_WARNING("Error when calling vdp_presentation_queue_block_until_surface_idle")
 
-    // we would need to provide past and future frames to allow deinterlacing,
-    // which is not really possible currently. Deinterlacing is supposed to fall
-    // back to bob deinterlacing, but that seems not to work either.
+    // we would need to provide past and future frames to allow advanced
+    // deinterlacing, which is not really possible currently.
+    for (i = 0; i <= (deint ? 1 : 0); i++) {
+        int field = top_field_first ? i : 1 - i;
+        if (i) {
+            flip_page();
+            output_surface = output_surfaces[surface_num];
+        }
     vdp_st = vdp_video_mixer_render(video_mixer, VDP_INVALID_HANDLE, 0,
+                                    deint ? field :
                                     VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME,
                                     0, NULL, surface_render[vid_surface_num].surface, 0, NULL, &src_rect_vid,
                                     output_surface,
                                     NULL, &out_rect_vid, 0, NULL);
     CHECK_ST_WARNING("Error when calling vdp_video_mixer_render")
+    }
 }
 
 static void resize(void)
@@ -344,9 +353,9 @@
         &vid_height,
         &vdp_chroma_type
     };
-    if (deint == 1)
+    if (deint == 2)
         features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL;
-    if (deint == 2)
+    if (deint == 3)
         features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL;
     if (pullup)
         features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE;
@@ -664,6 +673,7 @@
                                                     mpi->stride); // pitch
         CHECK_ST_ERROR("Error when calling vdp_video_surface_put_bits_y_cb_cr")
     }
+    top_field_first = mpi->fields & MP_IMGFIELD_TOP_FIRST;
 
     video_to_output_surface();
     return VO_TRUE;
@@ -766,8 +776,9 @@
     "\nOptions:\n"
     "  deint\n"
     "    0: no deinterlacing\n"
-    "    1: temporal deinterlacing (not yet working)\n"
-    "    2: temporal-spatial deinterlacing (not yet working)\n"
+    "    1: bob deinterlacing (current fallback)\n"
+    "    2: temporal deinterlacing (not yet working)\n"
+    "    3: temporal-spatial deinterlacing (not yet working)\n"
     "  pullup\n"
     "    Try to apply inverse-telecine (needs deinterlacing, not working)\n"
     "  denoise\n"


More information about the MPlayer-dev-eng mailing list