Index: third_party/libwebp/dsp/upsampling_mips_dsp_r2.c |
diff --git a/third_party/libwebp/dsp/upsampling_mips_dsp_r2.c b/third_party/libwebp/dsp/upsampling_mips_dsp_r2.c |
index d4ccbe0adaad8f2da5db53b44acc55c29d648a3b..ed2eb748255e97dd3bf93391f6a03797e403e5cd 100644 |
--- a/third_party/libwebp/dsp/upsampling_mips_dsp_r2.c |
+++ b/third_party/libwebp/dsp/upsampling_mips_dsp_r2.c |
@@ -14,9 +14,7 @@ |
#include "./dsp.h" |
-// Code is disabled for now, in favor of the plain-C version |
-// TODO(djordje.pesut): adapt the code to reflect the C-version. |
-#if 0 // defined(WEBP_USE_MIPS_DSP_R2) |
+#if defined(WEBP_USE_MIPS_DSP_R2) |
#include <assert.h> |
#include "./yuv.h" |
@@ -24,21 +22,21 @@ |
#if !defined(WEBP_YUV_USE_TABLE) |
#define YUV_TO_RGB(Y, U, V, R, G, B) do { \ |
- const int t1 = kYScale * Y; \ |
- const int t2 = kVToG * V; \ |
- R = kVToR * V; \ |
- G = kUToG * U; \ |
- B = kUToB * U; \ |
+ const int t1 = MultHi(Y, 19077); \ |
+ const int t2 = MultHi(V, 13320); \ |
+ R = MultHi(V, 26149); \ |
+ G = MultHi(U, 6419); \ |
+ B = MultHi(U, 33050); \ |
R = t1 + R; \ |
G = t1 - G; \ |
B = t1 + B; \ |
- R = R + kRCst; \ |
- G = G - t2 + kGCst; \ |
- B = B + kBCst; \ |
+ R = R - 14234; \ |
+ G = G - t2 + 8708; \ |
+ B = B - 17685; \ |
__asm__ volatile ( \ |
- "shll_s.w %[" #R "], %[" #R "], 9 \n\t" \ |
- "shll_s.w %[" #G "], %[" #G "], 9 \n\t" \ |
- "shll_s.w %[" #B "], %[" #B "], 9 \n\t" \ |
+ "shll_s.w %[" #R "], %[" #R "], 17 \n\t" \ |
+ "shll_s.w %[" #G "], %[" #G "], 17 \n\t" \ |
+ "shll_s.w %[" #B "], %[" #B "], 17 \n\t" \ |
"precrqu_s.qb.ph %[" #R "], %[" #R "], $zero \n\t" \ |
"precrqu_s.qb.ph %[" #G "], %[" #G "], $zero \n\t" \ |
"precrqu_s.qb.ph %[" #B "], %[" #B "], $zero \n\t" \ |
@@ -279,6 +277,6 @@ WEBP_DSP_INIT_STUB(WebPInitYUV444ConvertersMIPSdspR2) |
#endif // WEBP_USE_MIPS_DSP_R2 |
-#if 1 // !(defined(FANCY_UPSAMPLING) && defined(WEBP_USE_MIPS_DSP_R2)) |
+#if !(defined(FANCY_UPSAMPLING) && defined(WEBP_USE_MIPS_DSP_R2)) |
WEBP_DSP_INIT_STUB(WebPInitUpsamplersMIPSdspR2) |
#endif |