Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: third_party/libwebp/dsp/yuv_mips_dsp_r2.c

Issue 2149863002: libwebp: update to v0.5.1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libwebp/dsp/yuv_mips32.c ('k') | third_party/libwebp/enc/alpha.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 DSPr2 version of YUV to RGB upsampling functions. 10 // MIPS DSPr2 version of YUV to RGB upsampling functions.
11 // 11 //
12 // Author(s): Branimir Vasic (branimir.vasic@imgtec.com) 12 // Author(s): Branimir Vasic (branimir.vasic@imgtec.com)
13 // Djordje Pesut (djordje.pesut@imgtec.com) 13 // Djordje Pesut (djordje.pesut@imgtec.com)
14 14
15 #include "./dsp.h" 15 #include "./dsp.h"
16 16
17 // Code is disabled for now, in favor of the plain-C version 17 #if defined(WEBP_USE_MIPS_DSP_R2)
18 #if 0 // defined(WEBP_USE_MIPS_DSP_R2)
19 18
20 #include "./yuv.h" 19 #include "./yuv.h"
21 20
22 //------------------------------------------------------------------------------ 21 //------------------------------------------------------------------------------
23 // simple point-sampling 22 // simple point-sampling
24 23
25 #define ROW_FUNC_PART_1() \ 24 #define ROW_FUNC_PART_1() \
26 "lbu %[temp3], 0(%[v]) \n\t" \ 25 "lbu %[temp3], 0(%[v]) \n\t" \
27 "lbu %[temp4], 0(%[u]) \n\t" \ 26 "lbu %[temp4], 0(%[u]) \n\t" \
28 "lbu %[temp0], 0(%[y]) \n\t" \ 27 "lbu %[temp0], 0(%[y]) \n\t" \
29 "mul %[temp1], %[t_con_1], %[temp3] \n\t" \ 28 "mul %[temp1], %[t_con_1], %[temp3] \n\t" \
30 "mul %[temp3], %[t_con_2], %[temp3] \n\t" \ 29 "mul %[temp3], %[t_con_2], %[temp3] \n\t" \
31 "mul %[temp2], %[t_con_3], %[temp4] \n\t" \ 30 "mul %[temp2], %[t_con_3], %[temp4] \n\t" \
32 "mul %[temp4], %[t_con_4], %[temp4] \n\t" \ 31 "mul %[temp4], %[t_con_4], %[temp4] \n\t" \
33 "mul %[temp0], %[t_con_5], %[temp0] \n\t" \ 32 "mul %[temp0], %[t_con_5], %[temp0] \n\t" \
34 "addu %[temp1], %[temp1], %[t_con_6] \n\t" \ 33 "subu %[temp1], %[temp1], %[t_con_6] \n\t" \
35 "subu %[temp3], %[temp3], %[t_con_7] \n\t" \ 34 "subu %[temp3], %[temp3], %[t_con_7] \n\t" \
36 "addu %[temp2], %[temp2], %[temp3] \n\t" \ 35 "addu %[temp2], %[temp2], %[temp3] \n\t" \
37 "addu %[temp4], %[temp4], %[t_con_8] \n\t" \ 36 "subu %[temp4], %[temp4], %[t_con_8] \n\t" \
38 37
39 #define ROW_FUNC_PART_2(R, G, B, K) \ 38 #define ROW_FUNC_PART_2(R, G, B, K) \
40 "addu %[temp5], %[temp0], %[temp1] \n\t" \ 39 "addu %[temp5], %[temp0], %[temp1] \n\t" \
41 "subu %[temp6], %[temp0], %[temp2] \n\t" \ 40 "subu %[temp6], %[temp0], %[temp2] \n\t" \
42 "addu %[temp7], %[temp0], %[temp4] \n\t" \ 41 "addu %[temp7], %[temp0], %[temp4] \n\t" \
43 ".if " #K " \n\t" \ 42 ".if " #K " \n\t" \
44 "lbu %[temp0], 1(%[y]) \n\t" \ 43 "lbu %[temp0], 1(%[y]) \n\t" \
45 ".endif \n\t" \ 44 ".endif \n\t" \
46 "shll_s.w %[temp5], %[temp5], 9 \n\t" \ 45 "shll_s.w %[temp5], %[temp5], 17 \n\t" \
47 "shll_s.w %[temp6], %[temp6], 9 \n\t" \ 46 "shll_s.w %[temp6], %[temp6], 17 \n\t" \
48 ".if " #K " \n\t" \ 47 ".if " #K " \n\t" \
49 "mul %[temp0], %[t_con_5], %[temp0] \n\t" \ 48 "mul %[temp0], %[t_con_5], %[temp0] \n\t" \
50 ".endif \n\t" \ 49 ".endif \n\t" \
51 "shll_s.w %[temp7], %[temp7], 9 \n\t" \ 50 "shll_s.w %[temp7], %[temp7], 17 \n\t" \
52 "precrqu_s.qb.ph %[temp5], %[temp5], $zero \n\t" \ 51 "precrqu_s.qb.ph %[temp5], %[temp5], $zero \n\t" \
53 "precrqu_s.qb.ph %[temp6], %[temp6], $zero \n\t" \ 52 "precrqu_s.qb.ph %[temp6], %[temp6], $zero \n\t" \
54 "precrqu_s.qb.ph %[temp7], %[temp7], $zero \n\t" \ 53 "precrqu_s.qb.ph %[temp7], %[temp7], $zero \n\t" \
55 "srl %[temp5], %[temp5], 24 \n\t" \ 54 "srl %[temp5], %[temp5], 24 \n\t" \
56 "srl %[temp6], %[temp6], 24 \n\t" \ 55 "srl %[temp6], %[temp6], 24 \n\t" \
57 "srl %[temp7], %[temp7], 24 \n\t" \ 56 "srl %[temp7], %[temp7], 24 \n\t" \
58 "sb %[temp5], " #R "(%[dst]) \n\t" \ 57 "sb %[temp5], " #R "(%[dst]) \n\t" \
59 "sb %[temp6], " #G "(%[dst]) \n\t" \ 58 "sb %[temp6], " #G "(%[dst]) \n\t" \
60 "sb %[temp7], " #B "(%[dst]) \n\t" \ 59 "sb %[temp7], " #B "(%[dst]) \n\t" \
61 60
62 #define ASM_CLOBBER_LIST() \ 61 #define ASM_CLOBBER_LIST() \
63 : [temp0]"=&r"(temp0), [temp1]"=&r"(temp1), [temp2]"=&r"(temp2), \ 62 : [temp0]"=&r"(temp0), [temp1]"=&r"(temp1), [temp2]"=&r"(temp2), \
64 [temp3]"=&r"(temp3), [temp4]"=&r"(temp4), [temp5]"=&r"(temp5), \ 63 [temp3]"=&r"(temp3), [temp4]"=&r"(temp4), [temp5]"=&r"(temp5), \
65 [temp6]"=&r"(temp6), [temp7]"=&r"(temp7) \ 64 [temp6]"=&r"(temp6), [temp7]"=&r"(temp7) \
66 : [t_con_1]"r"(t_con_1), [t_con_2]"r"(t_con_2), [t_con_3]"r"(t_con_3), \ 65 : [t_con_1]"r"(t_con_1), [t_con_2]"r"(t_con_2), [t_con_3]"r"(t_con_3), \
67 [t_con_4]"r"(t_con_4), [t_con_5]"r"(t_con_5), [t_con_6]"r"(t_con_6), \ 66 [t_con_4]"r"(t_con_4), [t_con_5]"r"(t_con_5), [t_con_6]"r"(t_con_6), \
68 [u]"r"(u), [v]"r"(v), [y]"r"(y), [dst]"r"(dst), \ 67 [u]"r"(u), [v]"r"(v), [y]"r"(y), [dst]"r"(dst), \
69 [t_con_7]"r"(t_con_7), [t_con_8]"r"(t_con_8) \ 68 [t_con_7]"r"(t_con_7), [t_con_8]"r"(t_con_8) \
70 : "memory", "hi", "lo" \ 69 : "memory", "hi", "lo" \
71 70
72 #define ROW_FUNC(FUNC_NAME, XSTEP, R, G, B, A) \ 71 #define ROW_FUNC(FUNC_NAME, XSTEP, R, G, B, A) \
73 static void FUNC_NAME(const uint8_t* y, \ 72 static void FUNC_NAME(const uint8_t* y, \
74 const uint8_t* u, const uint8_t* v, \ 73 const uint8_t* u, const uint8_t* v, \
75 uint8_t* dst, int len) { \ 74 uint8_t* dst, int len) { \
76 int i; \ 75 int i; \
77 uint32_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; \ 76 uint32_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; \
78 const int t_con_1 = kVToR; \ 77 const int t_con_1 = 26149; \
79 const int t_con_2 = kVToG; \ 78 const int t_con_2 = 13320; \
80 const int t_con_3 = kUToG; \ 79 const int t_con_3 = 6419; \
81 const int t_con_4 = kUToB; \ 80 const int t_con_4 = 33050; \
82 const int t_con_5 = kYScale; \ 81 const int t_con_5 = 19077; \
83 const int t_con_6 = kRCst; \ 82 const int t_con_6 = 14234; \
84 const int t_con_7 = kGCst; \ 83 const int t_con_7 = 8708; \
85 const int t_con_8 = kBCst; \ 84 const int t_con_8 = 17685; \
86 for (i = 0; i < (len >> 1); i++) { \ 85 for (i = 0; i < (len >> 1); i++) { \
87 __asm__ volatile ( \ 86 __asm__ volatile ( \
88 ROW_FUNC_PART_1() \ 87 ROW_FUNC_PART_1() \
89 ROW_FUNC_PART_2(R, G, B, 1) \ 88 ROW_FUNC_PART_2(R, G, B, 1) \
90 ROW_FUNC_PART_2(R + XSTEP, G + XSTEP, B + XSTEP, 0) \ 89 ROW_FUNC_PART_2(R + XSTEP, G + XSTEP, B + XSTEP, 0) \
91 ASM_CLOBBER_LIST() \ 90 ASM_CLOBBER_LIST() \
92 ); \ 91 ); \
93 if (A) dst[A] = dst[A + XSTEP] = 0xff; \ 92 if (A) dst[A] = dst[A + XSTEP] = 0xff; \
94 y += 2; \ 93 y += 2; \
95 ++u; \ 94 ++u; \
(...skipping 30 matching lines...) Expand all
126 WebPSamplers[MODE_RGBA] = YuvToRgbaRow; 125 WebPSamplers[MODE_RGBA] = YuvToRgbaRow;
127 WebPSamplers[MODE_BGR] = YuvToBgrRow; 126 WebPSamplers[MODE_BGR] = YuvToBgrRow;
128 WebPSamplers[MODE_BGRA] = YuvToBgraRow; 127 WebPSamplers[MODE_BGRA] = YuvToBgraRow;
129 } 128 }
130 129
131 #else // !WEBP_USE_MIPS_DSP_R2 130 #else // !WEBP_USE_MIPS_DSP_R2
132 131
133 WEBP_DSP_INIT_STUB(WebPInitSamplersMIPSdspR2) 132 WEBP_DSP_INIT_STUB(WebPInitSamplersMIPSdspR2)
134 133
135 #endif // WEBP_USE_MIPS_DSP_R2 134 #endif // WEBP_USE_MIPS_DSP_R2
OLDNEW
« no previous file with comments | « third_party/libwebp/dsp/yuv_mips32.c ('k') | third_party/libwebp/enc/alpha.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698