summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo van Poorten <ivop@euronet.nl>2007-04-11 21:00:25 +0000
committerIvo van Poorten <ivop@euronet.nl>2007-04-11 21:00:25 +0000
commitdf170b81d9c8e7c97e373bb204240bc658b25c2b (patch)
tree5dad9555fe2603eedddaa02c4961e968fd9b93e8
parent3b77e48f0a4b6d660cd7eb14cd56f93fcb426ae2 (diff)
downloadffmpeg-df170b81d9c8e7c97e373bb204240bc658b25c2b.tar.gz
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. Originally committed as revision 22978 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
-rw-r--r--libswscale/rgb2rgb.c120
-rw-r--r--libswscale/rgb2rgb_template.c32
2 files changed, 36 insertions, 116 deletions
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
index a938abfc92..bea30e6f04 100644
--- a/libswscale/rgb2rgb.c
+++ b/libswscale/rgb2rgb.c
@@ -216,127 +216,15 @@ static uint64_t __attribute__((aligned(8))) dither8[2]={
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();
}
}
diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c
index d9511c955a..6489a4db91 100644
--- a/libswscale/rgb2rgb_template.c
+++ b/libswscale/rgb2rgb_template.c
@@ -2686,3 +2686,35 @@ static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2
);
#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);
+}