changeset 11373:3b9f8ee18ff9

another lame workaround for the g1 filter layer ... now filter chains with >8 scale filters initalize before u fall asleep
author michael
date Mon, 03 Nov 2003 12:15:32 +0000
parents 3761aff4722e
children e00d3351b912
files libmpcodecs/vf_scale.c
diffstat 1 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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; i<sizeof(outfmt_list)/sizeof(int)-1; i++){
+        const int format= outfmt_list[i];
+        int ret= vf->priv->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)
 	{