summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-08-31 20:45:06 +0000
committeralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-08-31 20:45:06 +0000
commitd169756b83ab07b13602f87054d7e99095dfc34b (patch)
tree6199dfe3ce7671948deb6c97a4855ad26e06ee99
parent94b4a47fa4a7d52dbe09dfc4426f3bb778954315 (diff)
downloadmpv-d169756b83ab07b13602f87054d7e99095dfc34b.tar.bz2
mpv-d169756b83ab07b13602f87054d7e99095dfc34b.tar.xz
basic nv12 and nv21 support by Angelo Cano <angelo_cano@fastmail.fm>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10743 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libmpcodecs/img_format.c1
-rw-r--r--libmpcodecs/img_format.h1
-rw-r--r--libmpcodecs/mp_image.h11
-rw-r--r--libmpcodecs/vd_raw.c15
4 files changed, 23 insertions, 5 deletions
diff --git a/libmpcodecs/img_format.c b/libmpcodecs/img_format.c
index ab7a08f5fa..1f581e1708 100644
--- a/libmpcodecs/img_format.c
+++ b/libmpcodecs/img_format.c
@@ -32,6 +32,7 @@ char *vo_format_name(int format)
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");
diff --git a/libmpcodecs/img_format.h b/libmpcodecs/img_format.h
index 6c6d66f99f..fd2a2f9ad1 100644
--- a/libmpcodecs/img_format.h
+++ b/libmpcodecs/img_format.h
@@ -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 --git a/libmpcodecs/mp_image.h b/libmpcodecs/mp_image.h
index 9efe128954..4a0544c038 100644
--- a/libmpcodecs/mp_image.h
+++ b/libmpcodecs/mp_image.h
@@ -183,6 +183,17 @@ static inline void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){
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;
diff --git a/libmpcodecs/vd_raw.c b/libmpcodecs/vd_raw.c
index 90689c3f35..407bcec7e6 100644
--- a/libmpcodecs/vd_raw.c
+++ b/libmpcodecs/vd_raw.c
@@ -68,13 +68,18 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
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;