diff mbox

[FFmpeg-devel,2/9] avcodec/mips: [loongson] reoptimize simple idct with mmi.

Message ID 1531302325-15827-1-git-send-email-yinshiyou-hf@loongson.cn
State Superseded
Headers show

Commit Message

Shiyou Yin July 11, 2018, 9:45 a.m. UTC
Reoptimized following functions with mmi.
1. ff_simple_idct_put_mmi
2. ff_simple_idct_add_mmi
3. ff_simple_idct_mmi (rename to ff_simple_idct_8_mmi)

Change-Id: I9d16d1e7dc9c3d9811548838b57d4eefd60cb8ce
Signed-off-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
---
 libavcodec/mips/idctdsp_init_mips.c |    7 +-
 libavcodec/mips/idctdsp_mips.h      |    2 +-
 libavcodec/mips/simple_idct_mmi.c   | 1746 +++++++++++++++++++----------------
 3 files changed, 971 insertions(+), 784 deletions(-)

Comments

Carl Eugen Hoyos July 11, 2018, 12:07 p.m. UTC | #1
2018-07-11 11:45 GMT+02:00, Shiyou Yin <yinshiyou-hf@loongson.cn>:
> Reoptimized following functions with mmi.
> 1. ff_simple_idct_put_mmi
> 2. ff_simple_idct_add_mmi
> 3. ff_simple_idct_mmi (rename to ff_simple_idct_8_mmi)

Are the new functions faster? Easier to maintain?
More future-proof?

Please add some explanation to the commit message.

Carl Eugen
Shiyou Yin July 12, 2018, 12:16 p.m. UTC | #2
> 2018-07-11 11:45 GMT+02:00, Shiyou Yin <yinshiyou-hf@loongson.cn>:

> > Reoptimized following functions with mmi.

> > 1. ff_simple_idct_put_mmi

> > 2. ff_simple_idct_add_mmi

> > 3. ff_simple_idct_mmi (rename to ff_simple_idct_8_mmi)

> 

> Are the new functions faster? Easier to maintain?

> More future-proof?

> 

> Please add some explanation to the commit message.

> 

> Carl Eugen


I have reupload all my patchs and added the performance data in the commit message for wach one.


本邮件及其附件含有龙芯中科技术有限公司的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部 分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。 

This email and its attachments contain confidential information from Loongson
Technology Corporation Limited, which is intended only for the person or entity
whose address is listed above. Any use of the information contained herein in
any way (including, but not limited to, total or partial disclosure,
reproduction or dissemination) by persons other than the intended recipient(s)
is prohibited. If you receive this email in error, please notify the sender by
phone or email immediately and delete it.
diff mbox

Patch

diff --git a/libavcodec/mips/idctdsp_init_mips.c b/libavcodec/mips/idctdsp_init_mips.c
index 8c26bca..7f3af86 100644
--- a/libavcodec/mips/idctdsp_init_mips.c
+++ b/libavcodec/mips/idctdsp_init_mips.c
@@ -20,6 +20,7 @@ 
  */
 
 #include "idctdsp_mips.h"
