comparison libmpcodecs/vf.c @ 30110:19414a605695

Add support for 16-bit per component YUV formats.
author reimar
date Thu, 31 Dec 2009 22:53:25 +0000
parents 5cb79ad246f2
children c26218c27e73
comparison
equal deleted inserted replaced
30109:0f25d3062987 30110:19414a605695
381 mpi->planes[3]=mpi->planes[0]+(mpi->width*mpi->height)+2*(mpi->chroma_width*mpi->chroma_height); 381 mpi->planes[3]=mpi->planes[0]+(mpi->width*mpi->height)+2*(mpi->chroma_width*mpi->chroma_height);
382 } 382 }
383 else 383 else
384 mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8); 384 mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8);
385 if(mpi->flags&MP_IMGFLAG_PLANAR){ 385 if(mpi->flags&MP_IMGFLAG_PLANAR){
386 int bpp = IMGFMT_IS_YUVP16(mpi->imgfmt)? 2 : 1;
386 // YV12/I420/YVU9/IF09. feel free to add other planar formats here... 387 // YV12/I420/YVU9/IF09. feel free to add other planar formats here...
387 //if(!mpi->stride[0]) 388 //if(!mpi->stride[0])
388 mpi->stride[0]=mpi->width; 389 mpi->stride[0]=bpp*mpi->width;
389 //if(!mpi->stride[1]) 390 //if(!mpi->stride[1])
390 if(mpi->num_planes > 2){ 391 if(mpi->num_planes > 2){
391 mpi->stride[1]=mpi->stride[2]=mpi->chroma_width; 392 mpi->stride[1]=mpi->stride[2]=bpp*mpi->chroma_width;
392 if(mpi->flags&MP_IMGFLAG_SWAPPED){ 393 if(mpi->flags&MP_IMGFLAG_SWAPPED){
393 // I420/IYUV (Y,U,V) 394 // I420/IYUV (Y,U,V)
394 mpi->planes[1]=mpi->planes[0]+mpi->width*mpi->height; 395 mpi->planes[1]=mpi->planes[0]+mpi->stride[0]*mpi->height;
395 mpi->planes[2]=mpi->planes[1]+mpi->chroma_width*mpi->chroma_height; 396 mpi->planes[2]=mpi->planes[1]+mpi->stride[1]*mpi->chroma_height;
396 } else { 397 } else {
397 // YV12,YVU9,IF09 (Y,V,U) 398 // YV12,YVU9,IF09 (Y,V,U)
398 mpi->planes[2]=mpi->planes[0]+mpi->width*mpi->height; 399 mpi->planes[2]=mpi->planes[0]+mpi->stride[0]*mpi->height;
399 mpi->planes[1]=mpi->planes[2]+mpi->chroma_width*mpi->chroma_height; 400 mpi->planes[1]=mpi->planes[2]+mpi->stride[1]*mpi->chroma_height;
400 } 401 }
401 } else { 402 } else {
402 // NV12/NV21 403 // NV12/NV21
403 mpi->stride[1]=mpi->chroma_width; 404 mpi->stride[1]=mpi->chroma_width;
404 mpi->planes[1]=mpi->planes[0]+mpi->width*mpi->height; 405 mpi->planes[1]=mpi->planes[0]+mpi->stride[0]*mpi->height;
405 } 406 }
406 } else { 407 } else {
407 //if(!mpi->stride[0]) 408 //if(!mpi->stride[0])
408 mpi->stride[0]=mpi->width*mpi->bpp/8; 409 mpi->stride[0]=mpi->width*mpi->bpp/8;
409 if (mpi->flags & MP_IMGFLAG_RGB_PALETTE) 410 if (mpi->flags & MP_IMGFLAG_RGB_PALETTE)