[MPlayer-dev-eng] [PATCH]Support packed YUV422 in vo vdpau, round 2

Carl Eugen Hoyos cehoyos at rainbow.studorg.tuwien.ac.at
Sat Mar 28 20:24:28 CET 2009


Hi!

Attached is a shorter patch to support yuy2 and uyvy in vo vdpau.
I also implemented support for nv12 (it needs destdata[1]=destdata[2]), 
patch follows.

Please comment, Carl Eugen
-------------- next part --------------
Index: libvo/vo_vdpau.c
===================================================================
--- libvo/vo_vdpau.c	(revision 29081)
+++ libvo/vo_vdpau.c	(working copy)
@@ -174,7 +174,8 @@
 static int                                vid_surface_num;
 static uint32_t                           vid_width, vid_height;
 static uint32_t                           image_format;
-static const VdpChromaType                vdp_chroma_type = VDP_CHROMA_TYPE_420;
+static VdpChromaType                      vdp_chroma_type;
+static VdpYCbCrFormat                     vdp_pixel_format;
 
 /* draw_osd */
 static unsigned char                     *index_data;
@@ -598,6 +599,19 @@
     if (vdp_flip_queue == VDP_INVALID_HANDLE && win_x11_init_vdpau_flip_queue())
         return -1;
 
+    vdp_chroma_type = VDP_CHROMA_TYPE_420;
+    switch (image_format) {
+        case IMGFMT_YV12:
+            vdp_pixel_format = VDP_YCBCR_FORMAT_YV12;
+            break;
+        case IMGFMT_YUY2:
+            vdp_pixel_format = VDP_YCBCR_FORMAT_YUYV;
+            vdp_chroma_type  = VDP_CHROMA_TYPE_422;
+            break;
+        case IMGFMT_UYVY:
+            vdp_pixel_format = VDP_YCBCR_FORMAT_UYVY;
+            vdp_chroma_type  = VDP_CHROMA_TYPE_422;
+    }
     if (create_vdp_mixer(vdp_chroma_type))
         return -1;
 
@@ -887,7 +901,7 @@
         deint_counter = (deint_counter + 1) % 3;
         vid_surface_num = rndr - surface_render;
         vdp_st = vdp_video_surface_put_bits_y_cb_cr(rndr->surface,
-                                                    VDP_YCBCR_FORMAT_YV12,
+                                                    vdp_pixel_format,
                                                     (const void *const*)destdata,
                                                     mpi->stride); // pitch
         CHECK_ST_ERROR("Error when calling vdp_video_surface_put_bits_y_cb_cr")
@@ -927,6 +941,8 @@
     int default_flags = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD | VFCAP_EOSD | VFCAP_EOSD_UNSCALED;
     switch (format) {
         case IMGFMT_YV12:
+        case IMGFMT_YUY2:
+        case IMGFMT_UYVY:
             return default_flags | VOCAP_NOSLICES;
         case IMGFMT_VDPAU_MPEG1:
         case IMGFMT_VDPAU_MPEG2:


More information about the MPlayer-dev-eng mailing list