OLD | NEW |
1 // Copyright 2014 Google Inc. All Rights Reserved. | 1 // Copyright 2014 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // Use of this source code is governed by a BSD-style license | 3 // Use of this source code is governed by a BSD-style license |
4 // that can be found in the COPYING file in the root of the source | 4 // that can be found in the COPYING file in the root of the source |
5 // tree. An additional intellectual property rights grant can be found | 5 // tree. An additional intellectual property rights grant can be found |
6 // in the file PATENTS. All contributing project authors may | 6 // in the file PATENTS. All contributing project authors may |
7 // be found in the AUTHORS file in the root of the source tree. | 7 // be found in the AUTHORS file in the root of the source tree. |
8 // ----------------------------------------------------------------------------- | 8 // ----------------------------------------------------------------------------- |
9 // | 9 // |
10 // MIPS version of dsp functions | 10 // MIPS version of dsp functions |
11 // | 11 // |
12 // Author(s): Djordje Pesut (djordje.pesut@imgtec.com) | 12 // Author(s): Djordje Pesut (djordje.pesut@imgtec.com) |
13 // Jovan Zelincevic (jovan.zelincevic@imgtec.com) | 13 // Jovan Zelincevic (jovan.zelincevic@imgtec.com) |
14 | 14 |
15 #include "./dsp.h" | 15 #include "./dsp.h" |
16 | 16 |
17 #if defined(WEBP_USE_MIPS32) | 17 #if defined(WEBP_USE_MIPS32) |
18 | 18 |
| 19 #include "./mips_macro.h" |
| 20 |
19 static const int kC1 = 20091 + (1 << 16); | 21 static const int kC1 = 20091 + (1 << 16); |
20 static const int kC2 = 35468; | 22 static const int kC2 = 35468; |
21 | 23 |
22 static WEBP_INLINE int abs_mips32(int x) { | 24 static WEBP_INLINE int abs_mips32(int x) { |
23 const int sign = x >> 31; | 25 const int sign = x >> 31; |
24 return (x ^ sign) - sign; | 26 return (x ^ sign) - sign; |
25 } | 27 } |
26 | 28 |
27 // 4 pixels in, 2 pixels out | 29 // 4 pixels in, 2 pixels out |
28 static WEBP_INLINE void do_filter2(uint8_t* p, int step) { | 30 static WEBP_INLINE void do_filter2(uint8_t* p, int step) { |
(...skipping 16 matching lines...) Expand all Loading... |
45 p[- step] = VP8kclip1[p0 + a2]; | 47 p[- step] = VP8kclip1[p0 + a2]; |
46 p[ 0] = VP8kclip1[q0 - a1]; | 48 p[ 0] = VP8kclip1[q0 - a1]; |
47 p[ step] = VP8kclip1[q1 - a3]; | 49 p[ step] = VP8kclip1[q1 - a3]; |
48 } | 50 } |
49 | 51 |
50 // 6 pixels in, 6 pixels out | 52 // 6 pixels in, 6 pixels out |
51 static WEBP_INLINE void do_filter6(uint8_t* p, int step) { | 53 static WEBP_INLINE void do_filter6(uint8_t* p, int step) { |
52 const int p2 = p[-3 * step], p1 = p[-2 * step], p0 = p[-step]; | 54 const int p2 = p[-3 * step], p1 = p[-2 * step], p0 = p[-step]; |
53 const int q0 = p[0], q1 = p[step], q2 = p[2 * step]; | 55 const int q0 = p[0], q1 = p[step], q2 = p[2 * step]; |
54 const int a = VP8ksclip1[3 * (q0 - p0) + VP8ksclip1[p1 - q1]]; | 56 const int a = VP8ksclip1[3 * (q0 - p0) + VP8ksclip1[p1 - q1]]; |
| 57 // a is in [-128,127], a1 in [-27,27], a2 in [-18,18] and a3 in [-9,9] |
55 const int a1 = (27 * a + 63) >> 7; // eq. to ((3 * a + 7) * 9) >> 7 | 58 const int a1 = (27 * a + 63) >> 7; // eq. to ((3 * a + 7) * 9) >> 7 |
56 const int a2 = (18 * a + 63) >> 7; // eq. to ((2 * a + 7) * 9) >> 7 | 59 const int a2 = (18 * a + 63) >> 7; // eq. to ((2 * a + 7) * 9) >> 7 |
57 const int a3 = (9 * a + 63) >> 7; // eq. to ((1 * a + 7) * 9) >> 7 | 60 const int a3 = (9 * a + 63) >> 7; // eq. to ((1 * a + 7) * 9) >> 7 |
58 p[-3 * step] = VP8kclip1[p2 + a3]; | 61 p[-3 * step] = VP8kclip1[p2 + a3]; |
59 p[-2 * step] = VP8kclip1[p1 + a2]; | 62 p[-2 * step] = VP8kclip1[p1 + a2]; |
60 p[- step] = VP8kclip1[p0 + a1]; | 63 p[- step] = VP8kclip1[p0 + a1]; |
61 p[ 0] = VP8kclip1[q0 - a1]; | 64 p[ 0] = VP8kclip1[q0 - a1]; |
62 p[ step] = VP8kclip1[q1 - a2]; | 65 p[ step] = VP8kclip1[q1 - a2]; |
63 p[ 2 * step] = VP8kclip1[q2 - a3]; | 66 p[ 2 * step] = VP8kclip1[q2 - a3]; |
64 } | 67 } |
65 | 68 |
66 static WEBP_INLINE int hev(const uint8_t* p, int step, int thresh) { | 69 static WEBP_INLINE int hev(const uint8_t* p, int step, int thresh) { |
67 const int p1 = p[-2 * step], p0 = p[-step], q0 = p[0], q1 = p[step]; | 70 const int p1 = p[-2 * step], p0 = p[-step], q0 = p[0], q1 = p[step]; |
68 return (abs_mips32(p1 - p0) > thresh) || (abs_mips32(q1 - q0) > thresh); | 71 return (abs_mips32(p1 - p0) > thresh) || (abs_mips32(q1 - q0) > thresh); |
69 } | 72 } |
70 | 73 |
71 static WEBP_INLINE int needs_filter(const uint8_t* p, int step, int thresh) { | 74 static WEBP_INLINE int needs_filter(const uint8_t* p, int step, int t) { |
72 const int p1 = p[-2 * step], p0 = p[-step], q0 = p[0], q1 = p[step]; | 75 const int p1 = p[-2 * step], p0 = p[-step], q0 = p[0], q1 = p[step]; |
73 return ((2 * abs_mips32(p0 - q0) + (abs_mips32(p1 - q1) >> 1)) <= thresh); | 76 return ((4 * abs_mips32(p0 - q0) + abs_mips32(p1 - q1)) <= t); |
74 } | 77 } |
75 | 78 |
76 static WEBP_INLINE int needs_filter2(const uint8_t* p, | 79 static WEBP_INLINE int needs_filter2(const uint8_t* p, |
77 int step, int t, int it) { | 80 int step, int t, int it) { |
78 const int p3 = p[-4 * step], p2 = p[-3 * step]; | 81 const int p3 = p[-4 * step], p2 = p[-3 * step]; |
79 const int p1 = p[-2 * step], p0 = p[-step]; | 82 const int p1 = p[-2 * step], p0 = p[-step]; |
80 const int q0 = p[0], q1 = p[step], q2 = p[2 * step], q3 = p[3 * step]; | 83 const int q0 = p[0], q1 = p[step], q2 = p[2 * step], q3 = p[3 * step]; |
81 if ((2 * abs_mips32(p0 - q0) + (abs_mips32(p1 - q1) >> 1)) > t) { | 84 if ((4 * abs_mips32(p0 - q0) + abs_mips32(p1 - q1)) > t) { |
82 return 0; | 85 return 0; |
83 } | 86 } |
84 return abs_mips32(p3 - p2) <= it && abs_mips32(p2 - p1) <= it && | 87 return abs_mips32(p3 - p2) <= it && abs_mips32(p2 - p1) <= it && |
85 abs_mips32(p1 - p0) <= it && abs_mips32(q3 - q2) <= it && | 88 abs_mips32(p1 - p0) <= it && abs_mips32(q3 - q2) <= it && |
86 abs_mips32(q2 - q1) <= it && abs_mips32(q1 - q0) <= it; | 89 abs_mips32(q2 - q1) <= it && abs_mips32(q1 - q0) <= it; |
87 } | 90 } |
88 | 91 |
89 static WEBP_INLINE void FilterLoop26(uint8_t* p, | 92 static WEBP_INLINE void FilterLoop26(uint8_t* p, |
90 int hstride, int vstride, int size, | 93 int hstride, int vstride, int size, |
91 int thresh, int ithresh, int hev_thresh) { | 94 int thresh, int ithresh, int hev_thresh) { |
| 95 const int thresh2 = 2 * thresh + 1; |
92 while (size-- > 0) { | 96 while (size-- > 0) { |
93 if (needs_filter2(p, hstride, thresh, ithresh)) { | 97 if (needs_filter2(p, hstride, thresh2, ithresh)) { |
94 if (hev(p, hstride, hev_thresh)) { | 98 if (hev(p, hstride, hev_thresh)) { |
95 do_filter2(p, hstride); | 99 do_filter2(p, hstride); |
96 } else { | 100 } else { |
97 do_filter6(p, hstride); | 101 do_filter6(p, hstride); |
98 } | 102 } |
99 } | 103 } |
100 p += vstride; | 104 p += vstride; |
101 } | 105 } |
102 } | 106 } |
103 | 107 |
104 static WEBP_INLINE void FilterLoop24(uint8_t* p, | 108 static WEBP_INLINE void FilterLoop24(uint8_t* p, |
105 int hstride, int vstride, int size, | 109 int hstride, int vstride, int size, |
106 int thresh, int ithresh, int hev_thresh) { | 110 int thresh, int ithresh, int hev_thresh) { |
| 111 const int thresh2 = 2 * thresh + 1; |
107 while (size-- > 0) { | 112 while (size-- > 0) { |
108 if (needs_filter2(p, hstride, thresh, ithresh)) { | 113 if (needs_filter2(p, hstride, thresh2, ithresh)) { |
109 if (hev(p, hstride, hev_thresh)) { | 114 if (hev(p, hstride, hev_thresh)) { |
110 do_filter2(p, hstride); | 115 do_filter2(p, hstride); |
111 } else { | 116 } else { |
112 do_filter4(p, hstride); | 117 do_filter4(p, hstride); |
113 } | 118 } |
114 } | 119 } |
115 p += vstride; | 120 p += vstride; |
116 } | 121 } |
117 } | 122 } |
118 | 123 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 p += 4; | 174 p += 4; |
170 FilterLoop24(p, 1, stride, 16, thresh, ithresh, hev_thresh); | 175 FilterLoop24(p, 1, stride, 16, thresh, ithresh, hev_thresh); |
171 } | 176 } |
172 } | 177 } |
173 | 178 |
174 //------------------------------------------------------------------------------ | 179 //------------------------------------------------------------------------------ |
175 // Simple In-loop filtering (Paragraph 15.2) | 180 // Simple In-loop filtering (Paragraph 15.2) |
176 | 181 |
177 static void SimpleVFilter16(uint8_t* p, int stride, int thresh) { | 182 static void SimpleVFilter16(uint8_t* p, int stride, int thresh) { |
178 int i; | 183 int i; |
| 184 const int thresh2 = 2 * thresh + 1; |
179 for (i = 0; i < 16; ++i) { | 185 for (i = 0; i < 16; ++i) { |
180 if (needs_filter(p + i, stride, thresh)) { | 186 if (needs_filter(p + i, stride, thresh2)) { |
181 do_filter2(p + i, stride); | 187 do_filter2(p + i, stride); |
182 } | 188 } |
183 } | 189 } |
184 } | 190 } |
185 | 191 |
186 static void SimpleHFilter16(uint8_t* p, int stride, int thresh) { | 192 static void SimpleHFilter16(uint8_t* p, int stride, int thresh) { |
187 int i; | 193 int i; |
| 194 const int thresh2 = 2 * thresh + 1; |
188 for (i = 0; i < 16; ++i) { | 195 for (i = 0; i < 16; ++i) { |
189 if (needs_filter(p + i * stride, 1, thresh)) { | 196 if (needs_filter(p + i * stride, 1, thresh2)) { |
190 do_filter2(p + i * stride, 1); | 197 do_filter2(p + i * stride, 1); |
191 } | 198 } |
192 } | 199 } |
193 } | 200 } |
194 | 201 |
195 static void SimpleVFilter16i(uint8_t* p, int stride, int thresh) { | 202 static void SimpleVFilter16i(uint8_t* p, int stride, int thresh) { |
196 int k; | 203 int k; |
197 for (k = 3; k > 0; --k) { | 204 for (k = 3; k > 0; --k) { |
198 p += 4 * stride; | 205 p += 4 * stride; |
199 SimpleVFilter16(p, stride, thresh); | 206 SimpleVFilter16(p, stride, thresh); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 "sra %[temp0], %[temp0], 3 \n\t" | 384 "sra %[temp0], %[temp0], 3 \n\t" |
378 "addu %[temp13], %[temp2], %[temp7] \n\t" | 385 "addu %[temp13], %[temp2], %[temp7] \n\t" |
379 "subu %[temp2], %[temp2], %[temp7] \n\t" | 386 "subu %[temp2], %[temp2], %[temp7] \n\t" |
380 "addu %[temp7], %[temp4], %[temp1] \n\t" | 387 "addu %[temp7], %[temp4], %[temp1] \n\t" |
381 "subu %[temp4], %[temp4], %[temp1] \n\t" | 388 "subu %[temp4], %[temp4], %[temp1] \n\t" |
382 "sra %[temp13], %[temp13], 3 \n\t" | 389 "sra %[temp13], %[temp13], 3 \n\t" |
383 "sra %[temp2], %[temp2], 3 \n\t" | 390 "sra %[temp2], %[temp2], 3 \n\t" |
384 "sra %[temp7], %[temp7], 3 \n\t" | 391 "sra %[temp7], %[temp7], 3 \n\t" |
385 "sra %[temp4], %[temp4], 3 \n\t" | 392 "sra %[temp4], %[temp4], 3 \n\t" |
386 "addiu %[temp6], $zero, 255 \n\t" | 393 "addiu %[temp6], $zero, 255 \n\t" |
387 "lbu %[temp1], 0(%[dst]) \n\t" | 394 "lbu %[temp1], 0+0*" XSTR(BPS) "(%[dst]) \n\t" |
388 "addu %[temp1], %[temp1], %[temp5] \n\t" | 395 "addu %[temp1], %[temp1], %[temp5] \n\t" |
389 "sra %[temp5], %[temp1], 8 \n\t" | 396 "sra %[temp5], %[temp1], 8 \n\t" |
390 "sra %[temp18], %[temp1], 31 \n\t" | 397 "sra %[temp18], %[temp1], 31 \n\t" |
391 "beqz %[temp5], 1f \n\t" | 398 "beqz %[temp5], 1f \n\t" |
392 "xor %[temp1], %[temp1], %[temp1] \n\t" | 399 "xor %[temp1], %[temp1], %[temp1] \n\t" |
393 "movz %[temp1], %[temp6], %[temp18] \n\t" | 400 "movz %[temp1], %[temp6], %[temp18] \n\t" |
394 "1: \n\t" | 401 "1: \n\t" |
395 "lbu %[temp18], 1(%[dst]) \n\t" | 402 "lbu %[temp18], 1+0*" XSTR(BPS) "(%[dst]) \n\t" |
396 "sb %[temp1], 0(%[dst]) \n\t" | 403 "sb %[temp1], 0+0*" XSTR(BPS) "(%[dst]) \n\t" |
397 "addu %[temp18], %[temp18], %[temp11] \n\t" | 404 "addu %[temp18], %[temp18], %[temp11] \n\t" |
398 "sra %[temp11], %[temp18], 8 \n\t" | 405 "sra %[temp11], %[temp18], 8 \n\t" |
399 "sra %[temp1], %[temp18], 31 \n\t" | 406 "sra %[temp1], %[temp18], 31 \n\t" |
400 "beqz %[temp11], 2f \n\t" | 407 "beqz %[temp11], 2f \n\t" |
401 "xor %[temp18], %[temp18], %[temp18] \n\t" | 408 "xor %[temp18], %[temp18], %[temp18] \n\t" |
402 "movz %[temp18], %[temp6], %[temp1] \n\t" | 409 "movz %[temp18], %[temp6], %[temp1] \n\t" |
403 "2: \n\t" | 410 "2: \n\t" |
404 "lbu %[temp1], 2(%[dst]) \n\t" | 411 "lbu %[temp1], 2+0*" XSTR(BPS) "(%[dst]) \n\t" |
405 "sb %[temp18], 1(%[dst]) \n\t" | 412 "sb %[temp18], 1+0*" XSTR(BPS) "(%[dst]) \n\t" |
406 "addu %[temp1], %[temp1], %[temp8] \n\t" | 413 "addu %[temp1], %[temp1], %[temp8] \n\t" |
407 "sra %[temp8], %[temp1], 8 \n\t" | 414 "sra %[temp8], %[temp1], 8 \n\t" |
408 "sra %[temp18], %[temp1], 31 \n\t" | 415 "sra %[temp18], %[temp1], 31 \n\t" |
409 "beqz %[temp8], 3f \n\t" | 416 "beqz %[temp8], 3f \n\t" |
410 "xor %[temp1], %[temp1], %[temp1] \n\t" | 417 "xor %[temp1], %[temp1], %[temp1] \n\t" |
411 "movz %[temp1], %[temp6], %[temp18] \n\t" | 418 "movz %[temp1], %[temp6], %[temp18] \n\t" |
412 "3: \n\t" | 419 "3: \n\t" |
413 "lbu %[temp18], 3(%[dst]) \n\t" | 420 "lbu %[temp18], 3+0*" XSTR(BPS) "(%[dst]) \n\t" |
414 "sb %[temp1], 2(%[dst]) \n\t" | 421 "sb %[temp1], 2+0*" XSTR(BPS) "(%[dst]) \n\t" |
415 "addu %[temp18], %[temp18], %[temp16] \n\t" | 422 "addu %[temp18], %[temp18], %[temp16] \n\t" |
416 "sra %[temp16], %[temp18], 8 \n\t" | 423 "sra %[temp16], %[temp18], 8 \n\t" |
417 "sra %[temp1], %[temp18], 31 \n\t" | 424 "sra %[temp1], %[temp18], 31 \n\t" |
418 "beqz %[temp16], 4f \n\t" | 425 "beqz %[temp16], 4f \n\t" |
419 "xor %[temp18], %[temp18], %[temp18] \n\t" | 426 "xor %[temp18], %[temp18], %[temp18] \n\t" |
420 "movz %[temp18], %[temp6], %[temp1] \n\t" | 427 "movz %[temp18], %[temp6], %[temp1] \n\t" |
421 "4: \n\t" | 428 "4: \n\t" |
422 "sb %[temp18], 3(%[dst]) \n\t" | 429 "sb %[temp18], 3+0*" XSTR(BPS) "(%[dst]) \n\t" |
423 "lbu %[temp5], 32(%[dst]) \n\t" | 430 "lbu %[temp5], 0+1*" XSTR(BPS) "(%[dst]) \n\t" |
424 "lbu %[temp8], 33(%[dst]) \n\t" | 431 "lbu %[temp8], 1+1*" XSTR(BPS) "(%[dst]) \n\t" |
425 "lbu %[temp11], 34(%[dst]) \n\t" | 432 "lbu %[temp11], 2+1*" XSTR(BPS) "(%[dst]) \n\t" |
426 "lbu %[temp16], 35(%[dst]) \n\t" | 433 "lbu %[temp16], 3+1*" XSTR(BPS) "(%[dst]) \n\t" |
427 "addu %[temp5], %[temp5], %[temp17] \n\t" | 434 "addu %[temp5], %[temp5], %[temp17] \n\t" |
428 "addu %[temp8], %[temp8], %[temp15] \n\t" | 435 "addu %[temp8], %[temp8], %[temp15] \n\t" |
429 "addu %[temp11], %[temp11], %[temp12] \n\t" | 436 "addu %[temp11], %[temp11], %[temp12] \n\t" |
430 "addu %[temp16], %[temp16], %[temp10] \n\t" | 437 "addu %[temp16], %[temp16], %[temp10] \n\t" |
431 "sra %[temp18], %[temp5], 8 \n\t" | 438 "sra %[temp18], %[temp5], 8 \n\t" |
432 "sra %[temp1], %[temp5], 31 \n\t" | 439 "sra %[temp1], %[temp5], 31 \n\t" |
433 "beqz %[temp18], 5f \n\t" | 440 "beqz %[temp18], 5f \n\t" |
434 "xor %[temp5], %[temp5], %[temp5] \n\t" | 441 "xor %[temp5], %[temp5], %[temp5] \n\t" |
435 "movz %[temp5], %[temp6], %[temp1] \n\t" | 442 "movz %[temp5], %[temp6], %[temp1] \n\t" |
436 "5: \n\t" | 443 "5: \n\t" |
437 "sra %[temp18], %[temp8], 8 \n\t" | 444 "sra %[temp18], %[temp8], 8 \n\t" |
438 "sra %[temp1], %[temp8], 31 \n\t" | 445 "sra %[temp1], %[temp8], 31 \n\t" |
439 "beqz %[temp18], 6f \n\t" | 446 "beqz %[temp18], 6f \n\t" |
440 "xor %[temp8], %[temp8], %[temp8] \n\t" | 447 "xor %[temp8], %[temp8], %[temp8] \n\t" |
441 "movz %[temp8], %[temp6], %[temp1] \n\t" | 448 "movz %[temp8], %[temp6], %[temp1] \n\t" |
442 "6: \n\t" | 449 "6: \n\t" |
443 "sra %[temp18], %[temp11], 8 \n\t" | 450 "sra %[temp18], %[temp11], 8 \n\t" |
444 "sra %[temp1], %[temp11], 31 \n\t" | 451 "sra %[temp1], %[temp11], 31 \n\t" |
445 "sra %[temp17], %[temp16], 8 \n\t" | 452 "sra %[temp17], %[temp16], 8 \n\t" |
446 "sra %[temp15], %[temp16], 31 \n\t" | 453 "sra %[temp15], %[temp16], 31 \n\t" |
447 "beqz %[temp18], 7f \n\t" | 454 "beqz %[temp18], 7f \n\t" |
448 "xor %[temp11], %[temp11], %[temp11] \n\t" | 455 "xor %[temp11], %[temp11], %[temp11] \n\t" |
449 "movz %[temp11], %[temp6], %[temp1] \n\t" | 456 "movz %[temp11], %[temp6], %[temp1] \n\t" |
450 "7: \n\t" | 457 "7: \n\t" |
451 "beqz %[temp17], 8f \n\t" | 458 "beqz %[temp17], 8f \n\t" |
452 "xor %[temp16], %[temp16], %[temp16] \n\t" | 459 "xor %[temp16], %[temp16], %[temp16] \n\t" |
453 "movz %[temp16], %[temp6], %[temp15] \n\t" | 460 "movz %[temp16], %[temp6], %[temp15] \n\t" |
454 "8: \n\t" | 461 "8: \n\t" |
455 "sb %[temp5], 32(%[dst]) \n\t" | 462 "sb %[temp5], 0+1*" XSTR(BPS) "(%[dst]) \n\t" |
456 "sb %[temp8], 33(%[dst]) \n\t" | 463 "sb %[temp8], 1+1*" XSTR(BPS) "(%[dst]) \n\t" |
457 "sb %[temp11], 34(%[dst]) \n\t" | 464 "sb %[temp11], 2+1*" XSTR(BPS) "(%[dst]) \n\t" |
458 "sb %[temp16], 35(%[dst]) \n\t" | 465 "sb %[temp16], 3+1*" XSTR(BPS) "(%[dst]) \n\t" |
459 "lbu %[temp5], 64(%[dst]) \n\t" | 466 "lbu %[temp5], 0+2*" XSTR(BPS) "(%[dst]) \n\t" |
460 "lbu %[temp8], 65(%[dst]) \n\t" | 467 "lbu %[temp8], 1+2*" XSTR(BPS) "(%[dst]) \n\t" |
461 "lbu %[temp11], 66(%[dst]) \n\t" | 468 "lbu %[temp11], 2+2*" XSTR(BPS) "(%[dst]) \n\t" |
462 "lbu %[temp16], 67(%[dst]) \n\t" | 469 "lbu %[temp16], 3+2*" XSTR(BPS) "(%[dst]) \n\t" |
463 "addu %[temp5], %[temp5], %[temp9] \n\t" | 470 "addu %[temp5], %[temp5], %[temp9] \n\t" |
464 "addu %[temp8], %[temp8], %[temp3] \n\t" | 471 "addu %[temp8], %[temp8], %[temp3] \n\t" |
465 "addu %[temp11], %[temp11], %[temp0] \n\t" | 472 "addu %[temp11], %[temp11], %[temp0] \n\t" |
466 "addu %[temp16], %[temp16], %[temp14] \n\t" | 473 "addu %[temp16], %[temp16], %[temp14] \n\t" |
467 "sra %[temp18], %[temp5], 8 \n\t" | 474 "sra %[temp18], %[temp5], 8 \n\t" |
468 "sra %[temp1], %[temp5], 31 \n\t" | 475 "sra %[temp1], %[temp5], 31 \n\t" |
469 "sra %[temp17], %[temp8], 8 \n\t" | 476 "sra %[temp17], %[temp8], 8 \n\t" |
470 "sra %[temp15], %[temp8], 31 \n\t" | 477 "sra %[temp15], %[temp8], 31 \n\t" |
471 "sra %[temp12], %[temp11], 8 \n\t" | 478 "sra %[temp12], %[temp11], 8 \n\t" |
472 "sra %[temp10], %[temp11], 31 \n\t" | 479 "sra %[temp10], %[temp11], 31 \n\t" |
473 "sra %[temp9], %[temp16], 8 \n\t" | 480 "sra %[temp9], %[temp16], 8 \n\t" |
474 "sra %[temp3], %[temp16], 31 \n\t" | 481 "sra %[temp3], %[temp16], 31 \n\t" |
475 "beqz %[temp18], 9f \n\t" | 482 "beqz %[temp18], 9f \n\t" |
476 "xor %[temp5], %[temp5], %[temp5] \n\t" | 483 "xor %[temp5], %[temp5], %[temp5] \n\t" |
477 "movz %[temp5], %[temp6], %[temp1] \n\t" | 484 "movz %[temp5], %[temp6], %[temp1] \n\t" |
478 "9: \n\t" | 485 "9: \n\t" |
479 "beqz %[temp17], 10f \n\t" | 486 "beqz %[temp17], 10f \n\t" |
480 "xor %[temp8], %[temp8], %[temp8] \n\t" | 487 "xor %[temp8], %[temp8], %[temp8] \n\t" |
481 "movz %[temp8], %[temp6], %[temp15] \n\t" | 488 "movz %[temp8], %[temp6], %[temp15] \n\t" |
482 "10: \n\t" | 489 "10: \n\t" |
483 "beqz %[temp12], 11f \n\t" | 490 "beqz %[temp12], 11f \n\t" |
484 "xor %[temp11], %[temp11], %[temp11] \n\t" | 491 "xor %[temp11], %[temp11], %[temp11] \n\t" |
485 "movz %[temp11], %[temp6], %[temp10] \n\t" | 492 "movz %[temp11], %[temp6], %[temp10] \n\t" |
486 "11: \n\t" | 493 "11: \n\t" |
487 "beqz %[temp9], 12f \n\t" | 494 "beqz %[temp9], 12f \n\t" |
488 "xor %[temp16], %[temp16], %[temp16] \n\t" | 495 "xor %[temp16], %[temp16], %[temp16] \n\t" |
489 "movz %[temp16], %[temp6], %[temp3] \n\t" | 496 "movz %[temp16], %[temp6], %[temp3] \n\t" |
490 "12: \n\t" | 497 "12: \n\t" |
491 "sb %[temp5], 64(%[dst]) \n\t" | 498 "sb %[temp5], 0+2*" XSTR(BPS) "(%[dst]) \n\t" |
492 "sb %[temp8], 65(%[dst]) \n\t" | 499 "sb %[temp8], 1+2*" XSTR(BPS) "(%[dst]) \n\t" |
493 "sb %[temp11], 66(%[dst]) \n\t" | 500 "sb %[temp11], 2+2*" XSTR(BPS) "(%[dst]) \n\t" |
494 "sb %[temp16], 67(%[dst]) \n\t" | 501 "sb %[temp16], 3+2*" XSTR(BPS) "(%[dst]) \n\t" |
495 "lbu %[temp5], 96(%[dst]) \n\t" | 502 "lbu %[temp5], 0+3*" XSTR(BPS) "(%[dst]) \n\t" |
496 "lbu %[temp8], 97(%[dst]) \n\t" | 503 "lbu %[temp8], 1+3*" XSTR(BPS) "(%[dst]) \n\t" |
497 "lbu %[temp11], 98(%[dst]) \n\t" | 504 "lbu %[temp11], 2+3*" XSTR(BPS) "(%[dst]) \n\t" |
498 "lbu %[temp16], 99(%[dst]) \n\t" | 505 "lbu %[temp16], 3+3*" XSTR(BPS) "(%[dst]) \n\t" |
499 "addu %[temp5], %[temp5], %[temp13] \n\t" | 506 "addu %[temp5], %[temp5], %[temp13] \n\t" |
500 "addu %[temp8], %[temp8], %[temp7] \n\t" | 507 "addu %[temp8], %[temp8], %[temp7] \n\t" |
501 "addu %[temp11], %[temp11], %[temp4] \n\t" | 508 "addu %[temp11], %[temp11], %[temp4] \n\t" |
502 "addu %[temp16], %[temp16], %[temp2] \n\t" | 509 "addu %[temp16], %[temp16], %[temp2] \n\t" |
503 "sra %[temp18], %[temp5], 8 \n\t" | 510 "sra %[temp18], %[temp5], 8 \n\t" |
504 "sra %[temp1], %[temp5], 31 \n\t" | 511 "sra %[temp1], %[temp5], 31 \n\t" |
505 "sra %[temp17], %[temp8], 8 \n\t" | 512 "sra %[temp17], %[temp8], 8 \n\t" |
506 "sra %[temp15], %[temp8], 31 \n\t" | 513 "sra %[temp15], %[temp8], 31 \n\t" |
507 "sra %[temp12], %[temp11], 8 \n\t" | 514 "sra %[temp12], %[temp11], 8 \n\t" |
508 "sra %[temp10], %[temp11], 31 \n\t" | 515 "sra %[temp10], %[temp11], 31 \n\t" |
509 "sra %[temp9], %[temp16], 8 \n\t" | 516 "sra %[temp9], %[temp16], 8 \n\t" |
510 "sra %[temp3], %[temp16], 31 \n\t" | 517 "sra %[temp3], %[temp16], 31 \n\t" |
511 "beqz %[temp18], 13f \n\t" | 518 "beqz %[temp18], 13f \n\t" |
512 "xor %[temp5], %[temp5], %[temp5] \n\t" | 519 "xor %[temp5], %[temp5], %[temp5] \n\t" |
513 "movz %[temp5], %[temp6], %[temp1] \n\t" | 520 "movz %[temp5], %[temp6], %[temp1] \n\t" |
514 "13: \n\t" | 521 "13: \n\t" |
515 "beqz %[temp17], 14f \n\t" | 522 "beqz %[temp17], 14f \n\t" |
516 "xor %[temp8], %[temp8], %[temp8] \n\t" | 523 "xor %[temp8], %[temp8], %[temp8] \n\t" |
517 "movz %[temp8], %[temp6], %[temp15] \n\t" | 524 "movz %[temp8], %[temp6], %[temp15] \n\t" |
518 "14: \n\t" | 525 "14: \n\t" |
519 "beqz %[temp12], 15f \n\t" | 526 "beqz %[temp12], 15f \n\t" |
520 "xor %[temp11], %[temp11], %[temp11] \n\t" | 527 "xor %[temp11], %[temp11], %[temp11] \n\t" |
521 "movz %[temp11], %[temp6], %[temp10] \n\t" | 528 "movz %[temp11], %[temp6], %[temp10] \n\t" |
522 "15: \n\t" | 529 "15: \n\t" |
523 "beqz %[temp9], 16f \n\t" | 530 "beqz %[temp9], 16f \n\t" |
524 "xor %[temp16], %[temp16], %[temp16] \n\t" | 531 "xor %[temp16], %[temp16], %[temp16] \n\t" |
525 "movz %[temp16], %[temp6], %[temp3] \n\t" | 532 "movz %[temp16], %[temp6], %[temp3] \n\t" |
526 "16: \n\t" | 533 "16: \n\t" |
527 "sb %[temp5], 96(%[dst]) \n\t" | 534 "sb %[temp5], 0+3*" XSTR(BPS) "(%[dst]) \n\t" |
528 "sb %[temp8], 97(%[dst]) \n\t" | 535 "sb %[temp8], 1+3*" XSTR(BPS) "(%[dst]) \n\t" |
529 "sb %[temp11], 98(%[dst]) \n\t" | 536 "sb %[temp11], 2+3*" XSTR(BPS) "(%[dst]) \n\t" |
530 "sb %[temp16], 99(%[dst]) \n\t" | 537 "sb %[temp16], 3+3*" XSTR(BPS) "(%[dst]) \n\t" |
531 | 538 |
532 : [temp0]"=&r"(temp0), [temp1]"=&r"(temp1), [temp2]"=&r"(temp2), | 539 : [temp0]"=&r"(temp0), [temp1]"=&r"(temp1), [temp2]"=&r"(temp2), |
533 [temp3]"=&r"(temp3), [temp4]"=&r"(temp4), [temp5]"=&r"(temp5), | 540 [temp3]"=&r"(temp3), [temp4]"=&r"(temp4), [temp5]"=&r"(temp5), |
534 [temp6]"=&r"(temp6), [temp7]"=&r"(temp7), [temp8]"=&r"(temp8), | 541 [temp6]"=&r"(temp6), [temp7]"=&r"(temp7), [temp8]"=&r"(temp8), |
535 [temp9]"=&r"(temp9), [temp10]"=&r"(temp10), [temp11]"=&r"(temp11), | 542 [temp9]"=&r"(temp9), [temp10]"=&r"(temp10), [temp11]"=&r"(temp11), |
536 [temp12]"=&r"(temp12), [temp13]"=&r"(temp13), [temp14]"=&r"(temp14), | 543 [temp12]"=&r"(temp12), [temp13]"=&r"(temp13), [temp14]"=&r"(temp14), |
537 [temp15]"=&r"(temp15), [temp16]"=&r"(temp16), [temp17]"=&r"(temp17), | 544 [temp15]"=&r"(temp15), [temp16]"=&r"(temp16), [temp17]"=&r"(temp17), |
538 [temp18]"=&r"(temp18) | 545 [temp18]"=&r"(temp18) |
539 : [in]"r"(p_in), [kC1]"r"(kC1), [kC2]"r"(kC2), [dst]"r"(dst) | 546 : [in]"r"(p_in), [kC1]"r"(kC1), [kC2]"r"(kC2), [dst]"r"(dst) |
540 : "memory", "hi", "lo" | 547 : "memory", "hi", "lo" |
541 ); | 548 ); |
542 } | 549 } |
543 | 550 |
544 static void TransformTwo(const int16_t* in, uint8_t* dst, int do_two) { | 551 static void TransformTwo(const int16_t* in, uint8_t* dst, int do_two) { |
545 TransformOne(in, dst); | 552 TransformOne(in, dst); |
546 if (do_two) { | 553 if (do_two) { |
547 TransformOne(in + 16, dst + 4); | 554 TransformOne(in + 16, dst + 4); |
548 } | 555 } |
549 } | 556 } |
550 | 557 |
551 #endif // WEBP_USE_MIPS32 | |
552 | |
553 //------------------------------------------------------------------------------ | 558 //------------------------------------------------------------------------------ |
554 // Entry point | 559 // Entry point |
555 | 560 |
556 extern void VP8DspInitMIPS32(void); | 561 extern void VP8DspInitMIPS32(void); |
557 | 562 |
558 void VP8DspInitMIPS32(void) { | 563 WEBP_TSAN_IGNORE_FUNCTION void VP8DspInitMIPS32(void) { |
559 #if defined(WEBP_USE_MIPS32) | |
560 VP8InitClipTables(); | 564 VP8InitClipTables(); |
561 | 565 |
562 VP8Transform = TransformTwo; | 566 VP8Transform = TransformTwo; |
563 | 567 |
564 VP8VFilter16 = VFilter16; | 568 VP8VFilter16 = VFilter16; |
565 VP8HFilter16 = HFilter16; | 569 VP8HFilter16 = HFilter16; |
566 VP8VFilter8 = VFilter8; | 570 VP8VFilter8 = VFilter8; |
567 VP8HFilter8 = HFilter8; | 571 VP8HFilter8 = HFilter8; |
568 VP8VFilter16i = VFilter16i; | 572 VP8VFilter16i = VFilter16i; |
569 VP8HFilter16i = HFilter16i; | 573 VP8HFilter16i = HFilter16i; |
570 VP8VFilter8i = VFilter8i; | 574 VP8VFilter8i = VFilter8i; |
571 VP8HFilter8i = HFilter8i; | 575 VP8HFilter8i = HFilter8i; |
572 | 576 |
573 VP8SimpleVFilter16 = SimpleVFilter16; | 577 VP8SimpleVFilter16 = SimpleVFilter16; |
574 VP8SimpleHFilter16 = SimpleHFilter16; | 578 VP8SimpleHFilter16 = SimpleHFilter16; |
575 VP8SimpleVFilter16i = SimpleVFilter16i; | 579 VP8SimpleVFilter16i = SimpleVFilter16i; |
576 VP8SimpleHFilter16i = SimpleHFilter16i; | 580 VP8SimpleHFilter16i = SimpleHFilter16i; |
| 581 } |
| 582 |
| 583 #else // !WEBP_USE_MIPS32 |
| 584 |
| 585 WEBP_DSP_INIT_STUB(VP8DspInitMIPS32) |
| 586 |
577 #endif // WEBP_USE_MIPS32 | 587 #endif // WEBP_USE_MIPS32 |
578 } | |
OLD | NEW |