initial import
[ICEs.git] / 169513 / video_out_dfb.i
1 typedef unsigned char uint8_t;
2 typedef struct vo_frame_s vo_frame_t;
3 struct vo_frame_s {
4 uint8_t *base[3];
5 };
6 typedef struct dfb_frame_s dfb_frame_t;
7 typedef enum {
8 MF_NONE = 0x0000000, MF_B = 0x00000001, MF_C = 0x00000002, MF_S =
9 0x00000004, MF_ALL = 0x00000007
10 } MixerFlags;
11 struct dfb_frame_s {
12 vo_frame_t vo_frame;
13 int area;
14 uint8_t *out_plane[3];
15 MixerFlags mixer_set;
16 };
17 static void __mmx_yuy2_be_yuy2(dfb_frame_t * frame)
18 {
19 uint8_t *S = frame->vo_frame.base[0];
20 uint8_t *D = frame->out_plane[0];
21 int n = frame->area / 4;
22 __asm__ __volatile__("movq wmask, %%mm2\n\t"
23 "psllw $8, %%mm2\n\t"
24 "pxor %%mm7, %%mm7\n\t" ".align 16\n" "1:\n\t"
25 "movq (%1), %%mm0\n\t"
26 "movq %%mm0, %%mm1\n\t"
27 "pand wmask, %%mm1\n\t" "testl $3, %3\n\t"
28 "jz 2f\n\t"
29 "psubw proc_table, %%mm1\n\t"
30 "psllw $3, %%mm1\n\t"
31 "pmulhw proc_table+24, %%mm1\n\t"
32 "paddw proc_table+8, %%mm1\n\t"
33 "packuswb %%mm1, %%mm1\n\t"
34 "punpcklbw %%mm7, %%mm1\n\t" ".align 8\n" "2:\n\t"
35 "pand %%mm2, %%mm0\n\t" "testl $4, %3\n\t"
36 "jz 3f\n\t" "psrlw $8, %%mm0\n\t"
37 "psubw proc_table+16, %%mm0\n\t"
38 "psllw $3, %%mm0\n\t"
39 "pmulhw proc_table+32, %%mm0\n\t"
40 "paddw proc_table+16, %%mm0\n\t"
41 "packuswb %%mm0, %%mm0\n\t"
42 "punpcklbw %%mm7, %%mm0\n\t"
43 "psllw $8, %%mm0\n\t" ".align 8\n" "3:\n\t"
44 "por %%mm1, %%mm0\n\t"
45 "movq %%mm0, (%0)\n\t" "addl $8, %0\n\t"
46 "addl $8, %1\n\t" "decl %2\n\t"
47 "jnz 1b\n\t" "emms":"=&D"(D), "=&S"(S),
48 "=&c"(n):"q"(frame->mixer_set), "0"(D), "1"(S),
49 "2"(n):"memory");
50 }