mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
Merge "Sync mips32 and dsp_r2 YUV->RGB code with C verison"
This commit is contained in:
commit
cadec0b126
@ -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
|
||||
|
@ -14,8 +14,7 @@
|
||||
|
||||
#include "./dsp.h"
|
||||
|
||||
// Code is disabled for now, in favor of the plain-C version
|
||||
#if 0 // defined(WEBP_USE_MIPS32)
|
||||
#if defined(WEBP_USE_MIPS32)
|
||||
|
||||
#include "./yuv.h"
|
||||
|
||||
@ -29,19 +28,19 @@ static void FUNC_NAME(const uint8_t* y, \
|
||||
int i, r, g, b; \
|
||||
int temp0, temp1, temp2, temp3, temp4; \
|
||||
for (i = 0; i < (len >> 1); i++) { \
|
||||
temp1 = kVToR * v[0]; \
|
||||
temp3 = kVToG * v[0]; \
|
||||
temp2 = kUToG * u[0]; \
|
||||
temp4 = kUToB * u[0]; \
|
||||
temp0 = kYScale * y[0]; \
|
||||
temp1 += kRCst; \
|
||||
temp3 -= kGCst; \
|
||||
temp1 = MultHi(v[0], 26149); \
|
||||
temp3 = MultHi(v[0], 13320); \
|
||||
temp2 = MultHi(u[0], 6419); \
|
||||
temp4 = MultHi(u[0], 33050); \
|
||||
temp0 = MultHi(y[0], 19077); \
|
||||
temp1 -= 14234; \
|
||||
temp3 -= 8708; \
|
||||
temp2 += temp3; \
|
||||
temp4 += kBCst; \
|
||||
temp4 -= 17685; \
|
||||
r = VP8Clip8(temp0 + temp1); \
|
||||
g = VP8Clip8(temp0 - temp2); \
|
||||
b = VP8Clip8(temp0 + temp4); \
|
||||
temp0 = kYScale * y[1]; \
|
||||
temp0 = MultHi(y[1], 19077); \
|
||||
dst[R] = r; \
|
||||
dst[G] = g; \
|
||||
dst[B] = b; \
|
||||
@ -59,15 +58,15 @@ static void FUNC_NAME(const uint8_t* y, \
|
||||
dst += 2 * XSTEP; \
|
||||
} \
|
||||
if (len & 1) { \
|
||||
temp1 = kVToR * v[0]; \
|
||||
temp3 = kVToG * v[0]; \
|
||||
temp2 = kUToG * u[0]; \
|
||||
temp4 = kUToB * u[0]; \
|
||||
temp0 = kYScale * y[0]; \
|
||||
temp1 += kRCst; \
|
||||
temp3 -= kGCst; \
|
||||
temp1 = MultHi(v[0], 26149); \
|
||||
temp3 = MultHi(v[0], 13320); \
|
||||
temp2 = MultHi(u[0], 6419); \
|
||||
temp4 = MultHi(u[0], 33050); \
|
||||
temp0 = MultHi(y[0], 19077); \
|
||||
temp1 -= 14234; \
|
||||
temp3 -= 8708; \
|
||||
temp2 += temp3; \
|
||||
temp4 += kBCst; \
|
||||
temp4 -= 17685; \
|
||||
r = VP8Clip8(temp0 + temp1); \
|
||||
g = VP8Clip8(temp0 - temp2); \
|
||||
b = VP8Clip8(temp0 + temp4); \
|
||||
|
@ -14,8 +14,7 @@
|
||||
|
||||
#include "./dsp.h"
|
||||
|
||||
// Code is disabled for now, in favor of the plain-C version
|
||||
#if 0 // defined(WEBP_USE_MIPS_DSP_R2)
|
||||
#if defined(WEBP_USE_MIPS_DSP_R2)
|
||||
|
||||
#include "./yuv.h"
|
||||
|
||||
@ -31,10 +30,10 @@
|
||||
"mul %[temp2], %[t_con_3], %[temp4] \n\t" \
|
||||
"mul %[temp4], %[t_con_4], %[temp4] \n\t" \
|
||||
"mul %[temp0], %[t_con_5], %[temp0] \n\t" \
|
||||
"addu %[temp1], %[temp1], %[t_con_6] \n\t" \
|
||||
"subu %[temp1], %[temp1], %[t_con_6] \n\t" \
|
||||
"subu %[temp3], %[temp3], %[t_con_7] \n\t" \
|
||||
"addu %[temp2], %[temp2], %[temp3] \n\t" \
|
||||
"addu %[temp4], %[temp4], %[t_con_8] \n\t" \
|
||||
"subu %[temp4], %[temp4], %[t_con_8] \n\t" \
|
||||
|
||||
#define ROW_FUNC_PART_2(R, G, B, K) \
|
||||
"addu %[temp5], %[temp0], %[temp1] \n\t" \
|
||||
@ -43,12 +42,12 @@
|
||||
".if " #K " \n\t" \
|
||||
"lbu %[temp0], 1(%[y]) \n\t" \
|
||||
".endif \n\t" \
|
||||
"shll_s.w %[temp5], %[temp5], 9 \n\t" \
|
||||
"shll_s.w %[temp6], %[temp6], 9 \n\t" \
|
||||
"shll_s.w %[temp5], %[temp5], 17 \n\t" \
|
||||
"shll_s.w %[temp6], %[temp6], 17 \n\t" \
|
||||
".if " #K " \n\t" \
|
||||
"mul %[temp0], %[t_con_5], %[temp0] \n\t" \
|
||||
".endif \n\t" \
|
||||
"shll_s.w %[temp7], %[temp7], 9 \n\t" \
|
||||
"shll_s.w %[temp7], %[temp7], 17 \n\t" \
|
||||
"precrqu_s.qb.ph %[temp5], %[temp5], $zero \n\t" \
|
||||
"precrqu_s.qb.ph %[temp6], %[temp6], $zero \n\t" \
|
||||
"precrqu_s.qb.ph %[temp7], %[temp7], $zero \n\t" \
|
||||
@ -75,14 +74,14 @@ static void FUNC_NAME(const uint8_t* y, \
|
||||
uint8_t* dst, int len) { \
|
||||
int i; \
|
||||
uint32_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; \
|
||||
const int t_con_1 = kVToR; \
|
||||
const int t_con_2 = kVToG; \
|
||||
const int t_con_3 = kUToG; \
|
||||
const int t_con_4 = kUToB; \
|
||||
const int t_con_5 = kYScale; \
|
||||
const int t_con_6 = kRCst; \
|
||||
const int t_con_7 = kGCst; \
|
||||
const int t_con_8 = kBCst; \
|
||||
const int t_con_1 = 26149; \
|
||||
const int t_con_2 = 13320; \
|
||||
const int t_con_3 = 6419; \
|
||||
const int t_con_4 = 33050; \
|
||||
const int t_con_5 = 19077; \
|
||||
const int t_con_6 = 14234; \
|
||||
const int t_con_7 = 8708; \
|
||||
const int t_con_8 = 17685; \
|
||||
for (i = 0; i < (len >> 1); i++) { \
|
||||
__asm__ volatile ( \
|
||||
ROW_FUNC_PART_1() \
|
||||
|
Loading…
Reference in New Issue
Block a user