[Mplayer-cvslog] CVS: main/libmpcodecs vf_scale.c,1.38,1.39

Michael Niedermayer CVS michael at mplayerhq.hu
Fri Apr 25 13:26:36 CEST 2003


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

Modified Files:
	vf_scale.c 
Log Message:
moving getFilter stuff back (vf_scale.c -> swscale.c)


Index: vf_scale.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_scale.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- vf_scale.c	24 Apr 2003 17:03:50 -0000	1.38
+++ vf_scale.c	25 Apr 2003 11:26:08 -0000	1.39
@@ -40,6 +40,9 @@
 
 //===========================================================================//
 
+void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam);
+struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat);
+
 static unsigned int outfmt_list[]={
 // RGB:
     IMGFMT_BGR32,
@@ -384,7 +387,7 @@
 int sws_flags=2;
 
 //global srcFilter
-SwsFilter src_filter= {NULL, NULL, NULL, NULL};
+static SwsFilter *src_filter= NULL;
 
 float sws_lum_gblur= 0.0;
 float sws_chr_gblur= 0.0;
@@ -442,63 +445,13 @@
 	}
 	else if(verbose>1) *flags= SWS_PRINT_INFO;
 
-	if(src_filter.lumH) sws_freeVec(src_filter.lumH);
-	if(src_filter.lumV) sws_freeVec(src_filter.lumV);
-	if(src_filter.chrH) sws_freeVec(src_filter.chrH);
-	if(src_filter.chrV) sws_freeVec(src_filter.chrV);
-
-	if(sws_lum_gblur!=0.0){
-		src_filter.lumH= sws_getGaussianVec(sws_lum_gblur, 3.0);
-		src_filter.lumV= sws_getGaussianVec(sws_lum_gblur, 3.0);
-	}else{
-		src_filter.lumH= sws_getIdentityVec();
-		src_filter.lumV= sws_getIdentityVec();
-	}
-
-	if(sws_chr_gblur!=0.0){
-		src_filter.chrH= sws_getGaussianVec(sws_chr_gblur, 3.0);
-		src_filter.chrV= sws_getGaussianVec(sws_chr_gblur, 3.0);
-	}else{
-		src_filter.chrH= sws_getIdentityVec();
-		src_filter.chrV= sws_getIdentityVec();
-	}
-
-	if(sws_chr_sharpen!=0.0){
-		SwsVector *g= sws_getConstVec(-1.0, 3);
-		SwsVector *id= sws_getConstVec(10.0/sws_chr_sharpen, 1);
-		g->coeff[1]=2.0;
-		sws_addVec(id, g);
-		sws_convVec(src_filter.chrH, id);
-		sws_convVec(src_filter.chrV, id);
-		sws_freeVec(g);
-		sws_freeVec(id);
-	}
-
-	if(sws_lum_sharpen!=0.0){
-		SwsVector *g= sws_getConstVec(-1.0, 3);
-		SwsVector *id= sws_getConstVec(10.0/sws_lum_sharpen, 1);
-		g->coeff[1]=2.0;
-		sws_addVec(id, g);
-		sws_convVec(src_filter.lumH, id);
-		sws_convVec(src_filter.lumV, id);
-		sws_freeVec(g);
-		sws_freeVec(id);
-	}
-
-	if(sws_chr_hshift)
-		sws_shiftVec(src_filter.chrH, sws_chr_hshift);
-
-	if(sws_chr_vshift)
-		sws_shiftVec(src_filter.chrV, sws_chr_vshift);
-
-	sws_normalizeVec(src_filter.chrH, 1.0);
-	sws_normalizeVec(src_filter.chrV, 1.0);
-	sws_normalizeVec(src_filter.lumH, 1.0);
-	sws_normalizeVec(src_filter.lumV, 1.0);
-
-	if(verbose > 1) sws_printVec(src_filter.chrH);
-	if(verbose > 1) sws_printVec(src_filter.lumH);
+	if(src_filter) sws_freeFilter(src_filter);
 
+	src_filter= sws_getDefaultFilter(
+		sws_lum_gblur, sws_chr_gblur,
+		sws_lum_sharpen, sws_chr_sharpen,
+		sws_chr_vshift, sws_chr_hshift, verbose>1);
+        
 	switch(sws_flags)
 	{
 		case 0: *flags|= SWS_FAST_BILINEAR; break;
@@ -515,7 +468,7 @@
 		default:*flags|= SWS_BILINEAR; break;
 	}
 	
-	*srcFilterParam= &src_filter;
+	*srcFilterParam= src_filter;
 	*dstFilterParam= NULL;
 }
 



More information about the MPlayer-cvslog mailing list