diff mbox

[FFmpeg-devel,6/7] avcodec/mips: version 1 of wmv2dsp optimizations for loongson mmi

Message ID 2bb930d5.8eaa.157ada5153e.Coremail.ipfootball@126.com
State Accepted
Headers show

Commit Message

周晓勇 Oct. 10, 2016, 8:10 a.m. UTC
From 9b19ea3364d96a6eb0f3441f549c8d20ede36592 Mon Sep 17 00:00:00 2001
From: Zhou Xiaoyong <zhouxiaoyong@loongson.cn>
Date: Mon, 10 Oct 2016 15:04:35 +0800
Subject: [PATCH 6/7] avcodec/mips: version 1 of wmv2dsp optimizations for
 loongson mmi


---
 libavcodec/mips/Makefile            |   2 +
 libavcodec/mips/wmv2dsp_init_mips.c |  38 +++++
 libavcodec/mips/wmv2dsp_mips.h      |  29 ++++
 libavcodec/mips/wmv2dsp_mmi.c       | 278 ++++++++++++++++++++++++++++++++++++
 libavcodec/wmv2dsp.c                |   3 +
 libavcodec/wmv2dsp.h                |   1 +
 6 files changed, 351 insertions(+)
 create mode 100644 libavcodec/mips/wmv2dsp_init_mips.c
 create mode 100644 libavcodec/mips/wmv2dsp_mips.h
 create mode 100644 libavcodec/mips/wmv2dsp_mmi.c

Comments

Michael Niedermayer Dec. 13, 2016, 2:49 a.m. UTC | #1
On Mon, Oct 10, 2016 at 04:10:59PM +0800, 周晓勇 wrote:
> From 9b19ea3364d96a6eb0f3441f549c8d20ede36592 Mon Sep 17 00:00:00 2001
> From: Zhou Xiaoyong <zhouxiaoyong@loongson.cn>
> Date: Mon, 10 Oct 2016 15:04:35 +0800
> Subject: [PATCH 6/7] avcodec/mips: version 1 of wmv2dsp optimizations for
>  loongson mmi
> 

applied

thx

[...]
diff mbox

Patch

diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile
index cf54f38..2b6f37e 100644
--- a/libavcodec/mips/Makefile
+++ b/libavcodec/mips/Makefile
@@ -36,6 +36,7 @@  OBJS-$(CONFIG_MPEGVIDEO)                  += mips/mpegvideo_init_mips.o
 OBJS-$(CONFIG_MPEGVIDEOENC)               += mips/mpegvideoencdsp_init_mips.o
 OBJS-$(CONFIG_ME_CMP)                     += mips/me_cmp_init_mips.o
 OBJS-$(CONFIG_MPEG4_DECODER)              += mips/xvididct_init_mips.o
+OBJS-$(CONFIG_WMV2DSP)                    += mips/wmv2dsp_init_mips.o
 MSA-OBJS-$(CONFIG_HEVC_DECODER)           += mips/hevcdsp_msa.o            \
                                              mips/hevc_mc_uni_msa.o        \
                                              mips/hevc_mc_uniw_msa.o       \
@@ -79,3 +80,4 @@  MMI-OBJS-$(CONFIG_PIXBLOCKDSP)            += mips/pixblockdsp_mmi.o
 MMI-OBJS-$(CONFIG_H264QPEL)               += mips/h264qpel_mmi.o
 MMI-OBJS-$(CONFIG_VP8_DECODER)            += mips/vp8dsp_mmi.o
 MMI-OBJS-$(CONFIG_HPELDSP)                += mips/hpeldsp_mmi.o
