1 // Copyright 2014 Google Inc. All Rights Reserved. 2 // 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 // ----------------------------------------------------------------------------- 9 // 10 // MIPS version of YUV to RGB upsampling functions. 11 // 12 // Author(s): Djordje Pesut (djordje.pesut@imgtec.com) 13 // Jovan Zelincevic (jovan.zelincevic@imgtec.com) 14 15 #include "./dsp.h" 16 17 // Code is disabled for now, in favor of the plain-C version 18 #if 0 // defined(WEBP_USE_MIPS32) 19 20 #include "./yuv.h" 21 22 //------------------------------------------------------------------------------ 23 // simple point-sampling 24 25 #define ROW_FUNC(FUNC_NAME, XSTEP, R, G, B, A) \ 26 static void FUNC_NAME(const uint8_t* y, \ 27 const uint8_t* u, const uint8_t* v, \ 28 uint8_t* dst, int len) { \ 29 int i, r, g, b; \ 30 int temp0, temp1, temp2, temp3, temp4; \ 31 for (i = 0; i < (len >> 1); i++) { \ 32 temp1 = kVToR * v[0]; \ 33 temp3 = kVToG * v[0]; \ 34 temp2 = kUToG * u[0]; \ 35 temp4 = kUToB * u[0]; \ 36 temp0 = kYScale * y[0]; \ 37 temp1 += kRCst; \ 38 temp3 -= kGCst; \ 39 temp2 += temp3; \ 40 temp4 += kBCst; \ 41 r = VP8Clip8(temp0 + temp1); \ 42 g = VP8Clip8(temp0 - temp2); \ 43 b = VP8Clip8(temp0 + temp4); \ 44 temp0 = kYScale * y[1]; \ 45 dst[R] = r; \ 46 dst[G] = g; \ 47 dst[B] = b; \ 48 if (A) dst[A] = 0xff; \ 49 r = VP8Clip8(temp0 + temp1); \ 50 g = VP8Clip8(temp0 - temp2); \ 51 b = VP8Clip8(temp0 + temp4); \ 52 dst[R + XSTEP] = r; \ 53 dst[G + XSTEP] = g; \ 54 dst[B + XSTEP] = b; \ 55 if (A) dst[A + XSTEP] = 0xff; \ 56 y += 2; \ 57 ++u; \ 58 ++v; \ 59 dst += 2 * XSTEP; \ 60 } \ 61 if (len & 1) { \ 62 temp1 = kVToR * v[0]; \ 63 temp3 = kVToG * v[0]; \ 64 temp2 = kUToG * u[0]; \ 65 temp4 = kUToB * u[0]; \ 66 temp0 = kYScale * y[0]; \ 67 temp1 += kRCst; \ 68 temp3 -= kGCst; \ 69 temp2 += temp3; \ 70 temp4 += kBCst; \ 71 r = VP8Clip8(temp0 + temp1); \ 72 g = VP8Clip8(temp0 - temp2); \ 73 b = VP8Clip8(temp0 + temp4); \ 74 dst[R] = r; \ 75 dst[G] = g; \ 76 dst[B] = b; \ 77 if (A) dst[A] = 0xff; \ 78 } \ 79 } 80 81 ROW_FUNC(YuvToRgbRow, 3, 0, 1, 2, 0) 82 ROW_FUNC(YuvToRgbaRow, 4, 0, 1, 2, 3) 83 ROW_FUNC(YuvToBgrRow, 3, 2, 1, 0, 0) 84 ROW_FUNC(YuvToBgraRow, 4, 2, 1, 0, 3) 85 86 #undef ROW_FUNC 87 88 //------------------------------------------------------------------------------ 89 // Entry point 90 91 extern void WebPInitSamplersMIPS32(void); 92 93 WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplersMIPS32(void) { 94 WebPSamplers[MODE_RGB] = YuvToRgbRow; 95 WebPSamplers[MODE_RGBA] = YuvToRgbaRow; 96 WebPSamplers[MODE_BGR] = YuvToBgrRow; 97 WebPSamplers[MODE_BGRA] = YuvToBgraRow; 98 } 99 100 #else // !WEBP_USE_MIPS32 101 102 WEBP_DSP_INIT_STUB(WebPInitSamplersMIPS32) 103 104 #endif // WEBP_USE_MIPS32 105