1 /*
2 * Copyright (c) 2017 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "./vp8_rtcd.h"
12 #include "vp8/common/blockd.h"
13 #include "vpx_mem/vpx_mem.h"
14 #include "vpx_ports/asmdefs_mmi.h"
15
vp8_dequantize_b_mmi(BLOCKD * d,int16_t * DQC)16 void vp8_dequantize_b_mmi(BLOCKD *d, int16_t *DQC) {
17 double ftmp[8];
18
19 __asm__ volatile(
20 "gsldlc1 %[ftmp0], 0x07(%[qcoeff]) \n\t"
21 "gsldrc1 %[ftmp0], 0x00(%[qcoeff]) \n\t"
22 "gsldlc1 %[ftmp1], 0x0f(%[qcoeff]) \n\t"
23 "gsldrc1 %[ftmp1], 0x08(%[qcoeff]) \n\t"
24 "gsldlc1 %[ftmp2], 0x17(%[qcoeff]) \n\t"
25 "gsldrc1 %[ftmp2], 0x10(%[qcoeff]) \n\t"
26 "gsldlc1 %[ftmp3], 0x1f(%[qcoeff]) \n\t"
27 "gsldrc1 %[ftmp3], 0x18(%[qcoeff]) \n\t"
28
29 "gsldlc1 %[ftmp4], 0x07(%[DQC]) \n\t"
30 "gsldrc1 %[ftmp4], 0x00(%[DQC]) \n\t"
31 "gsldlc1 %[ftmp5], 0x0f(%[DQC]) \n\t"
32 "gsldrc1 %[ftmp5], 0x08(%[DQC]) \n\t"
33 "gsldlc1 %[ftmp6], 0x17(%[DQC]) \n\t"
34 "gsldrc1 %[ftmp6], 0x10(%[DQC]) \n\t"
35 "gsldlc1 %[ftmp7], 0x1f(%[DQC]) \n\t"
36 "gsldrc1 %[ftmp7], 0x18(%[DQC]) \n\t"
37
38 "pmullh %[ftmp0], %[ftmp0], %[ftmp4] \n\t"
39 "pmullh %[ftmp1], %[ftmp1], %[ftmp5] \n\t"
40 "pmullh %[ftmp2], %[ftmp2], %[ftmp6] \n\t"
41 "pmullh %[ftmp3], %[ftmp3], %[ftmp7] \n\t"
42
43 "gssdlc1 %[ftmp0], 0x07(%[dqcoeff]) \n\t"
44 "gssdrc1 %[ftmp0], 0x00(%[dqcoeff]) \n\t"
45 "gssdlc1 %[ftmp1], 0x0f(%[dqcoeff]) \n\t"
46 "gssdrc1 %[ftmp1], 0x08(%[dqcoeff]) \n\t"
47 "gssdlc1 %[ftmp2], 0x17(%[dqcoeff]) \n\t"
48 "gssdrc1 %[ftmp2], 0x10(%[dqcoeff]) \n\t"
49 "gssdlc1 %[ftmp3], 0x1f(%[dqcoeff]) \n\t"
50 "gssdrc1 %[ftmp3], 0x18(%[dqcoeff]) \n\t"
51 : [ftmp0] "=&f"(ftmp[0]), [ftmp1] "=&f"(ftmp[1]), [ftmp2] "=&f"(ftmp[2]),
52 [ftmp3] "=&f"(ftmp[3]), [ftmp4] "=&f"(ftmp[4]), [ftmp5] "=&f"(ftmp[5]),
53 [ftmp6] "=&f"(ftmp[6]), [ftmp7] "=&f"(ftmp[7])
54 : [dqcoeff] "r"(d->dqcoeff), [qcoeff] "r"(d->qcoeff), [DQC] "r"(DQC)
55 : "memory");
56 }
57
vp8_dequant_idct_add_mmi(int16_t * input,int16_t * dq,unsigned char * dest,int stride)58 void vp8_dequant_idct_add_mmi(int16_t *input, int16_t *dq, unsigned char *dest,
59 int stride) {
60 double ftmp[8];
61
62 __asm__ volatile(
63 "gsldlc1 %[ftmp0], 0x07(%[dq]) \n\t"
64 "gsldrc1 %[ftmp0], 0x00(%[dq]) \n\t"
65 "gsldlc1 %[ftmp1], 0x0f(%[dq]) \n\t"
66 "gsldrc1 %[ftmp1], 0x08(%[dq]) \n\t"
67 "gsldlc1 %[ftmp2], 0x17(%[dq]) \n\t"
68 "gsldrc1 %[ftmp2], 0x10(%[dq]) \n\t"
69 "gsldlc1 %[ftmp3], 0x1f(%[dq]) \n\t"
70 "gsldrc1 %[ftmp3], 0x18(%[dq]) \n\t"
71
72 "gsldlc1 %[ftmp4], 0x07(%[input]) \n\t"
73 "gsldrc1 %[ftmp4], 0x00(%[input]) \n\t"
74 "gsldlc1 %[ftmp5], 0x0f(%[input]) \n\t"
75 "gsldrc1 %[ftmp5], 0x08(%[input]) \n\t"
76 "gsldlc1 %[ftmp6], 0x17(%[input]) \n\t"
77 "gsldrc1 %[ftmp6], 0x10(%[input]) \n\t"
78 "gsldlc1 %[ftmp7], 0x1f(%[input]) \n\t"
79 "gsldrc1 %[ftmp7], 0x18(%[input]) \n\t"
80
81 "pmullh %[ftmp0], %[ftmp0], %[ftmp4] \n\t"
82 "pmullh %[ftmp1], %[ftmp1], %[ftmp5] \n\t"
83 "pmullh %[ftmp2], %[ftmp2], %[ftmp6] \n\t"
84 "pmullh %[ftmp3], %[ftmp3], %[ftmp7] \n\t"
85
86 "gssdlc1 %[ftmp0], 0x07(%[input]) \n\t"
87 "gssdrc1 %[ftmp0], 0x00(%[input]) \n\t"
88 "gssdlc1 %[ftmp1], 0x0f(%[input]) \n\t"
89 "gssdrc1 %[ftmp1], 0x08(%[input]) \n\t"
90 "gssdlc1 %[ftmp2], 0x17(%[input]) \n\t"
91 "gssdrc1 %[ftmp2], 0x10(%[input]) \n\t"
92 "gssdlc1 %[ftmp3], 0x1f(%[input]) \n\t"
93 "gssdrc1 %[ftmp3], 0x18(%[input]) \n\t"
94 : [ftmp0] "=&f"(ftmp[0]), [ftmp1] "=&f"(ftmp[1]), [ftmp2] "=&f"(ftmp[2]),
95 [ftmp3] "=&f"(ftmp[3]), [ftmp4] "=&f"(ftmp[4]), [ftmp5] "=&f"(ftmp[5]),
96 [ftmp6] "=&f"(ftmp[6]), [ftmp7] "=&f"(ftmp[7])
97 : [dq] "r"(dq), [input] "r"(input)
98 : "memory");
99
100 vp8_short_idct4x4llm_mmi(input, dest, stride, dest, stride);
101
102 __asm__ volatile(
103 "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
104 "gssdlc1 %[ftmp0], 0x07(%[input]) \n\t"
105 "gssdrc1 %[ftmp0], 0x00(%[input]) \n\t"
106 "sdl $0, 0x0f(%[input]) \n\t"
107 "sdr $0, 0x08(%[input]) \n\t"
108 "gssdlc1 %[ftmp0], 0x17(%[input]) \n\t"
109 "gssdrc1 %[ftmp0], 0x10(%[input]) \n\t"
110 "sdl $0, 0x1f(%[input]) \n\t"
111 "sdr $0, 0x18(%[input]) \n\t"
112 : [ftmp0] "=&f"(ftmp[0])
113 : [input] "r"(input)
114 : "memory");
115 }
116