1 // Copyright 2014 Google Inc. All Rights Reserved.
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
5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS. All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree.
8 // -----------------------------------------------------------------------------
10 // MIPS version of YUV to RGB upsampling functions.
12 // Author(s): Djordje Pesut (djordje.pesut@imgtec.com)
13 // Jovan Zelincevic (jovan.zelincevic@imgtec.com)
17 #if defined(WEBP_USE_MIPS32)
21 //------------------------------------------------------------------------------
22 // simple point-sampling
24 #define ROW_FUNC(FUNC_NAME, XSTEP, R, G, B, A) \
25 static void FUNC_NAME(const uint8_t* y, \
26 const uint8_t* u, const uint8_t* v, \
27 uint8_t* dst, int len) { \
29 int temp0, temp1, temp2, temp3, temp4; \
30 for (i = 0; i < (len >> 1); i++) { \
31 temp1 = kVToR * v[0]; \
32 temp3 = kVToG * v[0]; \
33 temp2 = kUToG * u[0]; \
34 temp4 = kUToB * u[0]; \
35 temp0 = kYScale * y[0]; \
40 r = VP8Clip8(temp0 + temp1); \
41 g = VP8Clip8(temp0 - temp2); \
42 b = VP8Clip8(temp0 + temp4); \
43 temp0 = kYScale * y[1]; \
47 if (A) dst[A] = 0xff; \
48 r = VP8Clip8(temp0 + temp1); \
49 g = VP8Clip8(temp0 - temp2); \
50 b = VP8Clip8(temp0 + temp4); \
54 if (A) dst[A + XSTEP] = 0xff; \
61 temp1 = kVToR * v[0]; \
62 temp3 = kVToG * v[0]; \
63 temp2 = kUToG * u[0]; \
64 temp4 = kUToB * u[0]; \
65 temp0 = kYScale * y[0]; \
70 r = VP8Clip8(temp0 + temp1); \
71 g = VP8Clip8(temp0 - temp2); \
72 b = VP8Clip8(temp0 + temp4); \
76 if (A) dst[A] = 0xff; \
80 ROW_FUNC(YuvToRgbRow
, 3, 0, 1, 2, 0)
81 ROW_FUNC(YuvToRgbaRow
, 4, 0, 1, 2, 3)
82 ROW_FUNC(YuvToBgrRow
, 3, 2, 1, 0, 0)
83 ROW_FUNC(YuvToBgraRow
, 4, 2, 1, 0, 3)
87 #endif // WEBP_USE_MIPS32
89 //------------------------------------------------------------------------------
91 extern void WebPInitSamplersMIPS32(void);
93 void WebPInitSamplersMIPS32(void) {
94 #if defined(WEBP_USE_MIPS32)
95 WebPSamplers
[MODE_RGB
] = YuvToRgbRow
;
96 WebPSamplers
[MODE_RGBA
] = YuvToRgbaRow
;
97 WebPSamplers
[MODE_BGR
] = YuvToBgrRow
;
98 WebPSamplers
[MODE_BGRA
] = YuvToBgraRow
;
99 #endif // WEBP_USE_MIPS32