[MPlayer-dev-eng] [PATCH] tv tuners and nv12 image format

Angelo Cano angelo_cano at fastmail.fm
Wed Jul 2 05:13:36 CEST 2003


doesn't touch anything in lib/postproc  (no swscale.c stuff)

-------------- next part --------------
diff -Nur main/DOCS/de/mplayer.1 1/DOCS/de/mplayer.1
--- main/DOCS/de/mplayer.1	Sat Mar 22 07:01:47 2003
+++ 1/DOCS/de/mplayer.1	Tue Jul  1 21:50:09 2003
@@ -756,7 +756,7 @@
 Gibt die Frequenz an, auf die der Tuner gesetzt wird (z.B.\& 511.250).
 Kann nicht zusammen mit 'channels' benutzt werden.
 .IPs outfmt=<Wert>
-Ausgabeformat des Tuners (yv12, rgb32, rgb24, rgb16, rgb15, uyvy, yuy2, i420)
+Ausgabeformat des Tuners (yv12, rgb32, rgb24, rgb16, rgb15, uyvy, yuy2, i420, nv12, nv21)
 .IPs width=<Wert>
 Breite des Ausgabefensters
 .IPs height=<Wert>
diff -Nur main/DOCS/en/mplayer.1 1/DOCS/en/mplayer.1
--- main/DOCS/en/mplayer.1	Mon Jun 23 12:20:17 2003
+++ 1/DOCS/en/mplayer.1	Tue Jul  1 21:50:09 2003
@@ -917,7 +917,7 @@
 Not compatible with channels parameter.
 .IPs outfmt=<value>
 output format of the tuner (yv12, rgb32, rgb24, rgb16, rgb15, uyvy, yuy2,
-i420)
+i420, nv12, nv21)
 .IPs width=<value>
 width of the output window
 .IPs height=<value>
diff -Nur main/DOCS/fr/mplayer.1 1/DOCS/fr/mplayer.1
--- main/DOCS/fr/mplayer.1	Wed Jun 25 12:06:22 2003
+++ 1/DOCS/fr/mplayer.1	Tue Jul  1 21:50:09 2003
@@ -946,7 +946,7 @@
 Non compatible avec le param?tre channels.
 .IPs outfmt=<valeur>
 format de sortie du tuner (yv12, rgb32, rgb24, rgb16, rgb15, uyvy, yuy2,
-i420)
+i420, nv12, nv21)
 .IPs width=<valeur>
 largeur de la fen?tre
 .IPs height=<valeur>
diff -Nur main/DOCS/hu/mplayer.1 1/DOCS/hu/mplayer.1
--- main/DOCS/hu/mplayer.1	Mon Apr 21 10:13:59 2003
+++ 1/DOCS/hu/mplayer.1	Tue Jul  1 21:50:09 2003
@@ -717,7 +717,7 @@
 Nem haszn?lhat? a channels opci?val.
 .IPs outfmt=<?rt?k>
 A tuner kimeneti form?tum?nak megv?ltoztat?sa
-(yv12, rgb32, rgb24, rgb16, rgb15, uyvy, yuy2, i420)
+(yv12, rgb32, rgb24, rgb16, rgb15, uyvy, yuy2, i420, nv12, nv21)
 .IPs width=<?rt?k>
 a kimeneti ablak sz?less?ge
 .IPs height=<?rt?k>
diff -Nur main/DOCS/pl/mplayer.1 1/DOCS/pl/mplayer.1
--- main/DOCS/pl/mplayer.1	Sun May 11 07:03:46 2003
+++ 1/DOCS/pl/mplayer.1	Tue Jul  1 21:50:09 2003
@@ -731,7 +731,7 @@
 Nie kompatybilne z parametrami kana??w.
 .IPs outfmt=<warto??>
 format danych wyj?ciowych tunera (yv12, rgb32, rgb24, rgb16,rgb15, uyvy, yuy2,
-i420)
+i420, nv12, nv21)
 .IPs width=<warto??>
 szeroko?? okna danych wyj?ciowych
 .IPs height=<warto??>
