00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <time.h>
00004
00005
00006 static long long mpeg3_MMX_601_Y_COEF = 0x0000004000400040;
00007
00008 inline void mpeg3_601_mmx(unsigned long y,
00009 unsigned long *output)
00010 {
00011 asm("
00012 /* Output will be 0x00rrggbb */
00013 movd (%0), %%mm0; /* Load y 0x00000000000000yy */
00014 /* pmullw mpeg3_MMX_601_Y_COEF, %%mm0; // Scale y 0x00000000000000yy */
00015 psllw $6, %%mm0; /* Shift y coeffs 0x0000yyy0yyy0yyy0 */
00016 movd %%mm0, (%1); /* Store output */
00017 "
00018 :
00019 : "r" (&y), "r" (output));
00020 }
00021
00022
00023 int main(int argc, char *argv[])
00024 {
00025 unsigned char output[1024];
00026
00027 memset(output, 0, 1024);
00028 mpeg3_601_mmx(1, (unsigned long*)output);
00029 printf("%02x%02x\n", *(unsigned char*)&output[1], *(unsigned char*)&output[0]);
00030 }