[Mplayer-cvslog] CVS: main/libmpcodecs img_format.c,1.8,1.9 img_format.h,1.13,1.14 mp_image.h,1.26,1.27 vd_raw.c,1.14,1.15

Alex Beregszaszi alex at mplayerhq.hu
Sun Aug 31 22:45:37 CEST 2003


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv8215

Modified Files:
	img_format.c img_format.h mp_image.h vd_raw.c 
Log Message:
basic nv12 and nv21 support by Angelo Cano <angelo_cano at fastmail.fm>

Index: img_format.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/img_format.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- img_format.c	21 Jun 2003 01:47:25 -0000	1.8
+++ img_format.c	31 Aug 2003 20:45:06 -0000	1.9
@@ -32,6 +32,7 @@
 	case IMGFMT_422P: return("Planar 422P");
 	case IMGFMT_411P: return("Planar 411P");
 	case IMGFMT_NV12: return("Planar NV12");
+	case IMGFMT_NV21: return("Planar NV21");
         case IMGFMT_HM12: return("Planar NV12 Macroblock");
 	case IMGFMT_IUYV: return("Packed IUYV");
 	case IMGFMT_IY41: return("Packed IY41");

Index: img_format.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/img_format.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- img_format.h	21 Jun 2003 01:47:25 -0000	1.13
+++ img_format.h	31 Aug 2003 20:45:06 -0000	1.14
@@ -44,6 +44,7 @@
 #define IMGFMT_Y800 0x30303859
 #define IMGFMT_Y8   0x20203859
 #define IMGFMT_NV12 0x3231564E
+#define IMGFMT_NV21 0x3132564E
 
 /* unofficial Planar Formats, FIXME if official 4CC exists */
 #define IMGFMT_444P 0x50343434

Index: mp_image.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/mp_image.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- mp_image.h	18 Aug 2003 14:49:06 -0000	1.26
+++ mp_image.h	31 Aug 2003 20:45:06 -0000	1.27
@@ -183,6 +183,17 @@
 	mpi->bpp=16;
 	mpi->num_planes=1;
 	return;
+    case IMGFMT_NV12:
+	mpi->flags|=MP_IMGFLAG_SWAPPED;
+    case IMGFMT_NV21:
+	mpi->flags|=MP_IMGFLAG_PLANAR;
+	mpi->bpp=12;
+	mpi->num_planes=2;
+	mpi->chroma_width=(mpi->width>>0);
+	mpi->chroma_height=(mpi->height>>1);
+	mpi->chroma_x_shift=0;
+	mpi->chroma_y_shift=1;
+	return;
     }
     printf("mp_image: Unknown out_fmt: 0x%X\n",out_fmt);
     mpi->bpp=0;

Index: vd_raw.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vd_raw.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- vd_raw.c	17 Oct 2002 21:32:35 -0000	1.14
+++ vd_raw.c	31 Aug 2003 20:45:06 -0000	1.15
@@ -68,13 +68,18 @@
 	mpi->planes[0]=data;
 	mpi->stride[0]=mpi->width;
 	frame_size=mpi->stride[0]*mpi->h;
-        if(mpi->flags&MP_IMGFLAG_YUV) {
+	if((mpi->imgfmt == IMGFMT_NV12) || (mpi->imgfmt == IMGFMT_NV21))
+	{
+	    mpi->planes[1]=mpi->planes[0]+mpi->width*mpi->height;
+	    mpi->stride[1]=mpi->chroma_width;
+	    frame_size+=mpi->chroma_width*mpi->chroma_height;
+	} else if(mpi->flags&MP_IMGFLAG_YUV) {
+    	    int cb=2, cr=1;
+    	    if(mpi->flags&MP_IMGFLAG_SWAPPED) {
+        	cb=1; cr=2;
+    	    }
             // Support for some common Planar YUV formats
 	    /* YV12,I420,IYUV */
-            int cb=2, cr=1;
-            if(mpi->flags&MP_IMGFLAG_SWAPPED) {
-                cb=1; cr=2;
-            }
             mpi->planes[cb]=mpi->planes[0]+mpi->width*mpi->height;
             mpi->stride[cb]=mpi->chroma_width;
             mpi->planes[cr]=mpi->planes[cb]+mpi->chroma_width*mpi->chroma_height;



More information about the MPlayer-cvslog mailing list