36#if HAVE_X86_6REGS && HAVE_INLINE_ASM && HAVE_MMX_EXTERNAL
38void ff_vc1_put_ver_16b_shift2_mmx(int16_t *
dst,
42 const int16_t *
src,
int rnd);
44 const int16_t *
src,
int rnd);
47#define OP_AVG(S,D) "pavgb " #S ", " #D " \n\t"
50#define NORMALIZE_MMX(SHIFT) \
51 "paddw %%mm7, %%mm3 \n\t" \
52 "paddw %%mm7, %%mm4 \n\t" \
53 "psraw "SHIFT", %%mm3 \n\t" \
54 "psraw "SHIFT", %%mm4 \n\t"
56#define TRANSFER_DO_PACK(OP) \
57 "packuswb %%mm4, %%mm3 \n\t" \
59 "movq %%mm3, (%2) \n\t"
61#define TRANSFER_DONT_PACK(OP) \
64 "movq %%mm3, 0(%2) \n\t" \
65 "movq %%mm4, 8(%2) \n\t"
68#define DO_UNPACK(reg) "punpcklbw %%mm0, " reg "\n\t"
69#define DONT_UNPACK(reg)
72#define LOAD_ROUNDER_MMX(ROUND) \
73 "movd "ROUND", %%mm7 \n\t" \
74 "punpcklwd %%mm7, %%mm7 \n\t" \
75 "punpckldq %%mm7, %%mm7 \n\t"
87#define MSPEL_FILTER13_CORE(UNPACK, MOVQ, A1, A2, A3, A4) \
88 MOVQ "*0+"A1", %%mm1 \n\t" \
89 MOVQ "*4+"A1", %%mm2 \n\t" \
92 "pmullw "MANGLE(ff_pw_3)", %%mm1\n\t" \
93 "pmullw "MANGLE(ff_pw_3)", %%mm2\n\t" \
94 MOVQ "*0+"A2", %%mm3 \n\t" \
95 MOVQ "*4+"A2", %%mm4 \n\t" \
98 "pmullw %%mm6, %%mm3 \n\t" \
99 "pmullw %%mm6, %%mm4 \n\t" \
100 "psubw %%mm1, %%mm3 \n\t" \
101 "psubw %%mm2, %%mm4 \n\t" \
102 MOVQ "*0+"A4", %%mm1 \n\t" \
103 MOVQ "*4+"A4", %%mm2 \n\t" \
106 "psllw $2, %%mm1 \n\t" \
107 "psllw $2, %%mm2 \n\t" \
108 "psubw %%mm1, %%mm3 \n\t" \
109 "psubw %%mm2, %%mm4 \n\t" \
110 MOVQ "*0+"A3", %%mm1 \n\t" \
111 MOVQ "*4+"A3", %%mm2 \n\t" \
114 "pmullw %%mm5, %%mm1 \n\t" \
115 "pmullw %%mm5, %%mm2 \n\t" \
116 "paddw %%mm1, %%mm3 \n\t" \
117 "paddw %%mm2, %%mm4 \n\t"
127#define MSPEL_FILTER13_VER_16B(NAME, A1, A2, A3, A4) \
129vc1_put_ver_16b_ ## NAME ## _mmx(int16_t *dst, const uint8_t *src, \
130 x86_reg src_stride, \
131 int rnd, int64_t shift) \
136 LOAD_ROUNDER_MMX("%5") \
137 "movq "MANGLE(ff_pw_53)", %%mm5\n\t" \
138 "movq "MANGLE(ff_pw_18)", %%mm6\n\t" \
141 MSPEL_FILTER13_CORE(DO_UNPACK, "movd 1", A1, A2, A3, A4) \
142 NORMALIZE_MMX("%6") \
143 TRANSFER_DONT_PACK(OP_PUT) \
145 "movd 8+"A1", %%mm1 \n\t" \
147 "movq %%mm1, %%mm3 \n\t" \
148 "paddw %%mm1, %%mm1 \n\t" \
149 "paddw %%mm3, %%mm1 \n\t" \
150 "movd 8+"A2", %%mm3 \n\t" \
152 "pmullw %%mm6, %%mm3 \n\t" \
153 "psubw %%mm1, %%mm3 \n\t" \
154 "movd 8+"A3", %%mm1 \n\t" \
156 "pmullw %%mm5, %%mm1 \n\t" \
157 "paddw %%mm1, %%mm3 \n\t" \
158 "movd 8+"A4", %%mm1 \n\t" \
160 "psllw $2, %%mm1 \n\t" \
161 "psubw %%mm1, %%mm3 \n\t" \
162 "paddw %%mm7, %%mm3 \n\t" \
163 "psraw %6, %%mm3 \n\t" \
164 "movq %%mm3, 16(%2) \n\t" \
169 : "+r"(h), "+r" (src), "+r" (dst) \
170 : "r"(src_stride), "r"(3*src_stride), \
171 "m"(rnd), "m"(shift) \
172 NAMED_CONSTRAINTS_ADD(ff_pw_3,ff_pw_53,ff_pw_18) \
184#define MSPEL_FILTER13_HOR_16B(NAME, A1, A2, A3, A4, OP, OPNAME) \
186OPNAME ## vc1_hor_16b_ ## NAME ## _mmx(uint8_t *dst, x86_reg stride, \
187 const int16_t *src, int rnd) \
191 rnd -= (-4+58+13-3)*256; \
193 LOAD_ROUNDER_MMX("%4") \
194 "movq "MANGLE(ff_pw_18)", %%mm6 \n\t" \
195 "movq "MANGLE(ff_pw_53)", %%mm5 \n\t" \
198 MSPEL_FILTER13_CORE(DONT_UNPACK, "movq 2", A1, A2, A3, A4) \
199 NORMALIZE_MMX("$7") \
201 "paddw "MANGLE(ff_pw_128)", %%mm3 \n\t" \
202 "paddw "MANGLE(ff_pw_128)", %%mm4 \n\t" \
203 TRANSFER_DO_PACK(OP) \
208 : "+r"(h), "+r" (src), "+r" (dst) \
209 : "r"(stride), "m"(rnd) \
210 NAMED_CONSTRAINTS_ADD(ff_pw_3,ff_pw_18,ff_pw_53,ff_pw_128) \
239#define VC1_MSPEL_MC(OP, INSTR)\
240static void OP ## vc1_mspel_mc(uint8_t *dst, const uint8_t *src, ptrdiff_t stride,\
241 int hmode, int vmode, int rnd)\
243 static const vc1_mspel_mc_filter_ver_16bits vc1_put_shift_ver_16bits[] =\
244 { NULL, vc1_put_ver_16b_shift1_mmx, ff_vc1_put_ver_16b_shift2_mmx, vc1_put_ver_16b_shift3_mmx };\
245 static const vc1_mspel_mc_filter_hor_16bits vc1_put_shift_hor_16bits[] =\
246 { NULL, OP ## vc1_hor_16b_shift1_mmx, ff_vc1_ ## OP ## hor_16b_shift2_ ## INSTR, OP ## vc1_hor_16b_shift3_mmx };\
249 "pxor %%mm0, %%mm0 \n\t"\
253 static const int shift_value[] = { 0, 5, 1, 5 };\
254 int shift = (shift_value[hmode]+shift_value[vmode])>>1;\
256 LOCAL_ALIGNED(16, int16_t, tmp, [12*8]);\
258 r = (1<<(shift-1)) + rnd-1;\
259 vc1_put_shift_ver_16bits[vmode](tmp, src-1, stride, r, shift);\
261 vc1_put_shift_hor_16bits[hmode](dst, stride, tmp+1, 64-rnd);\
263static void OP ## vc1_mspel_mc_16(uint8_t *dst, const uint8_t *src, \
264 int stride, int hmode, int vmode, int rnd)\
266 OP ## vc1_mspel_mc(dst + 0, src + 0, stride, hmode, vmode, rnd); \
267 OP ## vc1_mspel_mc(dst + 8, src + 8, stride, hmode, vmode, rnd); \
268 dst += 8*stride; src += 8*stride; \
269 OP ## vc1_mspel_mc(dst + 0, src + 0, stride, hmode, vmode, rnd); \
270 OP ## vc1_mspel_mc(dst + 8, src + 8, stride, hmode, vmode, rnd); \
277#define DECLARE_FUNCTION(a, b) \
278static void put_vc1_mspel_mc ## a ## b ## _mmx(uint8_t *dst, \
279 const uint8_t *src, \
283 put_vc1_mspel_mc(dst, src, stride, a, b, rnd); \
285static void avg_vc1_mspel_mc ## a ## b ## _mmxext(uint8_t *dst, \
286 const uint8_t *src, \
290 avg_vc1_mspel_mc(dst, src, stride, a, b, rnd); \
292static void put_vc1_mspel_mc ## a ## b ## _16_mmx(uint8_t *dst, \
293 const uint8_t *src, \
297 put_vc1_mspel_mc_16(dst, src, stride, a, b, rnd); \
299static void avg_vc1_mspel_mc ## a ## b ## _16_mmxext(uint8_t *dst, \
304 avg_vc1_mspel_mc_16(dst, src, stride, a, b, rnd); \
319#define FN_ASSIGN(OP, X, Y, INSN) \
320 dsp->OP##vc1_mspel_pixels_tab[1][X+4*Y] = OP##vc1_mspel_mc##X##Y##INSN; \
321 dsp->OP##vc1_mspel_pixels_tab[0][X+4*Y] = OP##vc1_mspel_mc##X##Y##_16##INSN
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static int shift(int a, int b)
static const uint8_t shift1[6]
Macro definitions for various function/variable attributes.
#define MSPEL_FILTER13_HOR_16B(NAME, A1, A2, A3, A4, OP, OPNAME)
Macro to build the horizontal 16bits version of vc1_put_shift[13].
#define VC1_MSPEL_MC(OP)
Interpolate fractional pel values by applying proper vertical then horizontal filter.
#define DECLARE_FUNCTION(a, b)
Macro to ease bicubic filter interpolation functions declarations.
#define MSPEL_FILTER13_VER_16B(NAME, A1, A2, A3, A4)
Macro to build the vertical 16bits version of vc1_put_shift[13].
void(* vc1_mspel_mc_filter_hor_16bits)(uint8_t *dst, mips_reg dst_stride, const int16_t *src, int rnd)
void(* vc1_mspel_mc_filter_ver_16bits)(int16_t *dst, const uint8_t *src, mips_reg src_stride, int rnd, int64_t shift)
1/4 shift bicubic interpolation