mirror of
https://github.com/mpv-player/mpv
synced 2025-02-23 00:06:56 +00:00
video/filter: remove vf_match_csp()
This function improves automatic filter insertion, but this really should be done by the generic filter code. Remove vf_match_csp() and all code using it as preparation for that. This commit temporarily makes handling of filter insertion worse for now, but it will be fixed with the following commits.
This commit is contained in:
parent
6025abffda
commit
75d3bf4711
@ -282,60 +282,6 @@ vf_instance_t *vf_open_filter(struct MPOpts *opts, vf_instance_t *next,
|
||||
return vf_open(opts, next, name, args);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
unsigned int vf_match_csp(vf_instance_t **vfp, const unsigned int *list,
|
||||
unsigned int preferred)
|
||||
{
|
||||
vf_instance_t *vf = *vfp;
|
||||
struct MPOpts *opts = vf->opts;
|
||||
const unsigned int *p;
|
||||
unsigned int best = 0;
|
||||
int ret;
|
||||
if ((p = list))
|
||||
while (*p) {
|
||||
ret = vf->query_format(vf, *p);
|
||||
mp_msg(MSGT_VFILTER, MSGL_V, "[%s] query(%s) -> %x\n",
|
||||
vf->info->name, vo_format_name(*p), ret);
|
||||
if (ret & VFCAP_CSP_SUPPORTED_BY_HW) {
|
||||
best = *p;
|
||||
break;
|
||||
}
|
||||
if (ret & VFCAP_CSP_SUPPORTED && !best)
|
||||
best = *p;
|
||||
++p;
|
||||
}
|
||||
if (best)
|
||||
return best; // bingo, they have common csp!
|
||||
// ok, then try with scale:
|
||||
if (vf->info == &vf_info_scale)
|
||||
return 0; // avoid infinite recursion!
|
||||
vf = vf_open_filter(opts, vf, "scale", NULL);
|
||||
if (!vf)
|
||||
return 0; // failed to init "scale"
|
||||
// try the preferred csp first:
|
||||
if (preferred && vf->query_format(vf, preferred))
|
||||
best = preferred;
|
||||
else
|
||||
// try the list again, now with "scaler" :
|
||||
if ((p = list))
|
||||
while (*p) {
|
||||
ret = vf->query_format(vf, *p);
|
||||
mp_msg(MSGT_VFILTER, MSGL_V, "[%s] query(%s) -> %x\n",
|
||||
vf->info->name, vo_format_name(*p), ret);
|
||||
if (ret & VFCAP_CSP_SUPPORTED_BY_HW) {
|
||||
best = *p;
|
||||
break;
|
||||
}
|
||||
if (ret & VFCAP_CSP_SUPPORTED && !best)
|
||||
best = *p;
|
||||
++p;
|
||||
}
|
||||
if (best)
|
||||
*vfp = vf; // else uninit vf !FIXME!
|
||||
return best;
|
||||
}
|
||||
|
||||
// Used by filters to add a filtered frame to the output queue.
|
||||
// Ownership of img is transferred from caller to the filter chain.
|
||||
void vf_add_output_frame(struct vf_instance *vf, struct mp_image *img)
|
||||
|
@ -120,9 +120,6 @@ void vf_chain_seek_reset(struct vf_instance *vf);
|
||||
vf_instance_t *vf_open_filter(struct MPOpts *opts, vf_instance_t *next,
|
||||
const char *name, char **args);
|
||||
|
||||
unsigned int vf_match_csp(vf_instance_t **vfp, const unsigned int *list,
|
||||
unsigned int preferred);
|
||||
|
||||
// default wrappers:
|
||||
int vf_next_config(struct vf_instance *vf,
|
||||
int width, int height, int d_width, int d_height,
|
||||
|
@ -41,7 +41,6 @@
|
||||
//===========================================================================//
|
||||
|
||||
static struct vf_priv_s {
|
||||
unsigned int outfmt;
|
||||
int xoff, yoff, lw, lh, band, show;
|
||||
char *file;
|
||||
struct timed_rectangle {
|
||||
@ -51,9 +50,7 @@ static struct vf_priv_s {
|
||||
int cur_timed_rect;
|
||||
struct vf_lw_opts *lw_opts;
|
||||
} const vf_priv_dflt = {
|
||||
0,
|
||||
0, 0, 0, 0, 1, 0,
|
||||
NULL, NULL, 0, 0,
|
||||
.band = 1,
|
||||
};
|
||||
|
||||
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||
@ -195,16 +192,11 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){
|
||||
switch(fmt)
|
||||
{
|
||||
case IMGFMT_420P:
|
||||
return vf_next_query_format(vf,vf->priv->outfmt);
|
||||
return vf_next_query_format(vf,IMGFMT_420P);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const unsigned int fmt_list[]={
|
||||
IMGFMT_420P,
|
||||
0
|
||||
};
|
||||
|
||||
static int load_timed_rectangles(struct vf_priv_s *delogo)
|
||||
{
|
||||
FILE *f;
|
||||
@ -301,13 +293,6 @@ static int vf_open(vf_instance_t *vf){
|
||||
}
|
||||
fix_band(vf->priv);
|
||||
|
||||
// check csp:
|
||||
vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_420P);
|
||||
if(!vf->priv->outfmt)
|
||||
{
|
||||
return 0; // no csp match :(
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,6 @@ typedef struct FilterParam{
|
||||
struct vf_priv_s {
|
||||
FilterParam lumaParam;
|
||||
FilterParam chromaParam;
|
||||
unsigned int outfmt;
|
||||
int strength;
|
||||
int averaged;
|
||||
int pattern;
|
||||
@ -364,7 +363,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){
|
||||
switch(fmt)
|
||||
{
|
||||
case IMGFMT_420P:
|
||||
return vf_next_query_format(vf,vf->priv->outfmt);
|
||||
return vf_next_query_format(vf,IMGFMT_420P);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -380,11 +379,6 @@ static void parse(FilterParam *fp, struct vf_priv_s *p){
|
||||
if(fp->strength) initNoise(fp);
|
||||
}
|
||||
|
||||
static const unsigned int fmt_list[]={
|
||||
IMGFMT_420P,
|
||||
0
|
||||
};
|
||||
|
||||
static int vf_open(vf_instance_t *vf){
|
||||
vf->filter=filter;
|
||||
vf->query_format=query_format;
|
||||
@ -402,15 +396,6 @@ static int vf_open(vf_instance_t *vf){
|
||||
parse(&vf->priv->lumaParam, vf->priv);
|
||||
parse(&vf->priv->chromaParam, vf->priv);
|
||||
|
||||
// check csp:
|
||||
vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_420P);
|
||||
if(!vf->priv->outfmt)
|
||||
{
|
||||
uninit(vf);
|
||||
return 0; // no csp match :(
|
||||
}
|
||||
|
||||
|
||||
#if HAVE_MMX
|
||||
if(gCpuCaps.hasMMX){
|
||||
lineNoise= lineNoise_MMX;
|
||||
|
@ -37,7 +37,6 @@ struct vf_priv_s {
|
||||
int pp;
|
||||
pp_mode *ppMode[PP_QUALITY_MAX+1];
|
||||
void *context;
|
||||
unsigned int outfmt;
|
||||
char *arg;
|
||||
};
|
||||
|
||||
@ -117,16 +116,6 @@ static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi)
|
||||
return dmpi;
|
||||
}
|
||||
|
||||
//===========================================================================//
|
||||
|
||||
static const unsigned int fmt_list[]={
|
||||
IMGFMT_420P,
|
||||
IMGFMT_444P,
|
||||
IMGFMT_422P,
|
||||
IMGFMT_411P,
|
||||
0
|
||||
};
|
||||
|
||||
static int vf_open(vf_instance_t *vf){
|
||||
int i;
|
||||
|
||||
@ -135,10 +124,6 @@ static int vf_open(vf_instance_t *vf){
|
||||
vf->filter=filter;
|
||||
vf->uninit=uninit;
|
||||
|
||||
// check csp:
|
||||
vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_420P);
|
||||
if(!vf->priv->outfmt) return 0; // no csp match :(
|
||||
|
||||
for(i=0; i<=PP_QUALITY_MAX; i++){
|
||||
vf->priv->ppMode[i]= pp_get_mode_by_name_and_quality(vf->priv->arg, i);
|
||||
if(vf->priv->ppMode[i]==NULL) return -1;
|
||||
|
@ -51,7 +51,6 @@ typedef struct FilterParam {
|
||||
struct vf_priv_s {
|
||||
FilterParam lumaParam;
|
||||
FilterParam chromaParam;
|
||||
unsigned int outfmt;
|
||||
struct vf_lw_opts *lw_opts;
|
||||
};
|
||||
|
||||
@ -208,16 +207,11 @@ static void uninit( struct vf_instance *vf ) {
|
||||
static int query_format( struct vf_instance *vf, unsigned int fmt ) {
|
||||
switch(fmt) {
|
||||
case IMGFMT_420P:
|
||||
return vf_next_query_format( vf, vf->priv->outfmt );
|
||||
return vf_next_query_format( vf, IMGFMT_420P );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const unsigned int fmt_list[] = {
|
||||
IMGFMT_420P,
|
||||
0
|
||||
};
|
||||
|
||||
static int vf_open( vf_instance_t *vf) {
|
||||
vf->config = config;
|
||||
vf->filter = filter;
|
||||
@ -238,13 +232,6 @@ static int vf_open( vf_instance_t *vf) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// check csp:
|
||||
vf->priv->outfmt = vf_match_csp( &vf->next, fmt_list, IMGFMT_420P );
|
||||
if( !vf->priv->outfmt ) {
|
||||
uninit( vf );
|
||||
return 0; // no csp match :(
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user