Re: [FFmpeg-devel] [PATCH] avcodec/mips: [loongson] mmi optimizations for VP9 put and avg functions
> 在 2019年2月21日,上午9:55,Shiyou Yin 写道: > >> -Original Message- >> From: ffmpeg-devel-boun...@ffmpeg.org >> <mailto:ffmpeg-devel-boun...@ffmpeg.org> >> [mailto:ffmpeg-devel-boun...@ffmpeg.org >> <mailto:ffmpeg-devel-boun...@ffmpeg.org>] On Behalf Of gxw >> Sent: Tuesday, February 19, 2019 11:02 AM >> To: ffmpeg-devel@ffmpeg.org <mailto:ffmpeg-devel@ffmpeg.org> >> Cc: gxw >> Subject: [FFmpeg-devel] [PATCH] avcodec/mips: [loongson] mmi optimizations >> for VP9 put and avg >> functions >> >> VP9 decoding speed improved about 109.3%(from 32fps to 67fps, tested on >> loongson 3A3000). >> --- >> libavcodec/mips/Makefile | 1 + >> libavcodec/mips/vp9_mc_mmi.c | 680 >> + >> libavcodec/mips/vp9dsp_init_mips.c | 42 +++ >> libavcodec/mips/vp9dsp_mips.h | 50 +++ >> 4 files changed, 773 insertions(+) >> create mode 100644 libavcodec/mips/vp9_mc_mmi.c >> >> diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile >> index c827649..c5b54d5 100644 >> --- a/libavcodec/mips/Makefile >> +++ b/libavcodec/mips/Makefile >> @@ -88,3 +88,4 @@ 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 >> MMI-OBJS-$(CONFIG_VP3DSP) += mips/vp3dsp_idct_mmi.o >> +MMI-OBJS-$(CONFIG_VP9_DECODER)+= mips/vp9_mc_mmi.o >> diff --git a/libavcodec/mips/vp9_mc_mmi.c b/libavcodec/mips/vp9_mc_mmi.c >> new file mode 100644 >> index 000..145bbff >> --- /dev/null >> +++ b/libavcodec/mips/vp9_mc_mmi.c >> @@ -0,0 +1,680 @@ >> +/* >> + * Copyright (c) 2019 gxw >> + * >> + * 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 received a copy of the GNU Lesser General Public >> + * License along with FFmpeg; if not, write to the Free Software >> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 >> USA >> + */ >> + >> +#include "libavcodec/vp9dsp.h" >> +#include "libavutil/mips/mmiutils.h" >> +#include "vp9dsp_mips.h" >> + >> +#define GET_DATA_H_MMI \ >> +"pmaddhw%[ftmp4],%[ftmp4], %[filter1]\n\t" \ >> +"pmaddhw%[ftmp5],%[ftmp5], %[filter2]\n\t" \ >> +"paddw %[ftmp4],%[ftmp4], %[ftmp5] \n\t" \ >> +"punpckhwd %[ftmp5],%[ftmp4], %[ftmp0] \n\t" \ >> +"paddw %[ftmp4],%[ftmp4], %[ftmp5] \n\t" \ >> +"pmaddhw%[ftmp6],%[ftmp6], %[filter1]\n\t" \ >> +"pmaddhw%[ftmp7],%[ftmp7], %[filter2]\n\t" \ >> +"paddw %[ftmp6],%[ftmp6], %[ftmp7] \n\t" \ >> +"punpckhwd %[ftmp7],%[ftmp6], %[ftmp0] \n\t" \ >> +"paddw %[ftmp6],%[ftmp6], %[ftmp7] \n\t" \ >> +"punpcklwd %[srcl], %[ftmp4], %[ftmp6] \n\t" \ >> +"pmaddhw%[ftmp8],%[ftmp8], %[filter1]\n\t" \ >> +"pmaddhw%[ftmp9],%[ftmp9], %[filter2]\n\t" \ >> +"paddw %[ftmp8],%[ftmp8], %[ftmp9] \n\t" \ >> +"punpckhwd %[ftmp9],%[ftmp8], %[ftmp0] \n\t" \ >> +"paddw %[ftmp8],%[ftmp8], %[ftmp9] \n\t" \ >> +"pmaddhw%[ftmp10], %[ftmp10], %[filter1]\n\t" \ >> +"pmaddhw%[ftmp11], %[ftmp11], %[filter2]\n\t" \ >> +"paddw %[ftmp10], %[ftmp10], %[ftmp11] \n\t" \ >> +"punpckhwd %[ftmp11], %[ftmp10], %[ftmp0] \n\t" \ >> +"paddw %[ftmp10], %[ftmp10], %[ftmp11] \n\t" \ >> +"punpcklwd %[srch], %[ftmp8], %[ftmp10] \n\t" >>
Re: [FFmpeg-devel] [PATCH] avcodec/mips: [loongson] mmi optimizations for VP9 put and avg functions
>-Original Message- >From: ffmpeg-devel-boun...@ffmpeg.org [mailto:ffmpeg-devel-boun...@ffmpeg.org] >On Behalf Of gxw >Sent: Tuesday, February 19, 2019 11:02 AM >To: ffmpeg-devel@ffmpeg.org >Cc: gxw >Subject: [FFmpeg-devel] [PATCH] avcodec/mips: [loongson] mmi optimizations for >VP9 put and avg >functions > >VP9 decoding speed improved about 109.3%(from 32fps to 67fps, tested on >loongson 3A3000). >--- > libavcodec/mips/Makefile | 1 + > libavcodec/mips/vp9_mc_mmi.c | 680 + > libavcodec/mips/vp9dsp_init_mips.c | 42 +++ > libavcodec/mips/vp9dsp_mips.h | 50 +++ > 4 files changed, 773 insertions(+) > create mode 100644 libavcodec/mips/vp9_mc_mmi.c > >diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile >index c827649..c5b54d5 100644 >--- a/libavcodec/mips/Makefile >+++ b/libavcodec/mips/Makefile >@@ -88,3 +88,4 @@ 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 > MMI-OBJS-$(CONFIG_VP3DSP) += mips/vp3dsp_idct_mmi.o >+MMI-OBJS-$(CONFIG_VP9_DECODER)+= mips/vp9_mc_mmi.o >diff --git a/libavcodec/mips/vp9_mc_mmi.c b/libavcodec/mips/vp9_mc_mmi.c >new file mode 100644 >index 000..145bbff >--- /dev/null >+++ b/libavcodec/mips/vp9_mc_mmi.c >@@ -0,0 +1,680 @@ >+/* >+ * Copyright (c) 2019 gxw >+ * >+ * 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 received a copy of the GNU Lesser General Public >+ * License along with FFmpeg; if not, write to the Free Software >+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 >USA >+ */ >+ >+#include "libavcodec/vp9dsp.h" >+#include "libavutil/mips/mmiutils.h" >+#include "vp9dsp_mips.h" >+ >+#define GET_DATA_H_MMI \ >+"pmaddhw%[ftmp4],%[ftmp4], %[filter1]\n\t" \ >+"pmaddhw%[ftmp5],%[ftmp5], %[filter2]\n\t" \ >+"paddw %[ftmp4],%[ftmp4], %[ftmp5] \n\t" \ >+"punpckhwd %[ftmp5],%[ftmp4], %[ftmp0] \n\t" \ >+"paddw %[ftmp4],%[ftmp4], %[ftmp5] \n\t" \ >+"pmaddhw%[ftmp6],%[ftmp6], %[filter1]\n\t" \ >+"pmaddhw%[ftmp7],%[ftmp7], %[filter2]\n\t" \ >+"paddw %[ftmp6],%[ftmp6], %[ftmp7] \n\t" \ >+"punpckhwd %[ftmp7],%[ftmp6], %[ftmp0] \n\t" \ >+"paddw %[ftmp6],%[ftmp6], %[ftmp7] \n\t" \ >+"punpcklwd %[srcl], %[ftmp4], %[ftmp6] \n\t" \ >+"pmaddhw%[ftmp8],%[ftmp8], %[filter1]\n\t" \ >+"pmaddhw%[ftmp9],%[ftmp9], %[filter2]\n\t" \ >+"paddw %[ftmp8],%[ftmp8], %[ftmp9] \n\t" \ >+"punpckhwd %[ftmp9],%[ftmp8], %[ftmp0] \n\t" \ >+"paddw %[ftmp8],%[ftmp8], %[ftmp9] \n\t" \ >+"pmaddhw%[ftmp10], %[ftmp10], %[filter1]\n\t" \ >+"pmaddhw%[ftmp11], %[ftmp11], %[filter2]\n\t" \ >+"paddw %[ftmp10], %[ftmp10], %[ftmp11] \n\t" \ >+"punpckhwd %[ftmp11], %[ftmp10], %[ftmp0] \n\t" \ >+"paddw %[ftmp10], %[ftmp10], %[ftmp11] \n\t" \ >+"punpcklwd %[srch], %[ftmp8], %[ftmp10] \n\t" >+ >+#define GET_DATA_V_MMI \ >+"punpcklhw %[srcl], %[ftmp4], %[ftmp5] \n\t" \ >+"pmaddhw%[srcl], %[srcl],%[filter10] \n\t" \ >+"punpcklhw %[ftmp12], %[ftmp6], %[ftmp7] \n\t" \ >+"pmaddhw%[ftmp12], %[ftmp12], %[filter32] \n\t" \ >+"paddw %[srcl], %[srcl],%[ftmp12] \n\t" \ >+"punpcklhw %[ftmp12], %[ftmp8], %[ftmp9] \n\t" \ >+"pmaddhw%[ftmp12], %[ftmp12], %[filter54] \n\t" \ >+&qu
[FFmpeg-devel] [PATCH] avcodec/mips: [loongson] mmi optimizations for VP9 put and avg functions
VP9 decoding speed improved about 109.3%(from 32fps to 67fps, tested on loongson 3A3000). --- libavcodec/mips/Makefile | 1 + libavcodec/mips/vp9_mc_mmi.c | 680 + libavcodec/mips/vp9dsp_init_mips.c | 42 +++ libavcodec/mips/vp9dsp_mips.h | 50 +++ 4 files changed, 773 insertions(+) create mode 100644 libavcodec/mips/vp9_mc_mmi.c diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile index c827649..c5b54d5 100644 --- a/libavcodec/mips/Makefile +++ b/libavcodec/mips/Makefile @@ -88,3 +88,4 @@ 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 MMI-OBJS-$(CONFIG_VP3DSP) += mips/vp3dsp_idct_mmi.o +MMI-OBJS-$(CONFIG_VP9_DECODER)+= mips/vp9_mc_mmi.o diff --git a/libavcodec/mips/vp9_mc_mmi.c b/libavcodec/mips/vp9_mc_mmi.c new file mode 100644 index 000..145bbff --- /dev/null +++ b/libavcodec/mips/vp9_mc_mmi.c @@ -0,0 +1,680 @@ +/* + * Copyright (c) 2019 gxw + * + * 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 received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavcodec/vp9dsp.h" +#include "libavutil/mips/mmiutils.h" +#include "vp9dsp_mips.h" + +#define GET_DATA_H_MMI \ +"pmaddhw%[ftmp4],%[ftmp4], %[filter1]\n\t" \ +"pmaddhw%[ftmp5],%[ftmp5], %[filter2]\n\t" \ +"paddw %[ftmp4],%[ftmp4], %[ftmp5] \n\t" \ +"punpckhwd %[ftmp5],%[ftmp4], %[ftmp0] \n\t" \ +"paddw %[ftmp4],%[ftmp4], %[ftmp5] \n\t" \ +"pmaddhw%[ftmp6],%[ftmp6], %[filter1]\n\t" \ +"pmaddhw%[ftmp7],%[ftmp7], %[filter2]\n\t" \ +"paddw %[ftmp6],%[ftmp6], %[ftmp7] \n\t" \ +"punpckhwd %[ftmp7],%[ftmp6], %[ftmp0] \n\t" \ +"paddw %[ftmp6],%[ftmp6], %[ftmp7] \n\t" \ +"punpcklwd %[srcl], %[ftmp4], %[ftmp6] \n\t" \ +"pmaddhw%[ftmp8],%[ftmp8], %[filter1]\n\t" \ +"pmaddhw%[ftmp9],%[ftmp9], %[filter2]\n\t" \ +"paddw %[ftmp8],%[ftmp8], %[ftmp9] \n\t" \ +"punpckhwd %[ftmp9],%[ftmp8], %[ftmp0] \n\t" \ +"paddw %[ftmp8],%[ftmp8], %[ftmp9] \n\t" \ +"pmaddhw%[ftmp10], %[ftmp10], %[filter1]\n\t" \ +"pmaddhw%[ftmp11], %[ftmp11], %[filter2]\n\t" \ +"paddw %[ftmp10], %[ftmp10], %[ftmp11] \n\t" \ +"punpckhwd %[ftmp11], %[ftmp10], %[ftmp0] \n\t" \ +"paddw %[ftmp10], %[ftmp10], %[ftmp11] \n\t" \ +"punpcklwd %[srch], %[ftmp8], %[ftmp10] \n\t" + +#define GET_DATA_V_MMI \ +"punpcklhw %[srcl], %[ftmp4], %[ftmp5] \n\t" \ +"pmaddhw%[srcl], %[srcl],%[filter10] \n\t" \ +"punpcklhw %[ftmp12], %[ftmp6], %[ftmp7] \n\t" \ +"pmaddhw%[ftmp12], %[ftmp12], %[filter32] \n\t" \ +"paddw %[srcl], %[srcl],%[ftmp12] \n\t" \ +"punpcklhw %[ftmp12], %[ftmp8], %[ftmp9] \n\t" \ +"pmaddhw%[ftmp12], %[ftmp12], %[filter54] \n\t" \ +"paddw %[srcl], %[srcl],%[ftmp12] \n\t" \ +"punpcklhw %[ftmp12], %[ftmp10], %[ftmp11] \n\t" \ +"pmaddhw%[ftmp12], %[ftmp12], %[filter76] \n\t" \ +"paddw %[srcl], %[srcl],%[ftmp12] \n\t" \ +"punpckhhw %[srch], %[ftmp4], %[ftmp5] \n\t" \ +"pmaddhw%[srch], %[srch],%[filter10] \n\t" \ +"punpckhhw %[ftmp12], %[ftmp6], %[ftmp7] \n\t" \ +"pmaddhw%[ftmp12], %[ftmp12], %[filter32] \n\t" \ +"paddw %[srch], %[srch],%[ftmp12] \n\t" \ +"punpckhhw %[ftmp12], %[ftmp8], %[ftmp9] \n\t" \ +"pmaddhw%[ftmp12], %[ftmp12], %[filter54] \n\t" \ +"paddw %[srch], %[srch],%[ftmp12] \n\t" \ +"punpckhhw %[ftmp12], %[ftmp10], %[ftmp11] \n\t" \ +"pmaddhw%[ftmp12], %[ftmp12], %[filter76] \n\t" \ +"paddw %[srch], %[srch],%[ftmp12] \n\t" + +#define ROUND_POWER_OF_TWO_MMI