<div dir="ltr">As of now we have not used offset value as per our plan. Later when we need, can add offset value.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 29, 2014 at 4:46 PM, Santhoshini Sekar <span dir="ltr"><<a href="mailto:santhoshini@multicorewareinc.com" target="_blank">santhoshini@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 dir="ltr">As of now offset can be removed from CU structure. We don't have any planned optimization with it. If needed we can <div>add it later.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 29, 2014 at 4:11 PM, Deepthi Nandakumar <span dir="ltr"><<a href="mailto:deepthi@multicorewareinc.com" target="_blank">deepthi@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 dir="ltr">Ashok/Santhoshini - pls review. Does removing offsets affect any planned optimizations?<br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Sep 27, 2014 at 7:03 AM, <span dir="ltr"><<a href="mailto:dtyx265@gmail.com" target="_blank">dtyx265@gmail.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 David T Yuen <<a href="mailto:dtyx265@gmail.com" target="_blank">dtyx265@gmail.com</a>><br>
# Date 1411781537 25200<br>
# Node ID 85098db291ae133981419868685358227b8b1437<br>
# Parent 4b18a27b52ac69a16805c2b455d4f891cdd4a057<br>
Changes for loadCTUData<br>
<br>
Replaced getDepthScanIdx() with table g_depthScanIdx<br>
Moved Analysis::loadCTUData to TComDataCU::loadCTUData since it only works with TComDataCU fields<br>
Replaced CU.offsets[2] with local variables in loadCTUData since that is the only place it was set and used<br>
minor changes to reduce the number of local variables in loadCTUData<br>
<br>
diff -r 4b18a27b52ac -r 85098db291ae source/Lib/TLibCommon/TComDataCU.cpp<br>
--- a/source/Lib/TLibCommon/TComDataCU.cpp Fri Sep 26 10:48:07 2014 +0530<br>
+++ b/source/Lib/TLibCommon/TComDataCU.cpp Fri Sep 26 18:32:17 2014 -0700<br>
@@ -2407,4 +2407,43 @@<br>
result.firstSignificanceMapContext = bIsLuma ? 21 : 12;<br>
}<br>
<br>
+void TComDataCU::loadCTUData(uint32_t maxCUSize)<br>
+{<br>
+ // Initialize the coding blocks inside the CTB<br>
+ for (uint32_t log2CUSize = g_log2Size[maxCUSize], rangeCUIdx = 0; log2CUSize >= MIN_LOG2_CU_SIZE; log2CUSize--)<br>
+ {<br>
+ uint32_t blockSize = 1 << log2CUSize;<br>
+ uint32_t sbWidth = 1 << (g_log2Size[maxCUSize] - log2CUSize);<br>
+ int32_t last_level_flag = log2CUSize == MIN_LOG2_CU_SIZE;<br>
+ for (uint32_t sb_y = 0; sb_y < sbWidth; sb_y++)<br>
+ {<br>
+ for (uint32_t sb_x = 0; sb_x < sbWidth; sb_x++)<br>
+ {<br>
+ uint32_t depth_idx = g_depthScanIdx[sb_y][sb_x];<br>
+ uint32_t cuIdx = rangeCUIdx + depth_idx;<br>
+ uint32_t child_idx = rangeCUIdx + sbWidth * sbWidth + (depth_idx << 2);<br>
+ uint32_t px = m_cuPelX + sb_x * blockSize;<br>
+ uint32_t py = m_cuPelY + sb_y * blockSize;<br>
+ int32_t present_flag = px < m_pic->m_origPicYuv->m_picWidth && py < m_pic->m_origPicYuv->m_picHeight;<br>
+ int32_t split_mandatory_flag = present_flag && !last_level_flag && (px + blockSize > m_pic->m_origPicYuv->m_picWidth || py + blockSize > m_pic->m_origPicYuv->m_picHeight);<br>
+<br>
+ /* Offset of the luma CU in the X, Y direction in terms of pixels from the CTU origin */<br>
+ uint32_t xOffset = (sb_x * blockSize) >> 3;<br>
+ uint32_t yOffset = (sb_y * blockSize) >> 3;<br>
+<br>
+ CU *cu = m_CULocalData + cuIdx;<br>
+ cu->log2CUSize = log2CUSize;<br>
+ cu->childIdx = child_idx;<br>
+ cu->encodeIdx = g_depthScanIdx[yOffset][xOffset];<br>
+ cu->flags = 0;<br>
+<br>
+ CU_SET_FLAG(cu->flags, CU::PRESENT, present_flag);<br>
+ CU_SET_FLAG(cu->flags, CU::SPLIT_MANDATORY | CU::SPLIT, split_mandatory_flag);<br>
+ CU_SET_FLAG(cu->flags, CU::LEAF, last_level_flag);<br>
+ }<br>
+ }<br>
+ rangeCUIdx += sbWidth * sbWidth;<br>
+ }<br>
+}<br>
+<br>
//! \}<br>
diff -r 4b18a27b52ac -r 85098db291ae source/Lib/TLibCommon/TComDataCU.h<br>
--- a/source/Lib/TLibCommon/TComDataCU.h Fri Sep 26 10:48:07 2014 +0530<br>
+++ b/source/Lib/TLibCommon/TComDataCU.h Fri Sep 26 18:32:17 2014 -0700<br>
@@ -114,7 +114,6 @@<br>
uint32_t log2CUSize; // Log of the CU size.<br>
uint32_t childIdx; // Index of the first child CU<br>
uint32_t encodeIdx; // Encoding index of this CU in terms of 8x8 blocks.<br>
- uint32_t offset[2]; // Offset of the luma CU in the X, Y direction in terms of pixels from the CTU origin<br>
uint32_t flags; // CU flags.<br>
};<br>
<br>
@@ -274,6 +273,7 @@<br>
void initCU(Frame* pic, uint32_t cuAddr);<br>
void initEstData();<br>
void initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth, int qp);<br>
+ void loadCTUData(uint32_t maxCUSize);<br>
<br>
void copyToSubCU(TComDataCU* lcu, uint32_t partUnitIdx, uint32_t depth);<br>
void copyPartFrom(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth, bool isRDObasedAnalysis = true);<br>
diff -r 4b18a27b52ac -r 85098db291ae source/Lib/TLibCommon/TComRom.cpp<br>
--- a/source/Lib/TLibCommon/TComRom.cpp Fri Sep 26 10:48:07 2014 +0530<br>
+++ b/source/Lib/TLibCommon/TComRom.cpp Fri Sep 26 18:32:17 2014 -0700<br>
@@ -517,5 +517,18 @@<br>
{256, 64, 16, 4}<br>
};<br>
<br>
+/* g_depthScanIdx [y][x] */<br>
+const uint32_t g_depthScanIdx[8][8] =<br>
+{<br>
+ { 0, 1, 4, 5, 16, 17, 20, 21, },<br>
+ { 2, 3, 6, 7, 18, 19, 22, 23, },<br>
+ { 8, 9, 12, 13, 24, 25, 28, 29, },<br>
+ { 10, 11, 14, 15, 26, 27, 30, 31, },<br>
+ { 32, 33, 36, 37, 48, 49, 52, 53, },<br>
+ { 34, 35, 38, 39, 50, 51, 54, 55, },<br>
+ { 40, 41, 44, 45, 56, 57, 60, 61, },<br>
+ { 42, 43, 46, 47, 58, 59, 62, 63, }<br>
+};<br>
+<br>
}<br>
//! \}<br>
diff -r 4b18a27b52ac -r 85098db291ae source/Lib/TLibCommon/TComRom.h<br>
--- a/source/Lib/TLibCommon/TComRom.h Fri Sep 26 10:48:07 2014 +0530<br>
+++ b/source/Lib/TLibCommon/TComRom.h Fri Sep 26 18:32:17 2014 -0700<br>
@@ -159,6 +159,8 @@<br>
<br>
extern const uint32_t g_depthInc[3][4];<br>
<br>
+extern const uint32_t g_depthScanIdx[8][8];<br>
+<br>
}<br>
<br>
#endif //ifndef X265_TCOMROM_H<br>
diff -r 4b18a27b52ac -r 85098db291ae source/encoder/analysis.cpp<br>
--- a/source/encoder/analysis.cpp Fri Sep 26 10:48:07 2014 +0530<br>
+++ b/source/encoder/analysis.cpp Fri Sep 26 18:32:17 2014 -0700<br>
@@ -30,32 +30,6 @@<br>
<br>
using namespace x265;<br>
<br>
-namespace {<br>
-// TO DO: Remove this function with a table.<br>
-int getDepthScanIdx(int x, int y, int size)<br>
-{<br>
- if (size == 1)<br>
- return 0;<br>
-<br>
- int depth = 0;<br>
- int h = size >> 1;<br>
-<br>
- if (x >= h)<br>
- {<br>
- x -= h;<br>
- depth += h * h;<br>
- }<br>
-<br>
- if (y >= h)<br>
- {<br>
- y -= h;<br>
- depth += 2 * h * h;<br>
- }<br>
-<br>
- return depth + getDepthScanIdx(x, y, h);<br>
-}<br>
-}<br>
-<br>
Analysis::Analysis()<br>
{<br>
m_bestPredYuv = NULL;<br>
@@ -253,47 +227,6 @@<br>
delete [] m_origYuv;<br>
}<br>
<br>
-void Analysis::loadCTUData(TComDataCU* parentCU)<br>
-{<br>
- uint8_t cuRange[2]= {MIN_LOG2_CU_SIZE, g_log2Size[m_param->maxCUSize]};<br>
-<br>
- // Initialize the coding blocks inside the CTB<br>
- for (int rangeIdx = cuRange[1], rangeCUIdx = 0; rangeIdx >= cuRange[0]; rangeIdx--)<br>
- {<br>
- uint32_t log2CUSize = rangeIdx;<br>
- int32_t blockSize = 1 << log2CUSize;<br>
- uint32_t b8Width = 1 << (cuRange[1] - 3);<br>
- uint32_t sbWidth = 1 << (cuRange[1] - rangeIdx);<br>
- int32_t last_level_flag = rangeIdx == cuRange[0];<br>
- for (uint32_t sb_y = 0; sb_y < sbWidth; sb_y++)<br>
- {<br>
- for (uint32_t sb_x = 0; sb_x < sbWidth; sb_x++)<br>
- {<br>
- uint32_t depth_idx = getDepthScanIdx(sb_x, sb_y, sbWidth);<br>
- uint32_t cuIdx = rangeCUIdx + depth_idx;<br>
- uint32_t child_idx = rangeCUIdx + sbWidth * sbWidth + (depth_idx << 2);<br>
- int32_t px = parentCU->getCUPelX() + sb_x * blockSize;<br>
- int32_t py = parentCU->getCUPelY() + sb_y * blockSize;<br>
- int32_t present_flag = px < parentCU->m_pic->m_origPicYuv->m_picWidth && py < parentCU->m_pic->m_origPicYuv->m_picHeight;<br>
- int32_t split_mandatory_flag = present_flag && !last_level_flag && (px + blockSize > parentCU->m_pic->m_origPicYuv->m_picWidth || py + blockSize > parentCU->m_pic->m_origPicYuv->m_picHeight);<br>
-<br>
- CU *cu = parentCU->m_CULocalData + cuIdx;<br>
- cu->log2CUSize = log2CUSize;<br>
- cu->childIdx = child_idx;<br>
- cu->offset[0] = sb_x * blockSize;<br>
- cu->offset[1] = sb_y * blockSize;<br>
- cu->encodeIdx = getDepthScanIdx(cu->offset[0] >> 3, cu->offset[1] >> 3, b8Width);<br>
- cu->flags = 0;<br>
-<br>
- CU_SET_FLAG(cu->flags, CU::PRESENT, present_flag);<br>
- CU_SET_FLAG(cu->flags, CU::SPLIT_MANDATORY | CU::SPLIT, split_mandatory_flag);<br>
- CU_SET_FLAG(cu->flags, CU::LEAF, last_level_flag);<br>
- }<br>
- }<br>
- rangeCUIdx += sbWidth * sbWidth;<br>
- }<br>
-}<br>
-<br>
void Analysis::compressCU(TComDataCU* cu)<br>
{<br>
Frame* pic = cu->m_pic;<br>
diff -r 4b18a27b52ac -r 85098db291ae source/encoder/analysis.h<br>
--- a/source/encoder/analysis.h Fri Sep 26 10:48:07 2014 +0530<br>
+++ b/source/encoder/analysis.h Fri Sep 26 18:32:17 2014 -0700<br>
@@ -104,7 +104,6 @@<br>
bool create(uint32_t totalDepth, uint32_t maxWidth);<br>
void destroy();<br>
void compressCU(TComDataCU* cu);<br>
- void loadCTUData(TComDataCU* cu);<br>
<br>
protected:<br>
<br>
diff -r 4b18a27b52ac -r 85098db291ae source/encoder/frameencoder.cpp<br>
--- a/source/encoder/frameencoder.cpp Fri Sep 26 10:48:07 2014 +0530<br>
+++ b/source/encoder/frameencoder.cpp Fri Sep 26 18:32:17 2014 -0700<br>
@@ -686,7 +686,7 @@<br>
// load current best state from go-on entropy coder<br>
curRow.rdEntropyCoders[0][CI_CURR_BEST].load(rowCoder);<br>
<br>
- tld.analysis.loadCTUData(cu);<br>
+ cu->loadCTUData(m_param->maxCUSize);<br>
tld.analysis.m_quant.setQPforQuant(cu);<br>
tld.analysis.compressCU(cu); // Does all the CU analysis<br>
<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">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></div>
</div></div><br>_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">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>
<br></blockquote></div><br></div>
<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>
<br></blockquote></div><br></div>