[MPlayer-cvslog] r22978 - in trunk/libswscale: rgb2rgb.c rgb2rgb_template.c

ivo subversion at mplayerhq.hu
Wed Apr 11 23:00:25 CEST 2007


Author: ivo
Date: Wed Apr 11 23:00:25 2007
New Revision: 22978

Modified:
   trunk/libswscale/rgb2rgb.c
   trunk/libswscale/rgb2rgb_template.c

Log:
Remove code duplication in sws_rgb2rgb_init.

The lists of assignments of all rgbxtoy variants are removed from
sws_rgb2rgb_init and replaced by a single list inside the template file.
This way, multiple lists are generated by the preprocessor and each list
gets its own initialization function. Those are called from the main
sws_rgb2rgb_init function, if applicable.


Modified: trunk/libswscale/rgb2rgb.c
==============================================================================
--- trunk/libswscale/rgb2rgb.c	(original)
+++ trunk/libswscale/rgb2rgb.c	Wed Apr 11 23:00:25 2007
@@ -216,127 +216,15 @@ static uint64_t __attribute__((aligned(8
 void sws_rgb2rgb_init(int flags){
 #if (defined(HAVE_MMX2) || defined(HAVE_3DNOW) || defined(HAVE_MMX))  && defined(CONFIG_GPL)
 	if(flags & SWS_CPU_CAPS_MMX2){
-		rgb15to16= rgb15to16_MMX2;
-		rgb15to24= rgb15to24_MMX2;
-		rgb15to32= rgb15to32_MMX2;
-		rgb16to24= rgb16to24_MMX2;
-		rgb16to32= rgb16to32_MMX2;
-		rgb16to15= rgb16to15_MMX2;
-		rgb24to16= rgb24to16_MMX2;
-		rgb24to15= rgb24to15_MMX2;
-		rgb24to32= rgb24to32_MMX2;
-		rgb32to16= rgb32to16_MMX2;
-		rgb32to15= rgb32to15_MMX2;
-		rgb32to24= rgb32to24_MMX2;
-		rgb24tobgr15= rgb24tobgr15_MMX2;
-		rgb24tobgr16= rgb24tobgr16_MMX2;
-		rgb24tobgr24= rgb24tobgr24_MMX2;
-		rgb32tobgr32= rgb32tobgr32_MMX2;
-		rgb32tobgr16= rgb32tobgr16_MMX2;
-		rgb32tobgr15= rgb32tobgr15_MMX2;
-		yv12toyuy2= yv12toyuy2_MMX2;
-		yv12touyvy= yv12touyvy_MMX2;
-		yuv422ptoyuy2= yuv422ptoyuy2_MMX2;
-		yuy2toyv12= yuy2toyv12_MMX2;
-//		uyvytoyv12= uyvytoyv12_MMX2;
-//		yvu9toyv12= yvu9toyv12_MMX2;
-		planar2x= planar2x_MMX2;
-		rgb24toyv12= rgb24toyv12_MMX2;
-		interleaveBytes= interleaveBytes_MMX2;
-		vu9_to_vu12= vu9_to_vu12_MMX2;
-		yvu9_to_yuy2= yvu9_to_yuy2_MMX2;
+		rgb2rgb_init_MMX2();
 	}else if(flags & SWS_CPU_CAPS_3DNOW){
-		rgb15to16= rgb15to16_3DNOW;
-		rgb15to24= rgb15to24_3DNOW;
-		rgb15to32= rgb15to32_3DNOW;
-		rgb16to24= rgb16to24_3DNOW;
-		rgb16to32= rgb16to32_3DNOW;
-		rgb16to15= rgb16to15_3DNOW;
-		rgb24to16= rgb24to16_3DNOW;
-		rgb24to15= rgb24to15_3DNOW;
-		rgb24to32= rgb24to32_3DNOW;
-		rgb32to16= rgb32to16_3DNOW;
-		rgb32to15= rgb32to15_3DNOW;
-		rgb32to24= rgb32to24_3DNOW;
-		rgb24tobgr15= rgb24tobgr15_3DNOW;
-		rgb24tobgr16= rgb24tobgr16_3DNOW;
-		rgb24tobgr24= rgb24tobgr24_3DNOW;
-		rgb32tobgr32= rgb32tobgr32_3DNOW;
-		rgb32tobgr16= rgb32tobgr16_3DNOW;
-		rgb32tobgr15= rgb32tobgr15_3DNOW;
-		yv12toyuy2= yv12toyuy2_3DNOW;
-		yv12touyvy= yv12touyvy_3DNOW;
-		yuv422ptoyuy2= yuv422ptoyuy2_3DNOW;
-		yuy2toyv12= yuy2toyv12_3DNOW;
-//		uyvytoyv12= uyvytoyv12_3DNOW;
-//		yvu9toyv12= yvu9toyv12_3DNOW;
-		planar2x= planar2x_3DNOW;
-		rgb24toyv12= rgb24toyv12_3DNOW;
-		interleaveBytes= interleaveBytes_3DNOW;
-		vu9_to_vu12= vu9_to_vu12_3DNOW;
-		yvu9_to_yuy2= yvu9_to_yuy2_3DNOW;
+		rgb2rgb_init_3DNOW();
 	}else if(flags & SWS_CPU_CAPS_MMX){
-		rgb15to16= rgb15to16_MMX;
-		rgb15to24= rgb15to24_MMX;
-		rgb15to32= rgb15to32_MMX;
-		rgb16to24= rgb16to24_MMX;
-		rgb16to32= rgb16to32_MMX;
-		rgb16to15= rgb16to15_MMX;
-		rgb24to16= rgb24to16_MMX;
-		rgb24to15= rgb24to15_MMX;
-		rgb24to32= rgb24to32_MMX;
-		rgb32to16= rgb32to16_MMX;
-		rgb32to15= rgb32to15_MMX;
-		rgb32to24= rgb32to24_MMX;
-		rgb24tobgr15= rgb24tobgr15_MMX;
-		rgb24tobgr16= rgb24tobgr16_MMX;
-		rgb24tobgr24= rgb24tobgr24_MMX;
-		rgb32tobgr32= rgb32tobgr32_MMX;
-		rgb32tobgr16= rgb32tobgr16_MMX;
-		rgb32tobgr15= rgb32tobgr15_MMX;
-		yv12toyuy2= yv12toyuy2_MMX;
-		yv12touyvy= yv12touyvy_MMX;
-		yuv422ptoyuy2= yuv422ptoyuy2_MMX;
-		yuy2toyv12= yuy2toyv12_MMX;
-//		uyvytoyv12= uyvytoyv12_MMX;
-//		yvu9toyv12= yvu9toyv12_MMX;
-		planar2x= planar2x_MMX;
-		rgb24toyv12= rgb24toyv12_MMX;
-		interleaveBytes= interleaveBytes_MMX;
-		vu9_to_vu12= vu9_to_vu12_MMX;
-		yvu9_to_yuy2= yvu9_to_yuy2_MMX;
+		rgb2rgb_init_MMX();
 	}else
 #endif /* defined(HAVE_MMX2) || defined(HAVE_3DNOW) || defined(HAVE_MMX) */
 	{
-		rgb15to16= rgb15to16_C;
-		rgb15to24= rgb15to24_C;
-		rgb15to32= rgb15to32_C;
-		rgb16to24= rgb16to24_C;
-		rgb16to32= rgb16to32_C;
-		rgb16to15= rgb16to15_C;
-		rgb24to16= rgb24to16_C;
-		rgb24to15= rgb24to15_C;
-		rgb24to32= rgb24to32_C;
-		rgb32to16= rgb32to16_C;
-		rgb32to15= rgb32to15_C;
-		rgb32to24= rgb32to24_C;
-		rgb24tobgr15= rgb24tobgr15_C;
-		rgb24tobgr16= rgb24tobgr16_C;
-		rgb24tobgr24= rgb24tobgr24_C;
-		rgb32tobgr32= rgb32tobgr32_C;
-		rgb32tobgr16= rgb32tobgr16_C;
-		rgb32tobgr15= rgb32tobgr15_C;
-		yv12toyuy2= yv12toyuy2_C;
-		yv12touyvy= yv12touyvy_C;
-		yuv422ptoyuy2= yuv422ptoyuy2_C;
-		yuy2toyv12= yuy2toyv12_C;
-//		uyvytoyv12= uyvytoyv12_C;
-//		yvu9toyv12= yvu9toyv12_C;
-		planar2x= planar2x_C;
-		rgb24toyv12= rgb24toyv12_C;
-		interleaveBytes= interleaveBytes_C;
-		vu9_to_vu12= vu9_to_vu12_C;
-		yvu9_to_yuy2= yvu9_to_yuy2_C;
+		rgb2rgb_init_C();
 	}
 }
 

Modified: trunk/libswscale/rgb2rgb_template.c
==============================================================================
--- trunk/libswscale/rgb2rgb_template.c	(original)
+++ trunk/libswscale/rgb2rgb_template.c	Wed Apr 11 23:00:25 2007
@@ -2686,3 +2686,35 @@ static inline void RENAME(yvu9_to_yuy2)(
 		);
 #endif
 }
+
+static inline void RENAME(rgb2rgb_init)(void){
+	rgb15to16= RENAME(rgb15to16);
+	rgb15to24= RENAME(rgb15to24);
+	rgb15to32= RENAME(rgb15to32);
+	rgb16to24= RENAME(rgb16to24);
+	rgb16to32= RENAME(rgb16to32);
+	rgb16to15= RENAME(rgb16to15);
+	rgb24to16= RENAME(rgb24to16);
+	rgb24to15= RENAME(rgb24to15);
+	rgb24to32= RENAME(rgb24to32);
+	rgb32to16= RENAME(rgb32to16);
+	rgb32to15= RENAME(rgb32to15);
+	rgb32to24= RENAME(rgb32to24);
+	rgb24tobgr15= RENAME(rgb24tobgr15);
+	rgb24tobgr16= RENAME(rgb24tobgr16);
+	rgb24tobgr24= RENAME(rgb24tobgr24);
+	rgb32tobgr32= RENAME(rgb32tobgr32);
+	rgb32tobgr16= RENAME(rgb32tobgr16);
+	rgb32tobgr15= RENAME(rgb32tobgr15);
+	yv12toyuy2= RENAME(yv12toyuy2);
+	yv12touyvy= RENAME(yv12touyvy);
+	yuv422ptoyuy2= RENAME(yuv422ptoyuy2);
+	yuy2toyv12= RENAME(yuy2toyv12);
+//	uyvytoyv12= RENAME(uyvytoyv12);
+//	yvu9toyv12= RENAME(yvu9toyv12);
+	planar2x= RENAME(planar2x);
+	rgb24toyv12= RENAME(rgb24toyv12);
+	interleaveBytes= RENAME(interleaveBytes);
+	vu9_to_vu12= RENAME(vu9_to_vu12);
+	yvu9_to_yuy2= RENAME(yvu9_to_yuy2);
+}



More information about the MPlayer-cvslog mailing list