Re: [FFmpeg-devel] [PATCH] avcodec/mips: [loongson] optimize put_hevc_pel_bi_pixels_8 with mmi.

2019-01-19 Thread Michael Niedermayer
On Fri, Jan 18, 2019 at 02:42:20PM +0800, Shiyou Yin wrote:
> Optimize put_hevc_pel_bi_pixels_8 with mmi in the case width=8/16/24/32/48/64.
> This optimization improved HEVC decoding performance 2%(1.77x to 1.81x, 
> tested on loongson 3A3000).
> ---
>  libavcodec/mips/Makefile|   1 +
>  libavcodec/mips/hevcdsp_init_mips.c |  23 ++
>  libavcodec/mips/hevcdsp_mips.h  |  19 +
>  libavcodec/mips/hevcdsp_mmi.c   | 135 
> 
>  4 files changed, 178 insertions(+)
>  create mode 100644 libavcodec/mips/hevcdsp_mmi.c

will apply

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/mips: [loongson] optimize put_hevc_pel_bi_pixels_8 with mmi.

2019-01-17 Thread Shiyou Yin
Optimize put_hevc_pel_bi_pixels_8 with mmi in the case width=8/16/24/32/48/64.
This optimization improved HEVC decoding performance 2%(1.77x to 1.81x, tested 
on loongson 3A3000).
---
 libavcodec/mips/Makefile|   1 +
 libavcodec/mips/hevcdsp_init_mips.c |  23 ++
 libavcodec/mips/hevcdsp_mips.h  |  19 +
 libavcodec/mips/hevcdsp_mmi.c   | 135 
 4 files changed, 178 insertions(+)
 create mode 100644 libavcodec/mips/hevcdsp_mmi.c

diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile
index 3571207..3029872 100644
--- a/libavcodec/mips/Makefile
+++ b/libavcodec/mips/Makefile
@@ -86,3 +86,4 @@ MMI-OBJS-$(CONFIG_VP8_DECODER)+= mips/vp8dsp_mmi.o
 MMI-OBJS-$(CONFIG_HPELDSP)+= mips/hpeldsp_mmi.o
 MMI-OBJS-$(CONFIG_VC1_DECODER)+= mips/vc1dsp_mmi.o
 MMI-OBJS-$(CONFIG_WMV2DSP)+= mips/wmv2dsp_mmi.o
+MMI-OBJS-$(CONFIG_HEVC_DECODER)   += mips/hevcdsp_mmi.o
diff --git a/libavcodec/mips/hevcdsp_init_mips.c 
b/libavcodec/mips/hevcdsp_init_mips.c
index 776d13e..41c9001 100644
--- a/libavcodec/mips/hevcdsp_init_mips.c
+++ b/libavcodec/mips/hevcdsp_init_mips.c
@@ -20,6 +20,26 @@
 
 #include "libavcodec/mips/hevcdsp_mips.h"
 
+#if HAVE_MMI
+static av_cold void hevc_dsp_init_mmi(HEVCDSPContext *c,
+  const int bit_depth)
+{
+if (8 == bit_depth) {
+c->put_hevc_qpel_bi[3][0][0] = ff_hevc_put_hevc_pel_bi_pixels8_8_mmi;
+c->put_hevc_qpel_bi[5][0][0] = ff_hevc_put_hevc_pel_bi_pixels16_8_mmi;
+c->put_hevc_qpel_bi[6][0][0] = ff_hevc_put_hevc_pel_bi_pixels24_8_mmi;
+c->put_hevc_qpel_bi[7][0][0] = ff_hevc_put_hevc_pel_bi_pixels32_8_mmi;
+c->put_hevc_qpel_bi[8][0][0] = ff_hevc_put_hevc_pel_bi_pixels48_8_mmi;
+c->put_hevc_qpel_bi[9][0][0] = ff_hevc_put_hevc_pel_bi_pixels64_8_mmi;
+
+c->put_hevc_epel_bi[3][0][0] = ff_hevc_put_hevc_pel_bi_pixels8_8_mmi;
+c->put_hevc_epel_bi[5][0][0] = ff_hevc_put_hevc_pel_bi_pixels16_8_mmi;
+c->put_hevc_epel_bi[6][0][0] = ff_hevc_put_hevc_pel_bi_pixels24_8_mmi;
+c->put_hevc_epel_bi[7][0][0] = ff_hevc_put_hevc_pel_bi_pixels32_8_mmi;
+}
+}
+#endif // #if HAVE_MMI
+
 #if HAVE_MSA
 static av_cold void hevc_dsp_init_msa(HEVCDSPContext *c,
   const int bit_depth)
@@ -448,6 +468,9 @@ static av_cold void hevc_dsp_init_msa(HEVCDSPContext *c,
 
 void ff_hevc_dsp_init_mips(HEVCDSPContext *c, const int bit_depth)
 {
+#if HAVE_MMI
+hevc_dsp_init_mmi(c, bit_depth);
+#endif  // #if HAVE_MMI
 #if HAVE_MSA
 hevc_dsp_init_msa(c, bit_depth);
 #endif  // #if HAVE_MSA
diff --git a/libavcodec/mips/hevcdsp_mips.h b/libavcodec/mips/hevcdsp_mips.h
index 1573d1c..ff9401c 100644
--- a/libavcodec/mips/hevcdsp_mips.h
+++ b/libavcodec/mips/hevcdsp_mips.h
@@ -479,4 +479,23 @@ void ff_hevc_addblk_32x32_msa(uint8_t *dst, int16_t 
*pi16Coeffs,
   ptrdiff_t stride);
 void ff_hevc_idct_luma_4x4_msa(int16_t *pi16Coeffs);
 
+/* Loongson optimization */
+#define L_BI_MC(PEL, DIR, WIDTH, TYPE) 
\
+void ff_hevc_put_hevc_##PEL##_bi_##DIR##WIDTH##_8_##TYPE(uint8_t *dst,   \
+ptrdiff_t dst_stride,  
\
+uint8_t *src,  
\
+ptrdiff_t src_stride,  
\
+int16_t *src_16bit,
\
+int height,
\
+intptr_t mx,   
\
+intptr_t my,   
\
+int width)
+
+L_BI_MC(pel, pixels, 8, mmi);
+L_BI_MC(pel, pixels, 16, mmi);
+L_BI_MC(pel, pixels, 24, mmi);
+L_BI_MC(pel, pixels, 32, mmi);
+L_BI_MC(pel, pixels, 48, mmi);
+L_BI_MC(pel, pixels, 64, mmi);
+#undef L_BI_MC
 #endif  // #ifndef AVCODEC_MIPS_HEVCDSP_MIPS_H
diff --git a/libavcodec/mips/hevcdsp_mmi.c b/libavcodec/mips/hevcdsp_mmi.c
new file mode 100644
index 000..e9403c5
--- /dev/null
+++ b/libavcodec/mips/hevcdsp_mmi.c
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2019 Shiyou Yin (yinshiyou...@loongson.cn)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have