changeset 28059:8f43ff543dc6

Add support for YCBCR MESA texture format to vo_gl.
author reimar
date Fri, 05 Dec 2008 15:36:54 +0000
parents 323c1ddffdd6
children 70a2108520eb
files libvo/gl_common.c libvo/gl_common.h libvo/vo_gl.c
diffstat 3 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/gl_common.c	Fri Dec 05 14:50:48 2008 +0000
+++ b/libvo/gl_common.c	Fri Dec 05 15:36:54 2008 +0000
@@ -212,6 +212,13 @@
       *gl_format = GL_LUMINANCE;
       *gl_type = GL_UNSIGNED_BYTE;
       break;
+    case IMGFMT_UYVY:
+    case IMGFMT_YUY2:
+      *gl_texfmt = GL_YCBCR_MESA;
+      *bpp = 16;
+      *gl_format = GL_YCBCR_MESA;
+      *gl_type = fmt == IMGFMT_UYVY ? GL_UNSIGNED_SHORT_8_8 : GL_UNSIGNED_SHORT_8_8_REV;
+      break;
 #if 0
     // we do not support palettized formats, although the format the
     // swscale produces works
@@ -484,6 +491,8 @@
     case GL_LUMINANCE:
     case GL_ALPHA:
       return component_size;
+    case GL_YCBCR_MESA:
+      return 2;
     case GL_RGB:
     case GL_BGR:
       return 3 * component_size;
--- a/libvo/gl_common.h	Fri Dec 05 14:50:48 2008 +0000
+++ b/libvo/gl_common.h	Fri Dec 05 15:36:54 2008 +0000
@@ -210,6 +210,15 @@
 #ifndef GL_UNSIGNED_SHORT_1_5_5_5_REV
 #define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
 #endif
+#ifndef GL_UNSIGNED_SHORT_8_8
+#define GL_UNSIGNED_SHORT_8_8 0x85BA
+#endif
+#ifndef GL_UNSIGNED_SHORT_8_8_REV
+#define GL_UNSIGNED_SHORT_8_8_REV 0x85BB
+#endif
+#ifndef GL_YCBCR_MESA
+#define GL_YCBCR_MESA 0x8757
+#endif
 #ifndef GL_RGB32F
 #define GL_RGB32F 0x8815
 #endif
--- a/libvo/vo_gl.c	Fri Dec 05 14:50:48 2008 +0000
+++ b/libvo/vo_gl.c	Fri Dec 05 15:36:54 2008 +0000
@@ -71,6 +71,7 @@
 static int osd_color;
 
 static int use_aspect;
+static int use_ycbcr;
 static int use_yuv;
 static int lscale;
 static int cscale;
@@ -833,6 +834,8 @@
     // ideally MPlayer should be fixed instead not to use Y800 when it has the choice
     if (!use_yuv && (format == IMGFMT_Y8 || format == IMGFMT_Y800))
         return 0;
+    if (!use_ycbcr && (format == IMGFMT_UYVY || format == IMGFMT_YUY2))
+        return 0;
     if (many_fmts &&
          glFindFormat(format, NULL, NULL, NULL, NULL))
         return caps;
@@ -858,6 +861,7 @@
   {"osd",          OPT_ARG_BOOL, &use_osd,      NULL},
   {"scaled-osd",   OPT_ARG_BOOL, &scaled_osd,   NULL},
   {"aspect",       OPT_ARG_BOOL, &use_aspect,   NULL},
+  {"ycbcr",        OPT_ARG_BOOL, &use_ycbcr,    NULL},
   {"slice-height", OPT_ARG_INT,  &slice_height, (opt_test_f)int_non_neg},
   {"rectangle",    OPT_ARG_INT,  &use_rectangle,(opt_test_f)int_non_neg},
   {"yuv",          OPT_ARG_INT,  &use_yuv,      (opt_test_f)int_non_neg},
@@ -883,6 +887,7 @@
     use_osd = 1;
     scaled_osd = 0;
     use_aspect = 1;
+    use_ycbcr = 0;
     use_yuv = 0;
     lscale = 0;
     cscale = 0;