r123: Merged HEAD and TEST. New stuff shall be committed to HEAD from now on.
[cinelerra_cv/mob.git] / libmpeg3 / video / worksheet.c
blob377af1d20fcf49a09e86594bdd982cf78ab763fe
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <time.h>
6 static long long mpeg3_MMX_601_Y_COEF = 0x0000004000400040;
8 inline void mpeg3_601_mmx(unsigned long y,
9 unsigned long *output)
11 asm("
12 /* Output will be 0x00rrggbb */
13 movd (%0), %%mm0; /* Load y 0x00000000000000yy */
14 /* pmullw mpeg3_MMX_601_Y_COEF, %%mm0; // Scale y 0x00000000000000yy */
15 psllw $6, %%mm0; /* Shift y coeffs 0x0000yyy0yyy0yyy0 */
16 movd %%mm0, (%1); /* Store output */
19 : "r" (&y), "r" (output));
23 int main(int argc, char *argv[])
25 unsigned char output[1024];
27 memset(output, 0, 1024);
28 mpeg3_601_mmx(1, (unsigned long*)output);
29 printf("%02x%02x\n", *(unsigned char*)&output[1], *(unsigned char*)&output[0]);