+#include "xvididct_mips.h"
 
 #if HAVE_MSA
 static av_cold void idctdsp_init_msa(IDCTDSPContext *c, AVCodecContext *avctx,
@@ -48,8 +49,10 @@  static av_cold void idctdsp_init_mmi(IDCTDSPContext *c, AVCodecContext *avctx,
     if ((avctx->lowres != 1) && (avctx->lowres != 2) && (avctx->lowres != 3) &&
         (avctx->bits_per_raw_sample != 10) &&
         (avctx->bits_per_raw_sample != 12) &&
-        (avctx->idct_algo == FF_IDCT_AUTO)) {
-                c->idct = ff_simple_idct_mmi;
+        ((avctx->idct_algo == FF_IDCT_AUTO) || (avctx->idct_algo == FF_IDCT_SIMPLE))) {
+                c->idct_put = ff_simple_idct_put_mmi;
+                c->idct_add = ff_simple_idct_add_mmi;
+                c->idct = ff_simple_idct_8_mmi;
                 c->perm_type = FF_IDCT_PERM_NONE;
     }
 
diff --git a/libavcodec/mips/idctdsp_mips.h b/libavcodec/mips/idctdsp_mips.h
index 7ca7c1c..95f8299 100644
--- a/libavcodec/mips/idctdsp_mips.h
+++ b/libavcodec/mips/idctdsp_mips.h
@@ -46,7 +46,7 @@  void ff_put_signed_pixels_clamped_mmi(const int16_t *block,
         uint8_t *av_restrict pixels, ptrdiff_t line_size);
 void ff_add_pixels_clamped_mmi(const int16_t *block,
         uint8_t *av_restrict pixels, ptrdiff_t line_size);
-void ff_simple_idct_mmi(int16_t *block);
+void ff_simple_idct_8_mmi(int16_t *block);
 void ff_simple_idct_put_mmi(uint8_t *dest, ptrdiff_t line_size, int16_t *block);
 void ff_simple_idct_add_mmi(uint8_t *dest, ptrdiff_t line_size, int16_t *block);
 
diff --git a/libavcodec/mips/simple_idct_mmi.c b/libavcodec/mips/simple_idct_mmi.c
index 628e13f..3912569 100644
--- a/libavcodec/mips/simple_idct_mmi.c
+++ b/libavcodec/mips/simple_idct_mmi.c
@@ -24,793 +24,977 @@ 
 
 #include "idctdsp_mips.h"
 #include "constants.h"
+#include "libavutil/mips/asmdefs.h"
 
-#define C0 23170 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C1 22725 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C2 21407 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C3 19266 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C4 16383 //cos(i*M_PI/16)*sqrt(2)*(1<<14) - 0.5
-#define C5 12873 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C6 8867  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C7 4520  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define W1  22725  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define W2  21407  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define W3  19266  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define W4  16383  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define W5  12873  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define W6  8867   //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define W7  4520   //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
 
 #define ROW_SHIFT 11
 #define COL_SHIFT 20
-
-DECLARE_ALIGNED(8, static const int16_t, coeffs)[]= {
-    1<<(ROW_SHIFT-1),   0, 1<<(ROW_SHIFT-1),   0,
-    1<<(ROW_SHIFT-1),   1, 1<<(ROW_SHIFT-1),   0,
-                  C4,  C4,               C4,  C4,
-                  C4, -C4,               C4, -C4,
-                  C2,  C6,               C2,  C6,
-                  C6, -C2,               C6, -C2,
-                  C1,  C3,               C1,  C3,
-                  C5,  C7,               C5,  C7,
-                  C3, -C7,               C3, -C7,
-                 -C1, -C5,              -C1, -C5,
-                  C5, -C1,               C5, -C1,
-                  C7,  C3,               C7,  C3,
-                  C7, -C5,               C7, -C5,
-                  C3, -C1,               C3, -C1
+#define DC_SHIFT 3
+
+DECLARE_ALIGNED(8, const int16_t, W_arr)[46] = {
+    W4,  W2,  W4,  W6,
+    W1,  W3,  W5,  W7,
+    W4,  W6, -W4, -W2,
+    W3, -W7, -W1, -W5,
+    W4, -W6, -W4,  W2,
+    W5, -W1,  W7,  W3,
+    W4, -W2,  W4, -W6,
+    W7, -W5,  W3, -W1,
+    1024, 0,  1024, 0, //ff_p32_1024 = 0x0000040000000400ULL
+    0,   -1,  -1,  -1, //mask = 0xffffffffffff0000ULL
+    32,  32,  32,  32  //ff_p16_32 = 0x0020002000200020ULL
 };
 
-void ff_simple_idct_mmi(int16_t *block)
+void ff_simple_idct_8_mmi(int16_t *block)
 {
-        DECLARE_ALIGNED(8, int64_t, align_tmp)[16];
-        int16_t * const temp= (int16_t*)align_tmp;
-
-        __asm__ volatile (
-#undef  DC_COND_IDCT
-#define DC_COND_IDCT(src0, src4, src1, src5, dst, rounder, rarg, shift)      \
-        "ldc1 $f0, " #src0 "            \n\t" /* R4     R0      r4      r0 */\
-        "ldc1 $f2, " #src4 "            \n\t" /* R6     R2      r6      r2 */\
-        "ldc1 $f4, " #src1 "            \n\t" /* R3     R1      r3      r1 */\
-        "ldc1 $f6, " #src5 "            \n\t" /* R7     R5      r7      r5 */\
-        "ldc1 $f8, %3                   \n\t"                                \
-        "and  $f8, $f8, $f0             \n\t"                                \
-        "or $f8, $f8, $f2               \n\t"                                \
-        "or $f8, $f8, $f4               \n\t"                                \
-        "or $f8, $f8, $f6               \n\t"                                \
-        "packsswh $f8, $f8, $f8         \n\t"                                \
-        "li $11, " #shift "             \n\t"                                \
-        "mfc1 $10, $f8                  \n\t"                                \
-        "mtc1 $11, $f18                 \n\t"                                \
-        "beqz $10, 1f                   \n\t"                                \
-        "ldc1 $f8, 16(%2)               \n\t" /* C4     C4      C4      C4 */\
-        "pmaddhw $f8, $f8, $f0          \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "ldc1 $f10, 24(%2)              \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddhw $f0, $f0, $f10         \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "ldc1 $f10, 32(%2)              \n\t" /* C6     C2      C6      C2 */\
-        "pmaddhw $f10, $f10, $f2        \n\t" /* C6R6+C2R2      C6r6+C2r2  */\
-        "ldc1 $f12, 40(%2)              \n\t" /* -C2    C6      -C2     C6 */\
-        "pmaddhw $f2, $f2, $f12         \n\t" /* -C2R6+C6R2     -C2r6+C6r2 */\
-        "ldc1 $f14, 48(%2)              \n\t" /* C3     C1      C3      C1 */\
-        "ldc1 $f16, " #rarg "           \n\t"                                \
-        "pmaddhw $f14, $f14, $f4        \n\t" /* C3R3+C1R1      C3r3+C1r1  */\
-        #rounder " $f8, $f8, $f16       \n\t"                                \
-        "mov.d $f12, $f8                \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "paddw $f8, $f8, $f10           \n\t" /* A0             a0         */\
-        "psubw $f12, $f12, $f10         \n\t" /* A3             a3         */\
-        "ldc1 $f10, 56(%2)              \n\t" /* C7     C5      C7      C5 */\
-        "ldc1 $f16, " #rarg "           \n\t"                                \
-        "pmaddhw $f10, $f10, $f6        \n\t" /* C7R7+C5R5      C7r7+C5r5  */\
-        #rounder " $f0, $f0, $f16       \n\t"                                \
-        "paddw $f2, $f2, $f0            \n\t" /* A1             a1         */\
-        "ldc1 $f16, 64(%2)              \n\t"                                \
-        "paddw $f0, $f0, $f0            \n\t"                                \
-        "psubw $f0, $f0, $f2            \n\t" /* A2             a2         */\
-        "pmaddhw $f4, $f4, $f16         \n\t" /* -C7R3+C3R1     -C7r3+C3r1 */\
-        "paddw $f14, $f14, $f10         \n\t" /* B0             b0         */\
-        "ldc1 $f10, 72(%2)              \n\t" /* -C5    -C1     -C5    -C1 */\
-        "pmaddhw $f10, $f10, $f6        \n\t" /* -C5R7-C1R5     -C5r7-C1r5 */\
-        "paddw $f14, $f14, $f8          \n\t" /* A0+B0          a0+b0      */\
-        "paddw $f8, $f8, $f8            \n\t" /* 2A0            2a0        */\
-        "psubw $f8, $f8, $f14           \n\t" /* A0-B0          a0-b0      */\
-        "paddw $f10, $f10, $f4          \n\t" /* B1             b1         */\
-        "psraw $f14, $f14, $f18         \n\t"                                \
-        "psraw $f8, $f8, $f18           \n\t"                                \
-        "mov.d $f4, $f2                 \n\t" /* A1             a1         */\
-        "paddw $f2, $f2, $f10           \n\t" /* A1+B1          a1+b1      */\
-        "psubw $f4, $f4, $f10           \n\t" /* A1-B1          a1-b1      */\
-        "psraw $f2, $f2, $f18           \n\t"                                \
-        "psraw $f4, $f4, $f18           \n\t"                                \
-        "packsswh $f14, $f14, $f2       \n\t" /* A1+B1 a1+b1 A0+B0 a0+b0   */\
-        "packsswh $f4, $f4, $f8         \n\t" /* A0-B0 a0-b0 A1-B1 a1-b1   */\
-        "sdc1 $f14, " #dst "            \n\t"                                \
-        "ldc1 $f2, " #src1 "            \n\t" /* R3     R1      r3      r1 */\
-        "ldc1 $f8, 80(%2)               \n\t" /* -C1    C5      -C1     C5 */\
-        "sdc1 $f4, 24+" #dst "          \n\t"                                \
-        "pmaddhw $f8, $f8, $f2          \n\t" /* -C1R3+C5R1     -C1r3+C5r1 */\
-        "ldc1 $f16, 96(%2)              \n\t"                                \
-        "ldc1 $f14, 88(%2)              \n\t" /* C3     C7      C3      C7 */\
-        "pmaddhw $f2, $f2, $f16         \n\t" /* -C5R3+C7R1     -C5r3+C7r1 */\
-        "pmaddhw $f14, $f14, $f6        \n\t" /* C3R7+C7R5      C3r7+C7r5  */\
-        "ldc1 $f16, 104(%2)             \n\t"                                \
-        "mov.d $f4, $f0                 \n\t" /* A2             a2         */\
-        "pmaddhw $f6, $f6, $f16         \n\t" /* -C1R7+C3R5     -C1r7+C3r5 */\
-        "paddw $f8, $f8, $f14           \n\t" /* B2             b2         */\
-        "paddw $f4, $f4, $f8            \n\t" /* A2+B2          a2+b2      */\
-        "psubw $f0, $f0, $f8            \n\t" /* a2-B2          a2-b2      */\
-        "psraw $f4, $f4, $f18           \n\t"                                \
-        "psraw $f0, $f0, $f18           \n\t"                                \
-        "mov.d $f8, $f12                \n\t" /* A3             a3         */\
-        "paddw $f6, $f6, $f2            \n\t" /* B3             b3         */\
-        "paddw $f12, $f12, $f6          \n\t" /* A3+B3          a3+b3      */\
-        "psubw $f8, $f8, $f6            \n\t" /* a3-B3          a3-b3      */\
-        "psraw $f12, $f12, $f18         \n\t"                                \
-        "packsswh $f4, $f4, $f12        \n\t" /* A3+B3 a3+b3 A2+B2 a2+b2   */\
-        "sdc1 $f4, 8+" #dst "           \n\t"                                \
-        "psraw $f8, $f8, $f18           \n\t"                                \
-        "packsswh $f8, $f8, $f0         \n\t" /* A2-B2 a2-b2 A3-B3 a3-b3   */\
-        "sdc1 $f8, 16+" #dst "          \n\t"                                \
-        "b 2f                           \n\t"                                \
-        "1:                             \n\t"                                \
-        "li $10, 16                     \n\t"                                \
-        "mtc1 $10, $f16                 \n\t"                                \
-        "psllw $f0, $f0, $f16           \n\t"                                \
-        "ldc1 $f16, %4                  \n\t"                                \
-        "paddw $f0, $f0, $f16           \n\t"                                \
-        "li $10, 13                     \n\t"                                \
-        "mtc1 $10, $f16                 \n\t"                                \
-        "psraw $f0, $f0, $f16           \n\t"                                \
-        "packsswh $f0, $f0, $f0         \n\t"                                \
-        "sdc1 $f0, " #dst "             \n\t"                                \
-        "sdc1 $f0, 8+" #dst "           \n\t"                                \
-        "sdc1 $f0, 16+" #dst "          \n\t"                                \
-        "sdc1 $f0, 24+" #dst "          \n\t"                                \
-        "2:                             \n\t"
-
-#undef  Z_COND_IDCT
-#define Z_COND_IDCT(src0, src4, src1, src5, dst, rounder, rarg, shift, bt)   \
-        "ldc1 $f0, " #src0 "            \n\t" /* R4     R0      r4      r0 */\
-        "ldc1 $f2, " #src4 "            \n\t" /* R6     R2      r6      r2 */\
-        "ldc1 $f4, " #src1 "            \n\t" /* R3     R1      r3      r1 */\
-        "ldc1 $f6, " #src5 "            \n\t" /* R7     R5      r7      r5 */\
-        "mov.d $f8, $f0                 \n\t"                                \
-        "or $f8, $f8, $f2               \n\t"                                \
-        "or $f8, $f8, $f4               \n\t"                                \
-        "or $f8, $f8, $f6               \n\t"                                \
-        "packsswh $f8, $f8, $f8         \n\t"                                \
-        "mfc1 $10, $f8                  \n\t"                                \
-        "beqz $10, " #bt "              \n\t"                                \
-        "ldc1 $f8, 16(%2)               \n\t" /* C4     C4      C4      C4 */\
-        "pmaddhw $f8, $f8, $f0          \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "ldc1 $f10, 24(%2)              \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddhw $f0, $f0, $f10         \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "ldc1 $f10, 32(%2)              \n\t" /* C6     C2      C6      C2 */\
-        "pmaddhw $f10, $f10, $f2        \n\t" /* C6R6+C2R2      C6r6+C2r2  */\
-        "ldc1 $f12, 40(%2)              \n\t" /* -C2    C6      -C2     C6 */\
-        "pmaddhw $f2, $f2, $f12         \n\t" /* -C2R6+C6R2     -C2r6+C6r2 */\
-        "ldc1 $f14, 48(%2)              \n\t" /* C3     C1      C3      C1 */\
-        "ldc1 $f16, " #rarg "           \n\t"                                \
-        "pmaddhw $f14, $f14, $f4        \n\t" /* C3R3+C1R1      C3r3+C1r1  */\
-        #rounder " $f8, $f8, $f16       \n\t"                                \
-        "mov.d $f12, $f8                \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "paddw $f8, $f8, $f10           \n\t" /* A0             a0         */\
-        "psubw $f12, $f12, $f10         \n\t" /* A3             a3         */\
-        "ldc1 $f10, 56(%2)              \n\t" /* C7     C5      C7      C5 */\
-        "ldc1 $f16, " #rarg "           \n\t"                                \
-        "pmaddhw $f10, $f10, $f6        \n\t" /* C7R7+C5R5      C7r7+C5r5  */\
-        #rounder " $f0, $f0, $f16       \n\t"                                \
-        "paddw $f2, $f2, $f0            \n\t" /* A1             a1         */\
-        "paddw $f0, $f0, $f0            \n\t"                                \
-        "ldc1 $f16, 64(%2)              \n\t"                                \
-        "psubw $f0, $f0, $f2            \n\t" /* A2             a2         */\
-        "pmaddhw $f4, $f4, $f16         \n\t" /* -C7R3+C3R1     -C7r3+C3r1 */\
-        "paddw $f14, $f14, $f10         \n\t" /* B0             b0         */\
-        "ldc1 $f10, 72(%2)              \n\t" /* -C5    -C1     -C5    -C1 */\
-        "pmaddhw $f10, $f10, $f6        \n\t" /* -C5R7-C1R5     -C5r7-C1r5 */\
-        "paddw $f14, $f14, $f8          \n\t" /* A0+B0          a0+b0      */\
-        "paddw $f8, $f8, $f8            \n\t" /* 2A0            2a0        */\
-        "li $10, " #shift "             \n\t"                                \
-        "psubw $f8, $f8, $f14           \n\t" /* A0-B0          a0-b0      */\
-        "mtc1 $10, $f18                 \n\t"                                \
-        "paddw $f10, $f10, $f4          \n\t" /* B1             b1         */\
-        "psraw $f14, $f14, $f18         \n\t"                                \
-        "psraw $f8, $f8, $f18           \n\t"                                \
-        "mov.d $f4, $f2                 \n\t" /* A1             a1         */\
-        "paddw $f2, $f2, $f10           \n\t" /* A1+B1          a1+b1      */\
-        "psubw $f4, $f4, $f10           \n\t" /* A1-B1          a1-b1      */\
-        "psraw $f2, $f2, $f18           \n\t"                                \
-        "psraw $f4, $f4, $f18           \n\t"                                \
-        "packsswh $f14, $f14, $f2       \n\t" /* A1+B1 a1+b1 A0+B0 a0+b0   */\
-        "packsswh $f4, $f4, $f8         \n\t" /* A0-B0 a0-b0 A1-B1 a1-b1   */\
-        "sdc1 $f14, " #dst "            \n\t"                                \
-        "ldc1 $f2, " #src1 "            \n\t" /* R3     R1      r3      r1 */\
-        "ldc1 $f8, 80(%2)               \n\t" /* -C1    C5      -C1     C5 */\
-        "sdc1 $f4, 24+" #dst "          \n\t"                                \
-        "pmaddhw $f8, $f8, $f2          \n\t" /* -C1R3+C5R1     -C1r3+C5r1 */\
-        "ldc1 $f16, 96(%2)              \n\t"                                \
-        "ldc1 $f14, 88(%2)              \n\t" /* C3     C7      C3      C7 */\
-        "pmaddhw $f2, $f2, $f16         \n\t" /* -C5R3+C7R1     -C5r3+C7r1 */\
-        "pmaddhw $f14, $f14, $f6        \n\t" /* C3R7+C7R5      C3r7+C7r5  */\
-        "ldc1 $f16, 104(%2)             \n\t"                                \
-        "mov.d $f4, $f0                 \n\t" /* A2             a2         */\
-        "pmaddhw $f6, $f6, $f16         \n\t" /* -C1R7+C3R5     -C1r7+C3r5 */\
-        "paddw $f8, $f8, $f14           \n\t" /* B2             b2         */\
-        "paddw $f4, $f4, $f8            \n\t" /* A2+B2          a2+b2      */\
-        "psubw $f0, $f0, $f8            \n\t" /* a2-B2          a2-b2      */\
-        "psraw $f4, $f4, $f18           \n\t"                                \
-        "psraw $f0, $f0, $f18           \n\t"                                \
-        "mov.d $f8, $f12                \n\t" /* A3             a3         */\
-        "paddw $f6, $f6, $f2            \n\t" /* B3             b3         */\
-        "paddw $f12, $f12, $f6          \n\t" /* A3+B3          a3+b3      */\
-        "psubw $f8, $f8, $f6            \n\t" /* a3-B3          a3-b3      */\
-        "psraw $f12, $f12, $f18         \n\t"                                \
-        "packsswh $f4, $f4, $f12        \n\t" /* A3+B3 a3+b3 A2+B2 a2+b2   */\
-        "sdc1 $f4, 8+" #dst "           \n\t"                                \
-        "psraw $f8, $f8, $f18           \n\t"                                \
-        "packsswh $f8, $f8, $f0         \n\t" /* A2-B2 a2-b2 A3-B3 a3-b3   */\
-        "sdc1 $f8, 16+" #dst "          \n\t"                                \
-
-        //IDCT(       src0,   src4,   src1,   src5,    dst,     rounder, shift)
-        DC_COND_IDCT(0(%0),  8(%0), 16(%0), 24(%0),  0(%1), paddw,8(%2), 11)
-        Z_COND_IDCT(32(%0), 40(%0), 48(%0), 56(%0), 32(%1), paddw,(%2), 11, 4f)
-        Z_COND_IDCT(64(%0), 72(%0), 80(%0), 88(%0), 64(%1), paddw,(%2), 11, 2f)
-        Z_COND_IDCT(96(%0),104(%0),112(%0),120(%0), 96(%1), paddw,(%2), 11, 1f)
-
-#undef  IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift)                             \
-        "ldc1 $f0, " #src0 "            \n\t" /* R4     R0      r4      r0 */\
-        "ldc1 $f2, " #src4 "            \n\t" /* R6     R2      r6      r2 */\
-        "ldc1 $f4, " #src1 "            \n\t" /* R3     R1      r3      r1 */\
-        "ldc1 $f6, " #src5 "            \n\t" /* R7     R5      r7      r5 */\
-        "ldc1 $f8, 16(%2)               \n\t" /* C4     C4      C4      C4 */\
-        "pmaddhw $f8, $f8, $f0          \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "ldc1 $f10, 24(%2)              \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddhw $f0, $f0, $f10         \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "ldc1 $f10, 32(%2)              \n\t" /* C6     C2      C6      C2 */\
-        "pmaddhw $f10, $f10, $f2        \n\t" /* C6R6+C2R2      C6r6+C2r2  */\
-        "ldc1 $f12, 40(%2)              \n\t" /* -C2    C6      -C2     C6 */\
-        "pmaddhw $f2, $f2, $f12         \n\t" /* -C2R6+C6R2     -C2r6+C6r2 */\
-        "mov.d $f12, $f8                \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "ldc1 $f14, 48(%2)              \n\t" /* C3     C1      C3      C1 */\
-        "pmaddhw $f14, $f14, $f4        \n\t" /* C3R3+C1R1      C3r3+C1r1  */\
-        "paddw $f8, $f8, $f10           \n\t" /* A0             a0         */\
-        "psubw $f12, $f12, $f10         \n\t" /* A3             a3         */\
-        "mov.d $f10, $f0                \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "paddw $f0, $f0, $f2            \n\t" /* A1             a1         */\
-        "psubw $f10, $f10, $f2          \n\t" /* A2             a2         */\
-        "ldc1 $f2, 56(%2)               \n\t" /* C7     C5      C7      C5 */\
-        "ldc1 $f16, 64(%2)              \n\t"                                \
-        "pmaddhw $f2, $f2, $f6          \n\t" /* C7R7+C5R5      C7r7+C5r5  */\
-        "pmaddhw $f4, $f4, $f16         \n\t" /* -C7R3+C3R1     -C7r3+C3r1 */\
-        "li $10, " #shift "             \n\t"                                \
-        "paddw $f14, $f14, $f2          \n\t" /* B0             b0         */\
-        "ldc1 $f2, 72(%2)               \n\t" /* -C5    -C1     -C5    -C1 */\
-        "mtc1 $10, $f18                 \n\t"                                \
-        "pmaddhw $f2, $f2, $f6          \n\t" /* -C5R7-C1R5     -C5r7-C1r5 */\
-        "paddw $f14, $f14, $f8          \n\t" /* A0+B0          a0+b0      */\
-        "paddw $f8, $f8, $f8            \n\t" /* 2A0            2a0        */\
-        "psubw $f8, $f8, $f14           \n\t" /* A0-B0          a0-b0      */\
-        "paddw $f2, $f2, $f4            \n\t" /* B1             b1         */\
-        "psraw $f14, $f14, $f18         \n\t"                                \
-        "psraw $f8, $f8, $f18           \n\t"                                \
-        "mov.d $f4, $f0                 \n\t" /* A1             a1         */\
-        "paddw $f0, $f0, $f2            \n\t" /* A1+B1          a1+b1      */\
-        "psubw $f4, $f4, $f2            \n\t" /* A1-B1          a1-b1      */\
-        "psraw $f0, $f0, $f18           \n\t"                                \
-        "psraw $f4, $f4, $f18           \n\t"                                \
-        "packsswh $f14, $f14, $f14      \n\t" /* A0+B0          a0+b0      */\
-        "swc1 $f14, " #dst "            \n\t"                                \
-        "packsswh $f0, $f0, $f0         \n\t" /* A1+B1          a1+b1      */\
-        "swc1 $f0, 16+" #dst "          \n\t"                                \
-        "packsswh $f4, $f4, $f4         \n\t" /* A1-B1          a1-b1      */\
-        "swc1 $f4, 96+" #dst "          \n\t"                                \
-        "packsswh $f8, $f8, $f8         \n\t" /* A0-B0          a0-b0      */\
-        "swc1 $f8, 112+" #dst "         \n\t"                                \
-        "ldc1 $f0, " #src1 "            \n\t" /* R3     R1      r3      r1 */\
-        "ldc1 $f8, 80(%2)               \n\t" /* -C1    C5      -C1     C5 */\
-        "pmaddhw $f8, $f8, $f0          \n\t" /* -C1R3+C5R1     -C1r3+C5r1 */\
-        "ldc1 $f16, 96(%2)              \n\t"                                \
-        "ldc1 $f14, 88(%2)              \n\t" /* C3     C7      C3      C7 */\
-        "pmaddhw $f0, $f0, $f16         \n\t" /* -C5R3+C7R1     -C5r3+C7r1 */\
-        "pmaddhw $f14, $f14, $f6        \n\t" /* C3R7+C7R5      C3r7+C7r5  */\
-        "ldc1 $f16, 104(%2)             \n\t"                                \
-        "mov.d $f4, $f10                \n\t" /* A2             a2         */\
-        "pmaddhw $f6, $f6, $f16         \n\t" /* -C1R7+C3R5     -C1r7+C3r5 */\
-        "paddw $f8, $f8, $f14           \n\t" /* B2             b2         */\
-        "paddw $f4, $f4, $f8            \n\t" /* A2+B2          a2+b2      */\
-        "psubw $f10, $f10, $f8          \n\t" /* a2-B2          a2-b2      */\
-        "psraw $f4, $f4, $f18           \n\t"                                \
-        "psraw $f10, $f10, $f18         \n\t"                                \
-        "mov.d $f8, $f12                \n\t" /* A3             a3         */\
-        "paddw $f6, $f6, $f0            \n\t" /* B3             b3         */\
-        "paddw $f12, $f12, $f6          \n\t" /* A3+B3          a3+b3      */\
-        "psubw $f8, $f8, $f6            \n\t" /* a3-B3          a3-b3      */\
-        "psraw $f12, $f12, $f18         \n\t"                                \
-        "psraw $f8, $f8, $f18           \n\t"                                \
-        "packsswh $f4, $f4, $f4         \n\t" /* A2+B2          a2+b2      */\
-        "packsswh $f12, $f12, $f12      \n\t" /* A3+B3          a3+b3      */\
-        "swc1 $f4, 32+" #dst "          \n\t"                                \
-        "packsswh $f8, $f8, $f8         \n\t" /* A3-B3          a3-b3      */\
-        "packsswh $f10, $f10, $f10      \n\t" /* A2-B2          a2-b2      */\
-        "swc1 $f12, 48+" #dst "         \n\t"                                \
-        "swc1 $f8, 64+" #dst "          \n\t"                                \
-        "swc1 $f10, 80+" #dst "         \n\t"
-
-        //IDCT(  src0,   src4,   src1,    src5,    dst, shift)
-        IDCT(    (%1), 64(%1), 32(%1),  96(%1),  0(%0),    20)
-        IDCT(   8(%1), 72(%1), 40(%1), 104(%1),  4(%0),    20)
-        IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0),    20)
-        IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0),    20)
-        "b 9f                           \n\t"
-
-        "# .p2align 4                   \n\t"
-        "4:                             \n\t"
-        Z_COND_IDCT(64(%0), 72(%0), 80(%0), 88(%0), 64(%1),paddw,(%2), 11, 6f)
-        Z_COND_IDCT(96(%0),104(%0),112(%0),120(%0), 96(%1),paddw,(%2), 11, 5f)
-
-#undef  IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift)                             \
-        "ldc1 $f0, " #src0 "            \n\t" /* R4     R0      r4      r0 */\
-        "ldc1 $f2, " #src4 "            \n\t" /* R6     R2      r6      r2 */\
-        "ldc1 $f6, " #src5 "            \n\t" /* R7     R5      r7      r5 */\
-        "ldc1 $f8, 16(%2)               \n\t" /* C4     C4      C4      C4 */\
-        "pmaddhw $f8, $f8, $f0          \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "ldc1 $f10, 24(%2)              \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddhw $f0, $f0, $f10         \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "ldc1 $f10, 32(%2)              \n\t" /* C6     C2      C6      C2 */\
-        "pmaddhw $f10, $f10, $f2        \n\t" /* C6R6+C2R2      C6r6+C2r2  */\
-        "ldc1 $f12, 40(%2)              \n\t" /* -C2    C6      -C2     C6 */\
-        "pmaddhw $f2, $f2, $f12         \n\t" /* -C2R6+C6R2     -C2r6+C6r2 */\
-        "mov.d $f12, $f8                \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "paddw $f8, $f8, $f10           \n\t" /* A0             a0         */\
-        "psubw $f12, $f12, $f10         \n\t" /* A3             a3         */\
-        "mov.d $f10, $f0                \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "paddw $f0, $f0, $f2            \n\t" /* A1             a1         */\
-        "psubw $f10, $f10, $f2          \n\t" /* A2             a2         */\
-        "ldc1 $f2, 56(%2)               \n\t" /* C7     C5      C7      C5 */\
-        "li $10, " #shift "             \n\t"                                \
-        "pmaddhw $f2, $f2, $f6          \n\t" /* C7R7+C5R5      C7r7+C5r5  */\
-        "ldc1 $f14, 72(%2)              \n\t" /* -C5    -C1     -C5    -C1 */\
-        "mtc1 $10, $f18                 \n\t"                                \
-        "pmaddhw $f14, $f14, $f6        \n\t" /* -C5R7-C1R5     -C5r7-C1r5 */\
-        "paddw $f2, $f2, $f8            \n\t" /* A0+B0          a0+b0      */\
-        "paddw $f8, $f8, $f8            \n\t" /* 2A0            2a0        */\
-        "psubw $f8, $f8, $f2            \n\t" /* A0-B0          a0-b0      */\
-        "psraw $f2, $f2, $f18           \n\t"                                \
-        "psraw $f8, $f8, $f18           \n\t"                                \
-        "mov.d $f4, $f0                 \n\t" /* A1             a1         */\
-        "paddw $f0, $f0, $f14           \n\t" /* A1+B1          a1+b1      */\
-        "psubw $f4, $f4, $f14           \n\t" /* A1-B1          a1-b1      */\
-        "psraw $f0, $f0, $f18           \n\t"                                \
-        "psraw $f4, $f4, $f18           \n\t"                                \
-        "packsswh $f2, $f2, $f2         \n\t" /* A0+B0          a0+b0      */\
-        "swc1 $f2, " #dst "             \n\t"                                \
-        "packsswh $f0, $f0, $f0         \n\t" /* A1+B1          a1+b1      */\
-        "swc1 $f0, 16+" #dst "          \n\t"                                \
-        "packsswh $f4, $f4, $f4         \n\t" /* A1-B1          a1-b1      */\
-        "swc1 $f4, 96+" #dst "          \n\t"                                \
-        "packsswh $f8, $f8, $f8         \n\t" /* A0-B0          a0-b0      */\
-        "swc1 $f8, 112+" #dst "         \n\t"                                \
-        "ldc1 $f2, 88(%2)               \n\t" /* C3     C7      C3      C7 */\
-        "ldc1 $f16, 104(%2)             \n\t"                                \
-        "pmaddhw $f2, $f2, $f6          \n\t" /* C3R7+C7R5      C3r7+C7r5  */\
-        "mov.d $f4, $f10                \n\t" /* A2             a2         */\
-        "pmaddhw $f6, $f6, $f16         \n\t" /* -C1R7+C3R5     -C1r7+C3r5 */\
-        "paddw $f4, $f4, $f2            \n\t" /* A2+B2          a2+b2      */\
-        "psubw $f10, $f10, $f2          \n\t" /* a2-B2          a2-b2      */\
-        "psraw $f4, $f4, $f18           \n\t"                                \
-        "psraw $f10, $f10, $f18         \n\t"                                \
-        "mov.d $f2, $f12                \n\t" /* A3             a3         */\
-        "paddw $f12, $f12, $f6          \n\t" /* A3+B3          a3+b3      */\
-        "psubw $f2, $f2, $f6            \n\t" /* a3-B3          a3-b3      */\
-        "psraw $f12, $f12, $f18         \n\t"                                \
-        "psraw $f2, $f2, $f18           \n\t"                                \
-        "packsswh $f4, $f4, $f4         \n\t" /* A2+B2          a2+b2      */\
-        "packsswh $f12, $f12, $f12      \n\t" /* A3+B3          a3+b3      */\
-        "swc1 $f4, 32+" #dst "          \n\t"                                \
-        "packsswh $f2, $f2, $f2         \n\t" /* A3-B3          a3-b3      */\
-        "packsswh $f10, $f10, $f10      \n\t" /* A2-B2          a2-b2      */\
-        "swc1 $f12, 48+" #dst "         \n\t"                                \
-        "swc1 $f2, 64+" #dst "          \n\t"                                \
-        "swc1 $f10, 80+" #dst "         \n\t"
-
-        //IDCT(  src0,   src4,   src1,    src5,    dst, shift)
-        IDCT(    (%1), 64(%1), 32(%1),  96(%1),  0(%0),    20)
-        IDCT(   8(%1), 72(%1), 40(%1), 104(%1),  4(%0),    20)
-        IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0),    20)
-        IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0),    20)
-        "b 9f                           \n\t"
-
-        "# .p2align 4                   \n\t"
-        "6:                             \n\t"
-        Z_COND_IDCT(96(%0),104(%0),112(%0),120(%0), 96(%1),paddw,(%2), 11, 7f)
-
-#undef  IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift)                             \
-        "ldc1 $f0, " #src0 "            \n\t" /* R4     R0      r4      r0 */\
-        "ldc1 $f6, " #src5 "            \n\t" /* R7     R5      r7      r5 */\
-        "ldc1 $f8, 16(%2)               \n\t" /* C4     C4      C4      C4 */\
-        "pmaddhw $f8, $f8, $f0          \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "ldc1 $f10, 24(%2)              \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddhw $f0, $f0, $f10         \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "mov.d $f12, $f8                \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "mov.d $f10, $f0                \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "ldc1 $f2, 56(%2)               \n\t" /* C7     C5      C7      C5 */\
-        "pmaddhw $f2, $f2, $f6          \n\t" /* C7R7+C5R5      C7r7+C5r5  */\
-        "ldc1 $f14, 72(%2)              \n\t" /* -C5    -C1     -C5    -C1 */\
-        "li $10, " #shift "             \n\t"                                \
-        "pmaddhw $f14, $f14, $f6        \n\t" /* -C5R7-C1R5     -C5r7-C1r5 */\
-        "paddw $f2, $f2, $f8            \n\t" /* A0+B0          a0+b0      */\
-        "mtc1 $10, $f18                 \n\t"                                \
-        "paddw $f8, $f8, $f8            \n\t" /* 2A0            2a0        */\
-        "psubw $f8, $f8, $f2            \n\t" /* A0-B0          a0-b0      */\
-        "psraw $f2, $f2, $f18           \n\t"                                \
-        "psraw $f8, $f8, $f18           \n\t"                                \
-        "mov.d $f4, $f0                 \n\t" /* A1             a1         */\
-        "paddw $f0, $f0, $f14           \n\t" /* A1+B1          a1+b1      */\
-        "psubw $f4, $f4, $f14           \n\t" /* A1-B1          a1-b1      */\
-        "psraw $f0, $f0, $f18           \n\t"                                \
-        "psraw $f4, $f4, $f18           \n\t"                                \
-        "packsswh $f2, $f2, $f2         \n\t" /* A0+B0          a0+b0      */\
-        "swc1 $f2, " #dst "             \n\t"                                \
-        "packsswh $f0, $f0, $f0         \n\t" /* A1+B1          a1+b1      */\
-        "swc1 $f0, 16+" #dst "          \n\t"                                \
-        "packsswh $f4, $f4, $f4         \n\t" /* A1-B1          a1-b1      */\
-        "swc1 $f4, 96+" #dst "          \n\t"                                \
-        "packsswh $f8, $f8, $f8         \n\t" /* A0-B0          a0-b0      */\
-        "swc1 $f8, 112+" #dst "         \n\t"                                \
-        "ldc1 $f2, 88(%2)               \n\t" /* C3     C7      C3      C7 */\
-        "ldc1 $f16, 104(%2)             \n\t"                                \
-        "pmaddhw $f2, $f2, $f6          \n\t" /* C3R7+C7R5      C3r7+C7r5  */\
-        "mov.d $f4, $f10                \n\t" /* A2             a2         */\
-        "pmaddhw $f6, $f6, $f16         \n\t" /* -C1R7+C3R5     -C1r7+C3r5 */\
-        "paddw $f4, $f4, $f2            \n\t" /* A2+B2          a2+b2      */\
-        "psubw $f10, $f10, $f2          \n\t" /* a2-B2          a2-b2      */\
-        "psraw $f4, $f4, $f18           \n\t"                                \
-        "psraw $f10, $f10, $f18         \n\t"                                \
-        "mov.d $f2, $f12                \n\t" /* A3             a3         */\
-        "paddw $f12, $f12, $f6          \n\t" /* A3+B3          a3+b3      */\
-        "psubw $f2, $f2, $f6            \n\t" /* a3-B3          a3-b3      */\
-        "psraw $f12, $f12, $f18         \n\t"                                \
-        "psraw $f2, $f2, $f18           \n\t"                                \
-        "packsswh $f4, $f4, $f4         \n\t" /* A2+B2          a2+b2      */\
-        "packsswh $f12, $f12, $f12      \n\t" /* A3+B3          a3+b3      */\
-        "swc1 $f4, 32+" #dst "          \n\t"                                \
-        "packsswh $f2, $f2, $f2         \n\t" /* A3-B3          a3-b3      */\
-        "packsswh $f10, $f10, $f10      \n\t" /* A2-B2          a2-b2      */\
-        "swc1 $f12, 48+" #dst "         \n\t"                                \
-        "swc1 $f2, 64+" #dst "          \n\t"                                \
-        "swc1 $f10, 80+" #dst "         \n\t"
-
-        //IDCT(  src0,   src4,   src1,    src5,    dst, shift)
-        IDCT(    (%1), 64(%1), 32(%1),  96(%1),  0(%0),    20)
-        IDCT(   8(%1), 72(%1), 40(%1), 104(%1),  4(%0),    20)
-        IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0),    20)
-        IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0),    20)
-        "b 9f                           \n\t"
-
-        "# .p2align 4                   \n\t"
-        "2:                             \n\t"
-        Z_COND_IDCT(96(%0),104(%0),112(%0),120(%0), 96(%1),paddw,(%2), 11, 3f)
-
-#undef  IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift)                             \
-        "ldc1 $f0, " #src0 "            \n\t" /* R4     R0      r4      r0 */\
-        "ldc1 $f4, " #src1 "            \n\t" /* R3     R1      r3      r1 */\
-        "ldc1 $f6, " #src5 "            \n\t" /* R7     R5      r7      r5 */\
-        "ldc1 $f8, 16(%2)               \n\t" /* C4     C4      C4      C4 */\
-        "pmaddhw $f8, $f8, $f0          \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "ldc1 $f10, 24(%2)              \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddhw $f0, $f0, $f10         \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "mov.d $f12, $f8                \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "ldc1 $f14, 48(%2)              \n\t" /* C3     C1      C3      C1 */\
-        "pmaddhw $f14, $f14, $f4        \n\t" /* C3R3+C1R1      C3r3+C1r1  */\
-        "mov.d $f10, $f0                \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "ldc1 $f2, 56(%2)               \n\t" /* C7     C5      C7      C5 */\
-        "pmaddhw $f2, $f2, $f6          \n\t" /* C7R7+C5R5      C7r7+C5r5  */\
-        "ldc1 $f16, 64(%2)              \n\t"                                \
-        "pmaddhw $f4, $f4, $f16         \n\t" /* -C7R3+C3R1     -C7r3+C3r1 */\
-        "paddw $f14, $f14, $f2          \n\t" /* B0             b0         */\
-        "ldc1 $f2, 72(%2)               \n\t" /* -C5    -C1     -C5    -C1 */\
-        "li $10, " #shift "             \n\t"                                \
-        "pmaddhw $f2, $f2, $f6          \n\t" /* -C5R7-C1R5     -C5r7-C1r5 */\
-        "paddw $f14, $f14, $f8          \n\t" /* A0+B0          a0+b0      */\
-        "mtc1 $10, $f18                 \n\t"                                \
-        "paddw $f8, $f8, $f8            \n\t" /* 2A0            2a0        */\
-        "psubw $f8, $f8, $f14           \n\t" /* A0-B0          a0-b0      */\
-        "paddw $f2, $f2, $f4            \n\t" /* B1             b1         */\
-        "psraw $f14, $f14, $f18         \n\t"                                \
-        "psraw $f8, $f8, $f18           \n\t"                                \
-        "mov.d $f4, $f0                 \n\t" /* A1             a1         */\
-        "paddw $f0, $f0, $f2            \n\t" /* A1+B1          a1+b1      */\
-        "psubw $f4, $f4, $f2            \n\t" /* A1-B1          a1-b1      */\
-        "psraw $f0, $f0, $f18           \n\t"                                \
-        "psraw $f4, $f4, $f18           \n\t"                                \
-        "packsswh $f14, $f14, $f14      \n\t" /* A0+B0          a0+b0      */\
-        "swc1 $f14, " #dst "            \n\t"                                \
-        "packsswh $f0, $f0, $f0         \n\t" /* A1+B1          a1+b1      */\
-        "swc1 $f0, 16+" #dst "          \n\t"                                \
-        "packsswh $f4, $f4, $f4         \n\t" /* A1-B1          a1-b1      */\
-        "swc1 $f4, 96+" #dst "          \n\t"                                \
-        "packsswh $f8, $f8, $f8         \n\t" /* A0-B0          a0-b0      */\
-        "swc1 $f8, 112+" #dst "         \n\t"                                \
-        "ldc1 $f0, " #src1 "            \n\t" /* R3     R1      r3      r1 */\
-        "ldc1 $f8, 80(%2)               \n\t" /* -C1    C5      -C1     C5 */\
-        "pmaddhw $f8, $f8, $f0          \n\t" /* -C1R3+C5R1     -C1r3+C5r1 */\
-        "ldc1 $f14, 88(%2)              \n\t" /* C3     C7      C3      C7 */\
-        "ldc1 $f16, 96(%2)              \n\t"                                \
-        "pmaddhw $f0, $f0, $f16         \n\t" /* -C5R3+C7R1     -C5r3+C7r1 */\
-        "pmaddhw $f14, $f14, $f6        \n\t" /* C3R7+C7R5      C3r7+C7r5  */\
-        "mov.d $f4, $f10                \n\t" /* A2             a2         */\
-        "ldc1 $f16, 104(%2)             \n\t"                                \
-        "pmaddhw $f6, $f6, $f16         \n\t" /* -C1R7+C3R5     -C1r7+C3r5 */\
-        "paddw $f8, $f8, $f14           \n\t" /* B2             b2         */\
-        "paddw $f4, $f4, $f8            \n\t" /* A2+B2          a2+b2      */\
-        "psubw $f10, $f10, $f8          \n\t" /* a2-B2          a2-b2      */\
-        "psraw $f4, $f4, $f18           \n\t"                                \
-        "psraw $f10, $f10, $f18         \n\t"                                \
-        "mov.d $f8, $f12                \n\t" /* A3             a3         */\
-        "paddw $f6, $f6, $f0            \n\t" /* B3             b3         */\
-        "paddw $f12, $f12, $f6          \n\t" /* A3+B3          a3+b3      */\
-        "psubw $f8, $f8, $f6            \n\t" /* a3-B3          a3-b3      */\
-        "psraw $f12, $f12, $f18         \n\t"                                \
-        "psraw $f8, $f8, $f18           \n\t"                                \
-        "packsswh $f4, $f4, $f4         \n\t" /* A2+B2          a2+b2      */\
-        "packsswh $f12, $f12, $f12      \n\t" /* A3+B3          a3+b3      */\
-        "swc1 $f4, 32+" #dst "          \n\t"                                \
-        "packsswh $f8, $f8, $f8         \n\t" /* A3-B3          a3-b3      */\
-        "packsswh $f10, $f10, $f10      \n\t" /* A2-B2          a2-b2      */\
-        "swc1 $f12, 48+" #dst "         \n\t"                                \
-        "swc1 $f8, 64+" #dst "          \n\t"                                \
-        "swc1 $f10, 80+" #dst "         \n\t"
-
-        //IDCT(  src0,   src4,   src1,    src5,    dst, shift)
-        IDCT(    (%1), 64(%1), 32(%1),  96(%1),  0(%0),    20)
-        IDCT(   8(%1), 72(%1), 40(%1), 104(%1),  4(%0),    20)
-        IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0),    20)
-        IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0),    20)
-        "b 9f                           \n\t"
-
-        "# .p2align 4                   \n\t"
-        "3:                             \n\t"
-
-#undef  IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift)                             \
-        "ldc1 $f0, " #src0 "            \n\t" /* R4     R0      r4      r0 */\
-        "ldc1 $f4, " #src1 "            \n\t" /* R3     R1      r3      r1 */\
-        "ldc1 $f8, 16(%2)               \n\t" /* C4     C4      C4      C4 */\
-        "pmaddhw $f8, $f8, $f0          \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "ldc1 $f10, 24(%2)              \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddhw $f0, $f0, $f10         \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "mov.d $f12, $f8                \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "ldc1 $f14, 48(%2)              \n\t" /* C3     C1      C3      C1 */\
-        "pmaddhw $f14, $f14, $f4        \n\t" /* C3R3+C1R1      C3r3+C1r1  */\
-        "mov.d $f10, $f0                \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "ldc1 $f6, 64(%2)               \n\t"                                \
-        "pmaddhw $f6, $f6, $f4          \n\t" /* -C7R3+C3R1     -C7r3+C3r1 */\
-        "li $10, " #shift "             \n\t"                                \
-        "paddw $f14, $f14, $f8          \n\t" /* A0+B0          a0+b0      */\
-        "mtc1 $10, $f18                 \n\t"                                \
-        "paddw $f8, $f8, $f8            \n\t" /* 2A0            2a0        */\
-        "psubw $f8, $f8, $f14           \n\t" /* A0-B0          a0-b0      */\
-        "psraw $f14, $f14, $f18         \n\t"                                \
-        "psraw $f8, $f8, $f18           \n\t"                                \
-        "mov.d $f2, $f0                 \n\t" /* A1             a1         */\
-        "paddw $f0, $f0, $f6            \n\t" /* A1+B1          a1+b1      */\
-        "psubw $f2, $f2, $f6            \n\t" /* A1-B1          a1-b1      */\
-        "psraw $f0, $f0, $f18           \n\t"                                \
-        "psraw $f2, $f2, $f18           \n\t"                                \
-        "packsswh $f14, $f14, $f14      \n\t" /* A0+B0  a0+b0              */\
-        "swc1 $f14, " #dst "            \n\t"                                \
-        "packsswh $f0, $f0, $f0         \n\t" /* A1+B1  a1+b1              */\
-        "swc1 $f0, 16+" #dst "          \n\t"                                \
-        "packsswh $f2, $f2, $f2         \n\t" /* A1-B1  a1-b1              */\
-        "swc1 $f2, 96+" #dst "          \n\t"                                \
-        "packsswh $f8, $f8, $f8         \n\t" /* A0-B0  a0-b0              */\
-        "swc1 $f8, 112+" #dst "         \n\t"                                \
-        "ldc1 $f8, 80(%2)               \n\t" /* -C1    C5      -C1     C5 */\
-        "ldc1 $f16, 96(%2)              \n\t"                                \
-        "pmaddhw $f8, $f8, $f4          \n\t" /* -C1R3+C5R1     -C1r3+C5r1 */\
-        "pmaddhw $f4, $f4, $f16         \n\t" /* -C5R3+C7R1     -C5r3+C7r1 */\
-        "mov.d $f2, $f10                \n\t" /* A2             a2         */\
-        "paddw $f2, $f2, $f8            \n\t" /* A2+B2          a2+b2      */\
-        "psubw $f10, $f10, $f8          \n\t" /* a2-B2          a2-b2      */\
-        "psraw $f2, $f2, $f18           \n\t"                                \
-        "psraw $f10, $f10, $f18         \n\t"                                \
-        "mov.d $f8, $f12                \n\t" /* A3             a3         */\
-        "paddw $f12, $f12, $f4          \n\t" /* A3+B3          a3+b3      */\
-        "psubw $f8, $f8, $f4            \n\t" /* a3-B3          a3-b3      */\
-        "psraw $f12, $f12, $f18         \n\t"                                \
-        "psraw $f8, $f8, $f18           \n\t"                                \
-        "packsswh $f2, $f2, $f2         \n\t" /* A2+B2  a2+b2              */\
-        "packsswh $f12, $f12, $f12      \n\t" /* A3+B3  a3+b3              */\
-        "swc1 $f2, 32+" #dst "          \n\t"                                \
-        "packsswh $f8, $f8, $f8         \n\t" /* A3-B3  a3-b3              */\
-        "packsswh $f10, $f10, $f10      \n\t" /* A2-B2  a2-b2              */\
-        "swc1 $f12, 48+" #dst "         \n\t"                                \
-        "swc1 $f8, 64+" #dst "          \n\t"                                \
-        "swc1 $f10, 80+" #dst "         \n\t"
-
-        //IDCT(  src0,   src4,   src1,    src5,    dst, shift)
-        IDCT(    (%1), 64(%1), 32(%1),  96(%1),  0(%0),    20)
-        IDCT(   8(%1), 72(%1), 40(%1), 104(%1),  4(%0),    20)
-        IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0),    20)
-        IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0),    20)
-        "b 9f                           \n\t"
-
-        "# .p2align 4                   \n\t"
-        "5:                             \n\t"
-
-#undef  IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift)                             \
-        "ldc1 $f0, " #src0 "            \n\t" /* R4     R0      r4      r0 */\
-        "ldc1 $f2, " #src4 "            \n\t" /* R6     R2      r6      r2 */\
-        "ldc1 $f8, 16(%2)               \n\t" /* C4     C4      C4      C4 */\
-        "pmaddhw $f8, $f8, $f0          \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "ldc1 $f10, 24(%2)              \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddhw $f0, $f0, $f10         \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "ldc1 $f10, 32(%2)              \n\t" /* C6     C2      C6      C2 */\
-        "pmaddhw $f10, $f10, $f2        \n\t" /* C6R6+C2R2      C6r6+C2r2  */\
-        "ldc1 $f12, 40(%2)              \n\t" /* -C2    C6      -C2     C6 */\
-        "pmaddhw $f2, $f2, $f12         \n\t" /* -C2R6+C6R2     -C2r6+C6r2 */\
-        "mov.d $f12, $f8                \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "paddw $f8, $f8, $f10           \n\t" /* A0             a0         */\
-        "psubw $f12, $f12, $f10         \n\t" /* A3             a3         */\
-        "mov.d $f10, $f0                \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "paddw $f0, $f0, $f2            \n\t" /* A1             a1         */\
-        "psubw $f10, $f10, $f2          \n\t" /* A2             a2         */\
-        "ldc1 $f4, 8+" #src0 "          \n\t" /* R4     R0      r4      r0 */\
-        "ldc1 $f6, 8+" #src4 "          \n\t" /* R6     R2      r6      r2 */\
-        "ldc1 $f2, 16(%2)               \n\t" /* C4     C4      C4      C4 */\
-        "pmaddhw $f2, $f2, $f4          \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "ldc1 $f14, 24(%2)              \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddhw $f4, $f4, $f14         \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "ldc1 $f14, 32(%2)              \n\t" /* C6     C2      C6      C2 */\
-        "ldc1 $f16, 40(%2)              \n\t"                                \
-        "pmaddhw $f14, $f14, $f6        \n\t" /* C6R6+C2R2      C6r6+C2r2  */\
-        "pmaddhw $f6, $f6, $f16         \n\t" /* -C2R6+C6R2     -C2r6+C6r2 */\
-        "paddw $f14, $f14, $f2          \n\t" /* A0             a0         */\
-        "paddw $f2, $f2, $f2            \n\t" /* 2C0            2c0        */\
-        "psubw $f2, $f2, $f14           \n\t" /* A3             a3         */\
-        "li $10, " #shift "             \n\t"                                \
-        "paddw $f6, $f6, $f4            \n\t" /* A1             a1         */\
-        "mtc1 $10, $f18                 \n\t"                                \
-        "paddw $f4, $f4, $f4            \n\t" /* 2C1            2c1        */\
-        "psubw $f4, $f4, $f6            \n\t" /* A2             a2         */\
-        "psraw $f8, $f8, $f18           \n\t"                                \
-        "psraw $f14, $f14, $f18         \n\t"                                \
-        "psraw $f6, $f6, $f18           \n\t"                                \
-        "packsswh $f8, $f8, $f14        \n\t" /* A0             a0         */\
-        "sdc1 $f8, " #dst "             \n\t"                                \
-        "psraw $f0, $f0, $f18           \n\t"                                \
-        "packsswh $f0, $f0, $f6         \n\t" /* A1             a1         */\
-        "sdc1 $f0, 16+" #dst "          \n\t"                                \
-        "sdc1 $f0, 96+" #dst "          \n\t"                                \
-        "sdc1 $f8, 112+" #dst "         \n\t"                                \
-        "psraw $f10, $f10, $f18         \n\t"                                \
-        "psraw $f12, $f12, $f18         \n\t"                                \
-        "psraw $f4, $f4, $f18           \n\t"                                \
-        "packsswh $f10, $f10, $f4       \n\t" /* A2-B2          a2-b2      */\
-        "sdc1 $f10, 32+" #dst "         \n\t"                                \
-        "psraw $f2, $f2, $f18           \n\t"                                \
-        "packsswh $f12, $f12, $f2       \n\t" /* A3+B3          a3+b3      */\
-        "sdc1 $f12, 48+" #dst "         \n\t"                                \
-        "sdc1 $f12, 64+" #dst "         \n\t"                                \
-        "sdc1 $f10, 80+" #dst "         \n\t"
-
-        //IDCT(  src0,   src4,   src1,    src5,    dst, shift)
-        IDCT(   0(%1), 64(%1), 32(%1),  96(%1),  0(%0),    20)
-        IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0),    20)
-        "b 9f                           \n\t"
-
-        "# .p2align 4                   \n\t"
-        "1:                             \n\t"
-
-#undef  IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift)                             \
-        "ldc1 $f0, " #src0 "            \n\t" /* R4     R0      r4      r0 */\
-        "ldc1 $f2, " #src4 "            \n\t" /* R6     R2      r6      r2 */\
-        "ldc1 $f4, " #src1 "            \n\t" /* R3     R1      r3      r1 */\
-        "ldc1 $f8, 16(%2)               \n\t" /* C4     C4      C4      C4 */\
-        "li $10, " #shift "             \n\t"                                \
-        "pmaddhw $f8, $f8, $f0          \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "ldc1 $f10, 24(%2)              \n\t" /* -C4    C4      -C4     C4 */\
-        "mtc1 $10, $f18                 \n\t"                                \
-        "pmaddhw $f0, $f0, $f10         \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "ldc1 $f10, 32(%2)              \n\t" /* C6     C2      C6      C2 */\
-        "pmaddhw $f10, $f10, $f2        \n\t" /* C6R6+C2R2      C6r6+C2r2  */\
-        "ldc1 $f12, 40(%2)              \n\t" /* -C2    C6      -C2     C6 */\
-        "pmaddhw $f2, $f2, $f12         \n\t" /* -C2R6+C6R2     -C2r6+C6r2 */\
-        "mov.d $f12, $f8                \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "ldc1 $f14, 48(%2)              \n\t" /* C3     C1      C3      C1 */\
-        "pmaddhw $f14, $f14, $f4        \n\t" /* C3R3+C1R1      C3r3+C1r1  */\
-        "paddw $f8, $f8, $f10           \n\t" /* A0             a0         */\
-        "psubw $f12, $f12, $f10         \n\t" /* A3             a3         */\
-        "mov.d $f10, $f0                \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "paddw $f0, $f0, $f2            \n\t" /* A1             a1         */\
-        "psubw $f10, $f10, $f2          \n\t" /* A2             a2         */\
-        "ldc1 $f2, 64(%2)               \n\t"                                \
-        "pmaddhw $f2, $f2, $f4          \n\t" /* -C7R3+C3R1     -C7r3+C3r1 */\
-        "paddw $f14, $f14, $f8          \n\t" /* A0+B0          a0+b0      */\
-        "paddw $f8, $f8, $f8            \n\t" /* 2A0            2a0        */\
-        "psubw $f8, $f8, $f14           \n\t" /* A0-B0          a0-b0      */\
-        "psraw $f14, $f14, $f18         \n\t"                                \
-        "psraw $f8, $f8, $f18           \n\t"                                \
-        "mov.d $f6, $f0                 \n\t" /* A1             a1         */\
-        "paddw $f0, $f0, $f2            \n\t" /* A1+B1          a1+b1      */\
-        "psubw $f6, $f6, $f2            \n\t" /* A1-B1          a1-b1      */\
-        "psraw $f0, $f0, $f18           \n\t"                                \
-        "psraw $f6, $f6, $f18           \n\t"                                \
-        "packsswh $f14, $f14, $f14      \n\t" /* A0+B0  a0+b0              */\
-        "swc1 $f14, " #dst "            \n\t"                                \
-        "packsswh $f0, $f0, $f0         \n\t" /* A1+B1  a1+b1              */\
-        "swc1 $f0, 16+" #dst "          \n\t"                                \
-        "packsswh $f6, $f6, $f6         \n\t" /* A1-B1  a1-b1              */\
-        "swc1 $f6, 96+" #dst "          \n\t"                                \
-        "packsswh $f8, $f8, $f8         \n\t" /* A0-B0  a0-b0              */\
-        "swc1 $f8, 112+" #dst "         \n\t"                                \
-        "ldc1 $f8, 80(%2)               \n\t" /* -C1    C5      -C1     C5 */\
-        "ldc1 $f16, 96(%2)              \n\t"                                \
-        "pmaddhw $f8, $f8, $f4          \n\t" /* -C1R3+C5R1     -C1r3+C5r1 */\
-        "pmaddhw $f4, $f4, $f16         \n\t" /* -C5R3+C7R1     -C5r3+C7r1 */\
-        "mov.d $f6, $f10                \n\t" /* A2             a2         */\
-        "paddw $f6, $f6, $f8            \n\t" /* A2+B2          a2+b2      */\
-        "psubw $f10, $f10, $f8          \n\t" /* a2-B2          a2-b2      */\
-        "psraw $f6, $f6, $f18           \n\t"                                \
-        "psraw $f10, $f10, $f18         \n\t"                                \
-        "mov.d $f8, $f12                \n\t" /* A3             a3         */\
-        "paddw $f12, $f12, $f4          \n\t" /* A3+B3          a3+b3      */\
-        "psubw $f8, $f8, $f4            \n\t" /* a3-B3          a3-b3      */\
-        "psraw $f12, $f12, $f18         \n\t"                                \
-        "packsswh $f6, $f6, $f6         \n\t" /* A2+B2          a2+b2      */\
-        "swc1 $f6, 32+" #dst "          \n\t"                                \
-        "psraw $f8, $f8, $f18           \n\t"                                \
-        "packsswh $f12, $f12, $f12      \n\t" /* A3+B3          a3+b3      */\
-        "swc1 $f12, 48+" #dst "         \n\t"                                \
-        "packsswh $f8, $f8, $f8         \n\t" /* A3-B3          a3-b3      */\
-        "packsswh $f10, $f10, $f10      \n\t" /* A2-B2          a2-b2      */\
-        "swc1 $f8, 64+" #dst "          \n\t"                                \
-        "swc1 $f10, 80+" #dst "         \n\t"
-
-        //IDCT(  src0,   src4,   src1,    src5,    dst, shift)
-        IDCT(    (%1), 64(%1), 32(%1),  96(%1),  0(%0),    20)
-        IDCT(   8(%1), 72(%1), 40(%1), 104(%1),  4(%0),    20)
-        IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0),    20)
-        IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0),    20)
-        "b 9f                           \n\t"
-
-        "# .p2align 4                   \n\t"
-        "7:                             \n\t"
-
-#undef  IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift)                             \
-        "ldc1 $f0, " #src0 "            \n\t" /* R4     R0      r4      r0 */\
-        "ldc1 $f8, 16(%2)               \n\t" /* C4     C4      C4      C4 */\
-        "li $10, " #shift "             \n\t"                                \
-        "pmaddhw $f8, $f8, $f0          \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "mtc1 $10, $f18                 \n\t"                                \
-        "ldc1 $f10, 24(%2)              \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddhw $f0, $f0, $f10         \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "psraw $f8, $f8, $f18           \n\t"                                \
-        "psraw $f0, $f0, $f18           \n\t"                                \
-        "ldc1 $f4, 8+" #src0 "          \n\t" /* R4     R0      r4      r0 */\
-        "ldc1 $f2, 16(%2)               \n\t" /* C4     C4      C4      C4 */\
-        "pmaddhw $f2, $f2, $f4          \n\t" /* C4R4+C4R0      C4r4+C4r0  */\
-        "ldc1 $f14, 24(%2)              \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddhw $f4, $f4, $f14         \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "ldc1 $f14, 32(%2)              \n\t" /* C6     C2      C6      C2 */\
-        "psraw $f2, $f2, $f18           \n\t"                                \
-        "packsswh $f8, $f8, $f2         \n\t" /* A0             a0         */\
-        "sdc1 $f8, " #dst "             \n\t"                                \
-        "psraw $f4, $f4, $f18           \n\t"                                \
-        "packsswh $f0, $f0, $f4         \n\t" /* A1             a1         */\
-        "sdc1 $f0, 16+" #dst "          \n\t"                                \
-        "sdc1 $f0, 96+" #dst "          \n\t"                                \
-        "sdc1 $f8, 112+" #dst "         \n\t"                                \
-        "sdc1 $f0, 32+" #dst "          \n\t"                                \
-        "sdc1 $f8, 48+" #dst "          \n\t"                                \
-        "sdc1 $f8, 64+" #dst "          \n\t"                                \
-        "sdc1 $f0, 80+" #dst "          \n\t"
-
-        //IDCT(  src0,   src4,   src1,    src5,    dst, shift)
-        IDCT(   0(%1), 64(%1), 32(%1),  96(%1),  0(%0),    20)
-        IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0),    20)
-
-        "9:                             \n\t"
-        ::"r"(block),"r"(temp),"r"(coeffs),"m"(ff_wm1010),"m"(ff_d40000)
-        : "$10","$11"
+    double temp[8];
+
+    /* backup register */
+#if _MIPS_SIM == _ABI64
+    __asm__ volatile (
+        "gssqc1       $f25,      $f24,       0x00(%[temp])      \n\t"
+        "gssqc1       $f27,      $f26,       0x10(%[temp])      \n\t"
+        "gssqc1       $f29,      $f28,       0x20(%[temp])      \n\t"
+        "gssqc1       $f31,      $f30,       0x30(%[temp])      \n\t"
+        :
+        : [temp]"r"(temp)
+        : "memory"
+    );
+#else
+    __asm__ volatile (
+        "gssqc1       $f22,      $f20,       0x00(%[temp])      \n\t"
+        "gssqc1       $f26,      $f24,       0x10(%[temp])      \n\t"
+        "gssqc1       $f30,      $f28,       0x20(%[temp])      \n\t"
+        :
+        : [temp]"r"(temp)
+        : "memory"
+    );
+#endif
+    __asm__ volatile (
+        /* load W */
+        "gslqc1       $f19,      $f18,      0x00(%[w_arr])      \n\t"
+        "gslqc1       $f21,      $f20,      0x10(%[w_arr])      \n\t"
+        "gslqc1       $f23,      $f22,      0x20(%[w_arr])      \n\t"
+        "gslqc1       $f25,      $f24,      0x30(%[w_arr])      \n\t"
+        "gslqc1       $f17,      $f16,      0x40(%[w_arr])      \n\t"
+        /* load source in block */
+        "gslqc1       $f1,       $f0,       0x00(%[block])      \n\t"
+        "gslqc1       $f3,       $f2,       0x10(%[block])      \n\t"
+        "gslqc1       $f5,       $f4,       0x20(%[block])      \n\t"
+        "gslqc1       $f7,       $f6,       0x30(%[block])      \n\t"
+        "gslqc1       $f9,       $f8,       0x40(%[block])      \n\t"
+        "gslqc1       $f11,      $f10,      0x50(%[block])      \n\t"
+        "gslqc1       $f13,      $f12,      0x60(%[block])      \n\t"
+        "gslqc1       $f15,      $f14,      0x70(%[block])       \n\t"
+
+        /* mask = 0xffffffffffff0000ULL */
+        "dmfc1        $9,        $f17                           \n\t"
+        /* ROW_SHIFT = 11 */
+        "li           $10,       11                             \n\t"
+        "mtc1         $10,       $f17                           \n\t"
+
+#define IDCT_ROW_COND_DC(src1, src2)                                 \
+        "dmfc1        $11,      "#src1"                         \n\t" \
+        "dmfc1        $12,      "#src2"                         \n\t" \
+        "and          $11,       $11,       $9                  \n\t" \
+        "or           $10,       $11,       $12                 \n\t" \
+        "beqz         $10,       1f                             \n\t" \
+                                                                      \
+        "punpcklhw    $f30,     "#src1",   "#src2"              \n\t" \
+        "punpckhhw    $f31,     "#src1",   "#src2"              \n\t" \
+        /* s6, s4, s2, s0 */                                          \
+        "punpcklhw   "#src1",    $f30,      $f31                \n\t" \
+        /* s7, s5, s3, s1 */                                          \
+        "punpckhhw   "#src2",    $f30,      $f31                \n\t" \
+                                                                      \
+        "pmaddhw      $f30,     "#src1",    $f18                \n\t" \
+        "pmaddhw      $f31,     "#src2",    $f19                \n\t" \
+        "paddw        $f28,      $f30,      $f31                \n\t" \
+        "psubw        $f29,      $f30,      $f31                \n\t" \
+        "punpcklwd    $f30,      $f28,      $f29                \n\t" \
+        "punpckhwd    $f31,      $f28,      $f29                \n\t" \
+        "paddw        $f26,      $f30,      $f31                \n\t" \
+        "paddw        $f26,      $f26,      $f16                \n\t" \
+        /* $f26: src[7], src[0] */                                    \
+        "psraw        $f26,      $f26,      $f17                \n\t" \
+                                                                      \
+        "pmaddhw      $f30,     "#src1",    $f20                \n\t" \
+        "pmaddhw      $f31,     "#src2",    $f21                \n\t" \
+        "paddw        $f28,      $f30,      $f31                \n\t" \
+        "psubw        $f29,      $f30,      $f31                \n\t" \
+        "punpcklwd    $f30,      $f28,      $f29                \n\t" \
+        "punpckhwd    $f31,      $f28,      $f29                \n\t" \
+        "paddw        $f27,      $f30,      $f31                \n\t" \
+        "paddw        $f27,      $f27,      $f16                \n\t" \
+        /* $f27: src[6], src[1] */                                    \
+        "psraw        $f27,      $f27,      $f17                \n\t" \
+                                                                      \
+        "pmaddhw      $f30,     "#src1",    $f22                \n\t" \
+        "pmaddhw      $f31,     "#src2",    $f23                \n\t" \
+        "paddw        $f28,      $f30,      $f31                \n\t" \
+        "psubw        $f29,      $f30,      $f31                \n\t" \
+        "punpcklwd    $f30,      $f28,      $f29                \n\t" \
+        "punpckhwd    $f31,      $f28,      $f29                \n\t" \
+        "paddw        $f28,      $f30,      $f31                \n\t" \
+        "paddw        $f28,      $f28,      $f16                \n\t" \
+        /* $f28: src[5], src[2] */                                    \
+        "psraw        $f28,      $f28,      $f17                \n\t" \
+                                                                      \
+        "pmaddhw      $f30,     "#src1",    $f24                \n\t" \
+        "pmaddhw      $f31,     "#src2",    $f25                \n\t" \
+        "paddw       "#src1",    $f30,      $f31                \n\t" \
+        "psubw       "#src2",    $f30,      $f31                \n\t" \
+        "punpcklwd    $f30,     "#src1",   "#src2"              \n\t" \
+        "punpckhwd    $f31,     "#src1",   "#src2"              \n\t" \
+        "paddw        $f29,      $f30,      $f31                \n\t" \
+        "paddw        $f29,      $f29,      $f16                \n\t" \
+        /* $f29: src[4], src[3] */                                    \
+        "psraw        $f29,      $f29,      $f17                \n\t" \
+                                                                      \
+        "punpcklhw   "#src1",    $f26,      $f27                \n\t" \
+        "punpckhhw    $f30,      $f27,      $f26                \n\t" \
+        "punpcklhw    $f31,      $f28,      $f29                \n\t" \
+        "punpckhhw   "#src2",    $f29,      $f28                \n\t" \
+        /* src[3], src[2], src[1], src[0] */                          \
+        "punpcklwd   "#src1",   "#src1",    $f31                \n\t" \
+        /* src[7], src[6], src[5], src[4] */                          \
+        "punpcklwd   "#src2",   "#src2",    $f30                \n\t" \
+        "j                       2f                             \n\t" \
+                                                                      \
+        "1:                                                     \n\t" \
+        "li           $10,       3                              \n\t" \
+        "dmtc1        $10,       $f30                           \n\t" \
+        "psllh        $f28,     "#src1",    $f30                \n\t" \
+        "dmtc1        $9,        $f31                           \n\t" \
+        "punpcklhw    $f29,      $f28,      $f28                \n\t" \
+        "and          $f29,      $f29,      $f31                \n\t" \
+        "paddw        $f28,      $f28,      $f29                \n\t" \
+        "punpcklwd   "#src1",    $f28,      $f28                \n\t" \
+        "punpcklwd   "#src2",    $f28,      $f28                \n\t" \
+        "2:                                                     \n\t" \
+
+        IDCT_ROW_COND_DC($f0,$f1)
+        IDCT_ROW_COND_DC($f2,$f3)
+        IDCT_ROW_COND_DC($f4,$f5)
+        IDCT_ROW_COND_DC($f6,$f7)
+        IDCT_ROW_COND_DC($f8,$f9)
+        IDCT_ROW_COND_DC($f10,$f11)
+        IDCT_ROW_COND_DC($f12,$f13)
+        IDCT_ROW_COND_DC($f14,$f15)
+
+
+        "gsldlc1      $f17,      0x57(%[w_arr])                 \n\t"
+        "gsldrc1      $f17,      0x50(%[w_arr])                 \n\t"
+        "li           $10,       4                              \n\t"
+        "dmtc1        $10,       $f16                           \n\t"
+
+        //----col0~col3----
+        "paddh        $f0,       $f0,       $f17                \n\t"
+        /* Transpose */
+        "punpcklhw    $f26,      $f0,       $f4                 \n\t"
+        "punpckhhw    $f27,      $f0,       $f4                 \n\t"
+        "punpcklhw    $f28,      $f8,       $f12                \n\t"
+        "punpckhhw    $f29,      $f8,       $f12                \n\t"
+        "punpcklwd    $f0,       $f26,      $f28                \n\t"
+        "punpckhwd    $f4,       $f26,      $f28                \n\t"
+        "punpcklwd    $f8,       $f27,      $f29                \n\t"
+        "punpckhwd    $f12,      $f27,      $f29                \n\t"
+
+        "or           $f26,      $f2,       $f6                 \n\t"
+        "or           $f26,      $f26,      $f10                \n\t"
+        "or           $f26,      $f26,      $f14                \n\t"
+        "dmfc1        $10,       $f26                           \n\t"
+        "bnez         $10,       1f                             \n\t"
+
+        //row1
+        "pmaddhw      $f26,      $f0,       $f18                \n\t"
+        "pmaddhw      $f27,      $f0,       $f20                \n\t"
+        "pmaddhw      $f28,      $f0,       $f22                \n\t"
+        "pmaddhw      $f29,      $f0,       $f24                \n\t"
+
+        "punpcklwd    $f30,      $f26,      $f26                \n\t"
+        "punpckhwd    $f31,      $f26,      $f26                \n\t"
+        /* $f26: src[0], src[56] */
+        "paddw        $f26,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f27,      $f27                \n\t"
+        "punpckhwd    $f31,      $f27,      $f27                \n\t"
+        /* $f27: src[8], src[48] */
+        "paddw        $f27,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f28,      $f28                \n\t"
+        "punpckhwd    $f31,      $f28,      $f28                \n\t"
+        /* $f28: src[16], src[40] */
+        "paddw        $f28,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f29,      $f29                \n\t"
+        "punpckhwd    $f31,      $f29,      $f29                \n\t"
+        "paddw        $f29,      $f30,      $f31                \n\t"
+        /* $f29: src[24], src[32] */
+
+        "punpcklhw    $f30,      $f26,      $f27                \n\t"
+        "punpcklhw    $f31,      $f28,      $f29                \n\t"
+        /* $f0: src[24], src[16], src[8], src[0] */
+        "punpckhwd    $f0,       $f30,      $f31                \n\t"
+        "psrah        $f0,       $f0,       $f16                \n\t"
+        "punpcklhw    $f30,      $f27,      $f26                \n\t"
+        "punpcklhw    $f31,      $f29,      $f28                \n\t"
+        /* $f2: src[56], src[48], src[40], src[32] */
+        "punpckhwd    $f2,       $f31,      $f30                \n\t"
+        "psrah        $f2,       $f2,       $f16                \n\t"
+
+        //row2
+        "pmaddhw      $f26,      $f4,       $f18                \n\t"
+        "pmaddhw      $f27,      $f4,       $f20                \n\t"
+        "pmaddhw      $f28,      $f4,       $f22                \n\t"
+        "pmaddhw      $f29,      $f4,       $f24                \n\t"
+
+        "punpcklwd    $f30,      $f26,      $f26                \n\t"
+        "punpckhwd    $f31,      $f26,      $f26                \n\t"
+        /* $f26: src[0], src[56] */
+        "paddw        $f26,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f27,      $f27                \n\t"
+        "punpckhwd    $f31,      $f27,      $f27                \n\t"
+        /* $f27: src[8], src[48] */
+        "paddw        $f27,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f28,      $f28                \n\t"
+        "punpckhwd    $f31,      $f28,      $f28                \n\t"
+        /* $f28: src[16], src[40] */
+        "paddw        $f28,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f29,      $f29                \n\t"
+        "punpckhwd    $f31,      $f29,      $f29                \n\t"
+        /* $f29: src[24], src[32] */
+        "paddw        $f29,      $f30,      $f31                \n\t"
+
+        "punpcklhw    $f30,      $f26,      $f27                \n\t"
+        "punpcklhw    $f31,      $f28,      $f29                \n\t"
+        /* $f4: src[24], src[16], src[8], src[0] */
+        "punpckhwd    $f4,       $f30,      $f31                \n\t"
+        "psrah        $f4,       $f4,       $f16                \n\t"
+        "punpcklhw    $f30,      $f27,      $f26                \n\t"
+        "punpcklhw    $f31,      $f29,      $f28                \n\t"
+        /* $f6: src[56], src[48], src[40], src[32] */
+        "punpckhwd    $f6,       $f31,      $f30                \n\t"
+        "psrah        $f6,       $f6,       $f16                \n\t"
+
+        //row3
+        "pmaddhw      $f26,      $f8,       $f18                \n\t"
+        "pmaddhw      $f27,      $f8,       $f20                \n\t"
+        "pmaddhw      $f28,      $f8,       $f22                \n\t"
+        "pmaddhw      $f29,      $f8,       $f24                \n\t"
+
+        "punpcklwd    $f30,      $f26,      $f26                \n\t"
+        "punpckhwd    $f31,      $f26,      $f26                \n\t"
+        /* $f26: src[0], src[56] */
+        "paddw        $f26,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f27,      $f27                \n\t"
+        "punpckhwd    $f31,      $f27,      $f27                \n\t"
+        /* $f27: src[8], src[48] */
+        "paddw        $f27,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f28,      $f28                \n\t"
+        "punpckhwd    $f31,      $f28,      $f28                \n\t"
+        /* $f28: src[16], src[40] */
+        "paddw        $f28,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f29,      $f29                \n\t"
+        "punpckhwd    $f31,      $f29,      $f29                \n\t"
+        /* $f29: src[24], src[32] */
+        "paddw        $f29,      $f30,      $f31                \n\t"
+
+        "punpcklhw    $f30,      $f26,      $f27                \n\t"
+        "punpcklhw    $f31,      $f28,      $f29                \n\t"
+        /* $f8: src[24], src[16], src[8], src[0] */
+        "punpckhwd    $f8,       $f30,      $f31                \n\t"
+        "psrah        $f8,       $f8,       $f16                \n\t"
+        "punpcklhw    $f30,      $f27,      $f26                \n\t"
+        "punpcklhw    $f31,      $f29,      $f28                \n\t"
+        /* $f10: src[56], src[48], src[40], src[32] */
+        "punpckhwd    $f10,      $f31,      $f30                \n\t"
+        "psrah        $f10,      $f10,      $f16                \n\t"
+
+        //row4
+        "pmaddhw      $f26,      $f12,      $f18                \n\t"
+        "pmaddhw      $f27,      $f12,      $f20                \n\t"
+        "pmaddhw      $f28,      $f12,      $f22                \n\t"
+        "pmaddhw      $f29,      $f12,      $f24                \n\t"
+
+        "punpcklwd    $f30,      $f26,      $f26                \n\t"
+        "punpckhwd    $f31,      $f26,      $f26                \n\t"
+        /* $f26: src[0], src[56] */
+        "paddw        $f26,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f27,      $f27                \n\t"
+        "punpckhwd    $f31,      $f27,      $f27                \n\t"
+        /* $f27: src[8], src[48] */
+        "paddw        $f27,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f28,      $f28                \n\t"
+        "punpckhwd    $f31,      $f28,      $f28                \n\t"
+        /* $f28: src[16], src[40] */
+        "paddw        $f28,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f29,      $f29                \n\t"
+        "punpckhwd    $f31,      $f29,      $f29                \n\t"
+        /* $f29: src[24], src[32] */
+        "paddw        $f29,      $f30,      $f31                \n\t"
+
+        "punpcklhw    $f30,      $f26,      $f27                \n\t"
+        "punpcklhw    $f31,      $f28,      $f29                \n\t"
+        /* $f12: src[24], src[16], src[8], src[0] */
+        "punpckhwd    $f12,      $f30,      $f31                \n\t"
+        "psrah        $f12,      $f12,      $f16                \n\t"
+        "punpcklhw    $f30,      $f27,      $f26                \n\t"
+        "punpcklhw    $f31,      $f29,      $f28                \n\t"
+        /* $f14: src[56], src[48], src[40], src[32] */
+        "punpckhwd    $f14,      $f31,      $f30                \n\t"
+        "psrah        $f14,      $f14,      $f16                \n\t"
+        "j                                  2f                  \n\t"
+
+        "1:                                                     \n\t"
+        /* Transpose */
+        "punpcklhw    $f26,      $f2,       $f6                 \n\t"
+        "punpckhhw    $f27,      $f2,       $f6                 \n\t"
+        "punpcklhw    $f28,      $f10,      $f14                \n\t"
+        "punpckhhw    $f29,      $f10,      $f14                \n\t"
+        "punpcklwd    $f2,       $f26,      $f28                \n\t"
+        "punpckhwd    $f6,       $f26,      $f28                \n\t"
+        "punpcklwd    $f10,      $f27,      $f29                \n\t"
+        "punpckhwd    $f14,      $f27,      $f29                \n\t"
+
+        //row1
+        "pmaddhw      $f28,      $f0,       $f18                \n\t"
+        "pmaddhw      $f29,      $f2,       $f19                \n\t"
+        "paddw        $f30,      $f28,      $f29                \n\t"
+        "psubw        $f31,      $f28,      $f29                \n\t"
+        "punpcklwd    $f28,      $f30,      $f31                \n\t"
+        "punpckhwd    $f29,      $f30,      $f31                \n\t"
+
+        "pmaddhw      $f30,      $f0,       $f20                \n\t"
+        "pmaddhw      $f31,      $f2,       $f21                \n\t"
+        /* $f26: src[0], src[56] */
+        "paddw        $f26,      $f28,      $f29                \n\t"
+        "paddw        $f28,      $f30,      $f31                \n\t"
+        "psubw        $f29,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f28,      $f29                \n\t"
+        "punpckhwd    $f31,      $f28,      $f29                \n\t"
+
+        "pmaddhw      $f28,      $f0,       $f22                \n\t"
+        "pmaddhw      $f29,      $f2,       $f23                \n\t"
+        /* $f27: src[8], src[48] */
+        "paddw        $f27,      $f30,      $f31                \n\t"
+        "paddw        $f30,      $f28,      $f29                \n\t"
+        "psubw        $f31,      $f28,      $f29                \n\t"
+        "punpcklwd    $f28,      $f30,      $f31                \n\t"
+        "punpckhwd    $f29,      $f30,      $f31                \n\t"
+
+        "pmaddhw      $f30,      $f0,       $f24                \n\t"
+        "pmaddhw      $f31,      $f2,       $f25                \n\t"
+        /* $f28: src[16], src[40] */
+        "paddw        $f28,      $f28,      $f29                \n\t"
+        "paddw        $f0,       $f30,      $f31                \n\t"
+        "psubw        $f2,       $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f0,       $f2                 \n\t"
+        "punpckhwd    $f31,      $f0,       $f2                 \n\t"
+        "paddw        $f29,      $f30,      $f31                \n\t"
+        /* $f29: src[24], src[32] */
+
+        "punpcklhw    $f0,       $f26,      $f27                \n\t"
+        "punpckhhw    $f2,       $f27,      $f26                \n\t"
+        "punpcklhw    $f30,      $f28,      $f29                \n\t"
+        "punpckhhw    $f31,      $f29,      $f28                \n\t"
+
+        //row2
+        "pmaddhw      $f28,      $f4,       $f18                \n\t"
+        "pmaddhw      $f29,      $f6,       $f19                \n\t"
+        /* $f0: src[24], src[16], src[8], src[0] */
+        "punpckhwd    $f0,       $f0,       $f30                \n\t"
+        /* $f2: src[56], src[48], src[40], src[32] */
+        "punpckhwd    $f2,       $f31,      $f2                 \n\t"
+        "psrah        $f0,       $f0,       $f16                \n\t"
+        "psrah        $f2,       $f2,       $f16                \n\t"
+        "paddw        $f30,      $f28,      $f29                \n\t"
+        "psubw        $f31,      $f28,      $f29                \n\t"
+        "punpcklwd    $f28,      $f30,      $f31                \n\t"
+        "punpckhwd    $f29,      $f30,      $f31                \n\t"
+
+        "pmaddhw      $f30,      $f4,       $f20                \n\t"
+        "pmaddhw      $f31,      $f6,       $f21                \n\t"
+        /* $f26: src[0], src[56] */
+        "paddw        $f26,      $f28,      $f29                \n\t"
+        "paddw        $f28,      $f30,      $f31                \n\t"
+        "psubw        $f29,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f28,      $f29                \n\t"
+        "punpckhwd    $f31,      $f28,      $f29                \n\t"
+
+        "pmaddhw      $f28,      $f4,       $f22                \n\t"
+        "pmaddhw      $f29,      $f6,       $f23                \n\t"
+        /* $f27: src[8], src[48] */
+        "paddw        $f27,      $f30,      $f31                \n\t"
+        "paddw        $f30,      $f28,      $f29                \n\t"
+        "psubw        $f31,      $f28,      $f29                \n\t"
+        "punpcklwd    $f28,      $f30,      $f31                \n\t"
+        "punpckhwd    $f29,      $f30,      $f31                \n\t"
+
+        "pmaddhw      $f30,      $f4,       $f24                \n\t"
+        "pmaddhw      $f31,      $f6,       $f25                \n\t"
+        /* $f28: src[16], src[40] */
+        "paddw        $f28,      $f28,      $f29                \n\t"
+        "paddw        $f4,       $f30,      $f31                \n\t"
+        "psubw        $f6,       $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f4,       $f6                 \n\t"
+        "punpckhwd    $f31,      $f4,       $f6                 \n\t"
+        /* $f29: src[24], src[32] */
+        "paddw        $f29,      $f30,      $f31                \n\t"
+
+        "punpcklhw    $f4,       $f26,      $f27                \n\t"
+        "punpckhhw    $f6,       $f27,      $f26                \n\t"
+        "punpcklhw    $f30,      $f28,      $f29                \n\t"
+        "punpckhhw    $f31,      $f29,      $f28                \n\t"
+
+        //row3
+        "pmaddhw      $f28,      $f8,       $f18                \n\t"
+        "pmaddhw      $f29,      $f10,      $f19                \n\t"
+        /* $f4: src[24], src[16], src[8], src[0] */
+        "punpckhwd    $f4,       $f4,       $f30                \n\t"
+        /* $f6: src[56], src[48], src[40], src[32] */
+        "punpckhwd    $f6,       $f31,      $f6                 \n\t"
+        "psrah        $f4,       $f4,       $f16                \n\t"
+        "psrah        $f6,       $f6,       $f16                \n\t"
+        "paddw        $f30,      $f28,      $f29                \n\t"
+        "psubw        $f31,      $f28,      $f29                \n\t"
+        "punpcklwd    $f28,      $f30,      $f31                \n\t"
+        "punpckhwd    $f29,      $f30,      $f31                \n\t"
+
+        "pmaddhw      $f30,      $f8,       $f20                \n\t"
+        "pmaddhw      $f31,      $f10,      $f21                \n\t"
+        /* $f26: src[0], src[56] */
+        "paddw        $f26,      $f28,      $f29                \n\t"
+        "paddw        $f28,      $f30,      $f31                \n\t"
+        "psubw        $f29,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f28,      $f29                \n\t"
+        "punpckhwd    $f31,      $f28,      $f29                \n\t"
+
+        "pmaddhw      $f28,      $f8,       $f22                \n\t"
+        "pmaddhw      $f29,      $f10,      $f23                \n\t"
+        /* $f27: src[8], src[48] */
+        "paddw        $f27,      $f30,      $f31                \n\t"
+        "paddw        $f30,      $f28,      $f29                \n\t"
+        "psubw        $f31,      $f28,      $f29                \n\t"
+        "punpcklwd    $f28,      $f30,      $f31                \n\t"
+        "punpckhwd    $f29,      $f30,      $f31                \n\t"
+
+        "pmaddhw      $f30,      $f8,       $f24                \n\t"
+        "pmaddhw      $f31,      $f10,      $f25                \n\t"
+        /* $f28: src[16], src[40] */
+        "paddw        $f28,      $f28,      $f29                \n\t"
+        "paddw        $f8,       $f30,      $f31                \n\t"
+        "psubw        $f10,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f8,       $f10                \n\t"
+        "punpckhwd    $f31,      $f8,       $f10                \n\t"
+        /* $f29: src[24], src[32] */
+        "paddw        $f29,      $f30,      $f31                \n\t"
+
+        "punpcklhw    $f8,       $f26,      $f27                \n\t"
+        "punpckhhw    $f10,      $f27,      $f26                \n\t"
+        "punpcklhw    $f30,      $f28,      $f29                \n\t"
+        "punpckhhw    $f31,      $f29,      $f28                \n\t"
+
+        //row4
+        "pmaddhw      $f28,      $f12,      $f18                \n\t"
+        "pmaddhw      $f29,      $f14,      $f19                \n\t"
+        /* $f8: src[24], src[16], src[8], src[0] */
+        "punpckhwd    $f8,       $f8,       $f30                \n\t"
+        /* $f10: src[56], src[48], src[40], src[32] */
+        "punpckhwd    $f10,      $f31,      $f10                \n\t"
+        "psrah        $f8,       $f8,       $f16                \n\t"
+        "psrah        $f10,      $f10,      $f16                \n\t"
+        "paddw        $f30,      $f28,      $f29                \n\t"
+        "psubw        $f31,      $f28,      $f29                \n\t"
+        "punpcklwd    $f28,      $f30,      $f31                \n\t"
+        "punpckhwd    $f29,      $f30,      $f31                \n\t"
+
+        "pmaddhw      $f30,      $f12,      $f20                \n\t"
+        "pmaddhw      $f31,      $f14,      $f21                \n\t"
+        /* $f26: src[0], src[56] */
+        "paddw        $f26,      $f28,      $f29                \n\t"
+        "paddw        $f28,      $f30,      $f31                \n\t"
+        "psubw        $f29,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f28,      $f29                \n\t"
+        "punpckhwd    $f31,      $f28,      $f29                \n\t"
+
+        "pmaddhw      $f28,      $f12,      $f22                \n\t"
+        "pmaddhw      $f29,      $f14,      $f23                \n\t"
+        /* $f27: src[8], src[48] */
+        "paddw        $f27,      $f30,      $f31                \n\t"
+        "paddw        $f30,      $f28,      $f29                \n\t"
+        "psubw        $f31,      $f28,      $f29                \n\t"
+        "punpcklwd    $f28,      $f30,      $f31                \n\t"
+        "punpckhwd    $f29,      $f30,      $f31                \n\t"
+
+        "pmaddhw      $f30,      $f12,      $f24                \n\t"
+        "pmaddhw      $f31,      $f14,      $f25                \n\t"
+        /* $f28: src[16], src[40] */
+        "paddw        $f28,      $f28,      $f29                \n\t"
+        "paddw        $f12,      $f30,      $f31                \n\t"
+        "psubw        $f14,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f12,      $f14                \n\t"
+        "punpckhwd    $f31,      $f12,      $f14                \n\t"
+        /* $f29: src[24], src[32] */
+        "paddw        $f29,      $f30,      $f31                \n\t"
+
+        "punpcklhw    $f12,      $f26,      $f27                \n\t"
+        "punpckhhw    $f14,      $f27,      $f26                \n\t"
+        "punpcklhw    $f30,      $f28,      $f29                \n\t"
+        "punpckhhw    $f31,      $f29,      $f28                \n\t"
+        /* $f12: src[24], src[16], src[8], src[0] */
+        "punpckhwd    $f12,      $f12,      $f30                \n\t"
+        /* $f14: src[56], src[48], src[40], src[32] */
+        "punpckhwd    $f14,      $f31,      $f14                \n\t"
+        "psrah        $f12,      $f12,      $f16                \n\t"
+        "psrah        $f14,      $f14,      $f16                \n\t"
+
+        "2:                                                     \n\t"
+        /* Transpose */
+        "punpcklhw    $f26,      $f0,       $f4                 \n\t"
+        "punpckhhw    $f27,      $f0,       $f4                 \n\t"
+        "punpcklhw    $f28,      $f8,       $f12                \n\t"
+        "punpckhhw    $f29,      $f8,       $f12                \n\t"
+        "punpcklwd    $f0,       $f26,      $f28                \n\t"
+        "punpckhwd    $f4,       $f26,      $f28                \n\t"
+        "punpcklwd    $f8,       $f27,      $f29                \n\t"
+        "punpckhwd    $f12,      $f27,      $f29                \n\t"
+        /* Transpose */
+        "punpcklhw    $f26,      $f2,       $f6                 \n\t"
+        "punpckhhw    $f27,      $f2,       $f6                 \n\t"
+        "punpcklhw    $f28,      $f10,      $f14                \n\t"
+        "punpckhhw    $f29,      $f10,      $f14                \n\t"
+        "punpcklwd    $f2,       $f26,      $f28                \n\t"
+        "punpckhwd    $f6,       $f26,      $f28                \n\t"
+        "punpcklwd    $f10,      $f27,      $f29                \n\t"
+        "punpckhwd    $f14,      $f27,      $f29                \n\t"
+
+        //----col4~col7----
+        "paddh        $f1,       $f1,       $f17                \n\t"
+        /* Transpose */
+        "punpcklhw    $f26,      $f1,       $f5                 \n\t"
+        "punpckhhw    $f27,      $f1,       $f5                 \n\t"
+        "punpcklhw    $f28,      $f9,       $f13                \n\t"
+        "punpckhhw    $f29,      $f9,       $f13                \n\t"
+        "punpcklwd    $f1,       $f26,      $f28                \n\t"
+        "punpckhwd    $f5,       $f26,      $f28                \n\t"
+        "punpcklwd    $f9,       $f27,      $f29                \n\t"
+        "punpckhwd    $f13,      $f27,      $f29                \n\t"
+
+        "or           $f26,      $f3,       $f7                 \n\t"
+        "or           $f26,      $f26,      $f11                \n\t"
+        "or           $f26,      $f26,      $f15                \n\t"
+        "dmfc1        $10,       $f26                           \n\t"
+        "bnez         $10,       1f                             \n\t"
+
+        //row1
+        "pmaddhw      $f26,      $f1,       $f18                \n\t"
+        "pmaddhw      $f27,      $f1,       $f20                \n\t"
+        "pmaddhw      $f28,      $f1,       $f22                \n\t"
+        "pmaddhw      $f29,      $f1,       $f24                \n\t"
+
+        "punpcklwd    $f30,      $f26,      $f26                \n\t"
+        "punpckhwd    $f31,      $f26,      $f26                \n\t"
+        /* $f26: src[0], src[56] */
+        "paddw        $f26,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f27,      $f27                \n\t"
+        "punpckhwd    $f31,      $f27,      $f27                \n\t"
+        /* $f27: src[8], src[48] */
+        "paddw        $f27,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f28,      $f28                \n\t"
+        "punpckhwd    $f31,      $f28,      $f28                \n\t"
+        /* $f28: src[16], src[40] */
+        "paddw        $f28,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f29,      $f29                \n\t"
+        "punpckhwd    $f31,      $f29,      $f29                \n\t"
+        "paddw        $f29,      $f30,      $f31                \n\t"
+        /* $f29: src[24], src[32] */
+
+        "punpcklhw    $f30,      $f26,      $f27                \n\t"
+        "punpcklhw    $f31,      $f28,      $f29                \n\t"
+        /* $f1: src[24], src[16], src[8], src[0] */
+        "punpckhwd    $f1,       $f30,      $f31                \n\t"
+        "psrah        $f1,       $f1,       $f16                \n\t"
+        "punpcklhw    $f30,      $f27,      $f26                \n\t"
+        "punpcklhw    $f31,      $f29,      $f28                \n\t"
+        /* $f3: src[56], src[48], src[40], src[32] */
+        "punpckhwd    $f3,       $f31,      $f30                \n\t"
+        "psrah        $f3,       $f3,       $f16                \n\t"
+
+        //row2
+        "pmaddhw      $f26,      $f5,       $f18                \n\t"
+        "pmaddhw      $f27,      $f5,       $f20                \n\t"
+        "pmaddhw      $f28,      $f5,       $f22                \n\t"
+        "pmaddhw      $f29,      $f5,       $f24                \n\t"
+
+        "punpcklwd    $f30,      $f26,      $f26                \n\t"
+        "punpckhwd    $f31,      $f26,      $f26                \n\t"
+        /* $f26: src[0], src[56] */
+        "paddw        $f26,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f27,      $f27                \n\t"
+        "punpckhwd    $f31,      $f27,      $f27                \n\t"
+        /* $f27: src[8], src[48] */
+        "paddw        $f27,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f28,      $f28                \n\t"
+        "punpckhwd    $f31,      $f28,      $f28                \n\t"
+        /* $f28: src[16], src[40] */
+        "paddw        $f28,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f29,      $f29                \n\t"
+        "punpckhwd    $f31,      $f29,      $f29                \n\t"
+        /* $f29: src[24], src[32] */
+        "paddw        $f29,      $f30,      $f31                \n\t"
+
+        "punpcklhw    $f30,      $f26,      $f27                \n\t"
+        "punpcklhw    $f31,      $f28,      $f29                \n\t"
+        /* $f5: src[24], src[16], src[8], src[0] */
+        "punpckhwd    $f5,       $f30,      $f31                \n\t"
+        "psrah        $f5,       $f5,       $f16                \n\t"
+        "punpcklhw    $f30,      $f27,      $f26                \n\t"
+        "punpcklhw    $f31,      $f29,      $f28                \n\t"
+        /* $f7: src[56], src[48], src[40], src[32] */
+        "punpckhwd    $f7,       $f31,      $f30                \n\t"
+        "psrah        $f7,       $f7,       $f16                \n\t"
+
+        //row3
+        "pmaddhw      $f26,      $f9,       $f18                \n\t"
+        "pmaddhw      $f27,      $f9,       $f20                \n\t"
+        "pmaddhw      $f28,      $f9,       $f22                \n\t"
+        "pmaddhw      $f29,      $f9,       $f24                \n\t"
+
+        "punpcklwd    $f30,      $f26,      $f26                \n\t"
+        "punpckhwd    $f31,      $f26,      $f26                \n\t"
+        /* $f26: src[0], src[56] */
+        "paddw        $f26,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f27,      $f27                \n\t"
+        "punpckhwd    $f31,      $f27,      $f27                \n\t"
+        /* $f27: src[8], src[48] */
+        "paddw        $f27,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f28,      $f28                \n\t"
+        "punpckhwd    $f31,      $f28,      $f28                \n\t"
+        /* $f28: src[16], src[40] */
+        "paddw        $f28,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f29,      $f29                \n\t"
+        "punpckhwd    $f31,      $f29,      $f29                \n\t"
+        /* $f29: src[24], src[32] */
+        "paddw        $f29,      $f30,      $f31                \n\t"
+
+        "punpcklhw    $f30,      $f26,      $f27                \n\t"
+        "punpcklhw    $f31,      $f28,      $f29                \n\t"
+        /* $f9: src[24], src[16], src[8], src[0] */
+        "punpckhwd    $f9,       $f30,      $f31                \n\t"
+        "psrah        $f9,       $f9,       $f16                \n\t"
+        "punpcklhw    $f30,      $f27,      $f26                \n\t"
+        "punpcklhw    $f31,      $f29,      $f28                \n\t"
+        /* $f11: src[56], src[48], src[40], src[32] */
+        "punpckhwd    $f11,      $f31,      $f30                \n\t"
+        "psrah        $f11,      $f11,      $f16                \n\t"
+
+        //row4
+        "pmaddhw      $f26,      $f13,      $f18                \n\t"
+        "pmaddhw      $f27,      $f13,      $f20                \n\t"
+        "pmaddhw      $f28,      $f13,      $f22                \n\t"
+        "pmaddhw      $f29,      $f13,      $f24                \n\t"
+
+        "punpcklwd    $f30,      $f26,      $f26                \n\t"
+        "punpckhwd    $f31,      $f26,      $f26                \n\t"
+        /* $f26: src[0], src[56] */
+        "paddw        $f26,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f27,      $f27                \n\t"
+        "punpckhwd    $f31,      $f27,      $f27                \n\t"
+        /* $f27: src[8], src[48] */
+        "paddw        $f27,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f28,      $f28                \n\t"
+        "punpckhwd    $f31,      $f28,      $f28                \n\t"
+        /* $f28: src[16], src[40] */
+        "paddw        $f28,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f29,      $f29                \n\t"
+        "punpckhwd    $f31,      $f29,      $f29                \n\t"
+        /* $f29: src[24], src[32] */
+        "paddw        $f29,      $f30,      $f31                \n\t"
+
+        "punpcklhw    $f30,      $f26,      $f27                \n\t"
+        "punpcklhw    $f31,      $f28,      $f29                \n\t"
+        /* $f13: src[24], src[16], src[8], src[0] */
+        "punpckhwd    $f13,      $f30,      $f31                \n\t"
+        "psrah        $f13,      $f13,      $f16                \n\t"
+        "punpcklhw    $f30,      $f27,      $f26                \n\t"
+        "punpcklhw    $f31,      $f29,      $f28                \n\t"
+        /* $f15: src[56], src[48], src[40], src[32] */
+        "punpckhwd    $f15,      $f31,      $f30                \n\t"
+        "psrah        $f15,      $f15,      $f16                \n\t"
+        "j                                  2f                  \n\t"
+
+        "1:                                                     \n\t"
+        /* Transpose */
+        "punpcklhw    $f26,      $f3,       $f7                 \n\t"
+        "punpckhhw    $f27,      $f3,       $f7                 \n\t"
+        "punpcklhw    $f28,      $f11,      $f15                \n\t"
+        "punpckhhw    $f29,      $f11,      $f15                \n\t"
+        "punpcklwd    $f3,       $f26,      $f28                \n\t"
+        "punpckhwd    $f7,       $f26,      $f28                \n\t"
+        "punpcklwd    $f11,      $f27,      $f29                \n\t"
+        "punpckhwd    $f15,      $f27,      $f29                \n\t"
+
+        //row1
+        "pmaddhw      $f28,      $f1,       $f18                \n\t"
+        "pmaddhw      $f29,      $f3,       $f19                \n\t"
+        "paddw        $f30,      $f28,      $f29                \n\t"
+        "psubw        $f31,      $f28,      $f29                \n\t"
+        "punpcklwd    $f28,      $f30,      $f31                \n\t"
+        "punpckhwd    $f29,      $f30,      $f31                \n\t"
+
+        "pmaddhw      $f30,      $f1,       $f20                \n\t"
+        "pmaddhw      $f31,      $f3,       $f21                \n\t"
+        /* $f26: src[0], src[56] */
+        "paddw        $f26,      $f28,      $f29                \n\t"
+        "paddw        $f28,      $f30,      $f31                \n\t"
+        "psubw        $f29,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f28,      $f29                \n\t"
+        "punpckhwd    $f31,      $f28,      $f29                \n\t"
+
+        "pmaddhw      $f28,      $f1,       $f22                \n\t"
+        "pmaddhw      $f29,      $f3,       $f23                \n\t"
+        /* $f27: src[8], src[48] */
+        "paddw        $f27,      $f30,      $f31                \n\t"
+        "paddw        $f30,      $f28,      $f29                \n\t"
+        "psubw        $f31,      $f28,      $f29                \n\t"
+        "punpcklwd    $f28,      $f30,      $f31                \n\t"
+        "punpckhwd    $f29,      $f30,      $f31                \n\t"
+
+        "pmaddhw      $f30,      $f1,       $f24                \n\t"
+        "pmaddhw      $f31,      $f3,       $f25                \n\t"
+        /* $f28: src[16], src[40] */
+        "paddw        $f28,      $f28,      $f29                \n\t"
+        "paddw        $f1,       $f30,      $f31                \n\t"
+        "psubw        $f3,       $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f1,       $f3                 \n\t"
+        "punpckhwd    $f31,      $f1,       $f3                 \n\t"
+        /* $f29: src[24], src[32] */
+        "paddw        $f29,      $f30,      $f31                \n\t"
+
+        "punpcklhw    $f1,       $f26,      $f27                \n\t"
+        "punpckhhw    $f3,       $f27,      $f26                \n\t"
+        "punpcklhw    $f30,      $f28,      $f29                \n\t"
+        "punpckhhw    $f31,      $f29,      $f28                \n\t"
+
+        //row2
+        "pmaddhw      $f28,      $f5,       $f18                \n\t"
+        "pmaddhw      $f29,      $f7,       $f19                \n\t"
+        /* $f1: src[24], src[16], src[8], src[0] */
+        "punpckhwd    $f1,       $f1,       $f30                \n\t"
+        /* $f3: src[56], src[48], src[40], src[32] */
+        "punpckhwd    $f3,       $f31,      $f3                 \n\t"
+        "psrah        $f1,       $f1,       $f16                \n\t"
+        "psrah        $f3,       $f3,       $f16                \n\t"
+        "paddw        $f30,      $f28,      $f29                \n\t"
+        "psubw        $f31,      $f28,      $f29                \n\t"
+        "punpcklwd    $f28,      $f30,      $f31                \n\t"
+        "punpckhwd    $f29,      $f30,      $f31                \n\t"
+
+        "pmaddhw      $f30,      $f5,       $f20                \n\t"
+        "pmaddhw      $f31,      $f7,       $f21                \n\t"
+        /* $f26: src[0], src[56] */
+        "paddw        $f26,      $f28,      $f29                \n\t"
+        "paddw        $f28,      $f30,      $f31                \n\t"
+        "psubw        $f29,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f28,      $f29                \n\t"
+        "punpckhwd    $f31,      $f28,      $f29                \n\t"
+
+        "pmaddhw      $f28,      $f5,       $f22                \n\t"
+        "pmaddhw      $f29,      $f7,       $f23                \n\t"
+        /* $f27: src[8], src[48] */
+        "paddw        $f27,      $f30,      $f31                \n\t"
+        "paddw        $f30,      $f28,      $f29                \n\t"
+        "psubw        $f31,      $f28,      $f29                \n\t"
+        "punpcklwd    $f28,      $f30,      $f31                \n\t"
+        "punpckhwd    $f29,      $f30,      $f31                \n\t"
+
+        "pmaddhw      $f30,      $f5,       $f24                \n\t"
+        "pmaddhw      $f31,      $f7,       $f25                \n\t"
+        /* $f28: src[16], src[40] */
+        "paddw        $f28,      $f28,      $f29                \n\t"
+        "paddw        $f5,       $f30,      $f31                \n\t"
+        "psubw        $f7,       $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f5,       $f7                 \n\t"
+        "punpckhwd    $f31,      $f5,       $f7                 \n\t"
+        /* $f29: src[24], src[32] */
+        "paddw        $f29,      $f30,      $f31                \n\t"
+
+        "punpcklhw    $f5,       $f26,      $f27                \n\t"
+        "punpckhhw    $f7,       $f27,      $f26                \n\t"
+        "punpcklhw    $f30,      $f28,      $f29                \n\t"
+        "punpckhhw    $f31,      $f29,      $f28                \n\t"
+
+        //row3
+        "pmaddhw      $f28,      $f9,       $f18                \n\t"
+        "pmaddhw      $f29,      $f11,      $f19                \n\t"
+        /* $f5: src[24], src[16], src[8], src[0] */
+        "punpckhwd    $f5,       $f5,       $f30                \n\t"
+        /* $f7: src[56], src[48], src[40], src[32] */
+        "punpckhwd    $f7,       $f31,      $f7                 \n\t"
+        "psrah        $f5,       $f5,       $f16                \n\t"
+        "psrah        $f7,       $f7,       $f16                \n\t"
+        "paddw        $f30,      $f28,      $f29                \n\t"
+        "psubw        $f31,      $f28,      $f29                \n\t"
+        "punpcklwd    $f28,      $f30,      $f31                \n\t"
+        "punpckhwd    $f29,      $f30,      $f31                \n\t"
+
+        "pmaddhw      $f30,      $f9,       $f20                \n\t"
+        "pmaddhw      $f31,      $f11,      $f21                \n\t"
+        /* $f26: src[0], src[56] */
+        "paddw        $f26,      $f28,      $f29                \n\t"
+        "paddw        $f28,      $f30,      $f31                \n\t"
+        "psubw        $f29,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f28,      $f29                \n\t"
+        "punpckhwd    $f31,      $f28,      $f29                \n\t"
+
+        "pmaddhw      $f28,      $f9,       $f22                \n\t"
+        "pmaddhw      $f29,      $f11,      $f23                \n\t"
+        /* $f27: src[8], src[48] */
+        "paddw        $f27,      $f30,      $f31                \n\t"
+        "paddw        $f30,      $f28,      $f29                \n\t"
+        "psubw        $f31,      $f28,      $f29                \n\t"
+        "punpcklwd    $f28,      $f30,      $f31                \n\t"
+        "punpckhwd    $f29,      $f30,      $f31                \n\t"
+
+        "pmaddhw      $f30,      $f9,       $f24                \n\t"
+        "pmaddhw      $f31,      $f11,      $f25                \n\t"
+        /* $f28: src[16], src[40] */
+        "paddw        $f28,      $f28,      $f29                \n\t"
+        "paddw        $f9,       $f30,      $f31                \n\t"
+        "psubw        $f11,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f9,       $f11                \n\t"
+        "punpckhwd    $f31,      $f9,       $f11                \n\t"
+        /* $f29: src[24], src[32] */
+        "paddw        $f29,      $f30,      $f31                \n\t"
+
+        "punpcklhw    $f9,       $f26,      $f27                \n\t"
+        "punpckhhw    $f11,      $f27,      $f26                \n\t"
+        "punpcklhw    $f30,      $f28,      $f29                \n\t"
+        "punpckhhw    $f31,      $f29,      $f28                \n\t"
+
+        //row4
+        "pmaddhw      $f28,      $f13,      $f18                \n\t"
+        "pmaddhw      $f29,      $f15,      $f19                \n\t"
+        /* $f9: src[24], src[16], src[8], src[0] */
+        "punpckhwd    $f9,       $f9,       $f30                \n\t"
+        /* $f11: src[56], src[48], src[40], src[32] */
+        "punpckhwd    $f11,      $f31,      $f11                \n\t"
+        "psrah        $f9,       $f9,       $f16                \n\t"
+        "psrah        $f11,      $f11,      $f16                \n\t"
+        "paddw        $f30,      $f28,      $f29                \n\t"
+        "psubw        $f31,      $f28,      $f29                \n\t"
+        "punpcklwd    $f28,      $f30,      $f31                \n\t"
+        "punpckhwd    $f29,      $f30,      $f31                \n\t"
+
+        "pmaddhw      $f30,      $f13,      $f20                \n\t"
+        "pmaddhw      $f31,      $f15,      $f21                \n\t"
+        /* $f26: src[0], src[56] */
+        "paddw        $f26,      $f28,      $f29                \n\t"
+        "paddw        $f28,      $f30,      $f31                \n\t"
+        "psubw        $f29,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f28,      $f29                \n\t"
+        "punpckhwd    $f31,      $f28,      $f29                \n\t"
+
+        "pmaddhw      $f28,      $f13,      $f22                \n\t"
+        "pmaddhw      $f29,      $f15,      $f23                \n\t"
+        /* $f27: src[8], src[48] */
+        "paddw        $f27,      $f30,      $f31                \n\t"
+        "paddw        $f30,      $f28,      $f29                \n\t"
+        "psubw        $f31,      $f28,      $f29                \n\t"
+        "punpcklwd    $f28,      $f30,      $f31                \n\t"
+        "punpckhwd    $f29,      $f30,      $f31                \n\t"
+
+        "pmaddhw      $f30,      $f13,      $f24                \n\t"
+        "pmaddhw      $f31,      $f15,      $f25                \n\t"
+        /* $f28: src[16], src[40] */
+        "paddw        $f28,      $f28,      $f29                \n\t"
+        "paddw        $f13,      $f30,      $f31                \n\t"
+        "psubw        $f15,      $f30,      $f31                \n\t"
+        "punpcklwd    $f30,      $f13,      $f15                \n\t"
+        "punpckhwd    $f31,      $f13,      $f15                \n\t"
+        /* $f29: src[24], src[32] */
+        "paddw        $f29,      $f30,      $f31                \n\t"
+
+        "punpcklhw    $f13,      $f26,      $f27                \n\t"
+        "punpckhhw    $f15,      $f27,      $f26                \n\t"
+        "punpcklhw    $f30,      $f28,      $f29                \n\t"
+        "punpckhhw    $f31,      $f29,      $f28                \n\t"
+        /* $f13: src[24], src[16], src[8], src[0] */
+        "punpckhwd    $f13,      $f13,      $f30                \n\t"
+        /* $f15: src[56], src[48], src[40], src[32] */
+        "punpckhwd    $f15,      $f31,      $f15                \n\t"
+        "psrah        $f13,      $f13,      $f16                \n\t"
+        "psrah        $f15,      $f15,      $f16                \n\t"
+        "2:                                                     \n\t"
+
+        /* Transpose */
+        "punpcklhw    $f26,      $f1,       $f5                 \n\t"
+        "punpckhhw    $f27,      $f1,       $f5                 \n\t"
+        "punpcklhw    $f28,      $f9,       $f13                \n\t"
+        "punpckhhw    $f29,      $f9,       $f13                \n\t"
+        "punpcklwd    $f1,       $f26,      $f28                \n\t"
+        "punpckhwd    $f5,       $f26,      $f28                \n\t"
+        "punpcklwd    $f9,       $f27,      $f29                \n\t"
+        "punpckhwd    $f13,      $f27,      $f29                \n\t"
+        /* Transpose */
+        "punpcklhw    $f26,      $f3,       $f7                 \n\t"
+        "punpckhhw    $f27,      $f3,       $f7                 \n\t"
+        "punpcklhw    $f28,      $f11,      $f15                \n\t"
+        "punpckhhw    $f29,      $f11,      $f15                \n\t"
+        "punpcklwd    $f3,       $f26,      $f28                \n\t"
+        "punpckhwd    $f7,       $f26,      $f28                \n\t"
+        "punpcklwd    $f11,      $f27,      $f29                \n\t"
+        "punpckhwd    $f15,      $f27,      $f29                \n\t"
+        /* Store */
+        "gssqc1       $f1,       $f0,       0x00(%[block])      \n\t"
+        "gssqc1       $f5,       $f4,       0x10(%[block])      \n\t"
+        "gssqc1       $f9,       $f8,       0x20(%[block])      \n\t"
+        "gssqc1       $f13,      $f12,      0x30(%[block])      \n\t"
+        "gssqc1       $f3,       $f2,       0x40(%[block])      \n\t"
+        "gssqc1       $f7,       $f6,       0x50(%[block])      \n\t"
+        "gssqc1       $f11,      $f10,      0x60(%[block])      \n\t"
+        "gssqc1       $f15,      $f14,      0x70(%[block])      \n\t"
+
+        : [block]"+&r"(block)
+        : [w_arr]"r"(W_arr)
+        : "memory"
+    );
+
+    /* recover register */
+#if _MIPS_SIM == _ABI64
+    __asm__ volatile (
+        "gslqc1       $f25,      $f24,       0x00(%[temp])      \n\t"
+        "gslqc1       $f27,      $f26,       0x10(%[temp])      \n\t"
+        "gslqc1       $f29,      $f28,       0x20(%[temp])      \n\t"
+        "gslqc1       $f31,      $f30,       0x30(%[temp])      \n\t"
+        :
+        : [temp]"r"(temp)
+        : "memory"
+    );
+#else
+    __asm__ volatile (
+        "gslqc1       $f22,      $f20,       0x00(%[temp])      \n\t"
+        "gslqc1       $f26,      $f24,       0x10(%[temp])      \n\t"
+        "gslqc1       $f30,      $f28,       0x20(%[temp])      \n\t"
+        :
+        : [temp]"r"(temp)
+        : "memory"
     );
+#endif
+}
+
+void ff_simple_idct_put_mmi(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
+{
+    ff_simple_idct_8_mmi(block);
+    ff_put_pixels_clamped_mmi(block, dest, line_size);
+}
+void ff_simple_idct_add_mmi(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
+{
+    ff_simple_idct_8_mmi(block);
+    ff_add_pixels_clamped_mmi(block, dest, line_size);
 }