<div dir="ltr">Thanks Steve. I will change the variable name and resend the patch.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 2, 2015 at 1:44 AM, 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"><span class="">On Wed, Apr 1, 2015 at 8:40 AM, Divya Manivannan<br>
<<a href="mailto:divya@multicorewareinc.com">divya@multicorewareinc.com</a>> wrote:<br>
> # HG changeset patch<br>
> # User Divya Manivannan <<a href="mailto:divya@multicorewareinc.com">divya@multicorewareinc.com</a>><br>
> # Date 1427895336 -19800<br>
> # Wed Apr 01 19:05:36 2015 +0530<br>
> # Node ID f718abdc8004d0c859266b292730b7b5b3d0d4df<br>
> # Parent ac85c775620f1dcb0df056874633cbf916098bd2<br>
> sao: modify C and SSE4 code for saoCuOrgE0 to process 2 rows<br>
<br>
</span>/home/sborho/repos/x265/source/encoder/sao.cpp: In member function<br>
'void x265::SAO::processSaoCu(int, int, int)':<br>
/home/sborho/repos/x265/source/encoder/sao.cpp:289:21: warning:<br>
declaration of 'signLeft' shadows a previous local [-Wshadow]<br>
<span class=""> int signLeft = signOf(rec[startX] - tmpL[y]);<br>
</span> ^<br>
/home/sborho/repos/x265/source/encoder/sao.cpp:261:64: warning:<br>
shadowed declaration is here [-Wshadow]<br>
<div><div class="h5"> int8_t _upBuff1[MAX_CU_SIZE + 2], *upBuff1 = _upBuff1 + 1, signLeft[2];<br>
<br>
<br>
> diff -r ac85c775620f -r f718abdc8004 source/common/loopfilter.cpp<br>
> --- a/source/common/loopfilter.cpp Tue Mar 31 20:04:28 2015 -0500<br>
> +++ b/source/common/loopfilter.cpp Wed Apr 01 19:05:36 2015 +0530<br>
> @@ -42,18 +42,23 @@<br>
> dst[x] = signOf(src1[x] - src2[x]);<br>
> }<br>
><br>
> -void processSaoCUE0(pixel * rec, int8_t * offsetEo, int width, int8_t signLeft)<br>
> +void processSaoCUE0(pixel * rec, int8_t * offsetEo, int width, int8_t* signLeft, intptr_t stride)<br>
> {<br>
> - int x;<br>
> - int8_t signRight;<br>
> + int x, y;<br>
> + int8_t signRight, signLeft0;<br>
> int8_t edgeType;<br>
><br>
> - for (x = 0; x < width; x++)<br>
> + for (y = 0; y < 2; y++)<br>
> {<br>
> - signRight = ((rec[x] - rec[x + 1]) < 0) ? -1 : ((rec[x] - rec[x + 1]) > 0) ? 1 : 0;<br>
> - edgeType = signRight + signLeft + 2;<br>
> - signLeft = -signRight;<br>
> - rec[x] = x265_clip(rec[x] + offsetEo[edgeType]);<br>
> + signLeft0 = signLeft[y];<br>
> + for (x = 0; x < width; x++)<br>
> + {<br>
> + signRight = ((rec[x] - rec[x + 1]) < 0) ? -1 : ((rec[x] - rec[x + 1]) > 0) ? 1 : 0;<br>
> + edgeType = signRight + signLeft0 + 2;<br>
> + signLeft0 = -signRight;<br>
> + rec[x] = x265_clip(rec[x] + offsetEo[edgeType]);<br>
> + }<br>
> + rec += stride;<br>
> }<br>
> }<br>
><br>
> diff -r ac85c775620f -r f718abdc8004 source/common/primitives.h<br>
> --- a/source/common/primitives.h Tue Mar 31 20:04:28 2015 -0500<br>
> +++ b/source/common/primitives.h Wed Apr 01 19:05:36 2015 +0530<br>
> @@ -169,7 +169,7 @@<br>
> typedef void (*pixelavg_pp_t)(pixel* dst, intptr_t dstride, const pixel* src0, intptr_t sstride0, const pixel* src1, intptr_t sstride1, int weight);<br>
> typedef void (*addAvg_t)(const int16_t* src0, const int16_t* src1, pixel* dst, intptr_t src0Stride, intptr_t src1Stride, intptr_t dstStride);<br>
><br>
> -typedef void (*saoCuOrgE0_t)(pixel* rec, int8_t* offsetEo, int width, int8_t signLeft);<br>
> +typedef void (*saoCuOrgE0_t)(pixel* rec, int8_t* offsetEo, int width, int8_t* signLeft, intptr_t stride);<br>
> typedef void (*saoCuOrgE1_t)(pixel* rec, int8_t* upBuff1, int8_t* offsetEo, intptr_t stride, int width);<br>
> typedef void (*saoCuOrgE2_t)(pixel* rec, int8_t* pBufft, int8_t* pBuff1, int8_t* offsetEo, int lcuWidth, intptr_t stride);<br>
> typedef void (*saoCuOrgE3_t)(pixel* rec, int8_t* upBuff1, int8_t* m_offsetEo, intptr_t stride, int startX, int endX);<br>
> diff -r ac85c775620f -r f718abdc8004 source/common/x86/loopfilter.asm<br>
> --- a/source/common/x86/loopfilter.asm Tue Mar 31 20:04:28 2015 -0500<br>
> +++ b/source/common/x86/loopfilter.asm Wed Apr 01 19:05:36 2015 +0530<br>
> @@ -39,20 +39,25 @@<br>
><br>
><br>
> ;============================================================================================================<br>
> -; void saoCuOrgE0(pixel * rec, int8_t * offsetEo, int lcuWidth, int8_t signLeft)<br>
> +; void saoCuOrgE0(pixel * rec, int8_t * offsetEo, int lcuWidth, int8_t* signLeft, intptr_t stride)<br>
> ;============================================================================================================<br>
> INIT_XMM sse4<br>
> -cglobal saoCuOrgE0, 4, 4, 8, rec, offsetEo, lcuWidth, signLeft<br>
> +cglobal saoCuOrgE0, 5, 6, 8, rec, offsetEo, lcuWidth, signLeft, stride<br>
><br>
> - neg r3 ; r3 = -signLeft<br>
> - movzx r3d, r3b<br>
> - movd m0, r3d<br>
> - mova m4, [pb_128] ; m4 = [80]<br>
> - pxor m5, m5 ; m5 = 0<br>
> - movu m6, [r1] ; m6 = offsetEo<br>
> + mov r4d, r4m<br>
> + mova m4, [pb_128] ; m4 = [80]<br>
> + pxor m5, m5 ; m5 = 0<br>
> + movu m6, [r1] ; m6 = offsetEo<br>
> +<br>
> + movzx r5d, byte [r3]<br>
> + inc r3<br>
> + neg r5b<br>
> + movd m0, r5d<br>
> + lea r5, [r0 + r4]<br>
> + mov r4d, r2d<br>
><br>
> .loop:<br>
> - movu m7, [r0] ; m1 = rec[x]<br>
> + movu m7, [r0] ; m7 = rec[x]<br>
> movu m2, [r0 + 1] ; m2 = rec[x+1]<br>
><br>
> pxor m1, m7, m4<br>
> @@ -69,7 +74,7 @@<br>
> pxor m0, m0<br>
> palignr m0, m2, 15<br>
> paddb m2, m3<br>
> - paddb m2, [pb_2] ; m1 = uiEdgeType<br>
> + paddb m2, [pb_2] ; m2 = uiEdgeType<br>
> pshufb m3, m6, m2<br>
> pmovzxbw m2, m7 ; rec<br>
> punpckhbw m7, m5<br>
> @@ -84,6 +89,43 @@<br>
> add r0q, 16<br>
> sub r2d, 16<br>
> jnz .loop<br>
> +<br>
> + movzx r3d, byte [r3]<br>
> + neg r3b<br>
> + movd m0, r3d<br>
> +.loopH:<br>
> + movu m7, [r5] ; m7 = rec[x]<br>
> + movu m2, [r5 + 1] ; m2 = rec[x+1]<br>
> +<br>
> + pxor m1, m7, m4<br>
> + pxor m3, m2, m4<br>
> + pcmpgtb m2, m1, m3<br>
> + pcmpgtb m3, m1<br>
> + pand m2, [pb_1]<br>
> + por m2, m3<br>
> +<br>
> + pslldq m3, m2, 1<br>
> + por m3, m0<br>
> +<br>
> + psignb m3, m4 ; m3 = signLeft<br>
> + pxor m0, m0<br>
> + palignr m0, m2, 15<br>
> + paddb m2, m3<br>
> + paddb m2, [pb_2] ; m2 = uiEdgeType<br>
> + pshufb m3, m6, m2<br>
> + pmovzxbw m2, m7 ; rec<br>
> + punpckhbw m7, m5<br>
> + pmovsxbw m1, m3 ; offsetEo<br>
> + punpckhbw m3, m3<br>
> + psraw m3, 8<br>
> + paddw m2, m1<br>
> + paddw m7, m3<br>
> + packuswb m2, m7<br>
> + movu [r5], m2<br>
> +<br>
> + add r5q, 16<br>
> + sub r4d, 16<br>
> + jnz .loopH<br>
> RET<br>
><br>
> ;==================================================================================================<br>
> diff -r ac85c775620f -r f718abdc8004 source/common/x86/loopfilter.h<br>
> --- a/source/common/x86/loopfilter.h Tue Mar 31 20:04:28 2015 -0500<br>
> +++ b/source/common/x86/loopfilter.h Wed Apr 01 19:05:36 2015 +0530<br>
> @@ -25,7 +25,7 @@<br>
> #ifndef X265_LOOPFILTER_H<br>
> #define X265_LOOPFILTER_H<br>
><br>
> -void x265_saoCuOrgE0_sse4(pixel * rec, int8_t * offsetEo, int endX, int8_t signLeft);<br>
> +void x265_saoCuOrgE0_sse4(pixel * rec, int8_t * offsetEo, int endX, int8_t* signLeft, intptr_t stride);<br>
> void x265_saoCuOrgE1_sse4(pixel* rec, int8_t* upBuff1, int8_t* offsetEo, intptr_t stride, int width);<br>
> void x265_saoCuOrgE2_sse4(pixel* rec, int8_t* pBufft, int8_t* pBuff1, int8_t* offsetEo, int lcuWidth, intptr_t stride);<br>
> void x265_saoCuOrgE3_sse4(pixel *rec, int8_t *upBuff1, int8_t *m_offsetEo, intptr_t stride, int startX, int endX);<br>
> diff -r ac85c775620f -r f718abdc8004 source/encoder/sao.cpp<br>
> --- a/source/encoder/sao.cpp Tue Mar 31 20:04:28 2015 -0500<br>
> +++ b/source/encoder/sao.cpp Wed Apr 01 19:05:36 2015 +0530<br>
> @@ -258,7 +258,7 @@<br>
> pixel* tmpL;<br>
> pixel* tmpU;<br>
><br>
> - int8_t _upBuff1[MAX_CU_SIZE + 2], *upBuff1 = _upBuff1 + 1;<br>
> + int8_t _upBuff1[MAX_CU_SIZE + 2], *upBuff1 = _upBuff1 + 1, signLeft[2];<br>
> int8_t _upBufft[MAX_CU_SIZE + 2], *upBufft = _upBufft + 1;<br>
><br>
> memset(_upBuff1 + MAX_CU_SIZE, 0, 2 * sizeof(int8_t)); /* avoid valgrind uninit warnings */<br>
> @@ -279,7 +279,7 @@<br>
> {<br>
> case SAO_EO_0: // dir: -<br>
> {<br>
> - pixel firstPxl = 0, lastPxl = 0;<br>
> + pixel firstPxl = 0, lastPxl = 0, row1FirstPxl = 0, row1LastPxl = 0;<br>
> startX = !lpelx;<br>
> endX = (rpelx == picWidth) ? ctuWidth - 1 : ctuWidth;<br>
> if (ctuWidth & 15)<br>
> @@ -301,25 +301,38 @@<br>
> }<br>
> else<br>
> {<br>
> - for (y = 0; y < ctuHeight; y++)<br>
> + for (y = 0; y < ctuHeight; y += 2)<br>
> {<br>
> - int signLeft = signOf(rec[startX] - tmpL[y]);<br>
> -<br>
> - if (!lpelx)<br>
> - firstPxl = rec[0];<br>
> -<br>
> - if (rpelx == picWidth)<br>
> - lastPxl = rec[ctuWidth - 1];<br>
> -<br>
> - primitives.saoCuOrgE0(rec, m_offsetEo, ctuWidth, (int8_t)signLeft);<br>
> -<br>
> - if (!lpelx)<br>
> - rec[0] = firstPxl;<br>
> -<br>
> - if (rpelx == picWidth)<br>
> - rec[ctuWidth - 1] = lastPxl;<br>
> -<br>
> - rec += stride;<br>
> + signLeft[0] = signOf(rec[startX] - tmpL[y]);<br>
> + signLeft[1] = signOf(rec[stride + startX] - tmpL[y + 1]);<br>
> +<br>
> + if (!lpelx)<br>
> + {<br>
> + firstPxl = rec[0];<br>
> + row1FirstPxl = rec[stride];<br>
> + }<br>
> +<br>
> + if (rpelx == picWidth)<br>
> + {<br>
> + lastPxl = rec[ctuWidth - 1];<br>
> + row1LastPxl = rec[stride + ctuWidth - 1];<br>
> + }<br>
> +<br>
> + primitives.saoCuOrgE0(rec, m_offsetEo, ctuWidth, signLeft, stride);<br>
> +<br>
> + if (!lpelx)<br>
> + {<br>
> + rec[0] = firstPxl;<br>
> + rec[stride] = row1FirstPxl;<br>
> + }<br>
> +<br>
> + if (rpelx == picWidth)<br>
> + {<br>
> + rec[ctuWidth - 1] = lastPxl;<br>
> + rec[stride + ctuWidth - 1] = row1LastPxl;<br>
> + }<br>
> +<br>
> + rec += 2 * stride;<br>
> }<br>
> }<br>
> break;<br>
> diff -r ac85c775620f -r f718abdc8004 source/test/pixelharness.cpp<br>
> --- a/source/test/pixelharness.cpp Tue Mar 31 20:04:28 2015 -0500<br>
> +++ b/source/test/pixelharness.cpp Wed Apr 01 19:05:36 2015 +0530<br>
> @@ -908,12 +908,10 @@<br>
> for (int i = 0; i < ITERS; i++)<br>
> {<br>
> int width = 16 * (rand() % 4 + 1);<br>
> - int8_t sign = rand() % 3;<br>
> - if (sign == 2)<br>
> - sign = -1;<br>
> -<br>
> - ref(ref_dest, psbuf1 + j, width, sign);<br>
> - checked(opt, opt_dest, psbuf1 + j, width, sign);<br>
> + int stride = width + 1;<br>
> +<br>
> + ref(ref_dest, psbuf1 + j, width, psbuf2 + j, stride);<br>
> + checked(opt, opt_dest, psbuf1 + j, width, psbuf5 + j, stride);<br>
><br>
> if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))<br>
> return false;<br>
> @@ -2058,7 +2056,7 @@<br>
> if (opt.saoCuOrgE0)<br>
> {<br>
> HEADER0("SAO_EO_0");<br>
> - REPORT_SPEEDUP(opt.saoCuOrgE0, ref.saoCuOrgE0, pbuf1, psbuf1, 64, 1);<br>
> + REPORT_SPEEDUP(opt.saoCuOrgE0, ref.saoCuOrgE0, pbuf1, psbuf1, 64, psbuf2, 64);<br>
> }<br>
><br>
> if (opt.saoCuOrgE1)<br>
</div></div>> _______________________________________________<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>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
Steve Borho<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>
</font></span></blockquote></div><br></div>