From 7f8417f22619366aaaad848ee2ff71be14637b7b Mon Sep 17 00:00:00 2001 From: Kaustubh Raste Date: Thu, 21 Sep 2017 13:45:34 +0530 Subject: avcodec/mips: Improve hevc uni-w copy mc msa functions Load the specific destination bytes instead of MSA load and pack. Pack the data to half word before clipping. Use immediate unsigned saturation for clip to max saving one vector register. Signed-off-by: Kaustubh Raste Reviewed-by: Manojkumar Bhosale Signed-off-by: Michael Niedermayer --- libavutil/mips/generic_macros_msa.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'libavutil/mips/generic_macros_msa.h') diff --git a/libavutil/mips/generic_macros_msa.h b/libavutil/mips/generic_macros_msa.h index 3ff94fdc99..bda3ed263f 100644 --- a/libavutil/mips/generic_macros_msa.h +++ b/libavutil/mips/generic_macros_msa.h @@ -204,6 +204,12 @@ out3 = LW((psrc) + 3 * stride); \ } +#define LW2(psrc, stride, out0, out1) \ +{ \ + out0 = LW((psrc)); \ + out1 = LW((psrc) + stride); \ +} + /* Description : Load double words with stride Arguments : Inputs - psrc (source pointer to load from) - stride @@ -1047,6 +1053,25 @@ CLIP_SH2_0_255(in2, in3); \ } +#define CLIP_SH_0_255_MAX_SATU(in) \ +( { \ + v8i16 out_m; \ + \ + out_m = __msa_maxi_s_h((v8i16) in, 0); \ + out_m = (v8i16) __msa_sat_u_h((v8u16) out_m, 7); \ + out_m; \ +} ) +#define CLIP_SH2_0_255_MAX_SATU(in0, in1) \ +{ \ + in0 = CLIP_SH_0_255_MAX_SATU(in0); \ + in1 = CLIP_SH_0_255_MAX_SATU(in1); \ +} +#define CLIP_SH4_0_255_MAX_SATU(in0, in1, in2, in3) \ +{ \ + CLIP_SH2_0_255_MAX_SATU(in0, in1); \ + CLIP_SH2_0_255_MAX_SATU(in2, in3); \ +} + /* Description : Clips all signed word elements of input vector between 0 & 255 Arguments : Inputs - in (input vector) @@ -1965,6 +1990,11 @@ result is in place written to 'in0' Similar for other pairs */ +#define SLLI_2V(in0, in1, shift) \ +{ \ + in0 = in0 << shift; \ + in1 = in1 << shift; \ +} #define SLLI_4V(in0, in1, in2, in3, shift) \ { \ in0 = in0 << shift; \ -- cgit v1.2.3