comparison src/video/SDL_yuv_sw.c @ 2197:2ff40f30af31

Merged r3261:3262 from branches/SDL-1.2: MMX/YUV with __OPTIMIZE__. "Mac OS X/x86 won't build the MMX/YUV inline assembly without optimizations enabled (not enough registers), so for now, we only build it if we see the __OPTIMIZE__ #define, which GCC provides when you build at -O1 or higher."
author Ryan C. Gordon <icculus@icculus.org>
date Sat, 14 Jul 2007 07:28:45 +0000
parents bef26cfc8f79
children 5651642f4a78
comparison
equal deleted inserted replaced
2196:2aee80dab68a 2197:2ff40f30af31
115 SDL_Surface *display; 115 SDL_Surface *display;
116 }; 116 };
117 117
118 /* The colorspace conversion functions */ 118 /* The colorspace conversion functions */
119 119
120 #if (__GNUC__ > 2) && defined(__i386__) && SDL_ASSEMBLY_ROUTINES 120 #if (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES
121 extern void Color565DitherYV12MMX1X(int *colortab, Uint32 * rgb_2_pix, 121 extern void Color565DitherYV12MMX1X(int *colortab, Uint32 * rgb_2_pix,
122 unsigned char *lum, unsigned char *cr, 122 unsigned char *lum, unsigned char *cr,
123 unsigned char *cb, unsigned char *out, 123 unsigned char *cb, unsigned char *out,
124 int rows, int cols, int mod); 124 int rows, int cols, int mod);
125 extern void ColorRGBDitherYV12MMX1X(int *colortab, Uint32 * rgb_2_pix, 125 extern void ColorRGBDitherYV12MMX1X(int *colortab, Uint32 * rgb_2_pix,
976 /* You have chosen wisely... */ 976 /* You have chosen wisely... */
977 switch (swdata->texture->format) { 977 switch (swdata->texture->format) {
978 case SDL_PIXELFORMAT_YV12: 978 case SDL_PIXELFORMAT_YV12:
979 case SDL_PIXELFORMAT_IYUV: 979 case SDL_PIXELFORMAT_IYUV:
980 if (SDL_BYTESPERPIXEL(target_format) == 2) { 980 if (SDL_BYTESPERPIXEL(target_format) == 2) {
981 #if (__GNUC__ > 2) && defined(__i386__) && SDL_ASSEMBLY_ROUTINES 981 #if (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES
982 /* inline assembly functions */ 982 /* inline assembly functions */
983 if (SDL_HasMMX() && (Rmask == 0xF800) && 983 if (SDL_HasMMX() && (Rmask == 0xF800) &&
984 (Gmask == 0x07E0) && (Bmask == 0x001F) 984 (Gmask == 0x07E0) && (Bmask == 0x001F)
985 && (swdata->texture->w & 15) == 0) { 985 && (swdata->texture->w & 15) == 0) {
986 /*printf("Using MMX 16-bit 565 dither\n");*/ 986 /*printf("Using MMX 16-bit 565 dither\n");*/
997 if (SDL_BYTESPERPIXEL(target_format) == 3) { 997 if (SDL_BYTESPERPIXEL(target_format) == 3) {
998 swdata->Display1X = Color24DitherYV12Mod1X; 998 swdata->Display1X = Color24DitherYV12Mod1X;
999 swdata->Display2X = Color24DitherYV12Mod2X; 999 swdata->Display2X = Color24DitherYV12Mod2X;
1000 } 1000 }
1001 if (SDL_BYTESPERPIXEL(target_format) == 4) { 1001 if (SDL_BYTESPERPIXEL(target_format) == 4) {
1002 #if (__GNUC__ > 2) && defined(__i386__) && SDL_ASSEMBLY_ROUTINES 1002 #if (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES
1003 /* inline assembly functions */ 1003 /* inline assembly functions */
1004 if (SDL_HasMMX() && (Rmask == 0x00FF0000) && 1004 if (SDL_HasMMX() && (Rmask == 0x00FF0000) &&
1005 (Gmask == 0x0000FF00) && 1005 (Gmask == 0x0000FF00) &&
1006 (Bmask == 0x000000FF) && (swdata->texture->w & 15) == 0) { 1006 (Bmask == 0x000000FF) && (swdata->texture->w & 15) == 0) {
1007 /*printf("Using MMX 32-bit dither\n");*/ 1007 /*printf("Using MMX 32-bit dither\n");*/