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 // YUV to RGB upsampling functions. | 10 // 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 // TODO(djordje.pesut): adapt the code to reflect the C-version. | |
19 #if 0 // defined(WEBP_USE_MIPS_DSP_R2) | |
20 | 18 |
21 #include <assert.h> | 19 #include <assert.h> |
22 #include "./yuv.h" | 20 #include "./yuv.h" |
23 | 21 |
24 #if !defined(WEBP_YUV_USE_TABLE) | 22 #if !defined(WEBP_YUV_USE_TABLE) |
25 | 23 |
26 #define YUV_TO_RGB(Y, U, V, R, G, B) do { \ | 24 #define YUV_TO_RGB(Y, U, V, R, G, B) do { \ |
27 const int t1 = kYScale * Y; \ | 25 const int t1 = MultHi(Y, 19077); \ |
28 const int t2 = kVToG * V; \ | 26 const int t2 = MultHi(V, 13320); \ |
29 R = kVToR * V; \ | 27 R = MultHi(V, 26149); \ |
30 G = kUToG * U; \ | 28 G = MultHi(U, 6419); \ |
31 B = kUToB * U; \ | 29 B = MultHi(U, 33050); \ |
32 R = t1 + R; \ | 30 R = t1 + R; \ |
33 G = t1 - G; \ | 31 G = t1 - G; \ |
34 B = t1 + B; \ | 32 B = t1 + B; \ |
35 R = R + kRCst; \ | 33 R = R - 14234; \ |
36 G = G - t2 + kGCst; \ | 34 G = G - t2 + 8708; \ |
37 B = B + kBCst; \ | 35 B = B - 17685; \ |
38 __asm__ volatile ( \ | 36 __asm__ volatile ( \ |
39 "shll_s.w %[" #R "], %[" #R "], 9 \n\t" \ | 37 "shll_s.w %[" #R "], %[" #R "], 17 \n\t" \ |
40 "shll_s.w %[" #G "], %[" #G "], 9 \n\t" \ | 38 "shll_s.w %[" #G "], %[" #G "], 17 \n\t" \ |
41 "shll_s.w %[" #B "], %[" #B "], 9 \n\t" \ | 39 "shll_s.w %[" #B "], %[" #B "], 17 \n\t" \ |
42 "precrqu_s.qb.ph %[" #R "], %[" #R "], $zero \n\t" \ | 40 "precrqu_s.qb.ph %[" #R "], %[" #R "], $zero \n\t" \ |
43 "precrqu_s.qb.ph %[" #G "], %[" #G "], $zero \n\t" \ | 41 "precrqu_s.qb.ph %[" #G "], %[" #G "], $zero \n\t" \ |
44 "precrqu_s.qb.ph %[" #B "], %[" #B "], $zero \n\t" \ | 42 "precrqu_s.qb.ph %[" #B "], %[" #B "], $zero \n\t" \ |
45 "srl %[" #R "], %[" #R "], 24 \n\t" \ | 43 "srl %[" #R "], %[" #R "], 24 \n\t" \ |
46 "srl %[" #G "], %[" #G "], 24 \n\t" \ | 44 "srl %[" #G "], %[" #G "], 24 \n\t" \ |
47 "srl %[" #B "], %[" #B "], 24 \n\t" \ | 45 "srl %[" #B "], %[" #B "], 24 \n\t" \ |
48 : [R]"+r"(R), [G]"+r"(G), [B]"+r"(B) \ | 46 : [R]"+r"(R), [G]"+r"(G), [B]"+r"(B) \ |
49 : \ | 47 : \ |
50 ); \ | 48 ); \ |
51 } while (0) | 49 } while (0) |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 WebPYUV444Converters[MODE_Argb] = Yuv444ToArgb; | 270 WebPYUV444Converters[MODE_Argb] = Yuv444ToArgb; |
273 WebPYUV444Converters[MODE_rgbA_4444] = Yuv444ToRgba4444; | 271 WebPYUV444Converters[MODE_rgbA_4444] = Yuv444ToRgba4444; |
274 } | 272 } |
275 | 273 |
276 #else // !WEBP_USE_MIPS_DSP_R2 | 274 #else // !WEBP_USE_MIPS_DSP_R2 |
277 | 275 |
278 WEBP_DSP_INIT_STUB(WebPInitYUV444ConvertersMIPSdspR2) | 276 WEBP_DSP_INIT_STUB(WebPInitYUV444ConvertersMIPSdspR2) |
279 | 277 |
280 #endif // WEBP_USE_MIPS_DSP_R2 | 278 #endif // WEBP_USE_MIPS_DSP_R2 |
281 | 279 |
282 #if 1 // !(defined(FANCY_UPSAMPLING) && defined(WEBP_USE_MIPS_DSP_R2)) | 280 #if !(defined(FANCY_UPSAMPLING) && defined(WEBP_USE_MIPS_DSP_R2)) |
283 WEBP_DSP_INIT_STUB(WebPInitUpsamplersMIPSdspR2) | 281 WEBP_DSP_INIT_STUB(WebPInitUpsamplersMIPSdspR2) |
284 #endif | 282 #endif |
OLD | NEW |