|
|
@ -86,7 +86,8 @@ void ff_put_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, |
|
|
|
"movq %%mm2, (%0, %1) \n\t" |
|
|
|
"movq %%mm2, (%0, %1) \n\t" |
|
|
|
"movq %%mm4, (%0, %1, 2) \n\t" |
|
|
|
"movq %%mm4, (%0, %1, 2) \n\t" |
|
|
|
"movq %%mm6, (%0, %2) \n\t" |
|
|
|
"movq %%mm6, (%0, %2) \n\t" |
|
|
|
:: "r"(pix), "r"((x86_reg)line_size), "r"((x86_reg)line_size * 3), "r"(p) |
|
|
|
:: "r" (pix), "r" ((x86_reg) line_size), "r" ((x86_reg) line_size * 3), |
|
|
|
|
|
|
|
"r" (p) |
|
|
|
: "memory"); |
|
|
|
: "memory"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -182,8 +183,7 @@ void name(int16_t *blocks) \ |
|
|
|
"js 1b \n\t" \
|
|
|
|
"js 1b \n\t" \
|
|
|
|
:: "r"(((uint8_t *) blocks) + 128 * n), \
|
|
|
|
:: "r"(((uint8_t *) blocks) + 128 * n), \
|
|
|
|
"i"(-128 * n) \
|
|
|
|
"i"(-128 * n) \
|
|
|
|
: "%"REG_a \
|
|
|
|
: "%"REG_a); \
|
|
|
|
); \
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
CLEAR_BLOCKS(ff_clear_blocks_mmx, 6) |
|
|
|
CLEAR_BLOCKS(ff_clear_blocks_mmx, 6) |
|
|
|
CLEAR_BLOCKS(ff_clear_block_mmx, 1) |
|
|
|
CLEAR_BLOCKS(ff_clear_block_mmx, 1) |
|
|
@ -201,8 +201,7 @@ void ff_clear_block_sse(int16_t *block) |
|
|
|
"movaps %%xmm0, 96(%0) \n" |
|
|
|
"movaps %%xmm0, 96(%0) \n" |
|
|
|
"movaps %%xmm0, 112(%0) \n" |
|
|
|
"movaps %%xmm0, 112(%0) \n" |
|
|
|
:: "r" (block) |
|
|
|
:: "r" (block) |
|
|
|
: "memory" |
|
|
|
: "memory"); |
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ff_clear_blocks_sse(int16_t *blocks) |
|
|
|
void ff_clear_blocks_sse(int16_t *blocks) |
|
|
@ -221,15 +220,14 @@ void ff_clear_blocks_sse(int16_t *blocks) |
|
|
|
"movaps %%xmm0, 112(%0, %%"REG_a") \n" |
|
|
|
"movaps %%xmm0, 112(%0, %%"REG_a") \n" |
|
|
|
"add $128, %%"REG_a" \n" |
|
|
|
"add $128, %%"REG_a" \n" |
|
|
|
"js 1b \n" |
|
|
|
"js 1b \n" |
|
|
|
:: "r"(((uint8_t *)blocks) + 128 * 6), |
|
|
|
:: "r"(((uint8_t *) blocks) + 128 * 6), "i"(-128 * 6) |
|
|
|
"i"(-128 * 6) |
|
|
|
: "%"REG_a); |
|
|
|
: "%"REG_a |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ff_add_bytes_mmx(uint8_t *dst, uint8_t *src, int w) |
|
|
|
void ff_add_bytes_mmx(uint8_t *dst, uint8_t *src, int w) |
|
|
|
{ |
|
|
|
{ |
|
|
|
x86_reg i = 0; |
|
|
|
x86_reg i = 0; |
|
|
|
|
|
|
|
|
|
|
|
__asm__ volatile ( |
|
|
|
__asm__ volatile ( |
|
|
|
"jmp 2f \n\t" |
|
|
|
"jmp 2f \n\t" |
|
|
|
"1: \n\t" |
|
|
|
"1: \n\t" |
|
|
@ -246,8 +244,8 @@ void ff_add_bytes_mmx(uint8_t *dst, uint8_t *src, int w) |
|
|
|
"cmp %3, %0 \n\t" |
|
|
|
"cmp %3, %0 \n\t" |
|
|
|
"js 1b \n\t" |
|
|
|
"js 1b \n\t" |
|
|
|
: "+r" (i) |
|
|
|
: "+r" (i) |
|
|
|
: "r"(src), "r"(dst), "r"((x86_reg)w - 15) |
|
|
|
: "r" (src), "r" (dst), "r" ((x86_reg) w - 15)); |
|
|
|
); |
|
|
|
|
|
|
|
for (; i < w; i++) |
|
|
|
for (; i < w; i++) |
|
|
|
dst[i + 0] += src[i + 0]; |
|
|
|
dst[i + 0] += src[i + 0]; |
|
|
|
} |
|
|
|
} |
|
|
@ -280,8 +278,8 @@ void ff_draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, |
|
|
|
"cmp %3, %0 \n\t" |
|
|
|
"cmp %3, %0 \n\t" |
|
|
|
"jb 1b \n\t" |
|
|
|
"jb 1b \n\t" |
|
|
|
: "+r" (ptr) |
|
|
|
: "+r" (ptr) |
|
|
|
: "r"((x86_reg)wrap), "r"((x86_reg)width), "r"(ptr + wrap * height) |
|
|
|
: "r" ((x86_reg) wrap), "r" ((x86_reg) width), |
|
|
|
); |
|
|
|
"r" (ptr + wrap * height)); |
|
|
|
} else if (w == 16) { |
|
|
|
} else if (w == 16) { |
|
|
|
__asm__ volatile ( |
|
|
|
__asm__ volatile ( |
|
|
|
"1: \n\t" |
|
|
|
"1: \n\t" |
|
|
@ -320,8 +318,8 @@ void ff_draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, |
|
|
|
"cmp %3, %0 \n\t" |
|
|
|
"cmp %3, %0 \n\t" |
|
|
|
"jb 1b \n\t" |
|
|
|
"jb 1b \n\t" |
|
|
|
: "+r" (ptr) |
|
|
|
: "+r" (ptr) |
|
|
|
: "r"((x86_reg)wrap), "r"((x86_reg)width), "r"(ptr + wrap * height) |
|
|
|
: "r" ((x86_reg) wrap), "r" ((x86_reg) width), |
|
|
|
); |
|
|
|
"r" (ptr + wrap * height)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* top and bottom (and hopefully also the corners) */ |
|
|
|
/* top and bottom (and hopefully also the corners) */ |
|
|
@ -339,9 +337,9 @@ void ff_draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, |
|
|
|
"cmp %4, %0 \n\t" |
|
|
|
"cmp %4, %0 \n\t" |
|
|
|
"jb 1b \n\t" |
|
|
|
"jb 1b \n\t" |
|
|
|
: "+r" (ptr) |
|
|
|
: "+r" (ptr) |
|
|
|
: "r"((x86_reg)buf - (x86_reg)ptr - w), "r"((x86_reg) -wrap), |
|
|
|
: "r" ((x86_reg) buf - (x86_reg) ptr - w), |
|
|
|
"r"((x86_reg) -wrap * 3), "r"(ptr + width + 2 * w) |
|
|
|
"r" ((x86_reg) - wrap), "r" ((x86_reg) - wrap * 3), |
|
|
|
); |
|
|
|
"r" (ptr + width + 2 * w)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -361,8 +359,7 @@ void ff_draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, |
|
|
|
: "+r" (ptr) |
|
|
|
: "+r" (ptr) |
|
|
|
: "r" ((x86_reg) last_line - (x86_reg) ptr - w), |
|
|
|
: "r" ((x86_reg) last_line - (x86_reg) ptr - w), |
|
|
|
"r" ((x86_reg) wrap), "r" ((x86_reg) wrap * 3), |
|
|
|
"r" ((x86_reg) wrap), "r" ((x86_reg) wrap * 3), |
|
|
|
"r"(ptr + width + 2 * w) |
|
|
|
"r" (ptr + width + 2 * w)); |
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -406,10 +403,10 @@ static av_always_inline void gmc(uint8_t *dst, uint8_t *src, |
|
|
|
|
|
|
|
|
|
|
|
if ( // non-constant fullpel offset (3% of blocks)
|
|
|
|
if ( // non-constant fullpel offset (3% of blocks)
|
|
|
|
((ox ^ (ox + dxw)) | (ox ^ (ox + dxh)) | (ox ^ (ox + dxw + dxh)) | |
|
|
|
((ox ^ (ox + dxw)) | (ox ^ (ox + dxh)) | (ox ^ (ox + dxw + dxh)) | |
|
|
|
(oy ^ (oy + dyw)) | (oy ^ (oy + dyh)) | (oy ^ (oy + dyw + dyh))) >> (16 + shift) |
|
|
|
(oy ^ (oy + dyw)) | (oy ^ (oy + dyh)) | (oy ^ (oy + dyw + dyh))) >> (16 + shift) || |
|
|
|
// uses more than 16 bits of subpel mv (only at huge resolution)
|
|
|
|
// uses more than 16 bits of subpel mv (only at huge resolution)
|
|
|
|
|| (dxx | dxy | dyx | dyy) & 15 |
|
|
|
(dxx | dxy | dyx | dyy) & 15 || |
|
|
|
|| (need_emu && (h > MAX_H || stride > MAX_STRIDE))) { |
|
|
|
(need_emu && (h > MAX_H || stride > MAX_STRIDE))) { |
|
|
|
// FIXME could still use mmx for some of the rows
|
|
|
|
// FIXME could still use mmx for some of the rows
|
|
|
|
ff_gmc_c(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, |
|
|
|
ff_gmc_c(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, |
|
|
|
shift, r, width, height); |
|
|
|
shift, r, width, height); |
|
|
@ -427,8 +424,7 @@ static av_always_inline void gmc(uint8_t *dst, uint8_t *src, |
|
|
|
"pxor %%mm7, %%mm7 \n\t" |
|
|
|
"pxor %%mm7, %%mm7 \n\t" |
|
|
|
"punpcklwd %%mm6, %%mm6 \n\t" |
|
|
|
"punpcklwd %%mm6, %%mm6 \n\t" |
|
|
|
"punpcklwd %%mm6, %%mm6 \n\t" |
|
|
|
"punpcklwd %%mm6, %%mm6 \n\t" |
|
|
|
:: "r"(1<<shift) |
|
|
|
:: "r" (1 << shift)); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (x = 0; x < w; x += 4) { |
|
|
|
for (x = 0; x < w; x += 4) { |
|
|
|
uint16_t dx4[4] = { oxs - dxys + dxxs * (x + 0), |
|
|
|
uint16_t dx4[4] = { oxs - dxys + dxxs * (x + 0), |
|
|
@ -451,8 +447,7 @@ static av_always_inline void gmc(uint8_t *dst, uint8_t *src, |
|
|
|
"psrlw $12, %%mm4 \n\t" |
|
|
|
"psrlw $12, %%mm4 \n\t" |
|
|
|
"psrlw $12, %%mm5 \n\t" |
|
|
|
"psrlw $12, %%mm5 \n\t" |
|
|
|
: "+m" (*dx4), "+m" (*dy4) |
|
|
|
: "+m" (*dx4), "+m" (*dy4) |
|
|
|
: "m"(*dxy4), "m"(*dyy4) |
|
|
|
: "m" (*dxy4), "m" (*dyy4)); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__asm__ volatile ( |
|
|
|
__asm__ volatile ( |
|
|
|
"movq %%mm6, %%mm2 \n\t" |
|
|
|
"movq %%mm6, %%mm2 \n\t" |
|
|
@ -491,8 +486,7 @@ static av_always_inline void gmc(uint8_t *dst, uint8_t *src, |
|
|
|
: "=m" (dst[x + y * stride]) |
|
|
|
: "=m" (dst[x + y * stride]) |
|
|
|
: "m" (src[0]), "m" (src[1]), |
|
|
|
: "m" (src[0]), "m" (src[1]), |
|
|
|
"m" (src[stride]), "m" (src[stride + 1]), |
|
|
|
"m" (src[stride]), "m" (src[stride + 1]), |
|
|
|
"m"(*r4), "m"(shift2) |
|
|
|
"m" (*r4), "m" (shift2)); |
|
|
|
); |
|
|
|
|
|
|
|
src += stride; |
|
|
|
src += stride; |
|
|
|
} |
|
|
|
} |
|
|
|
src += 4 - h * stride; |
|
|
|
src += 4 - h * stride; |
|
|
@ -631,8 +625,7 @@ void ff_vector_clipf_sse(float *dst, const float *src, |
|
|
|
"jge 1b \n\t" |
|
|
|
"jge 1b \n\t" |
|
|
|
: "+&r" (i) |
|
|
|
: "+&r" (i) |
|
|
|
: "r" (dst), "r" (src), "m" (min), "m" (max) |
|
|
|
: "r" (dst), "r" (src), "m" (min), "m" (max) |
|
|
|
: "memory" |
|
|
|
: "memory"); |
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endif /* HAVE_INLINE_ASM */ |
|
|
|
#endif /* HAVE_INLINE_ASM */ |
|
|
|