<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 15, 2013 at 1:10 AM,  <span dir="ltr"><<a href="mailto:yuvaraj@multicorewareinc.com" target="_blank">yuvaraj@multicorewareinc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Yuvaraj Venkatesh <<a href="mailto:yuvaraj@multicorewareinc.com">yuvaraj@multicorewareinc.com</a>><br>
# Date 1381817402 -19800<br>
#      Tue Oct 15 11:40:02 2013 +0530<br>
# Node ID 7d7fb8a60c5d39d7f55261359560b84a7f0f8138<br>
# Parent  9493e8bb3581b547a5c9f2e13cffb83958b24654<br>
pixel: modified weightUnidir to clear the bug.<br></blockquote><div><br></div><div>Queued.  Was the unit test for this primitive detecting this bug, or did you find it by examination?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
diff -r 9493e8bb3581 -r 7d7fb8a60c5d source/common/vec/pixel-sse41.cpp<br>
--- a/source/common/vec/pixel-sse41.cpp Tue Oct 15 11:29:00 2013 +0530<br>
+++ b/source/common/vec/pixel-sse41.cpp Tue Oct 15 11:40:02 2013 +0530<br>
@@ -4883,7 +4883,7 @@<br>
<br>
 void weightUnidir(short *src, pixel *dst, intptr_t srcStride, intptr_t dstStride, int width, int height, int w0, int round, int shift, int offset)<br>
 {<br>
-    __m128i w00, roundoff, ofs, fs, tmpsrc, tmpdst, tmp;<br>
+    __m128i w00, roundoff, ofs, fs, tmpsrc, tmpdst, tmp, sign;<br>
     int x, y;<br>
<br>
     w00 = _mm_set1_epi32(w0);<br>
@@ -4895,7 +4895,8 @@<br>
         for (x = 0; x <= width - 4; x += 4)<br>
         {<br>
             tmpsrc = _mm_loadl_epi64((__m128i*)(src + x));<br>
-            tmpsrc = _mm_unpacklo_epi16(tmpsrc, _mm_setzero_si128());<br>
+            sign = _mm_srai_epi16(tmpsrc, 15);<br>
+            tmpsrc = _mm_unpacklo_epi16(tmpsrc, sign);<br>
             tmpdst = _mm_add_epi32(_mm_srai_epi32(_mm_add_epi32(_mm_mullo_epi32(w00, _mm_add_epi32(tmpsrc, ofs)), roundoff), shift), fs);<br>
             *(uint32_t*)(dst + x) = _mm_cvtsi128_si32(_mm_packus_epi16(_mm_packs_epi32(tmpdst, tmpdst), _mm_setzero_si128()));<br>
         }<br>
@@ -4903,7 +4904,8 @@<br>
         if (width > x)<br>
         {<br>
             tmpsrc = _mm_loadl_epi64((__m128i*)(src + x));<br>
-            tmpsrc = _mm_unpacklo_epi16(tmpsrc, _mm_setzero_si128());<br>
+            sign = _mm_srai_epi16(tmpsrc, 15);<br>
+            tmpsrc = _mm_unpacklo_epi16(tmpsrc, sign);<br>
             tmpdst = _mm_add_epi32(_mm_srai_epi32(_mm_add_epi32(_mm_mullo_epi32(w00, _mm_add_epi32(tmpsrc, ofs)), roundoff), shift), fs);<br>
             tmp = _mm_packus_epi16(_mm_packs_epi32(tmpdst, tmpdst), _mm_setzero_si128());<br>
             union<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>