0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

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
This commit is contained in:
alex 2003-08-31 20:45:06 +00:00
parent 94b4a47fa4
commit d169756b83
4 changed files with 23 additions and 5 deletions

View File

@ -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");

View File

@ -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

View File

@ -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;

View File

@ -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;