summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-07 19:32:03 +0100
committerwm4 <wm4@nowhere>2013-12-07 19:32:03 +0100
commit75d3bf4711f88a79af5fd3246a9503dbd6e01586 (patch)
treec1515f59f2d8fe1e4bab88a891fae97e8a8b3262
parent6025abffda964b07d04ff2806527d85d956e28ba (diff)
downloadmpv-75d3bf4711f88a79af5fd3246a9503dbd6e01586.tar.bz2
mpv-75d3bf4711f88a79af5fd3246a9503dbd6e01586.tar.xz
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.
-rw-r--r--video/filter/vf.c54
-rw-r--r--video/filter/vf.h3
-rw-r--r--video/filter/vf_delogo.c19
-rw-r--r--video/filter/vf_noise.c17
-rw-r--r--video/filter/vf_pp.c15
-rw-r--r--video/filter/vf_unsharp.c15
6 files changed, 4 insertions, 119 deletions
diff --git a/video/filter/vf.c b/video/filter/vf.c
index 5b226003b4..03044906f9 100644
--- a/video/filter/vf.c
+++ b/video/filter/vf.c
@@ -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)
diff --git a/video/filter/vf.h b/video/filter/vf.h
index 2c7ac2133e..d47ac2beb8 100644
--- a/video/filter/vf.h
+++ b/video/filter/vf.h
@@ -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,
diff --git a/video/filter/vf_delogo.c b/video/filter/vf_delogo.c
index afee3119de..3ec6755f03 100644
--- a/video/filter/vf_delogo.c
+++ b/video/filter/vf_delogo.c
@@ -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;
}
diff --git a/video/filter/vf_noise.c b/video/filter/vf_noise.c
index 3160907e19..8525b06dc2 100644
--- a/video/filter/vf_noise.c
+++ b/video/filter/vf_noise.c
@@ -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;
diff --git a/video/filter/vf_pp.c b/video/filter/vf_pp.c
index 83191594cc..dff8b2b3ec 100644
--- a/video/filter/vf_pp.c
+++ b/video/filter/vf_pp.c
@@ -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;
diff --git a/video/filter/vf_unsharp.c b/video/filter/vf_unsharp.c
index 1f60adc230..1cab2ada0c 100644
--- a/video/filter/vf_unsharp.c
+++ b/video/filter/vf_unsharp.c
@@ -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;
}