mirror of
https://github.com/mpv-player/mpv
synced 2025-03-25 04:38:01 +00:00
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10142 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
8b0fe12840
commit
fb5d935251
@ -12,7 +12,6 @@
|
||||
|
||||
struct vf_priv_s {
|
||||
int field;
|
||||
mp_image_t *dmpi;
|
||||
};
|
||||
|
||||
//===========================================================================//
|
||||
@ -29,24 +28,24 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
|
||||
return vf_next_put_image(vf,(mp_image_t*)mpi->priv);
|
||||
}
|
||||
|
||||
vf->priv->dmpi=vf_get_image(vf->next,mpi->imgfmt,
|
||||
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
|
||||
MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
|
||||
mpi->width, mpi->height/2);
|
||||
|
||||
// set up mpi as a double-stride image of dmpi:
|
||||
vf->priv->dmpi->planes[0]=mpi->planes[0]+mpi->stride[0]*vf->priv->field;
|
||||
vf->priv->dmpi->stride[0]=2*mpi->stride[0];
|
||||
if(vf->priv->dmpi->flags&MP_IMGFLAG_PLANAR){
|
||||
vf->priv->dmpi->planes[1]=mpi->planes[1]+
|
||||
vf->dmpi->planes[0]=mpi->planes[0]+mpi->stride[0]*vf->priv->field;
|
||||
vf->dmpi->stride[0]=2*mpi->stride[0];
|
||||
if(vf->dmpi->flags&MP_IMGFLAG_PLANAR){
|
||||
vf->dmpi->planes[1]=mpi->planes[1]+
|
||||
mpi->stride[1]*vf->priv->field;
|
||||
vf->priv->dmpi->stride[1]=2*mpi->stride[1];
|
||||
vf->priv->dmpi->planes[2]=mpi->planes[2]+
|
||||
vf->dmpi->stride[1]=2*mpi->stride[1];
|
||||
vf->dmpi->planes[2]=mpi->planes[2]+
|
||||
mpi->stride[2]*vf->priv->field;
|
||||
vf->priv->dmpi->stride[2]=2*mpi->stride[2];
|
||||
vf->dmpi->stride[2]=2*mpi->stride[2];
|
||||
} else
|
||||
vf->priv->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!!
|
||||
vf->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!!
|
||||
|
||||
return vf_next_put_image(vf,vf->priv->dmpi);
|
||||
return vf_next_put_image(vf,vf->dmpi);
|
||||
}
|
||||
|
||||
//===========================================================================//
|
||||
|
@ -8,11 +8,6 @@
|
||||
#include "mp_image.h"
|
||||
#include "vf.h"
|
||||
|
||||
#include "../libvo/fastmemcpy.h"
|
||||
|
||||
struct vf_priv_s {
|
||||
mp_image_t *dmpi;
|
||||
};
|
||||
|
||||
//===========================================================================//
|
||||
|
||||
@ -26,22 +21,22 @@ static int config(struct vf_instance_s* vf,
|
||||
static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
|
||||
if(mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE){
|
||||
// try full DR !
|
||||
vf->priv->dmpi=vf_get_image(vf->next,mpi->imgfmt,
|
||||
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
|
||||
mpi->type, mpi->flags, mpi->width, mpi->height);
|
||||
// set up mpi as a upside-down image of dmpi:
|
||||
mpi->planes[0]=vf->priv->dmpi->planes[0]+
|
||||
vf->priv->dmpi->stride[0]*(vf->priv->dmpi->height-1);
|
||||
mpi->stride[0]=-vf->priv->dmpi->stride[0];
|
||||
mpi->planes[0]=vf->dmpi->planes[0]+
|
||||
vf->dmpi->stride[0]*(vf->dmpi->height-1);
|
||||
mpi->stride[0]=-vf->dmpi->stride[0];
|
||||
if(mpi->flags&MP_IMGFLAG_PLANAR){
|
||||
mpi->planes[1]=vf->priv->dmpi->planes[1]+
|
||||
vf->priv->dmpi->stride[1]*((vf->priv->dmpi->height>>mpi->chroma_y_shift)-1);
|
||||
mpi->stride[1]=-vf->priv->dmpi->stride[1];
|
||||
mpi->planes[2]=vf->priv->dmpi->planes[2]+
|
||||
vf->priv->dmpi->stride[2]*((vf->priv->dmpi->height>>mpi->chroma_y_shift)-1);
|
||||
mpi->stride[2]=-vf->priv->dmpi->stride[2];
|
||||
mpi->planes[1]=vf->dmpi->planes[1]+
|
||||
vf->dmpi->stride[1]*((vf->dmpi->height>>mpi->chroma_y_shift)-1);
|
||||
mpi->stride[1]=-vf->dmpi->stride[1];
|
||||
mpi->planes[2]=vf->dmpi->planes[2]+
|
||||
vf->dmpi->stride[2]*((vf->dmpi->height>>mpi->chroma_y_shift)-1);
|
||||
mpi->stride[2]=-vf->dmpi->stride[2];
|
||||
}
|
||||
mpi->flags|=MP_IMGFLAG_DIRECT;
|
||||
mpi->priv=(void*)vf->priv->dmpi;
|
||||
mpi->priv=(void*)vf->dmpi;
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,25 +48,25 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
|
||||
return vf_next_put_image(vf,(mp_image_t*)mpi->priv);
|
||||
}
|
||||
|
||||
vf->priv->dmpi=vf_get_image(vf->next,mpi->imgfmt,
|
||||
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
|
||||
MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
|
||||
mpi->width, mpi->height);
|
||||
|
||||
// set up mpi as a upside-down image of dmpi:
|
||||
vf->priv->dmpi->planes[0]=mpi->planes[0]+
|
||||
vf->dmpi->planes[0]=mpi->planes[0]+
|
||||
mpi->stride[0]*(mpi->height-1);
|
||||
vf->priv->dmpi->stride[0]=-mpi->stride[0];
|
||||
if(vf->priv->dmpi->flags&MP_IMGFLAG_PLANAR){
|
||||
vf->priv->dmpi->planes[1]=mpi->planes[1]+
|
||||
vf->dmpi->stride[0]=-mpi->stride[0];
|
||||
if(vf->dmpi->flags&MP_IMGFLAG_PLANAR){
|
||||
vf->dmpi->planes[1]=mpi->planes[1]+
|
||||
mpi->stride[1]*((mpi->height>>mpi->chroma_y_shift)-1);
|
||||
vf->priv->dmpi->stride[1]=-mpi->stride[1];
|
||||
vf->priv->dmpi->planes[2]=mpi->planes[2]+
|
||||
vf->dmpi->stride[1]=-mpi->stride[1];
|
||||
vf->dmpi->planes[2]=mpi->planes[2]+
|
||||
mpi->stride[2]*((mpi->height>>mpi->chroma_y_shift)-1);
|
||||
vf->priv->dmpi->stride[2]=-mpi->stride[2];
|
||||
vf->dmpi->stride[2]=-mpi->stride[2];
|
||||
} else
|
||||
vf->priv->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!!
|
||||
vf->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!!
|
||||
|
||||
return vf_next_put_image(vf,vf->priv->dmpi);
|
||||
return vf_next_put_image(vf,vf->dmpi);
|
||||
}
|
||||
|
||||
//===========================================================================//
|
||||
@ -81,7 +76,6 @@ static int open(vf_instance_t *vf, char* args){
|
||||
vf->get_image=get_image;
|
||||
vf->put_image=put_image;
|
||||
vf->default_reqs=VFCAP_ACCEPT_STRIDE;
|
||||
vf->priv=malloc(sizeof(struct vf_priv_s));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,6 @@ typedef struct FilterParam{
|
||||
struct vf_priv_s {
|
||||
FilterParam lumaParam;
|
||||
FilterParam chromaParam;
|
||||
mp_image_t *dmpi;
|
||||
unsigned int outfmt;
|
||||
};
|
||||
|
||||
@ -320,16 +319,16 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
|
||||
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
|
||||
if(mpi->imgfmt!=vf->priv->outfmt) return; // colorspace differ
|
||||
// ok, we can do pp in-place (or pp disabled):
|
||||
vf->priv->dmpi=vf_get_image(vf->next,mpi->imgfmt,
|
||||
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
|
||||
mpi->type, mpi->flags, mpi->w, mpi->h);
|
||||
mpi->planes[0]=vf->priv->dmpi->planes[0];
|
||||
mpi->stride[0]=vf->priv->dmpi->stride[0];
|
||||
mpi->width=vf->priv->dmpi->width;
|
||||
mpi->planes[0]=vf->dmpi->planes[0];
|
||||
mpi->stride[0]=vf->dmpi->stride[0];
|
||||
mpi->width=vf->dmpi->width;
|
||||
if(mpi->flags&MP_IMGFLAG_PLANAR){
|
||||
mpi->planes[1]=vf->priv->dmpi->planes[1];
|
||||
mpi->planes[2]=vf->priv->dmpi->planes[2];
|
||||
mpi->stride[1]=vf->priv->dmpi->stride[1];
|
||||
mpi->stride[2]=vf->priv->dmpi->stride[2];
|
||||
mpi->planes[1]=vf->dmpi->planes[1];
|
||||
mpi->planes[2]=vf->dmpi->planes[2];
|
||||
mpi->stride[1]=vf->dmpi->stride[1];
|
||||
mpi->stride[2]=vf->dmpi->stride[2];
|
||||
}
|
||||
mpi->flags|=MP_IMGFLAG_DIRECT;
|
||||
}
|
||||
@ -339,13 +338,13 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
|
||||
|
||||
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
|
||||
// no DR, so get a new image! hope we'll get DR buffer:
|
||||
vf->priv->dmpi=vf_get_image(vf->next,vf->priv->outfmt,
|
||||
vf->dmpi=vf_get_image(vf->next,vf->priv->outfmt,
|
||||
MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
|
||||
mpi->w,mpi->h);
|
||||
//printf("nodr\n");
|
||||
}
|
||||
//else printf("dr\n");
|
||||
dmpi= vf->priv->dmpi;
|
||||
dmpi= vf->dmpi;
|
||||
|
||||
noise(dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, &vf->priv->lumaParam);
|
||||
noise(dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w/2, mpi->h/2, &vf->priv->chromaParam);
|
||||
|
@ -30,7 +30,6 @@ struct vf_priv_s {
|
||||
int pp;
|
||||
pp_mode_t *ppMode[PP_QUALITY_MAX+1];
|
||||
void *context;
|
||||
mp_image_t *dmpi;
|
||||
unsigned int outfmt;
|
||||
};
|
||||
|
||||
@ -97,16 +96,16 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
|
||||
if(!(mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE) && mpi->imgfmt!=vf->priv->outfmt)
|
||||
return; // colorspace differ
|
||||
// ok, we can do pp in-place (or pp disabled):
|
||||
vf->priv->dmpi=vf_get_image(vf->next,mpi->imgfmt,
|
||||
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
|
||||
mpi->type, mpi->flags, mpi->w, mpi->h);
|
||||
mpi->planes[0]=vf->priv->dmpi->planes[0];
|
||||
mpi->stride[0]=vf->priv->dmpi->stride[0];
|
||||
mpi->width=vf->priv->dmpi->width;
|
||||
mpi->planes[0]=vf->dmpi->planes[0];
|
||||
mpi->stride[0]=vf->dmpi->stride[0];
|
||||
mpi->width=vf->dmpi->width;
|
||||
if(mpi->flags&MP_IMGFLAG_PLANAR){
|
||||
mpi->planes[1]=vf->priv->dmpi->planes[1];
|
||||
mpi->planes[2]=vf->priv->dmpi->planes[2];
|
||||
mpi->stride[1]=vf->priv->dmpi->stride[1];
|
||||
mpi->stride[2]=vf->priv->dmpi->stride[2];
|
||||
mpi->planes[1]=vf->dmpi->planes[1];
|
||||
mpi->planes[2]=vf->dmpi->planes[2];
|
||||
mpi->stride[1]=vf->dmpi->stride[1];
|
||||
mpi->stride[2]=vf->dmpi->stride[2];
|
||||
}
|
||||
mpi->flags|=MP_IMGFLAG_DIRECT;
|
||||
}
|
||||
@ -114,18 +113,18 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
|
||||
static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
|
||||
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
|
||||
// no DR, so get a new image! hope we'll get DR buffer:
|
||||
vf->priv->dmpi=vf_get_image(vf->next,mpi->imgfmt,
|
||||
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
|
||||
MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
|
||||
// MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
|
||||
// mpi->w,mpi->h);
|
||||
(mpi->w+7)&(~7),(mpi->h+7)&(~7));
|
||||
vf->priv->dmpi->w=mpi->w; vf->priv->dmpi->h=mpi->h; // display w;h
|
||||
vf->dmpi->w=mpi->w; vf->dmpi->h=mpi->h; // display w;h
|
||||
}
|
||||
|
||||
if(vf->priv->pp || !(mpi->flags&MP_IMGFLAG_DIRECT)){
|
||||
// do the postprocessing! (or copy if no DR)
|
||||
pp_postprocess(mpi->planes ,mpi->stride,
|
||||
vf->priv->dmpi->planes,vf->priv->dmpi->stride,
|
||||
vf->dmpi->planes,vf->dmpi->stride,
|
||||
(mpi->w+7)&(~7),mpi->h,
|
||||
mpi->qscale, mpi->qstride,
|
||||
vf->priv->ppMode[ vf->priv->pp ], vf->priv->context,
|
||||
@ -135,7 +134,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
|
||||
mpi->pict_type);
|
||||
#endif
|
||||
}
|
||||
return vf_next_put_image(vf,vf->priv->dmpi);
|
||||
return vf_next_put_image(vf,vf->dmpi);
|
||||
}
|
||||
|
||||
//===========================================================================//
|
||||
|
@ -61,7 +61,6 @@ typedef struct FilterParam {
|
||||
struct vf_priv_s {
|
||||
FilterParam lumaParam;
|
||||
FilterParam chromaParam;
|
||||
mp_image_t *dmpi;
|
||||
unsigned int outfmt;
|
||||
};
|
||||
|
||||
@ -175,15 +174,15 @@ static void get_image( struct vf_instance_s* vf, mp_image_t *mpi ) {
|
||||
if( mpi->imgfmt!=vf->priv->outfmt )
|
||||
return; // colorspace differ
|
||||
|
||||
vf->priv->dmpi = vf_get_image( vf->next, mpi->imgfmt, mpi->type, mpi->flags, mpi->w, mpi->h );
|
||||
mpi->planes[0] = vf->priv->dmpi->planes[0];
|
||||
mpi->stride[0] = vf->priv->dmpi->stride[0];
|
||||
mpi->width = vf->priv->dmpi->width;
|
||||
vf->dmpi = vf_get_image( vf->next, mpi->imgfmt, mpi->type, mpi->flags, mpi->w, mpi->h );
|
||||
mpi->planes[0] = vf->dmpi->planes[0];
|
||||
mpi->stride[0] = vf->dmpi->stride[0];
|
||||
mpi->width = vf->dmpi->width;
|
||||
if( mpi->flags & MP_IMGFLAG_PLANAR ) {
|
||||
mpi->planes[1] = vf->priv->dmpi->planes[1];
|
||||
mpi->planes[2] = vf->priv->dmpi->planes[2];
|
||||
mpi->stride[1] = vf->priv->dmpi->stride[1];
|
||||
mpi->stride[2] = vf->priv->dmpi->stride[2];
|
||||
mpi->planes[1] = vf->dmpi->planes[1];
|
||||
mpi->planes[2] = vf->dmpi->planes[2];
|
||||
mpi->stride[1] = vf->dmpi->stride[1];
|
||||
mpi->stride[2] = vf->dmpi->stride[2];
|
||||
}
|
||||
mpi->flags |= MP_IMGFLAG_DIRECT;
|
||||
}
|
||||
@ -193,8 +192,8 @@ static int put_image( struct vf_instance_s* vf, mp_image_t *mpi ) {
|
||||
|
||||
if( !(mpi->flags & MP_IMGFLAG_DIRECT) )
|
||||
// no DR, so get a new image! hope we'll get DR buffer:
|
||||
vf->priv->dmpi = vf_get_image( vf->next,vf->priv->outfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w, mpi->h);
|
||||
dmpi= vf->priv->dmpi;
|
||||
vf->dmpi = vf_get_image( vf->next,vf->priv->outfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w, mpi->h);
|
||||
dmpi= vf->dmpi;
|
||||
|
||||
unsharp( dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, &vf->priv->lumaParam );
|
||||
unsharp( dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w/2, mpi->h/2, &vf->priv->chromaParam );
|
||||
|
Loading…
Reference in New Issue
Block a user