diff options
Diffstat (limited to 'libavcodec/mips/h264chroma_mmi.c')
-rw-r--r-- | libavcodec/mips/h264chroma_mmi.c | 157 |
1 files changed, 71 insertions, 86 deletions
diff --git a/libavcodec/mips/h264chroma_mmi.c b/libavcodec/mips/h264chroma_mmi.c index dbcba10b3e..cc2d7cb7e9 100644 --- a/libavcodec/mips/h264chroma_mmi.c +++ b/libavcodec/mips/h264chroma_mmi.c @@ -29,12 +29,12 @@ void ff_put_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int h, int x, int y) { - int A = 64, B, C, D, E; double ftmp[12]; - uint64_t tmp[1]; + union mmi_intfloat64 A, B, C, D, E; + A.i = 64; if (!(x || y)) { - /* x=0, y=0, A=64 */ + /* x=0, y=0, A.i=64 */ __asm__ volatile ( "1: \n\t" MMI_ULDC1(%[ftmp0], %[src], 0x00) @@ -66,14 +66,13 @@ void ff_put_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, ); } else if (x && y) { /* x!=0, y!=0 */ - D = x * y; - B = (x << 3) - D; - C = (y << 3) - D; - A = 64 - D - B - C; + D.i = x * y; + B.i = (x << 3) - D.i; + C.i = (y << 3) - D.i; + A.i = 64 - D.i - B.i - C.i; __asm__ volatile ( "pxor %[ftmp0], %[ftmp0], %[ftmp0] \n\t" - "dli %[tmp0], 0x06 \n\t" "pshufh %[A], %[A], %[ftmp0] \n\t" "pshufh %[B], %[B], %[ftmp0] \n\t" "mtc1 %[tmp0], %[ftmp9] \n\t" @@ -158,22 +157,21 @@ void ff_put_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, [ftmp6]"=&f"(ftmp[6]), [ftmp7]"=&f"(ftmp[7]), [ftmp8]"=&f"(ftmp[8]), [ftmp9]"=&f"(ftmp[9]), [ftmp10]"=&f"(ftmp[10]), [ftmp11]"=&f"(ftmp[11]), - [tmp0]"=&r"(tmp[0]), [dst]"+&r"(dst), [src]"+&r"(src), [h]"+&r"(h) - : [stride]"r"((mips_reg)stride),[ff_pw_32]"f"(ff_pw_32), - [A]"f"(A), [B]"f"(B), - [C]"f"(C), [D]"f"(D) + : [stride]"r"((mips_reg)stride),[ff_pw_32]"f"(ff_pw_32.f), + [A]"f"(A.f), [B]"f"(B.f), + [C]"f"(C.f), [D]"f"(D.f), + [tmp0]"r"(0x06) : "memory" ); } else if (x) { /* x!=0, y==0 */ - E = x << 3; - A = 64 - E; + E.i = x << 3; + A.i = 64 - E.i; __asm__ volatile ( "pxor %[ftmp0], %[ftmp0], %[ftmp0] \n\t" - "dli %[tmp0], 0x06 \n\t" "pshufh %[A], %[A], %[ftmp0] \n\t" "pshufh %[E], %[E], %[ftmp0] \n\t" "mtc1 %[tmp0], %[ftmp7] \n\t" @@ -207,22 +205,20 @@ void ff_put_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]), [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]), [ftmp6]"=&f"(ftmp[6]), [ftmp7]"=&f"(ftmp[7]), - [tmp0]"=&r"(tmp[0]), [dst]"+&r"(dst), [src]"+&r"(src), [h]"+&r"(h) : [stride]"r"((mips_reg)stride), - [ff_pw_32]"f"(ff_pw_32), - [A]"f"(A), [E]"f"(E) + [ff_pw_32]"f"(ff_pw_32.f), [tmp0]"r"(0x06), + [A]"f"(A.f), [E]"f"(E.f) : "memory" ); } else { /* x==0, y!=0 */ - E = y << 3; - A = 64 - E; + E.i = y << 3; + A.i = 64 - E.i; __asm__ volatile ( "pxor %[ftmp0], %[ftmp0], %[ftmp0] \n\t" - "dli %[tmp0], 0x06 \n\t" "pshufh %[A], %[A], %[ftmp0] \n\t" "pshufh %[E], %[E], %[ftmp0] \n\t" "mtc1 %[tmp0], %[ftmp7] \n\t" @@ -276,12 +272,12 @@ void ff_put_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]), [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]), [ftmp6]"=&f"(ftmp[6]), [ftmp7]"=&f"(ftmp[7]), - [ftmp8]"=&f"(ftmp[8]), [tmp0]"=&r"(tmp[0]), + [ftmp8]"=&f"(ftmp[8]), [dst]"+&r"(dst), [src]"+&r"(src), [h]"+&r"(h) : [stride]"r"((mips_reg)stride), - [ff_pw_32]"f"(ff_pw_32), - [A]"f"(A), [E]"f"(E) + [ff_pw_32]"f"(ff_pw_32.f), [A]"f"(A.f), + [E]"f"(E.f), [tmp0]"r"(0x06) : "memory" ); } @@ -290,12 +286,12 @@ void ff_put_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, void ff_avg_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int h, int x, int y) { - int A = 64, B, C, D, E; double ftmp[10]; - uint64_t tmp[1]; + union mmi_intfloat64 A, B, C, D, E; + A.i = 64; if(!(x || y)){ - /* x=0, y=0, A=64 */ + /* x=0, y=0, A.i=64 */ __asm__ volatile ( "1: \n\t" MMI_ULDC1(%[ftmp0], %[src], 0x00) @@ -323,13 +319,12 @@ void ff_avg_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, ); } else if (x && y) { /* x!=0, y!=0 */ - D = x * y; - B = (x << 3) - D; - C = (y << 3) - D; - A = 64 - D - B - C; + D.i = x * y; + B.i = (x << 3) - D.i; + C.i = (y << 3) - D.i; + A.i = 64 - D.i - B.i - C.i; __asm__ volatile ( "pxor %[ftmp0], %[ftmp0], %[ftmp0] \n\t" - "dli %[tmp0], 0x06 \n\t" "pshufh %[A], %[A], %[ftmp0] \n\t" "pshufh %[B], %[B], %[ftmp0] \n\t" "mtc1 %[tmp0], %[ftmp9] \n\t" @@ -383,21 +378,20 @@ void ff_avg_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]), [ftmp6]"=&f"(ftmp[6]), [ftmp7]"=&f"(ftmp[7]), [ftmp8]"=&f"(ftmp[8]), [ftmp9]"=&f"(ftmp[9]), - [tmp0]"=&r"(tmp[0]), [dst]"+&r"(dst), [src]"+&r"(src), [h]"+&r"(h) - : [stride]"r"((mips_reg)stride),[ff_pw_32]"f"(ff_pw_32), - [A]"f"(A), [B]"f"(B), - [C]"f"(C), [D]"f"(D) + : [stride]"r"((mips_reg)stride),[ff_pw_32]"f"(ff_pw_32.f), + [A]"f"(A.f), [B]"f"(B.f), + [C]"f"(C.f), [D]"f"(D.f), + [tmp0]"r"(0x06) : "memory" ); } else if (x) { /* x!=0, y==0 */ - E = x << 3; - A = 64 - E; + E.i = x << 3; + A.i = 64 - E.i; __asm__ volatile ( "pxor %[ftmp0], %[ftmp0], %[ftmp0] \n\t" - "dli %[tmp0], 0x06 \n\t" "pshufh %[A], %[A], %[ftmp0] \n\t" "pshufh %[E], %[E], %[ftmp0] \n\t" "mtc1 %[tmp0], %[ftmp7] \n\t" @@ -433,21 +427,19 @@ void ff_avg_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]), [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]), [ftmp6]"=&f"(ftmp[6]), [ftmp7]"=&f"(ftmp[7]), - [tmp0]"=&r"(tmp[0]), [dst]"+&r"(dst), [src]"+&r"(src), [h]"+&r"(h) : [stride]"r"((mips_reg)stride), - [ff_pw_32]"f"(ff_pw_32), - [A]"f"(A), [E]"f"(E) + [ff_pw_32]"f"(ff_pw_32.f), [tmp0]"r"(0x06), + [A]"f"(A.f), [E]"f"(E.f) : "memory" ); } else { /* x==0, y!=0 */ - E = y << 3; - A = 64 - E; + E.i = y << 3; + A.i = 64 - E.i; __asm__ volatile ( "pxor %[ftmp0], %[ftmp0], %[ftmp0] \n\t" - "dli %[tmp0], 0x06 \n\t" "pshufh %[A], %[A], %[ftmp0] \n\t" "pshufh %[E], %[E], %[ftmp0] \n\t" "mtc1 %[tmp0], %[ftmp7] \n\t" @@ -469,8 +461,8 @@ void ff_avg_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, "pmullh %[ftmp6], %[ftmp6], %[E] \n\t" "paddh %[ftmp2], %[ftmp4], %[ftmp6] \n\t" - "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t" - "paddh %[ftmp2], %[ftmp2], %[ff_pw_32] \n\t" + "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t" + "paddh %[ftmp2], %[ftmp2], %[ff_pw_32] \n\t" "psrlh %[ftmp1], %[ftmp1], %[ftmp7] \n\t" "psrlh %[ftmp2], %[ftmp2], %[ftmp7] \n\t" "packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t" @@ -483,12 +475,11 @@ void ff_avg_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]), [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]), [ftmp6]"=&f"(ftmp[6]), [ftmp7]"=&f"(ftmp[7]), - [tmp0]"=&r"(tmp[0]), [dst]"+&r"(dst), [src]"+&r"(src), [h]"+&r"(h) : [stride]"r"((mips_reg)stride), - [ff_pw_32]"f"(ff_pw_32), - [A]"f"(A), [E]"f"(E) + [ff_pw_32]"f"(ff_pw_32.f), [tmp0]"r"(0x06), + [A]"f"(A.f), [E]"f"(E.f) : "memory" ); } @@ -497,20 +488,19 @@ void ff_avg_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, void ff_put_h264_chroma_mc4_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int h, int x, int y) { - const int A = (8 - x) * (8 - y); - const int B = x * (8 - y); - const int C = (8 - x) * y; - const int D = x * y; - const int E = B + C; double ftmp[8]; - uint64_t tmp[1]; mips_reg addr[1]; + union mmi_intfloat64 A, B, C, D, E; DECLARE_VAR_LOW32; + A.i = (8 - x) * (8 - y); + B.i = x * (8 - y); + C.i = (8 - x) * y; + D.i = x * y; + E.i = B.i + C.i; - if (D) { + if (D.i) { __asm__ volatile ( "pxor %[ftmp0], %[ftmp0], %[ftmp0] \n\t" - "dli %[tmp0], 0x06 \n\t" "pshufh %[A], %[A], %[ftmp0] \n\t" "pshufh %[B], %[B], %[ftmp0] \n\t" "mtc1 %[tmp0], %[ftmp7] \n\t" @@ -547,20 +537,19 @@ void ff_put_h264_chroma_mc4_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]), [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]), [ftmp6]"=&f"(ftmp[6]), [ftmp7]"=&f"(ftmp[7]), - [tmp0]"=&r"(tmp[0]), RESTRICT_ASM_LOW32 [dst]"+&r"(dst), [src]"+&r"(src), [h]"+&r"(h) - : [stride]"r"((mips_reg)stride),[ff_pw_32]"f"(ff_pw_32), - [A]"f"(A), [B]"f"(B), - [C]"f"(C), [D]"f"(D) + : [stride]"r"((mips_reg)stride),[ff_pw_32]"f"(ff_pw_32.f), + [A]"f"(A.f), [B]"f"(B.f), + [C]"f"(C.f), [D]"f"(D.f), + [tmp0]"r"(0x06) : "memory" ); - } else if (E) { - const int step = C ? stride : 1; + } else if (E.i) { + const int step = C.i ? stride : 1; __asm__ volatile ( "pxor %[ftmp0], %[ftmp0], %[ftmp0] \n\t" - "dli %[tmp0], 0x06 \n\t" "pshufh %[A], %[A], %[ftmp0] \n\t" "pshufh %[E], %[E], %[ftmp0] \n\t" "mtc1 %[tmp0], %[ftmp5] \n\t" @@ -585,14 +574,13 @@ void ff_put_h264_chroma_mc4_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]), [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]), [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]), - [tmp0]"=&r"(tmp[0]), RESTRICT_ASM_LOW32 [addr0]"=&r"(addr[0]), [dst]"+&r"(dst), [src]"+&r"(src), [h]"+&r"(h) : [stride]"r"((mips_reg)stride),[step]"r"((mips_reg)step), - [ff_pw_32]"f"(ff_pw_32), - [A]"f"(A), [E]"f"(E) + [ff_pw_32]"f"(ff_pw_32.f), [tmp0]"r"(0x06), + [A]"f"(A.f), [E]"f"(E.f) : "memory" ); } else { @@ -621,20 +609,19 @@ void ff_put_h264_chroma_mc4_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, void ff_avg_h264_chroma_mc4_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int h, int x, int y) { - const int A = (8 - x) *(8 - y); - const int B = x * (8 - y); - const int C = (8 - x) * y; - const int D = x * y; - const int E = B + C; double ftmp[8]; - uint64_t tmp[1]; mips_reg addr[1]; + union mmi_intfloat64 A, B, C, D, E; DECLARE_VAR_LOW32; + A.i = (8 - x) *(8 - y); + B.i = x * (8 - y); + C.i = (8 - x) * y; + D.i = x * y; + E.i = B.i + C.i; - if (D) { + if (D.i) { __asm__ volatile ( "pxor %[ftmp0], %[ftmp0], %[ftmp0] \n\t" - "dli %[tmp0], 0x06 \n\t" "pshufh %[A], %[A], %[ftmp0] \n\t" "pshufh %[B], %[B], %[ftmp0] \n\t" "mtc1 %[tmp0], %[ftmp7] \n\t" @@ -673,20 +660,19 @@ void ff_avg_h264_chroma_mc4_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]), [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]), [ftmp6]"=&f"(ftmp[6]), [ftmp7]"=&f"(ftmp[7]), - [tmp0]"=&r"(tmp[0]), RESTRICT_ASM_LOW32 [dst]"+&r"(dst), [src]"+&r"(src), [h]"+&r"(h) - : [stride]"r"((mips_reg)stride),[ff_pw_32]"f"(ff_pw_32), - [A]"f"(A), [B]"f"(B), - [C]"f"(C), [D]"f"(D) + : [stride]"r"((mips_reg)stride),[ff_pw_32]"f"(ff_pw_32.f), + [A]"f"(A.f), [B]"f"(B.f), + [C]"f"(C.f), [D]"f"(D.f), + [tmp0]"r"(0x06) : "memory" ); - } else if (E) { - const int step = C ? stride : 1; + } else if (E.i) { + const int step = C.i ? stride : 1; __asm__ volatile ( "pxor %[ftmp0], %[ftmp0], %[ftmp0] \n\t" - "dli %[tmp0], 0x06 \n\t" "pshufh %[A], %[A], %[ftmp0] \n\t" "pshufh %[E], %[E], %[ftmp0] \n\t" "mtc1 %[tmp0], %[ftmp5] \n\t" @@ -713,14 +699,13 @@ void ff_avg_h264_chroma_mc4_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]), [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]), [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]), - [tmp0]"=&r"(tmp[0]), RESTRICT_ASM_LOW32 [addr0]"=&r"(addr[0]), [dst]"+&r"(dst), [src]"+&r"(src), [h]"+&r"(h) : [stride]"r"((mips_reg)stride),[step]"r"((mips_reg)step), - [ff_pw_32]"f"(ff_pw_32), - [A]"f"(A), [E]"f"(E) + [ff_pw_32]"f"(ff_pw_32.f), [tmp0]"r"(0x06), + [A]"f"(A.f), [E]"f"(E.f) : "memory" ); } else { |