[FFmpeg-devel] [PATCH v4 4/4] libavcodec: Enable runtime detection for MIPS MMI & MSA

Shiyou Yin yinshiyou-hf at loongson.cn
Tue Jun 9 16:04:52 EEST 2020


>-----Original Message-----
>From: ffmpeg-devel-bounces at ffmpeg.org [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf Of
>Jiaxun Yang
>Sent: Monday, June 8, 2020 11:32 AM
>To: ffmpeg-devel at ffmpeg.org
>Cc: yinshiyou at loongson.cn; Jiaxun Yang
>Subject: [FFmpeg-devel] [PATCH v4 4/4] libavcodec: Enable runtime detection for MIPS MMI & MSA
>
>Apply optimized functions according to cpuflags.
>MSA is always put after MMI as it's usually faster than MMI.
>
>Signed-off-by: Jiaxun Yang <jiaxun.yang at flygoat.com>
>---
> libavcodec/mips/blockdsp_init_mips.c        | 22 +++++++++++++-----
> libavcodec/mips/cabac.h                     |  2 +-
> libavcodec/mips/h263dsp_init_mips.c         | 12 +++++++---
> libavcodec/mips/h264chroma_init_mips.c      | 22 +++++++++++++-----
> libavcodec/mips/h264dsp_init_mips.c         | 25 ++++++++++++++++-----
> libavcodec/mips/h264pred_init_mips.c        | 25 ++++++++++++++++-----
> libavcodec/mips/h264qpel_init_mips.c        | 22 +++++++++++++-----
> libavcodec/mips/hevcdsp_init_mips.c         | 24 +++++++++++++++-----
> libavcodec/mips/hevcpred_init_mips.c        | 12 +++++++---
> libavcodec/mips/hpeldsp_init_mips.c         | 22 +++++++++++++-----
> libavcodec/mips/idctdsp_init_mips.c         | 24 +++++++++++++++-----
> libavcodec/mips/me_cmp_init_mips.c          | 12 +++++++---
> libavcodec/mips/mpegvideo_init_mips.c       | 22 +++++++++++++-----
> libavcodec/mips/mpegvideoencdsp_init_mips.c | 13 ++++++++---
> libavcodec/mips/pixblockdsp_init_mips.c     | 25 ++++++++++++++++-----
> libavcodec/mips/qpeldsp_init_mips.c         | 12 +++++++---
> libavcodec/mips/vc1dsp_init_mips.c          | 22 +++++++++++++-----
> libavcodec/mips/videodsp_init.c             | 12 +++++++---
> libavcodec/mips/vp3dsp_init_mips.c          | 22 +++++++++++++-----
> libavcodec/mips/vp8dsp_init_mips.c          | 22 +++++++++++++-----
> libavcodec/mips/vp9dsp_init_mips.c          | 22 +++++++++++++-----
> libavcodec/mips/wmv2dsp_init_mips.c         | 12 +++++++---
> libavcodec/mips/xvididct_init_mips.c        | 13 ++++++++---
> 23 files changed, 312 insertions(+), 109 deletions(-)
>
>diff --git a/libavcodec/mips/blockdsp_init_mips.c b/libavcodec/mips/blockdsp_init_mips.c
>index 55ac1c3e99..47170c17ef 100644
>--- a/libavcodec/mips/blockdsp_init_mips.c
>+++ b/libavcodec/mips/blockdsp_init_mips.c
>@@ -19,6 +19,7 @@
>  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>  */
>
>+#include "libavutil/mips/cpu.h"
> #include "blockdsp_mips.h"
>
> #if HAVE_MSA
>@@ -30,6 +31,10 @@ static av_cold void blockdsp_init_msa(BlockDSPContext *c)
>     c->fill_block_tab[0] = ff_fill_block16_msa;
>     c->fill_block_tab[1] = ff_fill_block8_msa;
> }
>+#else
>+static av_cold void blockdsp_init_msa(BlockDSPContext *c)
>+{
>+}
> #endif  // #if HAVE_MSA
>
> #if HAVE_MMI
>@@ -41,14 +46,19 @@ static av_cold void blockdsp_init_mmi(BlockDSPContext *c)
>     c->fill_block_tab[0] = ff_fill_block16_mmi;
>     c->fill_block_tab[1] = ff_fill_block8_mmi;
> }
>+#else
>+static av_cold void blockdsp_init_mmi(BlockDSPContext *c)
>+{
>+}
> #endif /* HAVE_MMI */
>

Move "#if HAVE_MSA " into the init function (Same in other init functions). 
static av_cold void blockdsp_init_msa(BlockDSPContext *c)
{
#if HAVE_MSA
    c->clear_block = ff_clear_block_msa;
    c->clear_blocks = ff_clear_blocks_msa;
    
    c->fill_block_tab[0] = ff_fill_block16_msa;
    c->fill_block_tab[1] = ff_fill_block8_msa;
#endif  // #if HAVE_MSA
}




More information about the ffmpeg-devel mailing list