<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Nov 7, 2013 at 5:17 AM, Aarthi Thirumalai <span dir="ltr"><<a href="mailto:aarthi@multicorewareinc.com" target="_blank">aarthi@multicorewareinc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"># HG changeset patch<br>
# User Aarthi Thirumalai<br>
</div># Date 1383823017 -19800<br>
# Thu Nov 07 16:46:57 2013 +0530<br>
# Node ID 0823d243b4e2f9eee6323a9750eeb811bccbad77<br>
# Parent 85002898f5b4308547af6ce464bbdff5f360fa13<br>
aq: bug fix.extend border of TComPic::m_origPicYuv to a multiple of 16<br>
<br>
diff -r 85002898f5b4 -r 0823d243b4e2 source/Lib/TLibCommon/TComPicYuv.cpp<br>
--- a/source/Lib/TLibCommon/TComPicYuv.cpp Thu Nov 07 14:31:05 2013 +0530<br>
+++ b/source/Lib/TLibCommon/TComPicYuv.cpp Thu Nov 07 16:46:57 2013 +0530<br>
@@ -345,6 +345,10 @@<br>
<div class="im"> /* width and height - without padsize */<br>
</div> int width = m_picWidth - padx;<br>
<div class="im"> int height = m_picHeight - pady;<br>
+ uint8_t rem = m_picWidth % 16;<br>
+ padx += rem ? 16 - rem : 0;<br>
+ rem = m_picHeight % 16;<br>
+ pady += rem ? 16 - rem : 0;<br></div></blockquote><div><br></div><div>if the row width was 17, padx would already be 3 in order to pad out to the nearest multiple of 4. You would be doing: padx += 15, which would result in a pad of 18, which is more than what you bargained for. I believe the += should just be =. Also, Gopu just added a new else {} clause this is missed here, so I've hoisted this operation higher in the file.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
</div> // Manually copy pixels to up-size them<br>
<div class="im"> for (int r = 0; r < height; r++)<br>
</div>@@ -475,10 +479,12 @@<br>
<div class="im"> uint8_t *v = (uint8_t*)pic.planes[2];<br>
<br>
/* width and height - without padsize */<br>
- int width = (m_picWidth * (pic.bitDepth > 8 ? 2 : 1)) - padx;<br>
- int height = m_picHeight - pady;<br>
-<br>
- // copy pixels by row into encoder's buffer<br>
+ int width = (m_picWidth * (pic.bitDepth > 8 ? 2 : 1)) - padx;<br>
+ int height = m_picHeight - pady;<br>
+ uint8_t rem = m_picWidth % 16;<br>
+ padx += rem ? 16 - rem : 0;<br>
+ rem = m_picHeight % 16;<br>
+ pady += rem ? 16 - rem : 0;<br></div></blockquote><div><br></div><div>still white-space alignment problems here, but this code has been removed</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">
</div><div class="im"> for (int r = 0; r < height; r++)<br>
{<br>
memcpy(Y, y, width);<br>
</div>diff -r 85002898f5b4 -r 0823d243b4e2 source/common/lowres.cpp<br>
--- a/source/common/lowres.cpp Thu Nov 07 14:31:05 2013 +0530<br>
+++ b/source/common/lowres.cpp Thu Nov 07 16:46:57 2013 +0530<br>
<div><div class="h5">@@ -150,31 +150,6 @@<br>
intraMbs[i] = 0;<br>
}<br>
<br>
- int y, extWidth = (orig->getWidth() + X265_LOWRES_CU_SIZE - 1);<br>
- int srcStride = orig->getStride();<br>
- int srcHeight = orig->getHeight();<br>
- int srcWidth = orig->getWidth();<br>
- Pel *src;<br>
- src = orig->getLumaAddr();<br>
-<br>
- /* extending right margin */<br>
- if (2 * width > srcWidth)<br>
- {<br>
- for (y = 0; y < srcHeight; y++)<br>
- {<br>
- ::memset(src + srcWidth, src[srcWidth - 1], sizeof(Pel) * (X265_LOWRES_CU_SIZE - 1));<br>
- src += srcStride;<br>
- }<br>
- }<br>
-<br>
- /* extending bottom margin */<br>
- src = orig->getLumaAddr() + (srcHeight - 1) * srcStride;<br>
-<br>
- for (y = 1; y <= 2 * lines - srcHeight; y++)<br>
- {<br>
- ::memcpy(src + y * srcStride, src, sizeof(Pel) * (extWidth));<br>
- }<br>
-<br>
/* downscale and generate 4 HPEL planes for lookahead */<br>
primitives.frame_init_lowres_core(orig->getLumaAddr(),<br>
lowresPlane[0], lowresPlane[1], lowresPlane[2], lowresPlane[3],<br>
</div></div>diff -r 85002898f5b4 -r 0823d243b4e2 source/encoder/frameencoder.cpp<br>
--- a/source/encoder/frameencoder.cpp Thu Nov 07 14:31:05 2013 +0530<br>
+++ b/source/encoder/frameencoder.cpp Thu Nov 07 16:46:57 2013 +0530<br>
@@ -1149,9 +1149,8 @@<br>
{<br>
/* Derive qpOffet for each CU by averaging offsets for all 16x16 blocks in the cu. */<br>
double qp_offset = 0;<br>
- int blockSize = g_maxCUWidth >> 2;<br>
- int maxBlockCols = (pic->getPicYuvOrg()->getWidth() + (blockSize - 1)) / blockSize;<br>
- int maxBlockRows = (pic->getPicYuvOrg()->getHeight() + (blockSize - 1)) / blockSize;<br>
+ int maxBlockCols = (pic->getPicYuvOrg()->getWidth() + (16 - 1)) / 16;<br>
+ int maxBlockRows = (pic->getPicYuvOrg()->getHeight() + (16 - 1)) / 16;<br></blockquote><div><br></div><div>much better</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
int block_y = (cuAddr / pic->getPicSym()->getFrameWidthInCU()) * 4;<br>
int block_x = (cuAddr * 4) - block_y * pic->getPicSym()->getFrameWidthInCU();<br>
int cnt = 0;<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>