summaryrefslogtreecommitdiff
path: root/libavcodec/mips/vp9dsp_init_mips.c
diff options
context:
space:
mode:
authorgxw <guxiwei-hf@loongson.cn>2019-02-25 18:13:51 +0800
committerMichael Niedermayer <michael@niedermayer.cc>2019-02-27 01:51:40 +0100
commit4571c7c05d8488cbc2ae0b337751f132f9670fec (patch)
tree674088dd8a00aaeceef98a0b54e56cd36623cfa3 /libavcodec/mips/vp9dsp_init_mips.c
parent97f47fd601d0e380109f501e4aabff71ffbad052 (diff)
avcodec/mips: [loongson] mmi optimizations for VP9 put and avg functions
VP9 decoding speed improved about 60.5%(from 38fps to 61fps, tested on loongson 3A3000). Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/mips/vp9dsp_init_mips.c')
-rw-r--r--libavcodec/mips/vp9dsp_init_mips.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/libavcodec/mips/vp9dsp_init_mips.c b/libavcodec/mips/vp9dsp_init_mips.c
index c8a48908af..5990fa6952 100644
--- a/libavcodec/mips/vp9dsp_init_mips.c
+++ b/libavcodec/mips/vp9dsp_init_mips.c
@@ -168,8 +168,50 @@ static av_cold void vp9dsp_init_msa(VP9DSPContext *dsp, int bpp)
}
#endif // #if HAVE_MSA
+#if HAVE_MMI
+static av_cold void vp9dsp_mc_init_mmi(VP9DSPContext *dsp)
+{
+#define init_subpel1(idx1, idx2, idxh, idxv, sz, dir, type) \
+ dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][idxh][idxv] = \
+ ff_##type##_8tap_smooth_##sz##dir##_mmi; \
+ dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][idxh][idxv] = \
+ ff_##type##_8tap_regular_##sz##dir##_mmi; \
+ dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][idxh][idxv] = \
+ ff_##type##_8tap_sharp_##sz##dir##_mmi;
+
+#define init_subpel2(idx, idxh, idxv, dir, type) \
+ init_subpel1(0, idx, idxh, idxv, 64, dir, type); \
+ init_subpel1(1, idx, idxh, idxv, 32, dir, type); \
+ init_subpel1(2, idx, idxh, idxv, 16, dir, type); \
+ init_subpel1(3, idx, idxh, idxv, 8, dir, type); \
+ init_subpel1(4, idx, idxh, idxv, 4, dir, type)
+
+#define init_subpel3(idx, type) \
+ init_subpel2(idx, 1, 1, hv, type); \
+ init_subpel2(idx, 0, 1, v, type); \
+ init_subpel2(idx, 1, 0, h, type)
+
+ init_subpel3(0, put);
+ init_subpel3(1, avg);
+
+#undef init_subpel1
+#undef init_subpel2
+#undef init_subpel3
+}
+
+static av_cold void vp9dsp_init_mmi(VP9DSPContext *dsp, int bpp)
+{
+ if (bpp == 8) {
+ vp9dsp_mc_init_mmi(dsp);
+ }
+}
+#endif // #if HAVE_MMI
+
av_cold void ff_vp9dsp_init_mips(VP9DSPContext *dsp, int bpp)
{
+#if HAVE_MMI
+ vp9dsp_init_mmi(dsp, bpp);
+#endif // #if HAVE_MMI
#if HAVE_MSA
vp9dsp_init_msa(dsp, bpp);
#endif // #if HAVE_MSA