diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2003-01-05 15:57:10 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-01-05 15:57:10 +0000 |
commit | 826f429ae9990632a04b06bd375afa54ffe54b76 (patch) | |
tree | dce2b6a89402130f5e3c6a9426063a47991f285b /libavcodec/i386/dsputil_mmx_rnd.h | |
parent | 70ac76c0eb13d74d2001e83d7803f3dc0299f86a (diff) | |
download | ffmpeg-826f429ae9990632a04b06bd375afa54ffe54b76.tar.gz |
qpel in mmx2/3dnow
qpel refinement quality parameter
Originally committed as revision 1393 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/i386/dsputil_mmx_rnd.h')
-rw-r--r-- | libavcodec/i386/dsputil_mmx_rnd.h | 363 |
1 files changed, 362 insertions, 1 deletions
diff --git a/libavcodec/i386/dsputil_mmx_rnd.h b/libavcodec/i386/dsputil_mmx_rnd.h index 3605e03f9c..f72ded1bcf 100644 --- a/libavcodec/i386/dsputil_mmx_rnd.h +++ b/libavcodec/i386/dsputil_mmx_rnd.h @@ -54,6 +54,42 @@ static void DEF(put, pixels8_x2)(UINT8 *block, const UINT8 *pixels, int line_siz :"eax", "memory"); } +static void DEF(put, pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) +{ + MOVQ_BFE(mm6); + __asm __volatile( + ".balign 8 \n\t" + "1: \n\t" + "movq (%1), %%mm0 \n\t" + "movq (%2), %%mm1 \n\t" + "addl %4, %1 \n\t" + "movq (%1), %%mm2 \n\t" + "movq 8(%2), %%mm3 \n\t" + "addl %4, %1 \n\t" + PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) + "movq %%mm4, (%3) \n\t" + "addl %5, %3 \n\t" + "movq %%mm5, (%3) \n\t" + "addl %5, %3 \n\t" + "movq (%1), %%mm0 \n\t" + "movq 16(%2), %%mm1 \n\t" + "addl %4, %1 \n\t" + "movq (%1), %%mm2 \n\t" + "movq 24(%2), %%mm3 \n\t" + "addl %4, %1 \n\t" + "addl $32, %2 \n\t" + PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) + "movq %%mm4, (%3) \n\t" + "addl %5, %3 \n\t" + "movq %%mm5, (%3) \n\t" + "addl %5, %3 \n\t" + "subl $4, %0 \n\t" + "jnz 1b \n\t" + :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst) + :"r"(src1Stride), "r"(dstStride) + :"memory"); +} + static void DEF(put, pixels16_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h) { MOVQ_BFE(mm6); @@ -90,7 +126,7 @@ static void DEF(put, pixels16_x2)(UINT8 *block, const UINT8 *pixels, int line_si "movq 9(%1, %3), %%mm3 \n\t" PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) "movq %%mm4, 8(%2) \n\t" - "movq %%mm5, 8(%2, %3) \n\t" + "movq %%mm5, 8(%2, %3) \n\t" "addl %%eax, %1 \n\t" "addl %%eax, %2 \n\t" "subl $4, %0 \n\t" @@ -100,6 +136,38 @@ static void DEF(put, pixels16_x2)(UINT8 *block, const UINT8 *pixels, int line_si :"eax", "memory"); } +static void DEF(put, pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) +{ + MOVQ_BFE(mm6); + __asm __volatile( + ".balign 8 \n\t" + "1: \n\t" + "movq (%1), %%mm0 \n\t" + "movq (%2), %%mm1 \n\t" + "movq 8(%1), %%mm2 \n\t" + "movq 8(%2), %%mm3 \n\t" + "addl %4, %1 \n\t" + PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) + "movq %%mm4, (%3) \n\t" + "movq %%mm5, 8(%3) \n\t" + "addl %5, %3 \n\t" + "movq (%1), %%mm0 \n\t" + "movq 16(%2), %%mm1 \n\t" + "movq 8(%1), %%mm2 \n\t" + "movq 24(%2), %%mm3 \n\t" + "addl %4, %1 \n\t" + PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) + "movq %%mm4, (%3) \n\t" + "movq %%mm5, 8(%3) \n\t" + "addl %5, %3 \n\t" + "addl $32, %2 \n\t" + "subl $2, %0 \n\t" + "jnz 1b \n\t" + :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst) + :"r"(src1Stride), "r"(dstStride) + :"memory"); +} + static void DEF(put, pixels8_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h) { MOVQ_BFE(mm6); @@ -195,6 +263,124 @@ static void DEF(put, pixels8_xy2)(UINT8 *block, const UINT8 *pixels, int line_si :"eax", "memory"); } +static void DEF(put, pixels8_l4)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int stride, int h) +{ + MOVQ_ZERO(mm7); + SET_RND(mm6); // =2 for rnd and =1 for no_rnd version + __asm __volatile( + ".balign 8 \n\t" + "1: \n\t" + "movq (%1), %%mm0 \n\t" + "movq (%2), %%mm1 \n\t" + "movq 64(%2), %%mm2 \n\t" + "movq 136(%2), %%mm3 \n\t" + "punpcklbw %%mm7, %%mm0 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" + "punpcklbw %%mm7, %%mm2 \n\t" + "punpcklbw %%mm7, %%mm3 \n\t" + "paddusw %%mm6, %%mm0 \n\t" + "paddusw %%mm0, %%mm1 \n\t" + "paddusw %%mm2, %%mm3 \n\t" + "paddusw %%mm1, %%mm3 \n\t" + "psrlw $2, %%mm3 \n\t" + "movq (%1), %%mm0 \n\t" + "movq (%2), %%mm1 \n\t" + "movq 64(%2), %%mm2 \n\t" + "movq 136(%2), %%mm4 \n\t" + "punpckhbw %%mm7, %%mm0 \n\t" + "punpckhbw %%mm7, %%mm1 \n\t" + "punpckhbw %%mm7, %%mm2 \n\t" + "punpckhbw %%mm7, %%mm4 \n\t" + "paddusw %%mm6, %%mm0 \n\t" + "paddusw %%mm0, %%mm1 \n\t" + "paddusw %%mm2, %%mm4 \n\t" + "paddusw %%mm1, %%mm4 \n\t" + "psrlw $2, %%mm4 \n\t" + "packuswb %%mm4, %%mm3 \n\t" + "movq %%mm3, (%0) \n\t" + "addl %4, %0 \n\t" + "addl %4, %1 \n\t" + "addl $8, %2 \n\t" + "decl %3 \n\t" + "jnz 1b \n\t" + :"+r"(dst), "+r"(src1), "+r"(src2), "+r"(h) + :"r"(stride) + :"memory"); +} + +static void DEF(put, pixels16_l4)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int stride, int h) +{ + MOVQ_ZERO(mm7); + SET_RND(mm6); // =2 for rnd and =1 for no_rnd version + __asm __volatile( + ".balign 8 \n\t" + "1: \n\t" + "movq (%1), %%mm0 \n\t" + "movq (%2), %%mm1 \n\t" + "movq 256(%2), %%mm2 \n\t" + "movq 528(%2), %%mm3 \n\t" + "punpcklbw %%mm7, %%mm0 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" + "punpcklbw %%mm7, %%mm2 \n\t" + "punpcklbw %%mm7, %%mm3 \n\t" + "paddusw %%mm6, %%mm0 \n\t" + "paddusw %%mm0, %%mm1 \n\t" + "paddusw %%mm2, %%mm3 \n\t" + "paddusw %%mm1, %%mm3 \n\t" + "psrlw $2, %%mm3 \n\t" + "movq (%1), %%mm0 \n\t" + "movq (%2), %%mm1 \n\t" + "movq 256(%2), %%mm2 \n\t" + "movq 528(%2), %%mm4 \n\t" + "punpckhbw %%mm7, %%mm0 \n\t" + "punpckhbw %%mm7, %%mm1 \n\t" + "punpckhbw %%mm7, %%mm2 \n\t" + "punpckhbw %%mm7, %%mm4 \n\t" + "paddusw %%mm6, %%mm0 \n\t" + "paddusw %%mm0, %%mm1 \n\t" + "paddusw %%mm2, %%mm4 \n\t" + "paddusw %%mm1, %%mm4 \n\t" + "psrlw $2, %%mm4 \n\t" + "packuswb %%mm4, %%mm3 \n\t" + "movq %%mm3, (%0) \n\t" + "movq 8(%1), %%mm0 \n\t" + "movq 8(%2), %%mm1 \n\t" + "movq 264(%2), %%mm2 \n\t" + "movq 536(%2), %%mm3 \n\t" + "punpcklbw %%mm7, %%mm0 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" + "punpcklbw %%mm7, %%mm2 \n\t" + "punpcklbw %%mm7, %%mm3 \n\t" + "paddusw %%mm6, %%mm0 \n\t" + "paddusw %%mm0, %%mm1 \n\t" + "paddusw %%mm2, %%mm3 \n\t" + "paddusw %%mm1, %%mm3 \n\t" + "psrlw $2, %%mm3 \n\t" + "movq 8(%1), %%mm0 \n\t" + "movq 8(%2), %%mm1 \n\t" + "movq 264(%2), %%mm2 \n\t" + "movq 536(%2), %%mm4 \n\t" + "punpckhbw %%mm7, %%mm0 \n\t" + "punpckhbw %%mm7, %%mm1 \n\t" + "punpckhbw %%mm7, %%mm2 \n\t" + "punpckhbw %%mm7, %%mm4 \n\t" + "paddusw %%mm6, %%mm0 \n\t" + "paddusw %%mm0, %%mm1 \n\t" + "paddusw %%mm2, %%mm4 \n\t" + "paddusw %%mm1, %%mm4 \n\t" + "psrlw $2, %%mm4 \n\t" + "packuswb %%mm4, %%mm3 \n\t" + "movq %%mm3, 8(%0) \n\t" + "addl %4, %0 \n\t" + "addl %4, %1 \n\t" + "addl $16, %2 \n\t" + "decl %3 \n\t" + "jnz 1b \n\t" + :"+r"(dst), "+r"(src1), "+r"(src2), "+r"(h) + :"r"(stride) + :"memory"); +} + // avg_pixels // in case more speed is needed - unroling would certainly help static void DEF(avg, pixels8)(UINT8 *block, const UINT8 *pixels, int line_size, int h) @@ -259,6 +445,27 @@ static void DEF(avg, pixels8_x2)(UINT8 *block, const UINT8 *pixels, int line_siz } while (--h); } +static void DEF(avg, pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) +{ + MOVQ_BFE(mm6); + JUMPALIGN(); + do { + __asm __volatile( + "movq %1, %%mm0 \n\t" + "movq %2, %%mm1 \n\t" + "movq %0, %%mm3 \n\t" + PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) + PAVGB(%%mm3, %%mm2, %%mm0, %%mm6) + "movq %%mm0, %0 \n\t" + :"+m"(*dst) + :"m"(*src1), "m"(*src2) + :"memory"); + dst += dstStride; + src1 += src1Stride; + src2 += 8; + } while (--h); +} + static void DEF(avg, pixels16_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h) { MOVQ_BFE(mm6); @@ -285,6 +492,33 @@ static void DEF(avg, pixels16_x2)(UINT8 *block, const UINT8 *pixels, int line_si } while (--h); } +static void DEF(avg, pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) +{ + MOVQ_BFE(mm6); + JUMPALIGN(); + do { + __asm __volatile( + "movq %1, %%mm0 \n\t" + "movq %2, %%mm1 \n\t" + "movq %0, %%mm3 \n\t" + PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) + PAVGB(%%mm3, %%mm2, %%mm0, %%mm6) + "movq %%mm0, %0 \n\t" + "movq 8%1, %%mm0 \n\t" + "movq 8%2, %%mm1 \n\t" + "movq 8%0, %%mm3 \n\t" + PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) + PAVGB(%%mm3, %%mm2, %%mm0, %%mm6) + "movq %%mm0, 8%0 \n\t" + :"+m"(*dst) + :"m"(*src1), "m"(*src2) + :"memory"); + dst += dstStride; + src1 += src1Stride; + src2 += 16; + } while (--h); +} + static void DEF(avg, pixels8_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h) { MOVQ_BFE(mm6); @@ -399,6 +633,133 @@ static void DEF(avg, pixels8_xy2)(UINT8 *block, const UINT8 *pixels, int line_si :"eax", "memory"); } +static void DEF(avg, pixels8_l4)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int stride, int h) +{ + MOVQ_ZERO(mm7); + SET_RND(mm6); // =2 for rnd and =1 for no_rnd version + MOVQ_BFE(mm5); + __asm __volatile( + ".balign 8 \n\t" + "1: \n\t" + "movq (%1), %%mm0 \n\t" + "movq (%2), %%mm1 \n\t" + "movq 64(%2), %%mm2 \n\t" + "movq 136(%2), %%mm3 \n\t" + "punpcklbw %%mm7, %%mm0 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" + "punpcklbw %%mm7, %%mm2 \n\t" + "punpcklbw %%mm7, %%mm3 \n\t" + "paddusw %%mm6, %%mm0 \n\t" + "paddusw %%mm0, %%mm1 \n\t" + "paddusw %%mm2, %%mm3 \n\t" + "paddusw %%mm1, %%mm3 \n\t" + "psrlw $2, %%mm3 \n\t" + "movq (%1), %%mm0 \n\t" + "movq (%2), %%mm1 \n\t" + "movq 64(%2), %%mm2 \n\t" + "movq 136(%4), %%mm4 \n\t" + "punpckhbw %%mm7, %%mm0 \n\t" + "punpckhbw %%mm7, %%mm1 \n\t" + "punpckhbw %%mm7, %%mm2 \n\t" + "punpckhbw %%mm7, %%mm4 \n\t" + "paddusw %%mm6, %%mm0 \n\t" + "paddusw %%mm0, %%mm1 \n\t" + "paddusw %%mm2, %%mm4 \n\t" + "paddusw %%mm1, %%mm4 \n\t" + "psrlw $2, %%mm4 \n\t" + "packuswb %%mm4, %%mm3 \n\t" + "movq (%0), %%mm4 \n\t" + PAVGB(%%mm3, %%mm4, %%mm0, %%mm5) + "movq %%mm3, (%0) \n\t" + "addl %4, %0 \n\t" + "addl %4, %1 \n\t" + "addl $8, %2 \n\t" + "decl %3 \n\t" + "jnz 1b \n\t" + :"+r"(dst), "+r"(src1), "+r"(src2), "+r"(h) + :"r"(stride) + :"memory"); +} + +static void DEF(avg, pixels16_l4)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int stride, int h) +{ + MOVQ_ZERO(mm7); + SET_RND(mm6); // =2 for rnd and =1 for no_rnd version + MOVQ_BFE(mm5); + __asm __volatile( + ".balign 8 \n\t" + "1: \n\t" + "movq (%1), %%mm0 \n\t" + "movq (%2), %%mm1 \n\t" + "movq 256(%2), %%mm2 \n\t" + "movq 528(%2), %%mm3 \n\t" + "punpcklbw %%mm7, %%mm0 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" + "punpcklbw %%mm7, %%mm2 \n\t" + "punpcklbw %%mm7, %%mm3 \n\t" + "paddusw %%mm6, %%mm0 \n\t" + "paddusw %%mm0, %%mm1 \n\t" + "paddusw %%mm2, %%mm3 \n\t" + "paddusw %%mm1, %%mm3 \n\t" + "psrlw $2, %%mm3 \n\t" + "movq (%1), %%mm0 \n\t" + "movq (%2), %%mm1 \n\t" + "movq 256(%2), %%mm2 \n\t" + "movq 528(%4), %%mm4 \n\t" + "punpckhbw %%mm7, %%mm0 \n\t" + "punpckhbw %%mm7, %%mm1 \n\t" + "punpckhbw %%mm7, %%mm2 \n\t" + "punpckhbw %%mm7, %%mm4 \n\t" + "paddusw %%mm6, %%mm0 \n\t" + "paddusw %%mm0, %%mm1 \n\t" + "paddusw %%mm2, %%mm4 \n\t" + "paddusw %%mm1, %%mm4 \n\t" + "psrlw $2, %%mm4 \n\t" + "packuswb %%mm4, %%mm3 \n\t" + "movq (%0), %%mm4 \n\t" + PAVGB(%%mm3, %%mm4, %%mm0, %%mm5) + "movq %%mm3, (%0) \n\t" + "movq 8(%1), %%mm0 \n\t" + "movq 8(%2), %%mm1 \n\t" + "movq 264(%2), %%mm2 \n\t" + "movq 536(%2), %%mm3 \n\t" + "punpcklbw %%mm7, %%mm0 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" + "punpcklbw %%mm7, %%mm2 \n\t" + "punpcklbw %%mm7, %%mm3 \n\t" + "paddusw %%mm6, %%mm0 \n\t" + "paddusw %%mm0, %%mm1 \n\t" + "paddusw %%mm2, %%mm3 \n\t" + "paddusw %%mm1, %%mm3 \n\t" + "psrlw $2, %%mm3 \n\t" + "movq 8(%1), %%mm0 \n\t" + "movq 8(%2), %%mm1 \n\t" + "movq 264(%2), %%mm2 \n\t" + "movq 536(%4), %%mm4 \n\t" + "punpckhbw %%mm7, %%mm0 \n\t" + "punpckhbw %%mm7, %%mm1 \n\t" + "punpckhbw %%mm7, %%mm2 \n\t" + "punpckhbw %%mm7, %%mm4 \n\t" + "paddusw %%mm6, %%mm0 \n\t" + "paddusw %%mm0, %%mm1 \n\t" + "paddusw %%mm2, %%mm4 \n\t" + "paddusw %%mm1, %%mm4 \n\t" + "psrlw $2, %%mm4 \n\t" + "packuswb %%mm4, %%mm3 \n\t" + "movq 8(%0), %%mm4 \n\t" + PAVGB(%%mm3, %%mm4, %%mm0, %%mm5) + "movq %%mm3, 8(%0) \n\t" + "addl %4, %0 \n\t" + "addl %4, %1 \n\t" + "addl $16, %2 \n\t" + "decl %3 \n\t" + "jnz 1b \n\t" + :"+r"(dst), "+r"(src1), "+r"(src2), "+r"(h) + :"r"(stride) + :"memory"); +} + + //FIXME optimize static void DEF(put, pixels16_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){ DEF(put, pixels8_y2)(block , pixels , line_size, h); |