mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
MIPS: dspr2: Added optimization for function VP8LSubtractGreenFromBlueAndRed
Change-Id: I683c73cceee4a40ca810deba15e54fbf7dbe8918
This commit is contained in:
parent
11a25f75bd
commit
aa42f4231f
@ -145,6 +145,61 @@ static WEBP_INLINE uint32_t ClampedAddSubtractHalf(uint32_t c0, uint32_t c1,
|
||||
return temp1;
|
||||
}
|
||||
|
||||
static void SubtractGreenFromBlueAndRed(uint32_t* argb_data,
|
||||
int num_pixels) {
|
||||
uint32_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
|
||||
uint32_t* const p_loop1_end = argb_data + (num_pixels & ~3);
|
||||
uint32_t* const p_loop2_end = p_loop1_end + (num_pixels & 3);
|
||||
__asm__ volatile (
|
||||
".set push \n\t"
|
||||
".set noreorder \n\t"
|
||||
"beq %[argb_data], %[p_loop1_end], 3f \n\t"
|
||||
" nop \n\t"
|
||||
"0: \n\t"
|
||||
"lw %[temp0], 0(%[argb_data]) \n\t"
|
||||
"lw %[temp1], 4(%[argb_data]) \n\t"
|
||||
"lw %[temp2], 8(%[argb_data]) \n\t"
|
||||
"lw %[temp3], 12(%[argb_data]) \n\t"
|
||||
"ext %[temp4], %[temp0], 8, 8 \n\t"
|
||||
"ext %[temp5], %[temp1], 8, 8 \n\t"
|
||||
"ext %[temp6], %[temp2], 8, 8 \n\t"
|
||||
"ext %[temp7], %[temp3], 8, 8 \n\t"
|
||||
"addiu %[argb_data], %[argb_data], 16 \n\t"
|
||||
"replv.ph %[temp4], %[temp4] \n\t"
|
||||
"replv.ph %[temp5], %[temp5] \n\t"
|
||||
"replv.ph %[temp6], %[temp6] \n\t"
|
||||
"replv.ph %[temp7], %[temp7] \n\t"
|
||||
"subu.qb %[temp0], %[temp0], %[temp4] \n\t"
|
||||
"subu.qb %[temp1], %[temp1], %[temp5] \n\t"
|
||||
"subu.qb %[temp2], %[temp2], %[temp6] \n\t"
|
||||
"subu.qb %[temp3], %[temp3], %[temp7] \n\t"
|
||||
"sw %[temp0], -16(%[argb_data]) \n\t"
|
||||
"sw %[temp1], -12(%[argb_data]) \n\t"
|
||||
"sw %[temp2], -8(%[argb_data]) \n\t"
|
||||
"bne %[argb_data], %[p_loop1_end], 0b \n\t"
|
||||
" sw %[temp3], -4(%[argb_data]) \n\t"
|
||||
"3: \n\t"
|
||||
"beq %[argb_data], %[p_loop2_end], 2f \n\t"
|
||||
" nop \n\t"
|
||||
"1: \n\t"
|
||||
"lw %[temp0], 0(%[argb_data]) \n\t"
|
||||
"addiu %[argb_data], %[argb_data], 4 \n\t"
|
||||
"ext %[temp4], %[temp0], 8, 8 \n\t"
|
||||
"replv.ph %[temp4], %[temp4] \n\t"
|
||||
"subu.qb %[temp0], %[temp0], %[temp4] \n\t"
|
||||
"bne %[argb_data], %[p_loop2_end], 1b \n\t"
|
||||
" sw %[temp0], -4(%[argb_data]) \n\t"
|
||||
"2: \n\t"
|
||||
".set pop \n\t"
|
||||
: [argb_data]"+&r"(argb_data), [temp0]"=&r"(temp0),
|
||||
[temp1]"=&r"(temp1), [temp2]"=&r"(temp2), [temp3]"=&r"(temp3),
|
||||
[temp4]"=&r"(temp4), [temp5]"=&r"(temp5), [temp6]"=&r"(temp6),
|
||||
[temp7]"=&r"(temp7)
|
||||
: [p_loop1_end]"r"(p_loop1_end), [p_loop2_end]"r"(p_loop2_end)
|
||||
: "memory"
|
||||
);
|
||||
}
|
||||
|
||||
static uint32_t Predictor12(uint32_t left, const uint32_t* const top) {
|
||||
return ClampedAddSubtractFull(left, top[0], top[-1]);
|
||||
}
|
||||
@ -165,6 +220,7 @@ void VP8LDspInitMIPSdspR2(void) {
|
||||
VP8LMapColor8b = MapAlpha;
|
||||
VP8LPredictors[12] = Predictor12;
|
||||
VP8LPredictors[13] = Predictor13;
|
||||
VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed;
|
||||
#endif // WEBP_USE_MIPS_DSP_R2
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user