Fix vpx_plane_add_noise_msa functionality bit-mismatch
Change-Id: I04961afb592ae6a67fdcfd8c9066e920dd4b30e7
This commit is contained in:
parent
7eff8f3b1d
commit
6922fc8230
1
AUTHORS
1
AUTHORS
@ -75,6 +75,7 @@ Joshua Litt <joshualitt@google.com>
|
||||
Julia Robson <juliamrobson@gmail.com>
|
||||
Justin Clift <justin@salasaga.org>
|
||||
Justin Lebar <justin.lebar@gmail.com>
|
||||
Kaustubh Raste <kaustubh.raste@imgtec.com>
|
||||
KO Myung-Hun <komh@chollian.net>
|
||||
Lawrence Velázquez <larryv@macports.org>
|
||||
Linfeng Zhang <linfengz@google.com>
|
||||
|
@ -15,6 +15,13 @@ void vpx_plane_add_noise_msa(uint8_t *start_ptr, const int8_t *noise,
|
||||
int blackclamp, int whiteclamp, int width,
|
||||
int height, int32_t pitch) {
|
||||
int i, j;
|
||||
v16u8 pos0, pos1, ref0, ref1;
|
||||
v16i8 black_clamp, white_clamp, both_clamp;
|
||||
|
||||
black_clamp = __msa_fill_b(blackclamp);
|
||||
white_clamp = __msa_fill_b(whiteclamp);
|
||||
both_clamp = black_clamp + white_clamp;
|
||||
both_clamp = -both_clamp;
|
||||
|
||||
for (i = 0; i < height / 2; ++i) {
|
||||
uint8_t *pos0_ptr = start_ptr + (2 * i) * pitch;
|
||||
@ -22,29 +29,16 @@ void vpx_plane_add_noise_msa(uint8_t *start_ptr, const int8_t *noise,
|
||||
uint8_t *pos1_ptr = start_ptr + (2 * i + 1) * pitch;
|
||||
const int8_t *ref1_ptr = noise + (rand() & 0xff);
|
||||
for (j = width / 16; j--;) {
|
||||
v16i8 temp00_s, temp01_s;
|
||||
v16u8 temp00, temp01, black_clamp, white_clamp;
|
||||
v16u8 pos0, ref0, pos1, ref1;
|
||||
v16i8 const127 = __msa_ldi_b(127);
|
||||
|
||||
pos0 = LD_UB(pos0_ptr);
|
||||
ref0 = LD_UB(ref0_ptr);
|
||||
pos1 = LD_UB(pos1_ptr);
|
||||
ref1 = LD_UB(ref1_ptr);
|
||||
black_clamp = (v16u8)__msa_fill_b(blackclamp);
|
||||
white_clamp = (v16u8)__msa_fill_b(whiteclamp);
|
||||
temp00 = (pos0 < black_clamp);
|
||||
pos0 = __msa_bmnz_v(pos0, black_clamp, temp00);
|
||||
temp01 = (pos1 < black_clamp);
|
||||
pos1 = __msa_bmnz_v(pos1, black_clamp, temp01);
|
||||
XORI_B2_128_UB(pos0, pos1);
|
||||
temp00_s = __msa_adds_s_b((v16i8)white_clamp, const127);
|
||||
temp00 = (v16u8)(temp00_s < pos0);
|
||||
pos0 = (v16u8)__msa_bmnz_v((v16u8)pos0, (v16u8)temp00_s, temp00);
|
||||
temp01_s = __msa_adds_s_b((v16i8)white_clamp, const127);
|
||||
temp01 = (temp01_s < pos1);
|
||||
pos1 = (v16u8)__msa_bmnz_v((v16u8)pos1, (v16u8)temp01_s, temp01);
|
||||
XORI_B2_128_UB(pos0, pos1);
|
||||
pos0 = __msa_subsus_u_b(pos0, black_clamp);
|
||||
pos1 = __msa_subsus_u_b(pos1, black_clamp);
|
||||
pos0 = __msa_subsus_u_b(pos0, both_clamp);
|
||||
pos1 = __msa_subsus_u_b(pos1, both_clamp);
|
||||
pos0 = __msa_subsus_u_b(pos0, white_clamp);
|
||||
pos1 = __msa_subsus_u_b(pos1, white_clamp);
|
||||
pos0 += ref0;
|
||||
ST_UB(pos0, pos0_ptr);
|
||||
pos1 += ref1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user