annotate libmpcodecs/vf_ilpack.c @ 11647:f9fccf97d588

For RealVideo the aspect ratio was overridden in vd_realvid.c. Implemented a workaround.
author mosu
date Mon, 15 Dec 2003 11:16:41 +0000
parents 3837fd1bfa5b
children 57372aa1d655
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9933
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
1 #include <stdio.h>
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
2 #include <stdlib.h>
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
3 #include <string.h>
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
4 #include <inttypes.h>
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
5
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
6 #include "../config.h"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
7 #include "../mp_msg.h"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
8 #include "../cpudetect.h"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
9
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
10 #include "img_format.h"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
11 #include "mp_image.h"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
12 #include "vf.h"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
13
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
14 #include "../libvo/fastmemcpy.h"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
15 #include "../postproc/rgb2rgb.h"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
16
11643
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
17 typedef void (pack_func_t)(unsigned char *dst, unsigned char *y,
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
18 unsigned char *u, unsigned char *v, int w, int us, int vs);
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
19
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
20 struct vf_priv_s {
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
21 int mode;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
22 pack_func_t *pack[2];
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
23 };
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
24
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
25 static void pack_nn_C(unsigned char *dst, unsigned char *y,
9933
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
26 unsigned char *u, unsigned char *v, int w)
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
27 {
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
28 int j;
11643
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
29 for (j = w/2; j; j--) {
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
30 *dst++ = *y++;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
31 *dst++ = *u++;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
32 *dst++ = *y++;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
33 *dst++ = *v++;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
34 }
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
35 }
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
36
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
37 static void pack_li_0_C(unsigned char *dst, unsigned char *y,
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
38 unsigned char *u, unsigned char *v, int w, int us, int vs)
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
39 {
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
40 int j;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
41 for (j = w/2; j; j--) {
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
42 *dst++ = *y++;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
43 *dst++ = (u[us+us] + 7*u[0])>>3;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
44 *dst++ = *y++;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
45 *dst++ = (v[vs+vs] + 7*v[0])>>3;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
46 u++; v++;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
47 }
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
48 }
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
49
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
50 static void pack_li_1_C(unsigned char *dst, unsigned char *y,
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
51 unsigned char *u, unsigned char *v, int w, int us, int vs)
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
52 {
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
53 int j;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
54 for (j = w/2; j; j--) {
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
55 *dst++ = *y++;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
56 *dst++ = (3*u[us+us] + 5*u[0])>>3;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
57 *dst++ = *y++;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
58 *dst++ = (3*v[vs+vs] + 5*v[0])>>3;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
59 u++; v++;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
60 }
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
61 }
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
62
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
63 #ifdef HAVE_MMX
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
64 static void pack_nn_MMX(unsigned char *dst, unsigned char *y,
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
65 unsigned char *u, unsigned char *v, int w)
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
66 {
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
67 int j;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
68 asm volatile (""
9933
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
69 "pxor %%mm0, %%mm0 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
70 ".balign 16 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
71 "1: \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
72 "movq (%0), %%mm1 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
73 "movq (%0), %%mm2 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
74 "punpcklbw %%mm0, %%mm1 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
75 "punpckhbw %%mm0, %%mm2 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
76
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
77 "movq (%1), %%mm3 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
78 "movq (%2), %%mm5 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
79 "punpcklbw %%mm0, %%mm3 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
80 "punpcklbw %%mm0, %%mm5 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
81 "movq %%mm3, %%mm4 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
82 "movq %%mm5, %%mm6 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
83 "punpcklwd %%mm0, %%mm3 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
84 "punpckhwd %%mm0, %%mm4 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
85 "punpcklwd %%mm0, %%mm5 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
86 "punpckhwd %%mm0, %%mm6 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
87 "pslld $8, %%mm3 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
88 "pslld $8, %%mm4 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
89 "pslld $24, %%mm5 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
90 "pslld $24, %%mm6 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
91
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
92 "por %%mm3, %%mm1 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
93 "por %%mm4, %%mm2 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
94 "por %%mm5, %%mm1 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
95 "por %%mm6, %%mm2 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
96
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
97 "addl $8, %0 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
98 "addl $4, %1 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
99 "addl $4, %2 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
100 "movq %%mm1, (%3) \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
101 "movq %%mm2, 8(%3) \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
102 "addl $16, %3 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
103 "decl %4 \n\t"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
104 "jnz 1b \n\t"
11643
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
105 "emms \n\t"
9933
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
106 :
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
107 : "r" (y), "r" (u), "r" (v), "r" (dst), "r" (w/8)
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
108 : "memory"
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
109 );
11643
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
110 pack_nn_C(dst, y, u, v, (w&7));
9933
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
111 }
11645
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
112
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
113 static void pack_li_0_MMX(unsigned char *dst, unsigned char *y,
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
114 unsigned char *u, unsigned char *v, int w, int us, int vs)
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
115 {
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
116 asm volatile (""
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
117 "pushl %%ebp \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
118 "movl 4(%%edx), %%ebp \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
119 "movl (%%edx), %%edx \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
120 "pxor %%mm0, %%mm0 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
121
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
122 ".balign 16 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
123 ".Lli0: \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
124 "movq (%%esi), %%mm1 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
125 "movq (%%esi), %%mm2 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
126 "punpcklbw %%mm0, %%mm1 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
127 "punpckhbw %%mm0, %%mm2 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
128
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
129 "movq (%%eax,%%edx,2), %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
130 "movq (%%ebx,%%ebp,2), %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
131 "punpcklbw %%mm0, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
132 "punpcklbw %%mm0, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
133 "movq (%%eax), %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
134 "movq (%%ebx), %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
135 "punpcklbw %%mm0, %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
136 "punpcklbw %%mm0, %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
137 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
138 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
139 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
140 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
141 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
142 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
143 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
144 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
145 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
146 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
147 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
148 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
149 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
150 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
151 "psrlw $3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
152 "psrlw $3, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
153 "movq %%mm4, %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
154 "movq %%mm6, %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
155 "punpcklwd %%mm0, %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
156 "punpckhwd %%mm0, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
157 "punpcklwd %%mm0, %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
158 "punpckhwd %%mm0, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
159 "pslld $8, %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
160 "pslld $8, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
161 "pslld $24, %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
162 "pslld $24, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
163
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
164 "por %%mm3, %%mm1 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
165 "por %%mm4, %%mm2 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
166 "por %%mm5, %%mm1 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
167 "por %%mm6, %%mm2 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
168
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
169 "movq %%mm1, (%%edi) \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
170 "movq %%mm2, 8(%%edi) \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
171
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
172 "movq 8(%%esi), %%mm1 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
173 "movq 8(%%esi), %%mm2 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
174 "punpcklbw %%mm0, %%mm1 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
175 "punpckhbw %%mm0, %%mm2 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
176
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
177 "movq (%%eax,%%edx,2), %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
178 "movq (%%ebx,%%ebp,2), %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
179 "punpckhbw %%mm0, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
180 "punpckhbw %%mm0, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
181 "movq (%%eax), %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
182 "movq (%%ebx), %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
183 "punpckhbw %%mm0, %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
184 "punpckhbw %%mm0, %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
185 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
186 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
187 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
188 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
189 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
190 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
191 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
192 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
193 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
194 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
195 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
196 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
197 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
198 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
199 "psrlw $3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
200 "psrlw $3, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
201 "movq %%mm4, %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
202 "movq %%mm6, %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
203 "punpcklwd %%mm0, %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
204 "punpckhwd %%mm0, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
205 "punpcklwd %%mm0, %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
206 "punpckhwd %%mm0, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
207 "pslld $8, %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
208 "pslld $8, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
209 "pslld $24, %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
210 "pslld $24, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
211
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
212 "por %%mm3, %%mm1 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
213 "por %%mm4, %%mm2 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
214 "por %%mm5, %%mm1 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
215 "por %%mm6, %%mm2 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
216
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
217 "addl $16, %%esi \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
218 "addl $8, %%eax \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
219 "addl $8, %%ebx \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
220
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
221 "movq %%mm1, 16(%%edi) \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
222 "movq %%mm2, 24(%%edi) \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
223 "addl $32, %%edi \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
224
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
225 "decl %%ecx \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
226 "jnz .Lli0 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
227 "emms \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
228 "popl %%ebp \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
229 :
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
230 : "S" (y), "D" (dst), "a" (u), "b" (v), "d" (&us), "c" (w/16)
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
231 : "memory"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
232 );
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
233 pack_li_0_C(dst, y, u, v, (w&15), us, vs);
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
234 }
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
235
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
236 static void pack_li_1_MMX(unsigned char *dst, unsigned char *y,
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
237 unsigned char *u, unsigned char *v, int w, int us, int vs)
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
238 {
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
239 asm volatile (""
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
240 "pushl %%ebp \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
241 "movl 4(%%edx), %%ebp \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
242 "movl (%%edx), %%edx \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
243 "pxor %%mm0, %%mm0 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
244
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
245 ".balign 16 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
246 ".Lli1: \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
247 "movq (%%esi), %%mm1 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
248 "movq (%%esi), %%mm2 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
249 "punpcklbw %%mm0, %%mm1 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
250 "punpckhbw %%mm0, %%mm2 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
251
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
252 "movq (%%eax,%%edx,2), %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
253 "movq (%%ebx,%%ebp,2), %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
254 "punpcklbw %%mm0, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
255 "punpcklbw %%mm0, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
256 "movq (%%eax), %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
257 "movq (%%ebx), %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
258 "punpcklbw %%mm0, %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
259 "punpcklbw %%mm0, %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
260 "movq %%mm4, %%mm7 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
261 "paddw %%mm4, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
262 "paddw %%mm7, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
263 "movq %%mm6, %%mm7 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
264 "paddw %%mm6, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
265 "paddw %%mm7, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
266 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
267 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
268 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
269 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
270 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
271 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
272 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
273 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
274 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
275 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
276 "psrlw $3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
277 "psrlw $3, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
278 "movq %%mm4, %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
279 "movq %%mm6, %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
280 "punpcklwd %%mm0, %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
281 "punpckhwd %%mm0, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
282 "punpcklwd %%mm0, %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
283 "punpckhwd %%mm0, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
284 "pslld $8, %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
285 "pslld $8, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
286 "pslld $24, %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
287 "pslld $24, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
288
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
289 "por %%mm3, %%mm1 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
290 "por %%mm4, %%mm2 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
291 "por %%mm5, %%mm1 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
292 "por %%mm6, %%mm2 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
293
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
294 "movq %%mm1, (%%edi) \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
295 "movq %%mm2, 8(%%edi) \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
296
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
297 "movq 8(%%esi), %%mm1 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
298 "movq 8(%%esi), %%mm2 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
299 "punpcklbw %%mm0, %%mm1 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
300 "punpckhbw %%mm0, %%mm2 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
301
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
302 "movq (%%eax,%%edx,2), %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
303 "movq (%%ebx,%%ebp,2), %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
304 "punpckhbw %%mm0, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
305 "punpckhbw %%mm0, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
306 "movq (%%eax), %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
307 "movq (%%ebx), %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
308 "punpckhbw %%mm0, %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
309 "punpckhbw %%mm0, %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
310 "movq %%mm4, %%mm7 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
311 "paddw %%mm4, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
312 "paddw %%mm7, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
313 "movq %%mm6, %%mm7 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
314 "paddw %%mm6, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
315 "paddw %%mm7, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
316 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
317 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
318 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
319 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
320 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
321 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
322 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
323 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
324 "paddw %%mm3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
325 "paddw %%mm5, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
326 "psrlw $3, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
327 "psrlw $3, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
328 "movq %%mm4, %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
329 "movq %%mm6, %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
330 "punpcklwd %%mm0, %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
331 "punpckhwd %%mm0, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
332 "punpcklwd %%mm0, %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
333 "punpckhwd %%mm0, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
334 "pslld $8, %%mm3 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
335 "pslld $8, %%mm4 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
336 "pslld $24, %%mm5 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
337 "pslld $24, %%mm6 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
338
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
339 "por %%mm3, %%mm1 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
340 "por %%mm4, %%mm2 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
341 "por %%mm5, %%mm1 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
342 "por %%mm6, %%mm2 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
343
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
344 "addl $16, %%esi \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
345 "addl $8, %%eax \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
346 "addl $8, %%ebx \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
347
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
348 "movq %%mm1, 16(%%edi) \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
349 "movq %%mm2, 24(%%edi) \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
350 "addl $32, %%edi \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
351
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
352 "decl %%ecx \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
353 "jnz .Lli1 \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
354 "emms \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
355 "popl %%ebp \n\t"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
356 :
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
357 : "S" (y), "D" (dst), "a" (u), "b" (v), "d" (&us), "c" (w/16)
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
358 : "memory"
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
359 );
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
360 pack_li_1_C(dst, y, u, v, (w&15), us, vs);
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
361 }
9933
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
362 #endif
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
363
11643
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
364 static pack_func_t *pack_nn;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
365 static pack_func_t *pack_li_0;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
366 static pack_func_t *pack_li_1;
9933
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
367
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
368 static void ilpack(unsigned char *dst, unsigned char *src[3],
11643
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
369 int dststride, int srcstride[3], int w, int h, pack_func_t *pack[2])
9933
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
370 {
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
371 int i;
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
372 unsigned char *y, *u, *v;
11643
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
373 int ys = srcstride[0], us = srcstride[1], vs = srcstride[2];
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
374 int a, b;
9933
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
375
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
376 y = src[0];
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
377 u = src[1];
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
378 v = src[2];
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
379
11643
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
380 pack_nn(dst, y, u, v, w, 0, 0);
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
381 y += ys; dst += dststride;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
382 pack_nn(dst, y, u+us, v+vs, w, 0, 0);
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
383 y += ys; dst += dststride;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
384 for (i=2; i<h-2; i++) {
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
385 a = (i&2) ? 1 : -1;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
386 b = (i&1) ^ ((i&2)>>1);
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
387 pack[b](dst, y, u, v, w, us*a, vs*a);
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
388 y += ys;
9933
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
389 if ((i&3) == 1) {
11643
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
390 u -= us;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
391 v -= vs;
9933
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
392 } else {
11643
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
393 u += us;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
394 v += vs;
9933
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
395 }
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
396 dst += dststride;
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
397 }
11643
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
398 pack_nn(dst, y, u, v, w, 0, 0);
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
399 y += ys; dst += dststride; u += us; v += vs;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
400 pack_nn(dst, y, u, v, w, 0, 0);
9933
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
401 }
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
402
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
403
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
404 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi)
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
405 {
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
406 mp_image_t *dmpi;
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
407
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
408 // hope we'll get DR buffer:
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
409 dmpi=vf_get_image(vf->next, IMGFMT_YUY2,
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
410 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
411 mpi->w, mpi->h);
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
412
11643
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
413 ilpack(dmpi->planes[0], mpi->planes, dmpi->stride[0], mpi->stride, mpi->w, mpi->h, vf->priv->pack);
9933
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
414
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
415 return vf_next_put_image(vf,dmpi);
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
416 }
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
417
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
418 static int config(struct vf_instance_s* vf,
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
419 int width, int height, int d_width, int d_height,
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
420 unsigned int flags, unsigned int outfmt)
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
421 {
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
422 /* FIXME - also support UYVY output? */
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
423 return vf_next_config(vf, width, height, d_width, d_height, flags, IMGFMT_YUY2);
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
424 }
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
425
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
426
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
427 static int query_format(struct vf_instance_s* vf, unsigned int fmt)
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
428 {
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
429 /* FIXME - really any YUV 4:2:0 input format should work */
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
430 switch (fmt) {
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
431 case IMGFMT_YV12:
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
432 case IMGFMT_IYUV:
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
433 case IMGFMT_I420:
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
434 return vf_next_query_format(vf,IMGFMT_YUY2);
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
435 }
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
436 return 0;
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
437 }
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
438
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
439 static int open(vf_instance_t *vf, char* args)
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
440 {
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
441 vf->config=config;
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
442 vf->query_format=query_format;
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
443 vf->put_image=put_image;
11643
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
444 vf->priv = calloc(1, sizeof(struct vf_priv_s));
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
445 vf->priv->mode = 1;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
446 if (args) sscanf(args, "%d", &vf->priv->mode);
9933
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
447
11643
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
448 pack_nn = (pack_func_t *)pack_nn_C;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
449 pack_li_0 = pack_li_0_C;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
450 pack_li_1 = pack_li_1_C;
9933
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
451 #ifdef HAVE_MMX
11645
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
452 if(gCpuCaps.hasMMX) {
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
453 pack_nn = (pack_func_t *)pack_nn_MMX;
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
454 pack_li_0 = pack_li_0_MMX;
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
455 pack_li_1 = pack_li_1_MMX;
3837fd1bfa5b mmx optimizations
rfelker
parents: 11643
diff changeset
456 }
9933
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
457 #endif
11643
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
458
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
459 switch(vf->priv->mode) {
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
460 case 0:
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
461 vf->priv->pack[0] = vf->priv->pack[1] = pack_nn;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
462 break;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
463 default:
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
464 mp_msg(MSGT_VFILTER, MSGL_WARN,
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
465 "ilpack: unknown mode %d (fallback to linear)\n",
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
466 vf->priv->mode);
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
467 case 1:
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
468 vf->priv->pack[0] = pack_li_0;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
469 vf->priv->pack[1] = pack_li_1;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
470 break;
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
471 }
3ddfe9316ca9 big updates to ilpack: do proper interpolation rather than just
rfelker
parents: 9933
diff changeset
472
9933
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
473 return 1;
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
474 }
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
475
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
476 vf_info_t vf_info_ilpack = {
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
477 "4:2:0 planar -> 4:2:2 packed reinterlacer",
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
478 "ilpack",
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
479 "Richard Felker",
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
480 "",
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
481 open,
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
482 NULL
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
483 };
3548701a13fe 1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff changeset
484