Sync mips32 and dsp_r2 YUV->RGB code with C verison

Change-Id: Ibe12f5ef596b8922225b95c36b67955a3f8b9ae4
This commit is contained in:
Jovan Zelincevic
2016-06-03 10:04:12 +02:00
parent eee788e26a
commit 50a486656d
3 changed files with 45 additions and 49 deletions

View File

@ -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