# HG changeset patch # User michael # Date 1067861732 0 # Node ID 3b9f8ee18ff952c69aee200fd4fc4a4013661024 # Parent 3761aff4722ec5df47f075e2ea88e6e0274753fe another lame workaround for the g1 filter layer ... now filter chains with >8 scale filters initalize before u fall asleep diff -r 3761aff4722e -r 3b9f8ee18ff9 libmpcodecs/vf_scale.c --- a/libmpcodecs/vf_scale.c Mon Nov 03 10:42:28 2003 +0000 +++ b/libmpcodecs/vf_scale.c Mon Nov 03 12:15:32 2003 +0000 @@ -25,6 +25,7 @@ unsigned int fmt; struct SwsContext *ctx; unsigned char* palette; + int query_format_cache[64]; } vf_priv_dflt = { -1,-1, 0, @@ -77,14 +78,24 @@ static unsigned int find_best_out(vf_instance_t *vf){ unsigned int best=0; - unsigned int* p=outfmt_list; + int i; + // find the best outfmt: - while(*p){ - int ret=vf_next_query_format(vf,*p); - mp_msg(MSGT_VFILTER,MSGL_DBG2,"scale: query(%s) -> %d\n",vo_format_name(*p),ret&3); - if(ret&VFCAP_CSP_SUPPORTED_BY_HW){ best=*p; break;} // no conversion -> bingo! - if(ret&VFCAP_CSP_SUPPORTED && !best) best=*p; // best with conversion - ++p; + for(i=0; ipriv->query_format_cache[i]-1; + if(ret == -1){ + ret= vf_next_query_format(vf, outfmt_list[i]); + vf->priv->query_format_cache[i]= ret+1; + } + + mp_msg(MSGT_VFILTER,MSGL_DBG2,"scale: query(%s) -> %d\n",vo_format_name(format),ret&3); + if(ret&VFCAP_CSP_SUPPORTED_BY_HW){ + best=format; // no conversion -> bingo! + break; + } + if(ret&VFCAP_CSP_SUPPORTED && !best) + best=format; // best with conversion } return best; } @@ -437,7 +448,7 @@ src_filter= sws_getDefaultFilter( sws_lum_gblur, sws_chr_gblur, sws_lum_sharpen, sws_chr_sharpen, - sws_chr_vshift, sws_chr_hshift, verbose>1); + sws_chr_hshift, sws_chr_vshift, verbose>1); switch(sws_flags) {