X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fmips%2Fvp9dsp_init_mips.c;h=27c8ec9d8c43a6ae1958c5775e926146703dbaf7;hb=f4df5039a791a56de85c64e6b9e4448a221b5c40;hp=c8a48908af30ec0ef672ffe4302b7f02d707a80b;hpb=ce47f1589e9f5a6cf8372a269bdd862ff0cc3f91;p=ffmpeg diff --git a/libavcodec/mips/vp9dsp_init_mips.c b/libavcodec/mips/vp9dsp_init_mips.c index c8a48908af3..27c8ec9d8c4 100644 --- a/libavcodec/mips/vp9dsp_init_mips.c +++ b/libavcodec/mips/vp9dsp_init_mips.c @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/attributes.h" +#include "libavutil/mips/cpu.h" #include "config.h" #include "libavutil/common.h" #include "libavcodec/vp9dsp.h" @@ -168,9 +170,58 @@ 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_MSA || HAVE_MMI + int cpu_flags = av_get_cpu_flags(); +#endif + +#if HAVE_MMI + if (have_mmi(cpu_flags)) + vp9dsp_init_mmi(dsp, bpp); +#endif + #if HAVE_MSA - vp9dsp_init_msa(dsp, bpp); -#endif // #if HAVE_MSA + if (have_msa(cpu_flags)) + vp9dsp_init_msa(dsp, bpp); +#endif }