[MPlayer-cvslog] CVS: main/libvo vo_dfbmga.c,1.24,1.25

Ville Syrjälä CVS syncmail at mplayerhq.hu
Thu Feb 17 01:05:25 CET 2005


CVS change done by Ville Syrjälä CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv5023

Modified Files:
	vo_dfbmga.c 
Log Message:
Added NV12/NV21 support.

Index: vo_dfbmga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_dfbmga.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- vo_dfbmga.c	31 Jan 2005 17:59:36 -0000	1.24
+++ vo_dfbmga.c	17 Feb 2005 00:05:23 -0000	1.25
@@ -102,7 +102,7 @@
 static int osd_current;
 static int osd_max;
 
-static int is_g200 = 0;
+static int is_g200;
 
 /******************************
 *	    vo_dfbmga         *
@@ -149,6 +149,12 @@
 	  return "I420";
      case DSPF_ALUT44:
 	  return "ALUT44";
+#if DIRECTFBVERSION > 921
+     case DSPF_NV12:
+          return "NV12";
+     case DSPF_NV21:
+          return "NV21";
+#endif
      default:
 	  return "Unknown pixel format";
      }
@@ -175,6 +181,12 @@
      case IMGFMT_I420:
      case IMGFMT_IYUV:
           return DSPF_I420;
+#if DIRECTFBVERSION > 921
+     case IMGFMT_NV12:
+          return DSPF_NV12;
+     case IMGFMT_NV21:
+          return DSPF_NV21;
+#endif
      default:
 	  return DSPF_UNKNOWN;
      }
@@ -845,14 +857,23 @@
                if (is_g200)
                     return 0;
           case IMGFMT_YUY2:
-               return (VFCAP_HWSCALE_UP |
-                       VFCAP_HWSCALE_DOWN |
-                       VFCAP_CSP_SUPPORTED_BY_HW |
-                       VFCAP_CSP_SUPPORTED |
-                       VFCAP_OSD);
+               break;
+#if DIRECTFBVERSION > 921
+          case IMGFMT_NV12:
+          case IMGFMT_NV21:
+               if (!use_bes || use_crtc2)
+                    return 0;
+               break;
+#endif
+          default:
+               return 0;
      }
 
-     return 0;
+     return (VFCAP_HWSCALE_UP |
+             VFCAP_HWSCALE_DOWN |
+             VFCAP_CSP_SUPPORTED_BY_HW |
+             VFCAP_CSP_SUPPORTED |
+             VFCAP_OSD);
 }
 
 static void
@@ -946,6 +967,10 @@
 			      ((uint8_t *) dst) + pitch * y0 + 2 * x0 + 1,
                               pitch );
 	  break;
+#if DIRECTFBVERSION > 921
+     case DSPF_NV12:
+     case DSPF_NV21:
+#endif
      case DSPF_I420:
      case DSPF_YV12:
 	  vo_draw_alpha_yv12( w, h, src, srca, stride,
@@ -977,8 +1002,18 @@
 
      dst += pitch * in_height;
 
-     x /= 2; y /= 2;
-     w /= 2; h /= 2;
+     y /= 2;
+     h /= 2;
+
+#if DIRECTFBVERSION > 921
+     if (frame_format == DSPF_NV12 || frame_format == DSPF_NV21) {
+          memcpy_pic( dst + pitch * y + x, src[1],
+                      w, h, pitch, stride[1] );
+     } else
+#endif
+     {
+     x /= 2;
+     w /= 2;
      pitch /= 2;
 
      if (frame_format == DSPF_I420 )
@@ -996,6 +1031,7 @@
      else
           memcpy_pic( dst + pitch * y + x, src[1],
                       w, h, pitch, stride[1] );
+     }
 
      frame->Unlock( frame );
 
@@ -1162,15 +1198,23 @@
           mpi->stride[0] = pitch;
 
           if (mpi->flags & MP_IMGFLAG_PLANAR) {
+               if (mpi->num_planes > 2) {
                mpi->stride[1] = mpi->stride[2] = pitch / 2;
 
                if (mpi->flags & MP_IMGFLAG_SWAPPED) {
+                    /* I420 */
                     mpi->planes[1] = dst + in_height * pitch;
                     mpi->planes[2] = mpi->planes[1] + in_height * pitch / 4;
                } else {
+                    /* YV12 */
                     mpi->planes[2] = dst + in_height * pitch;
                     mpi->planes[1] = mpi->planes[2] + in_height * pitch / 4;
                }
+               } else {
+                    /* NV12/NV21 */
+                    mpi->stride[1] = pitch;
+                    mpi->planes[1] = dst + in_height * pitch;
+               }
           }
 
           mpi->flags |= MP_IMGFLAG_DIRECT;




More information about the MPlayer-cvslog mailing list