30#define SPLATW(reg) "pshuflw $0, %%" #reg ", %%" #reg "\n\t" \
31 "punpcklqdq %%" #reg ", %%" #reg "\n\t"
39static void gmc_ssse3(uint8_t *
dst,
const uint8_t *
src,
40 ptrdiff_t
stride,
int h,
int ox,
int oy,
41 int dxx,
int dxy,
int dyx,
int dyy,
50 const int ix = ox >> (16 +
shift);
51 const int iy = oy >> (16 +
shift);
52 const int ox2 = ox & (1 << (16 +
shift)) - 1;
53 const int oy2 = oy & (1 << (16 +
shift)) - 1;
54 const int oxs = ox2 >> 4;
55 const int oys = oy2 >> 4;
56 const int dxx2 = dxx - (1 << (16 +
shift));
57 const int dyy2 = dyy - (1 << (16 +
shift));
58 const int dxxs = dxx2 >> 4;
59 const int dxys = dxy >> 4;
60 const int dyxs = dyx >> 4;
61 const int dyys = dyy2 >> 4;
63 const int dxw = dxx2 * (
w - 1);
64 const int dyh = dyy2 * (
h - 1);
65 const int dxh = dxy * (
h - 1);
66 const int dyw = dyx * (
w - 1);
67 int need_emu = (unsigned) ix >=
width -
w ||
width <
w ||
72 ((ox2 + dxw) | (ox2 + dxh) | (ox2 + dxw + dxh) |
73 (oy2 + dyw) | (oy2 + dyh) | (oy2 + dyw + dyh)) >> (16 +
shift) ||
75 (dxx | dxy | dyx | dyy) & 15 ||
76 (!HAVE_SSE2_EXTERNAL && need_emu)) {
77 ff_gmc_c(
dst,
src,
stride,
h, ox, oy, dxx, dxy, dyx, dyy,
83 const ptrdiff_t dst_stride =
stride;
84 ptrdiff_t src_stride =
stride;
86 uint8_t edge_buf[(MAX_H + 1) * EDGE_EMU_STRIDE];
91 src_stride = EDGE_EMU_STRIDE;
96 xmm_u16 dxy8, dyy8, r8;
101 "movd %[dxxs], %%xmm2 \n\t"
102 "movd %[dyxs], %%xmm3 \n\t"
103 "movd %[oxs], %%xmm1 \n\t"
105 "movd %[oys], %%xmm7 \n\t"
107 "pmullw "MANGLE(pw_0to7)
", %%xmm2 \n\t"
109 "movd %[s], %%xmm6 \n\t"
110 "pmullw "MANGLE(pw_0to7)
", %%xmm3 \n\t"
111 "movq (%[src]), %%xmm5 \n\t"
114 "movd %[dxys], %%xmm0 \n\t"
116 "movd %[dxys], %%xmm11 \n\t"
118 "paddw %%xmm2, %%xmm1 \n\t"
119 "movq 1(%[src]), %%xmm2 \n\t"
122 "movd %[dyys], %%xmm4 \n\t"
124 "movd %[dyys], %%xmm9 \n\t"
126 "paddw %%xmm3, %%xmm7 \n\t"
127 "punpcklbw %%xmm2, %%xmm5 \n\t"
130 "movd %[r], %%xmm2 \n\t"
132 "movdqa %%xmm0, %[dxy8] \n\t"
134 "movdqa %%xmm4, %[dyy8] \n\t"
135 "movdqa %%xmm2, %[r8] \n\t"
138 "movd %[r], %%xmm8 \n\t"
141 "movd %[shift2], %%xmm12 \n\t"
145 "add %[src_stride], %[src] \n\t"
146 "movq (%[src]), %%xmm3 \n\t"
147 "movq 1(%[src]), %%xmm0 \n\t"
148 "movdqa %%xmm1, %%xmm4 \n\t"
149 "psrlw $12, %%xmm4 \n\t"
150 "movdqa %%xmm6, %%xmm2 \n\t"
151 "psubw %%xmm4, %%xmm2 \n\t"
152 "psllw $8, %%xmm4 \n\t"
153 "por %%xmm4, %%xmm2 \n\t"
154 "pmaddubsw %%xmm2, %%xmm5 \n\t"
155 "punpcklbw %%xmm0, %%xmm3 \n\t"
156 "movdqa %%xmm3, %%xmm0 \n\t"
157 "pmaddubsw %%xmm2, %%xmm3 \n\t"
159 "paddw %[dxy8], %%xmm1 \n\t"
161 "paddw %%xmm11, %%xmm1 \n\t"
163 "movdqa %%xmm7, %%xmm4 \n\t"
164 "movdqa %%xmm6, %%xmm2 \n\t"
165 "psrlw $12, %%xmm4 \n\t"
166 "psubw %%xmm4, %%xmm2 \n\t"
167 "pmullw %%xmm5, %%xmm2 \n\t"
169 "paddw %[dyy8], %%xmm7 \n\t"
171 "paddw %%xmm9, %%xmm7 \n\t"
173 "pmullw %%xmm3, %%xmm4 \n\t"
176 "paddw %[r8], %%xmm2 \n\t"
178 "paddw %%xmm8, %%xmm2 \n\t"
180 "paddw %%xmm2, %%xmm4 \n\t"
183 "psrlw %[shift2], %%xmm4 \n\t"
185 "psrlw %%xmm12, %%xmm4 \n\t"
187 "packuswb %%xmm4, %%xmm4 \n\t"
188 "movq %%xmm4, (%[dst]) \n\t"
189 "movdqa %%xmm0, %%xmm5 \n\t"
190 "add %[dst_stride], %[dst] \n\t"
195#if HAVE_X86_6REGS || HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS
201 , [dxy8]
"=m" (dxy8), [dyy8]
"=m" (dyy8), [r8]
"=m" (r8)
203 : [dst_stride]
"r"(dst_stride), [src_stride]
"r"(src_stride),
210 [oxs]
"g"(oxs), [oys]
"g"(oys), [dxxs]
"g"(dxxs), [dyxs]
"g"(dyxs),
212 :
XMM_CLOBBERS(
"xmm0",
"xmm1",
"xmm2",
"xmm3",
"xmm4",
"xmm5",
"xmm6",
"xmm7",)
214 XMM_CLOBBERS(
"xmm8",
"xmm9",
"xmm10",
"xmm11",
"xmm12",)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
#define NAMED_CONSTRAINTS_ADD(...)
#define XMM_CLOBBERS(...)
__asm__(".macro parse_r var r\n\t" "\\var = -1\n\t" _IFC_REG(0) _IFC_REG(1) _IFC_REG(2) _IFC_REG(3) _IFC_REG(4) _IFC_REG(5) _IFC_REG(6) _IFC_REG(7) _IFC_REG(8) _IFC_REG(9) _IFC_REG(10) _IFC_REG(11) _IFC_REG(12) _IFC_REG(13) _IFC_REG(14) _IFC_REG(15) _IFC_REG(16) _IFC_REG(17) _IFC_REG(18) _IFC_REG(19) _IFC_REG(20) _IFC_REG(21) _IFC_REG(22) _IFC_REG(23) _IFC_REG(24) _IFC_REG(25) _IFC_REG(26) _IFC_REG(27) _IFC_REG(28) _IFC_REG(29) _IFC_REG(30) _IFC_REG(31) ".iflt \\var\n\t" ".error \"Unable to parse register name \\r\"\n\t" ".endif\n\t" ".endm")
static int shift(int a, int b)
static const uint8_t shift2[6]
void ff_gmc_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, int h, int ox, int oy, int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height)
Macro definitions for various function/variable attributes.
static atomic_int cpu_flags
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
#define INLINE_SSSE3(flags)
#define DECLARE_ASM_CONST(n, t, v)
Declare a static constant aligned variable appropriate for use in inline assembly code.
#define DECLARE_ALIGNED_16(t, v)
void ff_mpeg4videodsp_init_x86(Mpeg4VideoDSPContext *c)
void ff_emulated_edge_mc_sse2(uint8_t *buf, const uint8_t *src, ptrdiff_t buf_stride, ptrdiff_t src_stride, int block_w, int block_h, int src_x, int src_y, int w, int h)