mirror of
https://github.com/mpv-player/mpv
synced 2025-04-01 23:00:41 +00:00
yvu9 and if09 support
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6526 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
74323ca8bf
commit
78191f35e9
@ -76,6 +76,7 @@ static inline void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){
|
||||
mpi->flags|=MP_IMGFLAG_PLANAR;
|
||||
mpi->bpp=12;
|
||||
return;
|
||||
case IMGFMT_IF09:
|
||||
case IMGFMT_YVU9:
|
||||
mpi->flags|=MP_IMGFLAG_PLANAR;
|
||||
mpi->bpp=9;
|
||||
|
@ -67,6 +67,8 @@ static int init(sh_video_t *sh){
|
||||
case IMGFMT_I420:
|
||||
case IMGFMT_IYUV:
|
||||
DS_VideoDecoder_SetDestFmt(sh->context,12,out_fmt);break; // planar YUV
|
||||
case IMGFMT_YVU9:
|
||||
DS_VideoDecoder_SetDestFmt(sh->context,9,out_fmt);break;
|
||||
default:
|
||||
DS_VideoDecoder_SetDestFmt(sh->context,out_fmt&255,0); // RGB/BGR
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){
|
||||
|
||||
// init driver
|
||||
static int init(sh_video_t *sh){
|
||||
if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,sh->format)) return 0;
|
||||
if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12)) return 0;
|
||||
return xacodec_init_video(sh,sh->codec->outfmt[sh->outfmtidx]);
|
||||
}
|
||||
|
||||
|
@ -146,6 +146,7 @@ static void draw_osd(struct vf_instance_s* vf_,int w,int h){
|
||||
static int config(struct vf_instance_s* vf,
|
||||
int width, int height, int d_width, int d_height,
|
||||
unsigned int flags, unsigned int outfmt){
|
||||
if (outfmt == IMGFMT_IF09) return 0;
|
||||
// calculate the missing parameters:
|
||||
#if 0
|
||||
if(vf->priv->exp_w<width) vf->priv->exp_w=width;
|
||||
@ -194,10 +195,20 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
|
||||
if(mpi->flags&MP_IMGFLAG_PLANAR){
|
||||
mpi->planes[0]=vf->priv->dmpi->planes[0]+
|
||||
vf->priv->exp_y*vf->priv->dmpi->stride[0]+vf->priv->exp_x;
|
||||
if (mpi->imgfmt == IMGFMT_YVU9)
|
||||
{
|
||||
mpi->planes[1]=vf->priv->dmpi->planes[1]+
|
||||
(vf->priv->exp_y>>2)*vf->priv->dmpi->stride[1]+(vf->priv->exp_x>>2);
|
||||
mpi->planes[2]=vf->priv->dmpi->planes[2]+
|
||||
(vf->priv->exp_y>>2)*vf->priv->dmpi->stride[2]+(vf->priv->exp_x>>2);
|
||||
}
|
||||
else
|
||||
{
|
||||
mpi->planes[1]=vf->priv->dmpi->planes[1]+
|
||||
(vf->priv->exp_y>>1)*vf->priv->dmpi->stride[1]+(vf->priv->exp_x>>1);
|
||||
mpi->planes[2]=vf->priv->dmpi->planes[2]+
|
||||
(vf->priv->exp_y>>1)*vf->priv->dmpi->stride[2]+(vf->priv->exp_x>>1);
|
||||
}
|
||||
mpi->stride[1]=vf->priv->dmpi->stride[1];
|
||||
mpi->stride[2]=vf->priv->dmpi->stride[2];
|
||||
} else {
|
||||
@ -231,6 +242,19 @@ static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){
|
||||
vf->priv->exp_y*vf->priv->dmpi->stride[0]+vf->priv->exp_x,
|
||||
mpi->planes[0], mpi->w, mpi->h,
|
||||
vf->priv->dmpi->stride[0],mpi->stride[0]);
|
||||
if (mpi->imgfmt == IMGFMT_YVU9)
|
||||
{
|
||||
memcpy_pic(vf->priv->dmpi->planes[1]+
|
||||
(vf->priv->exp_y>>2)*vf->priv->dmpi->stride[1]+(vf->priv->exp_x>>2),
|
||||
mpi->planes[1], mpi->w>>2, mpi->h>>2,
|
||||
vf->priv->dmpi->stride[1],mpi->stride[1]);
|
||||
memcpy_pic(vf->priv->dmpi->planes[2]+
|
||||
(vf->priv->exp_y>>2)*vf->priv->dmpi->stride[2]+(vf->priv->exp_x>>2),
|
||||
mpi->planes[2], mpi->w>>2, mpi->h>>2,
|
||||
vf->priv->dmpi->stride[2],mpi->stride[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy_pic(vf->priv->dmpi->planes[1]+
|
||||
(vf->priv->exp_y>>1)*vf->priv->dmpi->stride[1]+(vf->priv->exp_x>>1),
|
||||
mpi->planes[1], mpi->w>>1, mpi->h>>1,
|
||||
@ -239,6 +263,7 @@ static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){
|
||||
(vf->priv->exp_y>>1)*vf->priv->dmpi->stride[2]+(vf->priv->exp_x>>1),
|
||||
mpi->planes[2], mpi->w>>1, mpi->h>>1,
|
||||
vf->priv->dmpi->stride[2],mpi->stride[2]);
|
||||
}
|
||||
} else {
|
||||
memcpy_pic(vf->priv->dmpi->planes[0]+
|
||||
vf->priv->exp_y*vf->priv->dmpi->stride[0]+vf->priv->exp_x*(vf->priv->dmpi->bpp/8),
|
||||
|
@ -31,12 +31,15 @@ static int open(vf_instance_t *vf, char* args){
|
||||
if(!strcasecmp(args,"yuy2")) vf->priv->fmt=IMGFMT_YUY2; else
|
||||
if(!strcasecmp(args,"yv12")) vf->priv->fmt=IMGFMT_YV12; else
|
||||
if(!strcasecmp(args,"i420")) vf->priv->fmt=IMGFMT_I420; else
|
||||
if(!strcasecmp(args,"yvu9")) vf->priv->fmt=IMGFMT_YVU9; else
|
||||
if(!strcasecmp(args,"if09")) vf->priv->fmt=IMGFMT_IF09; else
|
||||
if(!strcasecmp(args,"iyuv")) vf->priv->fmt=IMGFMT_IYUV; else
|
||||
if(!strcasecmp(args,"uyvy")) vf->priv->fmt=IMGFMT_UYVY; else
|
||||
if(!strcasecmp(args,"bgr24")) vf->priv->fmt=IMGFMT_BGR24; else
|
||||
if(!strcasecmp(args,"bgr32")) vf->priv->fmt=IMGFMT_BGR32; else
|
||||
if(!strcasecmp(args,"bgr16")) vf->priv->fmt=IMGFMT_BGR16; else
|
||||
if(!strcasecmp(args,"bgr15")) vf->priv->fmt=IMGFMT_BGR15; else
|
||||
if(!strcasecmp(args,"bgr8")) vf->priv->fmt=IMGFMT_BGR8; else
|
||||
{ printf("Unknown format name: '%s'\n",args);return 0;}
|
||||
} else
|
||||
vf->priv->fmt=IMGFMT_YUY2;
|
||||
|
Loading…
Reference in New Issue
Block a user