diff -Nur main/DOCS/zh/mplayer.1 1/DOCS/zh/mplayer.1
--- main/DOCS/zh/mplayer.1	Sun Apr  6 08:27:10 2003
+++ 1/DOCS/zh/mplayer.1	Tue Jul  1 21:50:09 2003
@@ -638,7 +638,7 @@
 ????????????????.
 .IPs outfmt=<????>
 ????????????????????(yv12, rgb32, rgb24, rgb16, rgb15, uyvy, yuy2,
-i420)
+i420, nv12, nv21)
 .IPs width=<????>
 ??????????????
 .IPs height=<????>
diff -Nur main/codec-cfg.c 1/codec-cfg.c
--- main/codec-cfg.c	Sat Jun 21 11:12:08 2003
+++ 1/codec-cfg.c	Tue Jul  1 21:50:09 2003
@@ -132,6 +132,8 @@
 		{"YV12",  IMGFMT_YV12},
 		{"I420",  IMGFMT_I420},
 		{"IYUV",  IMGFMT_IYUV},
+		{"NV12",  IMGFMT_NV12},
+		{"NV21",  IMGFMT_NV21},
 		{"YVU9",  IMGFMT_YVU9},
 		{"IF09",  IMGFMT_IF09},
 		{"444P",  IMGFMT_444P},
diff -Nur main/libmpcodecs/img_format.c 1/libmpcodecs/img_format.c
--- main/libmpcodecs/img_format.c	Sat Jun 21 11:12:08 2003
+++ 1/libmpcodecs/img_format.c	Tue Jul  1 21:50:09 2003
@@ -33,6 +33,7 @@
 	case IMGFMT_411P: return("Planar 411P");
 	case IMGFMT_NV12: return("Planar NV12");
         case IMGFMT_HM12: return("Planar NV12 Macroblock");
+	case IMGFMT_NV21: return("Planar NV21");
 	case IMGFMT_IUYV: return("Packed IUYV");
 	case IMGFMT_IY41: return("Packed IY41");
 	case IMGFMT_IYU1: return("Packed IYU1");
