[Mplayer-cvslog] CVS: main/libmpcodecs vf_scale.c,1.47,1.48

Michael Niedermayer CVS michael at mplayerhq.hu
Mon Nov 3 13:15:57 CET 2003


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv21617

Modified Files:
	vf_scale.c 
Log Message:
another lame workaround for the g1 filter layer ...
now filter chains with >8 scale filters initalize before u fall asleep


Index: vf_scale.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_scale.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- vf_scale.c	9 Oct 2003 22:32:30 -0000	1.47
+++ vf_scale.c	3 Nov 2003 12:15:32 -0000	1.48
@@ -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)
 	{



More information about the MPlayer-cvslog mailing list