+MMI-OBJS-$(CONFIG_WMV2DSP)                += mips/wmv2dsp_mmi.o
diff --git a/libavcodec/mips/wmv2dsp_init_mips.c b/libavcodec/mips/wmv2dsp_init_mips.c
new file mode 100644
index 0000000..51dd207
--- /dev/null
+++ b/libavcodec/mips/wmv2dsp_init_mips.c
@@ -0,0 +1,38 @@ 
+/*
+ * Copyright (c) 2016 Zhou Xiaoyong <zhouxiaoyong@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 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 "config.h"
+#include "libavutil/attributes.h"
+#include "wmv2dsp_mips.h"
+
+#if HAVE_MMI
+static av_cold void wmv2dsp_init_mmi(WMV2DSPContext *c)
+{
+    c->idct_add  = ff_wmv2_idct_add_mmi;
+    c->idct_put  = ff_wmv2_idct_put_mmi;
+}
+#endif /* HAVE_MMI */
+
+av_cold void ff_wmv2dsp_init_mips(WMV2DSPContext *c)
+{
+#if HAVE_MMI
+    wmv2dsp_init_mmi(c);
+#endif /* HAVE_MMI */
+}
diff --git a/libavcodec/mips/wmv2dsp_mips.h b/libavcodec/mips/wmv2dsp_mips.h
new file mode 100644
index 0000000..22894c5
--- /dev/null
+++ b/libavcodec/mips/wmv2dsp_mips.h
@@ -0,0 +1,29 @@ 
+/*
+ * Copyright (c) 2016 Zhou Xiaoyong <zhouxiaoyong@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 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
+ */
+
+#ifndef AVCODEC_MIPS_WMV2DSP_MIPS_H
+#define AVCODEC_MIPS_WMV2DSP_MIPS_H
+
+#include "libavcodec/wmv2dsp.h"
+
+void ff_wmv2_idct_add_mmi(uint8_t *dest, int line_size, int16_t *block);
+void ff_wmv2_idct_put_mmi(uint8_t *dest, int line_size, int16_t *block);
+
+#endif /* AVCODEC_MIPS_WMV2DSP_MIPS_H */
diff --git a/libavcodec/mips/wmv2dsp_mmi.c b/libavcodec/mips/wmv2dsp_mmi.c
new file mode 100644
index 0000000..1f6ccb2
--- /dev/null
+++ b/libavcodec/mips/wmv2dsp_mmi.c
@@ -0,0 +1,278 @@ 
+/*
+ * WMV2 - DSP functions Loongson MMI-optimized
+ *
+ * Copyright (c) 2016 Zhou Xiaoyong <zhouxiaoyong@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 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 "libavutil/avassert.h"
+#include "constants.h"
+#include "wmv2dsp_mips.h"
+#include "libavutil/mips/mmiutils.h"
+
+#define W0 2048
+#define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */
+#define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */
+#define W3 2408 /* 2048*sqrt (2)*cos (3*pi/16) */
+#define W4 2048 /* 2048*sqrt (2)*cos (4*pi/16) */
+#define W5 1609 /* 2048*sqrt (2)*cos (5*pi/16) */
+#define W6 1108 /* 2048*sqrt (2)*cos (6*pi/16) */
+#define W7 565  /* 2048*sqrt (2)*cos (7*pi/16) */
+
+static void wmv2_idct_row_mmi(short * b)
+{
+    int s1, s2;
+    int a0, a1, a2, a3, a4, a5, a6, a7;
+
+    /* step 1 */
+    a0 = W0 * b[0] + W0 * b[4];
+    a1 = W1 * b[1] + W7 * b[7];
+    a2 = W2 * b[2] + W6 * b[6];
+    a3 = W3 * b[5] - W5 * b[3];
+    a4 = W0 * b[0] - W0 * b[4];
+    a5 = W5 * b[5] + W3 * b[3];
+    a6 = W6 * b[2] - W2 * b[6];
+    a7 = W7 * b[1] - W1 * b[7];
+
+    /* step 2 */
+    s1 = (181 * (a1 - a5 + a7 - a3) + 128) >> 8; // 1, 3, 5, 7
+    s2 = (181 * (a1 - a5 - a7 + a3) + 128) >> 8;
+
+    /* step 3 */
+    b[0] = (a0 + a2 + a1 + a5 + 128) >> 8;
+    b[1] = (a4 + a6 + s1      + 128) >> 8;
+    b[2] = (a4 - a6 + s2      + 128) >> 8;
+    b[3] = (a0 - a2 + a7 + a3 + 128) >> 8;
+    b[4] = (a0 - a2 - a7 - a3 + 128) >> 8;
+    b[5] = (a4 - a6 - s2      + 128) >> 8;
+    b[6] = (a4 + a6 - s1      + 128) >> 8;
+    b[7] = (a0 + a2 - a1 - a5 + 128) >> 8;
+}
+
+static void wmv2_idct_col_mmi(short * b)
+{
+    int s1, s2;
+    int a0, a1, a2, a3, a4, a5, a6, a7;
+
+    /* step 1, with extended precision */
+    a0 = (W0 * b[ 0] + W0 * b[32]    ) >> 3;
+    a1 = (W1 * b[ 8] + W7 * b[56] + 4) >> 3;
+    a2 = (W2 * b[16] + W6 * b[48] + 4) >> 3;
+    a3 = (W3 * b[40] - W5 * b[24] + 4) >> 3;
+    a4 = (W0 * b[ 0] - W0 * b[32]    ) >> 3;
+    a5 = (W5 * b[40] + W3 * b[24] + 4) >> 3;
+    a6 = (W6 * b[16] - W2 * b[48] + 4) >> 3;
+    a7 = (W7 * b[ 8] - W1 * b[56] + 4) >> 3;
+
+    /* step 2 */
+    s1 = (181 * (a1 - a5 + a7 - a3) + 128) >> 8;
+    s2 = (181 * (a1 - a5 - a7 + a3) + 128) >> 8;
+
+    /* step 3 */
+    b[ 0] = (a0 + a2 + a1 + a5 + 8192) >> 14;
+    b[ 8] = (a4 + a6 + s1      + 8192) >> 14;
+    b[16] = (a4 - a6 + s2      + 8192) >> 14;
+    b[24] = (a0 - a2 + a7 + a3 + 8192) >> 14;
+
+    b[32] = (a0 - a2 - a7 - a3 + 8192) >> 14;
+    b[40] = (a4 - a6 - s2      + 8192) >> 14;
+    b[48] = (a4 + a6 - s1      + 8192) >> 14;
+    b[56] = (a0 + a2 - a1 - a5 + 8192) >> 14;
+}
+
+void ff_wmv2_idct_add_mmi(uint8_t *dest, int line_size, int16_t *block)
+{
+    int i;
+    double ftmp[11];
+
+    for (i = 0; i < 64; i += 8)
+        wmv2_idct_row_mmi(block + i);
+    for (i = 0; i < 8; i++)
+        wmv2_idct_col_mmi(block + i);
+
+    __asm__ volatile (
+        "xor        %[ftmp0],   %[ftmp0],   %[ftmp0]                    \n\t"
+
+        // low 4 loop
+        MMI_LDC1(%[ftmp1], %[block], 0x00)
+        MMI_LDC1(%[ftmp2], %[block], 0x08)
+        MMI_LDC1(%[ftmp3], %[block], 0x10)
+        MMI_LDC1(%[ftmp4], %[block], 0x18)
+        MMI_LDC1(%[ftmp5], %[block], 0x20)
+        MMI_LDC1(%[ftmp6], %[block], 0x28)
+        MMI_LDC1(%[ftmp7], %[block], 0x30)
+        MMI_LDC1(%[ftmp8], %[block], 0x38)
+
+        MMI_LDC1(%[ftmp9], %[dest], 0x00)
+        "punpckhbh  %[ftmp10],  %[ftmp9],   %[ftmp0]                    \n\t"
+        "punpcklbh  %[ftmp9],   %[ftmp9],   %[ftmp0]                    \n\t"
+        "paddh      %[ftmp1],   %[ftmp1],   %[ftmp9]                    \n\t"
+        "paddh      %[ftmp2],   %[ftmp2],   %[ftmp10]                   \n\t"
+        "packushb   %[ftmp1],   %[ftmp1],   %[ftmp2]                    \n\t"
+        MMI_SDC1(%[ftmp1], %[dest], 0x00)
+        PTR_ADDU   "%[dest],    %[dest],    %[line_size]                \n\t"
+
+        MMI_LDC1(%[ftmp9], %[dest], 0x00)
+        "punpckhbh  %[ftmp10],  %[ftmp9],   %[ftmp0]                    \n\t"
+        "punpcklbh  %[ftmp9],   %[ftmp9],   %[ftmp0]                    \n\t"
+        "paddh      %[ftmp3],   %[ftmp3],   %[ftmp9]                    \n\t"
+        "paddh      %[ftmp4],   %[ftmp4],   %[ftmp10]                   \n\t"
+        "packushb   %[ftmp3],   %[ftmp3],   %[ftmp4]                    \n\t"
+        MMI_SDC1(%[ftmp3], %[dest], 0x00)
+        PTR_ADDU   "%[dest],    %[dest],    %[line_size]                \n\t"
+
+        MMI_LDC1(%[ftmp9], %[dest], 0x00)
+        "punpckhbh  %[ftmp10],  %[ftmp9],   %[ftmp0]                    \n\t"
+        "punpcklbh  %[ftmp9],   %[ftmp9],   %[ftmp0]                    \n\t"
+        "paddh      %[ftmp5],   %[ftmp5],   %[ftmp9]                    \n\t"
+        "paddh      %[ftmp6],   %[ftmp6],   %[ftmp10]                   \n\t"
+        "packushb   %[ftmp5],   %[ftmp5],   %[ftmp6]                    \n\t"
+        MMI_SDC1(%[ftmp5], %[dest], 0x00)
+        PTR_ADDU   "%[dest],    %[dest],    %[line_size]                \n\t"
+
+        MMI_LDC1(%[ftmp9], %[dest], 0x00)
+        "punpckhbh  %[ftmp10],  %[ftmp9],   %[ftmp0]                    \n\t"
+        "punpcklbh  %[ftmp9],   %[ftmp9],   %[ftmp0]                    \n\t"
+        "paddh      %[ftmp7],   %[ftmp7],   %[ftmp9]                    \n\t"
+        "paddh      %[ftmp8],   %[ftmp8],   %[ftmp10]                   \n\t"
+        "packushb   %[ftmp7],   %[ftmp7],   %[ftmp8]                    \n\t"
+        MMI_SDC1(%[ftmp7], %[dest], 0x00)
+
+        PTR_ADDIU  "%[block],   %[block],   0x40                        \n\t"
+        PTR_ADDU   "%[dest],    %[dest],    %[line_size]                \n\t"
+
+        // high 4 loop
+        MMI_LDC1(%[ftmp1], %[block], 0x00)
+        MMI_LDC1(%[ftmp2], %[block], 0x08)
+        MMI_LDC1(%[ftmp3], %[block], 0x10)
+        MMI_LDC1(%[ftmp4], %[block], 0x18)
+        MMI_LDC1(%[ftmp5], %[block], 0x20)
+        MMI_LDC1(%[ftmp6], %[block], 0x28)
+        MMI_LDC1(%[ftmp7], %[block], 0x30)
+        MMI_LDC1(%[ftmp8], %[block], 0x38)
+
+        MMI_LDC1(%[ftmp9], %[dest], 0x00)
+        "punpckhbh  %[ftmp10],  %[ftmp9],   %[ftmp0]                    \n\t"
+        "punpcklbh  %[ftmp9],   %[ftmp9],   %[ftmp0]                    \n\t"
+        "paddh      %[ftmp1],   %[ftmp1],   %[ftmp9]                    \n\t"
+        "paddh      %[ftmp2],   %[ftmp2],   %[ftmp10]                   \n\t"
+        "packushb   %[ftmp1],   %[ftmp1],   %[ftmp2]                    \n\t"
+        MMI_SDC1(%[ftmp1], %[dest], 0x00)
+        PTR_ADDU   "%[dest],    %[dest],    %[line_size]                \n\t"
+
+        MMI_LDC1(%[ftmp9], %[dest], 0x00)
+        "punpckhbh  %[ftmp10],  %[ftmp9],   %[ftmp0]                    \n\t"
+        "punpcklbh  %[ftmp9],   %[ftmp9],   %[ftmp0]                    \n\t"
+        "paddh      %[ftmp3],   %[ftmp3],   %[ftmp9]                    \n\t"
+        "paddh      %[ftmp4],   %[ftmp4],   %[ftmp10]                   \n\t"
+        "packushb   %[ftmp3],   %[ftmp3],   %[ftmp4]                    \n\t"
+        MMI_SDC1(%[ftmp3], %[dest], 0x00)
+        PTR_ADDU   "%[dest],    %[dest],    %[line_size]                \n\t"
+
+        MMI_LDC1(%[ftmp9], %[dest], 0x00)
+        "punpckhbh  %[ftmp10],  %[ftmp9],   %[ftmp0]                    \n\t"
+        "punpcklbh  %[ftmp9],   %[ftmp9],   %[ftmp0]                    \n\t"
+        "paddh      %[ftmp5],   %[ftmp5],   %[ftmp9]                    \n\t"
+        "paddh      %[ftmp6],   %[ftmp6],   %[ftmp10]                   \n\t"
+        "packushb   %[ftmp5],   %[ftmp5],   %[ftmp6]                    \n\t"
+        MMI_SDC1(%[ftmp5], %[dest], 0x00)
+        PTR_ADDU   "%[dest],    %[dest],    %[line_size]                \n\t"
+
+        MMI_LDC1(%[ftmp9], %[dest], 0x00)
+        "punpckhbh  %[ftmp10],  %[ftmp9],   %[ftmp0]                    \n\t"
+        "punpcklbh  %[ftmp9],   %[ftmp9],   %[ftmp0]                    \n\t"
+        "paddh      %[ftmp7],   %[ftmp7],   %[ftmp9]                    \n\t"
+        "paddh      %[ftmp8],   %[ftmp8],   %[ftmp10]                   \n\t"
+        "packushb   %[ftmp7],   %[ftmp7],   %[ftmp8]                    \n\t"
+        MMI_SDC1(%[ftmp7], %[dest], 0x00)
+        : [ftmp0]"=&f"(ftmp[0]),            [ftmp1]"=&f"(ftmp[1]),
+          [ftmp2]"=&f"(ftmp[2]),            [ftmp3]"=&f"(ftmp[3]),
+          [ftmp4]"=&f"(ftmp[4]),            [ftmp5]"=&f"(ftmp[5]),
+          [ftmp6]"=&f"(ftmp[6]),            [ftmp7]"=&f"(ftmp[7]),
+          [ftmp8]"=&f"(ftmp[8]),            [ftmp9]"=&f"(ftmp[9]),
+          [ftmp10]"=&f"(ftmp[10]),
+          [block]"+&r"(block),              [dest]"+&r"(dest)
+        : [line_size]"r"((mips_reg)line_size)
+        : "memory"
+    );
+}
+
+void ff_wmv2_idct_put_mmi(uint8_t *dest, int line_size, int16_t *block)
+{
+    int i;
+    double ftmp[8];
+
+    for (i = 0; i < 64; i += 8)
+        wmv2_idct_row_mmi(block + i);
+    for (i = 0; i < 8; i++)
+        wmv2_idct_col_mmi(block + i);
+
+    __asm__ volatile (
+        // low 4 loop
+        MMI_LDC1(%[ftmp0], %[block], 0x00)
+        MMI_LDC1(%[ftmp1], %[block], 0x08)
+        MMI_LDC1(%[ftmp2], %[block], 0x10)
+        MMI_LDC1(%[ftmp3], %[block], 0x18)
+        MMI_LDC1(%[ftmp4], %[block], 0x20)
+        MMI_LDC1(%[ftmp5], %[block], 0x28)
+        MMI_LDC1(%[ftmp6], %[block], 0x30)
+        MMI_LDC1(%[ftmp7], %[block], 0x38)
+        "packushb   %[ftmp0],   %[ftmp0],   %[ftmp1]                    \n\t"
+        "packushb   %[ftmp2],   %[ftmp2],   %[ftmp3]                    \n\t"
+        "packushb   %[ftmp4],   %[ftmp4],   %[ftmp5]                    \n\t"
+        "packushb   %[ftmp6],   %[ftmp6],   %[ftmp7]                    \n\t"
+        MMI_SDC1(%[ftmp0], %[dest], 0x00)
+        PTR_ADDU   "%[dest],    %[dest],    %[line_size]                \n\t"
+        MMI_SDC1(%[ftmp2], %[dest], 0x00)
+        PTR_ADDU   "%[dest],    %[dest],    %[line_size]                \n\t"
+        MMI_SDC1(%[ftmp4], %[dest], 0x00)
+        PTR_ADDU   "%[dest],    %[dest],    %[line_size]                \n\t"
+        MMI_SDC1(%[ftmp6], %[dest], 0x00)
+
+        PTR_ADDIU  "%[block],   %[block],   0x40                        \n\t"
+        PTR_ADDU   "%[dest],    %[dest],    %[line_size]                \n\t"
+
+        // high 4 loop
+        MMI_LDC1(%[ftmp0], %[block], 0x00)
+        MMI_LDC1(%[ftmp1], %[block], 0x08)
+        MMI_LDC1(%[ftmp2], %[block], 0x10)
+        MMI_LDC1(%[ftmp3], %[block], 0x18)
+        MMI_LDC1(%[ftmp4], %[block], 0x20)
+        MMI_LDC1(%[ftmp5], %[block], 0x28)
+        MMI_LDC1(%[ftmp6], %[block], 0x30)
+        MMI_LDC1(%[ftmp7], %[block], 0x38)
+        "packushb   %[ftmp0],   %[ftmp0],   %[ftmp1]                    \n\t"
+        "packushb   %[ftmp2],   %[ftmp2],   %[ftmp3]                    \n\t"
+        "packushb   %[ftmp4],   %[ftmp4],   %[ftmp5]                    \n\t"
+        "packushb   %[ftmp6],   %[ftmp6],   %[ftmp7]                    \n\t"
+        MMI_SDC1(%[ftmp0], %[dest], 0x00)
+        PTR_ADDU   "%[dest],    %[dest],    %[line_size]                \n\t"
+        MMI_SDC1(%[ftmp2], %[dest], 0x00)
+        PTR_ADDU   "%[dest],    %[dest],    %[line_size]                \n\t"
+        MMI_SDC1(%[ftmp4], %[dest], 0x00)
+        PTR_ADDU   "%[dest],    %[dest],    %[line_size]                \n\t"
+        MMI_SDC1(%[ftmp6], %[dest], 0x00)
+        : [ftmp0]"=&f"(ftmp[0]),            [ftmp1]"=&f"(ftmp[1]),
+          [ftmp2]"=&f"(ftmp[2]),            [ftmp3]"=&f"(ftmp[3]),
+          [ftmp4]"=&f"(ftmp[4]),            [ftmp5]"=&f"(ftmp[5]),
+          [ftmp6]"=&f"(ftmp[6]),            [ftmp7]"=&f"(ftmp[7]),
+          [block]"+&r"(block),              [dest]"+&r"(dest)
+        : [line_size]"r"((mips_reg)line_size)
+        : "memory"
+    );
+}
diff --git a/libavcodec/wmv2dsp.c b/libavcodec/wmv2dsp.c
index 40e0bef..b9e98d5 100644
--- a/libavcodec/wmv2dsp.c
+++ b/libavcodec/wmv2dsp.c
@@ -262,4 +262,7 @@  av_cold void ff_wmv2dsp_init(WMV2DSPContext *c)
     c->put_mspel_pixels_tab[5] = put_mspel8_mc12_c;
     c->put_mspel_pixels_tab[6] = put_mspel8_mc22_c;
     c->put_mspel_pixels_tab[7] = put_mspel8_mc32_c;
+
+    if (ARCH_MIPS)
+        ff_wmv2dsp_init_mips(c);
 }
diff --git a/libavcodec/wmv2dsp.h b/libavcodec/wmv2dsp.h
index 0bf9489..62a990d 100644
--- a/libavcodec/wmv2dsp.h
+++ b/libavcodec/wmv2dsp.h
@@ -33,5 +33,6 @@  typedef struct WMV2DSPContext {
 } WMV2DSPContext;
 
 void ff_wmv2dsp_init(WMV2DSPContext *c);
+void ff_wmv2dsp_init_mips(WMV2DSPContext *c);
 
 #endif /* AVCODEC_WMV2DSP_H */