| Index: source/libvpx/vp9/common/mips/msa/vp9_macros_msa.h
|
| diff --git a/source/libvpx/vp9/common/mips/msa/vp9_macros_msa.h b/source/libvpx/vp9/common/mips/msa/vp9_macros_msa.h
|
| index 351656766d020da08b06a562f68531eca37c5a02..3751e35f2d59961b3a06d0ea414f7782f8fa8878 100644
|
| --- a/source/libvpx/vp9/common/mips/msa/vp9_macros_msa.h
|
| +++ b/source/libvpx/vp9/common/mips/msa/vp9_macros_msa.h
|
| @@ -228,6 +228,22 @@
|
| }
|
| #endif // (__mips_isa_rev >= 6)
|
|
|
| +/* Description : Load 4 words with stride
|
| + Arguments : Inputs - psrc (source pointer to load from)
|
| + - stride
|
| + Outputs - out0, out1, out2, out3
|
| + Details : Loads word in 'out0' from (psrc)
|
| + Loads word in 'out1' from (psrc + stride)
|
| + Loads word in 'out2' from (psrc + 2 * stride)
|
| + Loads word in 'out3' from (psrc + 3 * stride)
|
| +*/
|
| +#define LW4(psrc, stride, out0, out1, out2, out3) { \
|
| + out0 = LW((psrc)); \
|
| + out1 = LW((psrc) + stride); \
|
| + out2 = LW((psrc) + 2 * stride); \
|
| + out3 = LW((psrc) + 3 * stride); \
|
| +}
|
| +
|
| /* Description : Store 4 words with stride
|
| Arguments : Inputs - in0, in1, in2, in3, pdst, stride
|
| Details : Stores word from 'in0' to (pdst)
|
| @@ -336,6 +352,18 @@
|
| }
|
| #define LD_SH16(...) LD_H16(v8i16, __VA_ARGS__)
|
|
|
| +/* Description : Load as 4x4 block of signed halfword elements from 1D source
|
| + data into 4 vectors (Each vector with 4 signed halfwords)
|
| + Arguments : Inputs - psrc
|
| + Outputs - out0, out1, out2, out3
|
| +*/
|
| +#define LD4x4_SH(psrc, out0, out1, out2, out3) { \
|
| + out0 = LD_SH(psrc); \
|
| + out2 = LD_SH(psrc + 8); \
|
| + out1 = (v8i16)__msa_ilvl_d((v2i64)out0, (v2i64)out0); \
|
| + out3 = (v8i16)__msa_ilvl_d((v2i64)out2, (v2i64)out2); \
|
| +}
|
| +
|
| /* Description : Store vectors of 16 byte elements with stride
|
| Arguments : Inputs - in0, in1, stride
|
| Outputs - pdst (destination pointer to store to)
|
| @@ -385,6 +413,33 @@
|
| }
|
| #define ST_SH8(...) ST_H8(v8i16, __VA_ARGS__)
|
|
|
| +/* Description : Store as 2x4 byte block to destination memory from input vector
|
| + Arguments : Inputs - in, stidx, pdst, stride
|
| + Return Type - unsigned byte
|
| + Details : Index stidx halfword element from 'in' vector is copied and
|
| + stored on first line
|
| + Index stidx+1 halfword element from 'in' vector is copied and
|
| + stored on second line
|
| + Index stidx+2 halfword element from 'in' vector is copied and
|
| + stored on third line
|
| + Index stidx+3 halfword element from 'in' vector is copied and
|
| + stored on fourth line
|
| +*/
|
| +#define ST2x4_UB(in, stidx, pdst, stride) { \
|
| + uint16_t out0_m, out1_m, out2_m, out3_m; \
|
| + uint8_t *pblk_2x4_m = (uint8_t *)(pdst); \
|
| + \
|
| + out0_m = __msa_copy_u_h((v8i16)in, (stidx)); \
|
| + out1_m = __msa_copy_u_h((v8i16)in, (stidx + 1)); \
|
| + out2_m = __msa_copy_u_h((v8i16)in, (stidx + 2)); \
|
| + out3_m = __msa_copy_u_h((v8i16)in, (stidx + 3)); \
|
| + \
|
| + SH(out0_m, pblk_2x4_m); \
|
| + SH(out1_m, pblk_2x4_m + stride); \
|
| + SH(out2_m, pblk_2x4_m + 2 * stride); \
|
| + SH(out3_m, pblk_2x4_m + 3 * stride); \
|
| +}
|
| +
|
| /* Description : Store as 4x4 byte block to destination memory from input vector
|
| Arguments : Inputs - in0, in1, pdst, stride
|
| Return Type - unsigned byte
|
| @@ -490,6 +545,13 @@
|
| }
|
| #define SLDI_B2_0_SW(...) SLDI_B2_0(v4i32, __VA_ARGS__)
|
|
|
| +#define SLDI_B4_0(RTYPE, in0, in1, in2, in3, \
|
| + out0, out1, out2, out3, slide_val) { \
|
| + SLDI_B2_0(RTYPE, in0, in1, out0, out1, slide_val); \
|
| + SLDI_B2_0(RTYPE, in2, in3, out2, out3, slide_val); \
|
| +}
|
| +#define SLDI_B4_0_UB(...) SLDI_B4_0(v16u8, __VA_ARGS__)
|
| +
|
| /* Description : Immediate number of columns to slide
|
| Arguments : Inputs - in0_0, in0_1, in1_0, in1_1, slide_val
|
| Outputs - out0, out1
|
| @@ -681,6 +743,18 @@
|
| CLIP_SH2_0_255(in2, in3); \
|
| }
|
|
|
| +/* Description : Insert specified word elements from input vectors to 1
|
| + destination vector
|
| + Arguments : Inputs - in0, in1, in2, in3 (4 input vectors)
|
| + Outputs - out (output vector)
|
| + Return Type - as per RTYPE
|
| +*/
|
| +#define INSERT_W2(RTYPE, in0, in1, out) { \
|
| + out = (RTYPE)__msa_insert_w((v4i32)out, 0, in0); \
|
| + out = (RTYPE)__msa_insert_w((v4i32)out, 1, in1); \
|
| +}
|
| +#define INSERT_W2_SB(...) INSERT_W2(v16i8, __VA_ARGS__)
|
| +
|
| /* Description : Interleave even byte elements from vectors
|
| Arguments : Inputs - in0, in1, in2, in3
|
| Outputs - out0, out1
|
| @@ -714,6 +788,21 @@
|
| #define ILVEV_H2_SH(...) ILVEV_H2(v8i16, __VA_ARGS__)
|
| #define ILVEV_H2_SW(...) ILVEV_H2(v4i32, __VA_ARGS__)
|
|
|
| +/* Description : Interleave even double word elements from vectors
|
| + Arguments : Inputs - in0, in1, in2, in3
|
| + Outputs - out0, out1
|
| + Return Type - as per RTYPE
|
| + Details : Even double word elements of 'in0' and even double word
|
| + elements of 'in1' are interleaved and copied to 'out0'
|
| + Even double word elements of 'in2' and even double word
|
| + elements of 'in3' are interleaved and copied to 'out1'
|
| +*/
|
| +#define ILVEV_D2(RTYPE, in0, in1, in2, in3, out0, out1) { \
|
| + out0 = (RTYPE)__msa_ilvev_d((v2i64)in1, (v2i64)in0); \
|
| + out1 = (RTYPE)__msa_ilvev_d((v2i64)in3, (v2i64)in2); \
|
| +}
|
| +#define ILVEV_D2_UB(...) ILVEV_D2(v16u8, __VA_ARGS__)
|
| +
|
| /* Description : Interleave left half of byte elements from vectors
|
| Arguments : Inputs - in0, in1, in2, in3
|
| Outputs - out0, out1
|
| @@ -800,6 +889,16 @@
|
| #define ILVR_B4_UH(...) ILVR_B4(v8u16, __VA_ARGS__)
|
| #define ILVR_B4_SH(...) ILVR_B4(v8i16, __VA_ARGS__)
|
|
|
| +#define ILVR_B8(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \
|
| + in8, in9, in10, in11, in12, in13, in14, in15, \
|
| + out0, out1, out2, out3, out4, out5, out6, out7) { \
|
| + ILVR_B4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \
|
| + out0, out1, out2, out3); \
|
| + ILVR_B4(RTYPE, in8, in9, in10, in11, in12, in13, in14, in15, \
|
| + out4, out5, out6, out7); \
|
| +}
|
| +#define ILVR_B8_UH(...) ILVR_B8(v8u16, __VA_ARGS__)
|
| +
|
| /* Description : Interleave right half of halfword elements from vectors
|
| Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7
|
| Outputs - out0, out1, out2, out3
|
| @@ -830,6 +929,13 @@
|
| #define ILVR_W2_UB(...) ILVR_W2(v16u8, __VA_ARGS__)
|
| #define ILVR_W2_SH(...) ILVR_W2(v8i16, __VA_ARGS__)
|
|
|
| +#define ILVR_W4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \
|
| + out0, out1, out2, out3) { \
|
| + ILVR_W2(RTYPE, in0, in1, in2, in3, out0, out1); \
|
| + ILVR_W2(RTYPE, in4, in5, in6, in7, out2, out3); \
|
| +}
|
| +#define ILVR_W4_UB(...) ILVR_W4(v16u8, __VA_ARGS__)
|
| +
|
| /* Description : Interleave right half of double word elements from vectors
|
| Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7
|
| Outputs - out0, out1, out2, out3
|
| @@ -1098,6 +1204,23 @@
|
| }
|
| #define ADDS_SH4_SH(...) ADDS_SH4(v8i16, __VA_ARGS__)
|
|
|
| +/* Description : Arithmetic shift right all elements of vector
|
| + (generic for all data types)
|
| + Arguments : Inputs - in0, in1, in2, in3, shift
|
| + Outputs - in0, in1, in2, in3 (in place)
|
| + Return Type - as per input vector RTYPE
|
| + Details : Each element of vector 'in0' is right shifted by 'shift' and
|
| + result is in place written to 'in0'
|
| + Here, 'shift' is GP variable passed in
|
| + Similar for other pairs
|
| +*/
|
| +#define SRA_4V(in0, in1, in2, in3, shift) { \
|
| + in0 = in0 >> shift; \
|
| + in1 = in1 >> shift; \
|
| + in2 = in2 >> shift; \
|
| + in3 = in3 >> shift; \
|
| +}
|
| +
|
| /* Description : Shift right arithmetic rounded (immediate)
|
| Arguments : Inputs - in0, in1, in2, in3, shift
|
| Outputs - in0, in1, in2, in3 (in place)
|
| @@ -1178,6 +1301,21 @@
|
| out3 = in6 - in7; \
|
| }
|
|
|
| +/* Description : Sign extend halfword elements from right half of the vector
|
| + Arguments : Inputs - in (input halfword vector)
|
| + Outputs - out (sign extended word vectors)
|
| + Return Type - signed word
|
| + Details : Sign bit of halfword elements from input vector 'in' is
|
| + extracted and interleaved with same vector 'in0' to generate
|
| + 4 word elements keeping sign intact
|
| +*/
|
| +#define UNPCK_R_SH_SW(in, out) { \
|
| + v8i16 sign_m; \
|
| + \
|
| + sign_m = __msa_clti_s_h((v8i16)in, 0); \
|
| + out = (v4i32)__msa_ilvr_h(sign_m, (v8i16)in); \
|
| +}
|
| +
|
| /* Description : Zero extend unsigned byte elements to halfword elements
|
| Arguments : Inputs - in (1 input unsigned byte vector)
|
| Outputs - out0, out1 (unsigned 2 halfword vectors)
|
| @@ -1222,6 +1360,93 @@
|
| out7 = in0 - in7; \
|
| }
|
|
|
| +/* Description : Transposes input 8x8 byte block
|
| + Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7
|
| + (input 8x8 byte block)
|
| + Outputs - out0, out1, out2, out3, out4, out5, out6, out7
|
| + (output 8x8 byte block)
|
| + Return Type - unsigned byte
|
| + Details :
|
| +*/
|
| +#define TRANSPOSE8x8_UB(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \
|
| + out0, out1, out2, out3, out4, out5, out6, out7) { \
|
| + v16i8 tmp0_m, tmp1_m, tmp2_m, tmp3_m; \
|
| + v16i8 tmp4_m, tmp5_m, tmp6_m, tmp7_m; \
|
| + \
|
| + ILVR_B4_SB(in2, in0, in3, in1, in6, in4, in7, in5, \
|
| + tmp0_m, tmp1_m, tmp2_m, tmp3_m); \
|
| + ILVRL_B2_SB(tmp1_m, tmp0_m, tmp4_m, tmp5_m); \
|
| + ILVRL_B2_SB(tmp3_m, tmp2_m, tmp6_m, tmp7_m); \
|
| + ILVRL_W2(RTYPE, tmp6_m, tmp4_m, out0, out2); \
|
| + ILVRL_W2(RTYPE, tmp7_m, tmp5_m, out4, out6); \
|
| + SLDI_B2_0(RTYPE, out0, out2, out1, out3, 8); \
|
| + SLDI_B2_0(RTYPE, out4, out6, out5, out7, 8); \
|
| +}
|
| +#define TRANSPOSE8x8_UB_UB(...) TRANSPOSE8x8_UB(v16u8, __VA_ARGS__)
|
| +
|
| +/* Description : Transposes 16x8 block into 8x16 with byte elements in vectors
|
| + Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7,
|
| + in8, in9, in10, in11, in12, in13, in14, in15
|
| + Outputs - out0, out1, out2, out3, out4, out5, out6, out7
|
| + Return Type - unsigned byte
|
| + Details :
|
| +*/
|
| +#define TRANSPOSE16x8_UB_UB(in0, in1, in2, in3, in4, in5, in6, in7, \
|
| + in8, in9, in10, in11, in12, in13, in14, in15, \
|
| + out0, out1, out2, out3, out4, out5, out6, out7) { \
|
| + v16u8 tmp0_m, tmp1_m, tmp2_m, tmp3_m; \
|
| + v16u8 tmp4_m, tmp5_m, tmp6_m, tmp7_m; \
|
| + \
|
| + ILVEV_D2_UB(in0, in8, in1, in9, out7, out6); \
|
| + ILVEV_D2_UB(in2, in10, in3, in11, out5, out4); \
|
| + ILVEV_D2_UB(in4, in12, in5, in13, out3, out2); \
|
| + ILVEV_D2_UB(in6, in14, in7, in15, out1, out0); \
|
| + \
|
| + tmp0_m = (v16u8)__msa_ilvev_b((v16i8)out6, (v16i8)out7); \
|
| + tmp4_m = (v16u8)__msa_ilvod_b((v16i8)out6, (v16i8)out7); \
|
| + tmp1_m = (v16u8)__msa_ilvev_b((v16i8)out4, (v16i8)out5); \
|
| + tmp5_m = (v16u8)__msa_ilvod_b((v16i8)out4, (v16i8)out5); \
|
| + out5 = (v16u8)__msa_ilvev_b((v16i8)out2, (v16i8)out3); \
|
| + tmp6_m = (v16u8)__msa_ilvod_b((v16i8)out2, (v16i8)out3); \
|
| + out7 = (v16u8)__msa_ilvev_b((v16i8)out0, (v16i8)out1); \
|
| + tmp7_m = (v16u8)__msa_ilvod_b((v16i8)out0, (v16i8)out1); \
|
| + \
|
| + ILVEV_H2_UB(tmp0_m, tmp1_m, out5, out7, tmp2_m, tmp3_m); \
|
| + out0 = (v16u8)__msa_ilvev_w((v4i32)tmp3_m, (v4i32)tmp2_m); \
|
| + out4 = (v16u8)__msa_ilvod_w((v4i32)tmp3_m, (v4i32)tmp2_m); \
|
| + \
|
| + tmp2_m = (v16u8)__msa_ilvod_h((v8i16)tmp1_m, (v8i16)tmp0_m); \
|
| + tmp3_m = (v16u8)__msa_ilvod_h((v8i16)out7, (v8i16)out5); \
|
| + out2 = (v16u8)__msa_ilvev_w((v4i32)tmp3_m, (v4i32)tmp2_m); \
|
| + out6 = (v16u8)__msa_ilvod_w((v4i32)tmp3_m, (v4i32)tmp2_m); \
|
| + \
|
| + ILVEV_H2_UB(tmp4_m, tmp5_m, tmp6_m, tmp7_m, tmp2_m, tmp3_m); \
|
| + out1 = (v16u8)__msa_ilvev_w((v4i32)tmp3_m, (v4i32)tmp2_m); \
|
| + out5 = (v16u8)__msa_ilvod_w((v4i32)tmp3_m, (v4i32)tmp2_m); \
|
| + \
|
| + tmp2_m = (v16u8)__msa_ilvod_h((v8i16)tmp5_m, (v8i16)tmp4_m); \
|
| + tmp2_m = (v16u8)__msa_ilvod_h((v8i16)tmp5_m, (v8i16)tmp4_m); \
|
| + tmp3_m = (v16u8)__msa_ilvod_h((v8i16)tmp7_m, (v8i16)tmp6_m); \
|
| + tmp3_m = (v16u8)__msa_ilvod_h((v8i16)tmp7_m, (v8i16)tmp6_m); \
|
| + out3 = (v16u8)__msa_ilvev_w((v4i32)tmp3_m, (v4i32)tmp2_m); \
|
| + out7 = (v16u8)__msa_ilvod_w((v4i32)tmp3_m, (v4i32)tmp2_m); \
|
| +}
|
| +
|
| +/* Description : Transposes 4x4 block with half word elements in vectors
|
| + Arguments : Inputs - in0, in1, in2, in3
|
| + Outputs - out0, out1, out2, out3
|
| + Return Type - signed halfword
|
| + Details :
|
| +*/
|
| +#define TRANSPOSE4x4_SH_SH(in0, in1, in2, in3, out0, out1, out2, out3) { \
|
| + v8i16 s0_m, s1_m; \
|
| + \
|
| + ILVR_H2_SH(in1, in0, in3, in2, s0_m, s1_m); \
|
| + ILVRL_W2_SH(s1_m, s0_m, out0, out2); \
|
| + out1 = (v8i16)__msa_ilvl_d((v2i64)out0, (v2i64)out0); \
|
| + out3 = (v8i16)__msa_ilvl_d((v2i64)out0, (v2i64)out2); \
|
| +}
|
| +
|
| /* Description : Transposes 4x8 block with half word elements in vectors
|
| Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7
|
| Outputs - out0, out1, out2, out3, out4, out5, out6, out7
|
| @@ -1294,6 +1519,55 @@
|
| }
|
| #define TRANSPOSE8x8_SH_SH(...) TRANSPOSE8x8_H(v8i16, __VA_ARGS__)
|
|
|
| +/* Description : Transposes 4x4 block with word elements in vectors
|
| + Arguments : Inputs - in0, in1, in2, in3
|
| + Outputs - out0, out1, out2, out3
|
| + Return Type - signed word
|
| + Details :
|
| +*/
|
| +#define TRANSPOSE4x4_SW_SW(in0, in1, in2, in3, out0, out1, out2, out3) { \
|
| + v4i32 s0_m, s1_m, s2_m, s3_m; \
|
| + \
|
| + ILVRL_W2_SW(in1, in0, s0_m, s1_m); \
|
| + ILVRL_W2_SW(in3, in2, s2_m, s3_m); \
|
| + \
|
| + out0 = (v4i32)__msa_ilvr_d((v2i64)s2_m, (v2i64)s0_m); \
|
| + out1 = (v4i32)__msa_ilvl_d((v2i64)s2_m, (v2i64)s0_m); \
|
| + out2 = (v4i32)__msa_ilvr_d((v2i64)s3_m, (v2i64)s1_m); \
|
| + out3 = (v4i32)__msa_ilvl_d((v2i64)s3_m, (v2i64)s1_m); \
|
| +}
|
| +
|
| +/* Description : Add block 4x4
|
| + Arguments : Inputs - in0, in1, in2, in3, pdst, stride
|
| + Outputs -
|
| + Return Type - unsigned bytes
|
| + Details : Least significant 4 bytes from each input vector are added to
|
| + the destination bytes, clipped between 0-255 and then stored.
|
| +*/
|
| +#define ADDBLK_ST4x4_UB(in0, in1, in2, in3, pdst, stride) { \
|
| + uint32_t src0_m, src1_m, src2_m, src3_m; \
|
| + uint32_t out0_m, out1_m, out2_m, out3_m; \
|
| + v8i16 inp0_m, inp1_m, res0_m, res1_m; \
|
| + v16i8 dst0_m = { 0 }; \
|
| + v16i8 dst1_m = { 0 }; \
|
| + v16i8 zero_m = { 0 }; \
|
| + \
|
| + ILVR_D2_SH(in1, in0, in3, in2, inp0_m, inp1_m) \
|
| + LW4(pdst, stride, src0_m, src1_m, src2_m, src3_m); \
|
| + INSERT_W2_SB(src0_m, src1_m, dst0_m); \
|
| + INSERT_W2_SB(src2_m, src3_m, dst1_m); \
|
| + ILVR_B2_SH(zero_m, dst0_m, zero_m, dst1_m, res0_m, res1_m); \
|
| + ADD2(res0_m, inp0_m, res1_m, inp1_m, res0_m, res1_m); \
|
| + CLIP_SH2_0_255(res0_m, res1_m); \
|
| + PCKEV_B2_SB(res0_m, res0_m, res1_m, res1_m, dst0_m, dst1_m); \
|
| + \
|
| + out0_m = __msa_copy_u_w((v4i32)dst0_m, 0); \
|
| + out1_m = __msa_copy_u_w((v4i32)dst0_m, 1); \
|
| + out2_m = __msa_copy_u_w((v4i32)dst1_m, 0); \
|
| + out3_m = __msa_copy_u_w((v4i32)dst1_m, 1); \
|
| + SW4(out0_m, out1_m, out2_m, out3_m, pdst, stride); \
|
| +}
|
| +
|
| /* Description : Pack even elements of input vectors & xor with 128
|
| Arguments : Inputs - in0, in1
|
| Outputs - out_m
|
| @@ -1310,6 +1584,23 @@
|
| out_m; \
|
| })
|
|
|
| +/* Description : Converts inputs to unsigned bytes, interleave, average & store
|
| + as 8x4 unsigned byte block
|
| + Arguments : Inputs - in0, in1, in2, in3, dst0, dst1, dst2, dst3,
|
| + pdst, stride
|
| +*/
|
| +#define CONVERT_UB_AVG_ST8x4_UB(in0, in1, in2, in3, \
|
| + dst0, dst1, dst2, dst3, pdst, stride) { \
|
| + v16u8 tmp0_m, tmp1_m, tmp2_m, tmp3_m; \
|
| + uint8_t *pdst_m = (uint8_t *)(pdst); \
|
| + \
|
| + tmp0_m = PCKEV_XORI128_UB(in0, in1); \
|
| + tmp1_m = PCKEV_XORI128_UB(in2, in3); \
|
| + ILVR_D2_UB(dst1, dst0, dst3, dst2, tmp2_m, tmp3_m); \
|
| + AVER_UB2_UB(tmp0_m, tmp2_m, tmp1_m, tmp3_m, tmp0_m, tmp1_m); \
|
| + ST8x4_UB(tmp0_m, tmp1_m, pdst_m, stride); \
|
| +}
|
| +
|
| /* Description : Pack even byte elements and store byte vector in destination
|
| memory
|
| Arguments : Inputs - in0, in1, pdst
|
|
|