diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-12-31 22:53:25 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-12-31 22:53:25 +0000 |
commit | a326622304cedacce34b31f47dafe7069e076e01 (patch) | |
tree | d4046032aae4527ec51bec2dd502b0c55991fc7e /libmpcodecs/mp_image.c | |
parent | 498ad7ba573b80ac8740886b46f9f8e660647858 (diff) | |
download | mpv-a326622304cedacce34b31f47dafe7069e076e01.tar.bz2 mpv-a326622304cedacce34b31f47dafe7069e076e01.tar.xz |
Add support for 16-bit per component YUV formats.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30152 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/mp_image.c')
-rw-r--r-- | libmpcodecs/mp_image.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libmpcodecs/mp_image.c b/libmpcodecs/mp_image.c index 3eb524d491..3d73a2e3ed 100644 --- a/libmpcodecs/mp_image.c +++ b/libmpcodecs/mp_image.c @@ -29,17 +29,18 @@ mp_image_t* alloc_mpi(int w, int h, unsigned long int fmt) { else mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8); if(mpi->flags&MP_IMGFLAG_PLANAR){ + int bpp = IMGFMT_IS_YUVP16(fmt)? 2 : 1; // YV12/I420/YVU9/IF09. feel free to add other planar formats here... - if(!mpi->stride[0]) mpi->stride[0]=mpi->width; - if(!mpi->stride[1]) mpi->stride[1]=mpi->stride[2]=mpi->chroma_width; + if(!mpi->stride[0]) mpi->stride[0]=bpp*mpi->width; + if(!mpi->stride[1]) mpi->stride[1]=mpi->stride[2]=bpp*mpi->chroma_width; if(mpi->flags&MP_IMGFLAG_SWAPPED){ // I420/IYUV (Y,U,V) - mpi->planes[1]=mpi->planes[0]+mpi->width*mpi->height; - mpi->planes[2]=mpi->planes[1]+mpi->chroma_width*mpi->chroma_height; + mpi->planes[1]=mpi->planes[0]+mpi->stride[0]*mpi->height; + mpi->planes[2]=mpi->planes[1]+mpi->stride[1]*mpi->chroma_height; } else { // YV12,YVU9,IF09 (Y,V,U) - mpi->planes[2]=mpi->planes[0]+mpi->width*mpi->height; - mpi->planes[1]=mpi->planes[2]+mpi->chroma_width*mpi->chroma_height; + mpi->planes[2]=mpi->planes[0]+mpi->stride[0]*mpi->height; + mpi->planes[1]=mpi->planes[2]+mpi->stride[1]*mpi->chroma_height; } } else { if(!mpi->stride[0]) mpi->stride[0]=mpi->width*mpi->bpp/8; |