<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 8, 2013 at 12:08 PM, Steve Borho <span dir="ltr"><<a href="mailto:steve@borho.org" target="_blank">steve@borho.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Tue, Oct 8, 2013 at 4:05 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" target="_blank">yuvaraj@multicorewareinc.com</a>><br>
# Date 1381223006 -19800<br>
# Tue Oct 08 14:33:26 2013 +0530<br>
# Node ID 1a62566488b7ece9bbfb665e37ac402a08ce156e<br>
# Parent 96e30370f4d96c7fed69f432027ed3be8e01dcf6<br>
pixel: replace getResidual32 from vector class to intrinsic<br>
<br>
diff -r 96e30370f4d9 -r 1a62566488b7 source/common/vec/pixel8.inc<br>
--- a/source/common/vec/pixel8.inc Tue Oct 08 14:16:23 2013 +0530<br>
+++ b/source/common/vec/pixel8.inc Tue Oct 08 14:33:26 2013 +0530<br>
@@ -79,31 +79,37 @@<br>
RESIDUAL_16x4(12);<br>
}<br>
<br>
-void getResidual32(pixel *fenc, pixel *pred, short *resi, int stride)<br>
-{<br>
- Vec16uc f, p;<br>
- Vec8s r;<br>
-<br>
- for (int y = 0; y < 32; y++)<br>
- {<br>
- f.load_a(fenc);<br>
- p.load_a(pred);<br>
- r = extend_low(f) - extend_low(p);<br>
- r.store(resi);<br>
- r = extend_high(f) - extend_high(p);<br>
- r.store(resi + 8);<br>
-<br>
- f.load_a(fenc + 16);<br>
- p.load_a(pred + 16);<br>
- r = extend_low(f) - extend_low(p);<br>
- r.store(resi + 16);<br>
- r = extend_high(f) - extend_high(p);<br>
- r.store(resi + 24);<br>
-<br>
- fenc += stride;<br>
- pred += stride;<br>
- resi += stride;<br>
- }<br>
+void getResidual32(pixel *fenc, pixel *pred, short *resi, int stride)<br>
+{<br>
+ __m128i T00, T01, T02, T03, T04;<br>
+<br>
+#define RESIDUAL_32x4(BASE, OFFSET) \<br>
+ T00 = _mm_load_si128((__m128i*)(fenc + OFFSET + (BASE + 0) * stride)); \<br>
+ T01 = _mm_load_si128((__m128i*)(pred + OFFSET + (BASE + 0) * stride)); \<br>
+ T02 = _mm_unpacklo_epi8(T00, _mm_setzero_si128()); \<br>
+ T03 = _mm_unpacklo_epi8(T01, _mm_setzero_si128()); \<br>
+ T04 = _mm_sub_epi16(T02, T03); \<br>
+ _mm_store_si128((__m128i*)(resi + OFFSET + (BASE + 0) * stride), T04); \<br>
+ T02 = _mm_unpackhi_epi8(T00, _mm_setzero_si128()); \<br>
+ T03 = _mm_unpackhi_epi8(T01, _mm_setzero_si128()); \<br>
+ T04 = _mm_sub_epi16(T02, T03); \<br>
+ _mm_store_si128((__m128i*)(resi + 8 + OFFSET + (BASE + 0) * stride), T04); \<br>
+ T00 = _mm_load_si128((__m128i*)(fenc + OFFSET + (BASE + 1) * stride)); \<br>
+ T01 = _mm_load_si128((__m128i*)(pred + OFFSET + (BASE + 1) * stride)); \<br>
+ T02 = _mm_unpacklo_epi8(T00, _mm_setzero_si128()); \<br>
+ T03 = _mm_unpacklo_epi8(T01, _mm_setzero_si128()); \<br>
+ T04 = _mm_sub_epi16(T02, T03); \<br>
+ _mm_store_si128((__m128i*)(resi + OFFSET + (BASE + 1) * stride), T04); \<br>
+ T02 = _mm_unpackhi_epi8(T00, _mm_setzero_si128()); \<br>
+ T03 = _mm_unpackhi_epi8(T01, _mm_setzero_si128()); \<br>
+ T04 = _mm_sub_epi16(T02, T03); \<br>
+ _mm_store_si128((__m128i*)(resi + 8 + OFFSET + (BASE + 1) * stride), T04)<br>
+<br>
+ for (int i = 0; i < 32; i += 2)<br>
+ {<br>
+ RESIDUAL_32x4(i, 0);<br>
+ RESIDUAL_32x4(i, 16);<br></blockquote><div><br></div></div></div><div>I assume this macro should be named RESIDUAL_32x16; changing then queueing</div><div class="im"><div><br></div></div></div></div></div></blockquote>
<div><br></div><div>Actually.. 2x16</div><div> </div></div>-- <br>Steve Borho
</div></div>