src/video/SDL_yuv_mmx.c
changeset 946 8520712f8ef0
parent 887 b4b64bb88f2f
child 949 e0d96eb0af19
equal deleted inserted replaced
945:d33645c36072 946:8520712f8ef0
    28 
    28 
    29 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
    29 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
    30 
    30 
    31 #include "SDL_types.h"
    31 #include "SDL_types.h"
    32 
    32 
    33 #ifdef __ELF__
    33 static unsigned int  MMX_0080w[]    = {0x00800080, 0x00800080};
    34 #define ASM_VAR(X) _##X
    34 static unsigned int  MMX_00FFw[]    = {0x00ff00ff, 0x00ff00ff}; 
    35 #else
    35 static unsigned int  MMX_FF00w[]    = {0xff00ff00, 0xff00ff00}; 
    36 #define ASM_VAR(X) X
    36 
    37 #endif
    37 static unsigned short MMX_Ycoeff[]  = {0x004a, 0x004a, 0x004a, 0x004a}; 
    38 
    38 
    39 static unsigned int  ASM_VAR(MMX_0080w)[]    = {0x00800080, 0x00800080};
    39 static unsigned short MMX_UbluRGB[] = {0x0072, 0x0072, 0x0072, 0x0072};    
    40 static unsigned int  ASM_VAR(MMX_00FFw)[]    = {0x00ff00ff, 0x00ff00ff}; 
    40 static unsigned short MMX_VredRGB[] = {0x0059, 0x0059, 0x0059, 0x0059};  
    41 static unsigned int  ASM_VAR(MMX_FF00w)[]    = {0xff00ff00, 0xff00ff00}; 
    41 static unsigned short MMX_UgrnRGB[] = {0xffea, 0xffea, 0xffea, 0xffea}; 
    42 
    42 static unsigned short MMX_VgrnRGB[] = {0xffd2, 0xffd2, 0xffd2, 0xffd2};  
    43 static unsigned short ASM_VAR(MMX_Ycoeff)[]  = {0x004a, 0x004a, 0x004a, 0x004a}; 
    43 
    44 
    44 static unsigned short MMX_Ublu5x5[] = {0x0081, 0x0081, 0x0081, 0x0081};
    45 static unsigned short ASM_VAR(MMX_UbluRGB)[] = {0x0072, 0x0072, 0x0072, 0x0072};    
    45 static unsigned short MMX_Vred5x5[] = {0x0066, 0x0066, 0x0066, 0x0066};
    46 static unsigned short ASM_VAR(MMX_VredRGB)[] = {0x0059, 0x0059, 0x0059, 0x0059};  
    46 static unsigned short MMX_Ugrn555[] = {0xffe7, 0xffe7, 0xffe7, 0xffe7};
    47 static unsigned short ASM_VAR(MMX_UgrnRGB)[] = {0xffea, 0xffea, 0xffea, 0xffea}; 
    47 static unsigned short MMX_Vgrn555[] = {0xffcc, 0xffcc, 0xffcc, 0xffcc};
    48 static unsigned short ASM_VAR(MMX_VgrnRGB)[] = {0xffd2, 0xffd2, 0xffd2, 0xffd2};  
    48 static unsigned short MMX_Ugrn565[] = {0xffe8, 0xffe8, 0xffe8, 0xffe8};
    49 
    49 static unsigned short MMX_Vgrn565[] = {0xffcd, 0xffcd, 0xffcd, 0xffcd};
    50 static unsigned short ASM_VAR(MMX_Ublu5x5)[] = {0x0081, 0x0081, 0x0081, 0x0081};
    50 
    51 static unsigned short ASM_VAR(MMX_Vred5x5)[] = {0x0066, 0x0066, 0x0066, 0x0066};
    51 static unsigned short MMX_red555[]  = {0x7c00, 0x7c00, 0x7c00, 0x7c00};
    52 static unsigned short ASM_VAR(MMX_Ugrn555)[] = {0xffe7, 0xffe7, 0xffe7, 0xffe7};
    52 static unsigned short MMX_red565[]  = {0xf800, 0xf800, 0xf800, 0xf800};
    53 static unsigned short ASM_VAR(MMX_Vgrn555)[] = {0xffcc, 0xffcc, 0xffcc, 0xffcc};
    53 static unsigned short MMX_grn555[]  = {0x03e0, 0x03e0, 0x03e0, 0x03e0};
    54 static unsigned short ASM_VAR(MMX_Ugrn565)[] = {0xffe8, 0xffe8, 0xffe8, 0xffe8};
    54 static unsigned short MMX_grn565[]  = {0x07e0, 0x07e0, 0x07e0, 0x07e0};
    55 static unsigned short ASM_VAR(MMX_Vgrn565)[] = {0xffcd, 0xffcd, 0xffcd, 0xffcd};
    55 static unsigned short MMX_blu5x5[]  = {0x001f, 0x001f, 0x001f, 0x001f};
    56 
       
    57 static unsigned short ASM_VAR(MMX_red555)[]  = {0x7c00, 0x7c00, 0x7c00, 0x7c00};
       
    58 static unsigned short ASM_VAR(MMX_red565)[]  = {0xf800, 0xf800, 0xf800, 0xf800};
       
    59 static unsigned short ASM_VAR(MMX_grn555)[]  = {0x03e0, 0x03e0, 0x03e0, 0x03e0};
       
    60 static unsigned short ASM_VAR(MMX_grn565)[]  = {0x07e0, 0x07e0, 0x07e0, 0x07e0};
       
    61 static unsigned short ASM_VAR(MMX_blu5x5)[]  = {0x001f, 0x001f, 0x001f, 0x001f};
       
    62 
    56 
    63 /**
    57 /**
    64    This MMX assembler is my first assembler/MMX program ever.
    58    This MMX assembler is my first assembler/MMX program ever.
    65    Thus it maybe buggy.
    59    Thus it maybe buggy.
    66    Send patches to:
    60    Send patches to:
   237 		 "emms\n"
   231 		 "emms\n"
   238 		 "popl %%ebx\n"
   232 		 "popl %%ebx\n"
   239 		 :
   233 		 :
   240 		 : "m" (cr), "r"(cb),"r"(lum),
   234 		 : "m" (cr), "r"(cb),"r"(lum),
   241 		 "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod),
   235 		 "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod),
   242          [_MMX_0080w] "m" (*_MMX_0080w),
   236          [_MMX_0080w] "m" (*MMX_0080w),
   243          [_MMX_00FFw] "m" (*_MMX_00FFw),
   237          [_MMX_00FFw] "m" (*MMX_00FFw),
   244          [_MMX_FF00w] "m" (*_MMX_FF00w),
   238          [_MMX_FF00w] "m" (*MMX_FF00w),
   245          [_MMX_VgrnRGB] "m" (*_MMX_VgrnRGB),
   239          [_MMX_VgrnRGB] "m" (*MMX_VgrnRGB),
   246          [_MMX_VredRGB] "m" (*_MMX_VredRGB),
   240          [_MMX_VredRGB] "m" (*MMX_VredRGB),
   247          [_MMX_UgrnRGB] "m" (*_MMX_UgrnRGB),
   241          [_MMX_UgrnRGB] "m" (*MMX_UgrnRGB),
   248          [_MMX_UbluRGB] "m" (*_MMX_UbluRGB)
   242          [_MMX_UbluRGB] "m" (*MMX_UbluRGB)
   249 		 );
   243 		 );
   250 }
   244 }
   251 
   245 
   252 void Color565DitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix,
   246 void Color565DitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix,
   253                              unsigned char *lum, unsigned char *cr,
   247                              unsigned char *lum, unsigned char *cr,
   415 	 "movl           $0,     %6\n" // x=0
   409 	 "movl           $0,     %6\n" // x=0
   416 	 "cmpl           %7,     %2\n"
   410 	 "cmpl           %7,     %2\n"
   417 	 "jl             1b\n"
   411 	 "jl             1b\n"
   418          "emms\n"
   412          "emms\n"
   419 	 "popl %%ebx\n"
   413 	 "popl %%ebx\n"
   420          :
   414 	:
   421          :"m" (cr), "r"(cb),"r"(lum),
   415 	:"m" (cr), "r"(cb),"r"(lum),
   422 	 "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod),
   416 	 "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod),
   423      [_MMX_0080w] "m" (*_MMX_0080w),
   417 	[_MMX_0080w] "m" (*MMX_0080w),
   424  [_MMX_Ugrn565] "m" (*_MMX_Ugrn565),
   418 	[_MMX_Ugrn565] "m" (*MMX_Ugrn565),
   425  [_MMX_Ublu5x5] "m" (*_MMX_Ublu5x5),
   419 	[_MMX_Ublu5x5] "m" (*MMX_Ublu5x5),
   426  [_MMX_00FFw] "m" (*_MMX_00FFw),
   420 	[_MMX_00FFw] "m" (*MMX_00FFw),
   427  [_MMX_Vgrn565] "m" (*_MMX_Vgrn565),
   421 	[_MMX_Vgrn565] "m" (*MMX_Vgrn565),
   428  [_MMX_Vred5x5] "m" (*_MMX_Vred5x5),
   422 	[_MMX_Vred5x5] "m" (*MMX_Vred5x5),
   429  [_MMX_Ycoeff] "m" (*_MMX_Ycoeff),
   423 	[_MMX_Ycoeff] "m" (*MMX_Ycoeff),
   430  [_MMX_red565] "m" (*_MMX_red565),
   424 	[_MMX_red565] "m" (*MMX_red565),
   431  [_MMX_grn565] "m" (*_MMX_grn565)
   425 	[_MMX_grn565] "m" (*MMX_grn565)
   432          );
   426          );
   433 }
   427 }
   434 
   428 
   435 #endif /* GCC i386 inline assembly */
   429 #endif /* GCC i386 inline assembly */