diff options
author | Christophe Gisquet <christophe.gisquet@gmail.com> | 2014-05-22 17:48:18 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-05-22 20:17:49 +0200 |
commit | c081ca851c9b84a41fafbce22c47a9b30b7bf8ad (patch) | |
tree | eb7ad0723126fb7834ec4814e6bc917fc9ec65a7 /libavcodec/x86/hpeldsp.asm | |
parent | 17ac9980555a0afc5b4633a538c5170c8ceacc04 (diff) | |
download | ffmpeg-c081ca851c9b84a41fafbce22c47a9b30b7bf8ad.tar.gz |
x86: hpeldsp: avg_pixels_xy2 for mmx2&3dnow
This is a port of the inline assembly of the mmx version to use the
pavg(us|)b instruction.
8 16
mmx 1498 4355
mmx2 1242 3509
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/x86/hpeldsp.asm')
-rw-r--r-- | libavcodec/x86/hpeldsp.asm | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/libavcodec/x86/hpeldsp.asm b/libavcodec/x86/hpeldsp.asm index 937b59bf4f..2adead218c 100644 --- a/libavcodec/x86/hpeldsp.asm +++ b/libavcodec/x86/hpeldsp.asm @@ -29,6 +29,7 @@ SECTION_RODATA cextern pb_1 +cextern pw_2 SECTION_TEXT @@ -494,3 +495,79 @@ INIT_MMX mmxext AVG_APPROX_PIXELS8_XY2 INIT_MMX 3dnow AVG_APPROX_PIXELS8_XY2 + + +; void ff_avg_pixels16_xy2(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h) +%macro AVG_PIXELS_XY2 0 +%if cpuflag(sse2) +cglobal avg_pixels16_xy2, 4,5,8 +%else +cglobal avg_pixels8_xy2, 4,5 +%endif + pxor m7, m7 + mova m6, [pw_2] + movu m0, [r1] + movu m4, [r1+1] + mova m1, m0 + mova m5, m4 + punpcklbw m0, m7 + punpcklbw m4, m7 + punpckhbw m1, m7 + punpckhbw m5, m7 + paddusw m4, m0 + paddusw m5, m1 + xor r4, r4 + add r1, r2 +.loop: + movu m0, [r1+r4] + movu m2, [r1+r4+1] + mova m1, m0 + mova m3, m2 + punpcklbw m0, m7 + punpcklbw m2, m7 + punpckhbw m1, m7 + punpckhbw m3, m7 + paddusw m0, m2 + paddusw m1, m3 + paddusw m4, m6 + paddusw m5, m6 + paddusw m4, m0 + paddusw m5, m1 + psrlw m4, 2 + psrlw m5, 2 + mova m3, [r0+r4] + packuswb m4, m5 + PAVGB m4, m3 + mova [r0+r4], m4 + add r4, r2 + + movu m2, [r1+r4] + movu m4, [r1+r4+1] + mova m3, m2 + mova m5, m4 + punpcklbw m2, m7 + punpcklbw m4, m7 + punpckhbw m3, m7 + punpckhbw m5, m7 + paddusw m4, m2 + paddusw m5, m3 + paddusw m0, m6 + paddusw m1, m6 + paddusw m0, m4 + paddusw m1, m5 + psrlw m0, 2 + psrlw m1, 2 + mova m3, [r0+r4] + packuswb m0, m1 + PAVGB m0, m3 + mova [r0+r4], m0 + add r4, r2 + sub r3d, 2 + jnz .loop + REP_RET +%endmacro + +INIT_MMX mmxext +AVG_PIXELS_XY2 +INIT_MMX 3dnow +AVG_PIXELS_XY2 |