]> granicus.if.org Git - libvpx/commitdiff
Fix vpx_plane_add_noise_msa functionality bit-mismatch
authorKaustubh Raste <kaustubh.raste@imgtec.com>
Mon, 3 Oct 2016 10:14:17 +0000 (15:44 +0530)
committerJohann Koenig <johannkoenig@google.com>
Mon, 3 Oct 2016 18:15:59 +0000 (18:15 +0000)
Change-Id: I04961afb592ae6a67fdcfd8c9066e920dd4b30e7

AUTHORS
vpx_dsp/mips/add_noise_msa.c

diff --git a/AUTHORS b/AUTHORS
index fcd5c534a8c0c84c43eef09ada6dc34e3340c6b6..6478a902254b5c67c3dae1f16c188d46f73e5fed 100644 (file)
--- a/AUTHORS
+++ b/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>
index 48278d2ec2723a7c5a9789911fa974e1395cdef8..43d2c1146ecf0c695532c3176ab76ab829834d9b 100644 (file)
@@ -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;