<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Nov 14, 2013 at 9:27 AM, chen <span dir="ltr"><<a href="mailto:chenm003@163.com" target="_blank">chenm003@163.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;font-size:14px;font-family:arial"><div>At <a href="tel:2013-11-14%C2%A023" value="+12013111423" target="_blank">2013-11-14 23</a>:12:15,<a href="mailto:dnyaneshwar@multicorewareinc.com" target="_blank">dnyaneshwar@multicorewareinc.com</a> wrote:<div>
<div class="h5"><br>># HG changeset patch<br>># User Dnyaneshwar Gorade <<a href="mailto:dnyaneshwar@multicorewareinc.com" target="_blank">dnyaneshwar@multicorewareinc.com</a>><br>># Date 1384441865 -19800<br>
># Thu Nov 14 20:41:05 2013 +0530<br>># Node ID d16bcb0416b43912fc8d69d98af89c9a17475c60<br>># Parent c4ca80d19105ccf1ba2ec14dd65915f2820a660d<br>>primitive function for luma and chroma for loops in addAvg()<br>
><br>>diff -r c4ca80d19105 -r d16bcb0416b4 source/Lib/TLibCommon/TComYuv.cpp<br>>--- a/source/Lib/TLibCommon/TComYuv.cpp Tue Nov 12 19:10:23 2013 +0530<br>>+++ b/source/Lib/TLibCommon/TComYuv.cpp Thu Nov 14 20:41:05 2013 +0530<br>
>@@ -590,7 +590,6 @@<br>> <br>> void TComYuv::addAvg(TShortYUV* srcYuv0, TShortYUV* srcYuv1, uint32_t partUnitIdx, uint32_t width, uint32_t height, bool bLuma, bool bChroma)<br>> {<br>>- int x, y;<br>> uint32_t src0Stride, src1Stride, dststride;<br>
> int shiftNum, offset;<br>> <br>>@@ -606,6 +605,8 @@<br>> Pel* dstU = getCbAddr(partUnitIdx);<br>> Pel* dstV = getCrAddr(partUnitIdx);<br>> <br>>+ int part = partitionFromSizes(width, height);<br>
>+<br>> if (bLuma)<br>> {<br>> src0Stride = srcYuv0->m_width;<br>>@@ -614,20 +615,7 @@<br>> shiftNum = IF_INTERNAL_PREC + 1 - X265_DEPTH;<br>> offset = (1 << (shiftNum - 1)) + 2 * IF_INTERNAL_OFFS;<br>
> <br>>- for (y = 0; y < height; y++)<br>>- {<br>>- for (x = 0; x < width; x += 4)<br>>- {<br>>- dstY[x + 0] = ClipY((srcY0[x + 0] + srcY1[x + 0] + offset) >> shiftNum);<br>
>- dstY[x + 1] = ClipY((srcY0[x + 1] + srcY1[x + 1] + offset) >> shiftNum);<br>>- dstY[x + 2] = ClipY((srcY0[x + 2] + srcY1[x + 2] + offset) >> shiftNum);<br>>- dstY[x + 3] = ClipY((srcY0[x + 3] + srcY1[x + 3] + offset) >> shiftNum);<br>
>- }<br>>-<br>>- srcY0 += src0Stride;<br>>- srcY1 += src1Stride;<br>>- dstY += dststride;<br>>- }<br>>+ primitives.addAvg_c[part](dstY, dststride, srcY0, src0Stride, srcY1, src1Stride);<br>
> }<br>> if (bChroma)<br>> {<br>>@@ -641,26 +629,8 @@<br>> width >>= m_hChromaShift;<br>> height >>= m_vChromaShift;<br>> <br>>- for (y = height - 1; y >= 0; y--)<br>
>- {<br>>- for (x = width - 1; x >= 0; )<br>>- {<br>>- // note: chroma min width is 2<br>>- dstU[x] = ClipC((srcU0[x] + srcU1[x] + offset) >> shiftNum);<br>
>- dstV[x] = ClipC((srcV0[x] + srcV1[x] + offset) >> shiftNum);<br>>- x--;<br>>- dstU[x] = ClipC((srcU0[x] + srcU1[x] + offset) >> shiftNum);<br>>- dstV[x] = ClipC((srcV0[x] + srcV1[x] + offset) >> shiftNum);<br>
>- x--;<br>>- }<br>>-<br>>- srcU0 += src0Stride;<br>>- srcU1 += src1Stride;<br>>- srcV0 += src0Stride;<br>>- srcV1 += src1Stride;<br>
>- dstU += dststride;<br>>- dstV += dststride;<br>>- }<br>>+ primitives.addAvg_c[part](dstU, dststride, srcU0, src0Stride, srcU1, src1Stride);<br>>+ primitives.addAvg_c[part](dstV, dststride, srcV0, src0Stride, srcV1, src1Stride);<br>
</div></div>I guess you use luma index here will be wrong size for chroma</div></div></blockquote><div><br></div><div><br></div><div>No, it is correct to use the luma partition enum here.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="line-height:1.7;font-size:14px;font-family:arial"><div><div class="h5"><div>>+<br>>+ addAvg_t addAvg_c[NUM_LUMA_PARTITIONS];<br></div>
</div></div><div>name addAvg_c is for C reference code, here use addAvg is better</div></div></blockquote><div><br></div><div>agreed </div></div></div></div>