diff -Nur main/libmpcodecs/img_format.h 1/libmpcodecs/img_format.h
--- main/libmpcodecs/img_format.h	Sat Jun 21 11:12:08 2003
+++ 1/libmpcodecs/img_format.h	Tue Jul  1 21:50:09 2003
@@ -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
diff -Nur main/libmpcodecs/mp_image.h 1/libmpcodecs/mp_image.h
--- main/libmpcodecs/mp_image.h	Sat Jun 21 11:12:08 2003
+++ 1/libmpcodecs/mp_image.h	Tue Jul  1 21:50:09 2003
@@ -118,6 +118,17 @@
     mpi->flags|=MP_IMGFLAG_YUV;
     mpi->num_planes=3;
     switch(out_fmt){
+    case IMGFMT_NV12:
+	mpi->flags|=MP_IMGFLAG_SWAPPED;
+    case IMGFMT_NV21:
+	mpi->num_planes=2;
+	mpi->flags|=MP_IMGFLAG_PLANAR;
+	mpi->bpp=12;
+	mpi->chroma_width=(mpi->width>>0);
+	mpi->chroma_height=(mpi->height>>1);
+	mpi->chroma_x_shift=0;
+	mpi->chroma_y_shift=1;
+	return;
     case IMGFMT_I420:
     case IMGFMT_IYUV:
 	mpi->flags|=MP_IMGFLAG_SWAPPED;
diff -Nur main/libmpcodecs/vd_raw.c 1/libmpcodecs/vd_raw.c
--- main/libmpcodecs/vd_raw.c	Thu Oct 17 16:32:35 2002
+++ 1/libmpcodecs/vd_raw.c	Tue Jul  1 21:50:09 2003
@@ -68,7 +68,11 @@
 	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) {
             // Support for some common Planar YUV formats
 	    /* YV12,I420,IYUV */
             int cb=2, cr=1;
diff -Nur main/libmpcodecs/vf_eq.c 1/libmpcodecs/vf_eq.c
--- main/libmpcodecs/vf_eq.c	Sat Mar 15 15:45:03 2003
+++ 1/libmpcodecs/vf_eq.c	Tue Jul  1 21:50:09 2003
@@ -188,6 +188,7 @@
 	case IMGFMT_Y800:
 	case IMGFMT_Y8:
 	case IMGFMT_NV12:
+	case IMGFMT_NV21:
 	case IMGFMT_444P:
 	case IMGFMT_422P:
 	case IMGFMT_411P:
diff -Nur main/libmpcodecs/vf_scale.c 1/libmpcodecs/vf_scale.c
--- main/libmpcodecs/vf_scale.c	Mon Jun  2 05:39:23 2003
+++ 1/libmpcodecs/vf_scale.c	Tue Jul  1 21:50:09 2003
@@ -326,13 +326,15 @@
 
 //===========================================================================//
 
-//  supported Input formats: YV12, I420, IYUV, YUY2, UYVY, BGR32, BGR24, BGR16, BGR15, RGB32, RGB24, Y8, Y800
+//  supported Input formats: YV12, I420, IYUV, NV12, NV21, YUY2, UYVY, BGR32, BGR24, BGR16, BGR15, RGB32, RGB24, Y8, Y800
 
 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
     switch(fmt){
     case IMGFMT_YV12:
     case IMGFMT_I420:
     case IMGFMT_IYUV:
+    case IMGFMT_NV12:
+    case IMGFMT_NV21:
     case IMGFMT_UYVY:
     case IMGFMT_YUY2:
     case IMGFMT_BGR32:
diff -Nur main/libmpdemux/tv.c 1/libmpdemux/tv.c
--- main/libmpdemux/tv.c	Tue Jun  3 16:29:02 2003
+++ 1/libmpdemux/tv.c	Tue Jul  1 21:48:04 2003
@@ -150,6 +150,8 @@
 	picture_format = IMGFMT_RGB16;
     else if (!strcasecmp(tv_param_outfmt, "rgb15"))
 	picture_format = IMGFMT_RGB15;
+    else if (!strcasecmp(tv_param_outfmt, "nv12"))
+	picture_format = IMGFMT_NV12;
     else
     {
 	mp_msg(MSGT_TV, MSGL_ERR, "Unknown format given: %s\n", tv_param_outfmt);
diff -Nur main/libmpdemux/tvi_v4l.c 1/libmpdemux/tvi_v4l.c
--- main/libmpdemux/tvi_v4l.c	Mon Apr 28 21:23:47 2003
+++ 1/libmpdemux/tvi_v4l.c	Tue Jul  1 21:49:09 2003
@@ -151,7 +151,7 @@
 static const char *device_palette2name[] = {
     "-", "grey", "hi240", "rgb16", "rgb24", "rgb32", "rgb15", "yuv422",
     "yuyv", "uyvy", "yuv420", "yuv411", "raw", "yuv422p", "yuv411p",
-    "yuv420p", "yuv410p"
+    "yuv420p", "yuv410p", "nv12"
 };
 #define PALETTE(x) ((x < sizeof(device_palette2name)/sizeof(char*)) ? device_palette2name[x] : "UNKNOWN")
 
@@ -234,6 +234,8 @@
 	    return(VIDEO_PALETTE_RGB32);
 	case IMGFMT_YV12:
 	case IMGFMT_I420:
+	case IMGFMT_NV12:
+	case IMGFMT_NV21:
 	    return(VIDEO_PALETTE_YUV420P);
 	case IMGFMT_YUY2:
 	    return(VIDEO_PALETTE_YUV422);
diff -Nur main/m_option.c 1/m_option.c
--- main/m_option.c	Tue Jul  1 11:48:51 2003
+++ 1/m_option.c	Tue Jul  1 21:50:09 2003
@@ -927,6 +927,8 @@
   {"yuy2", IMGFMT_YUY2},
   {"yv12", IMGFMT_YV12},
   {"i420", IMGFMT_I420},
+  {"nv12", IMGFMT_NV12},
+  {"nv21", IMGFMT_NV21},
   {"yvu9", IMGFMT_YVU9},
   {"if09", IMGFMT_IF09},
   {"iyuv", IMGFMT_IYUV},


More information about the MPlayer-dev-eng mailing list