<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 6, 2017 at 5:22 PM, Sean McGovern <span dir="ltr"><<a href="mailto:gseanmcg@gmail.com" target="_blank">gseanmcg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Same as I noted for other changes, please be sure to export this in the .<a href="http://def.in" rel="noreferrer" target="_blank">def.in</a></blockquote><div><br></div><div>This is not an API function - doesn't need to be exported. For the others, I concur.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
-- Sean McG.<br>
<br>
<br>
Original Message <br>
From: <a href="mailto:santhoshini@multicorewareinc.com">santhoshini@multicorewareinc.<wbr>com</a><br>
Sent: November 6, 2017 3:35 AM<br>
To: <a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
Reply-to: <a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
Subject: [x265] [PATCH 1 of 4] add function to copy analysis data after z scan<br>
<div><div class="h5"><br>
# HG changeset patch<br>
# User Santhoshini Sekar <<a href="mailto:santhoshini@multicorewareinc.com">santhoshini@multicorewareinc.<wbr>com</a>><br>
# Date 1502258938 -19800<br>
# Wed Aug 09 11:38:58 2017 +0530<br>
# Node ID 2508de5ad27440f650a6ba68a42feb<wbr>c273a2cd17<br>
# Parent aa9649a2aa8c30bcb84ee8287839fa<wbr>877978d4a7<br>
add function to copy analysis data after z scan<br>
<br>
The pointer to x265_analysis_data sent as parameter to this function has data for<br>
16x16 blocks stored continuously. To store this data in bigger CTU sizes(32x32 or 64x64) we<br>
need to perform z-scan of constituent 16x16 blocks before copying.<br>
<br>
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp<br>
+++ b/source/encoder/encoder.cpp<br>
@@ -487,6 +487,95 @@<br>
return 0;<br>
}<br>
<br>
+int Encoder::<wbr>setAnalysisDataAfterZScan(<wbr>x265_analysis_data *analysis_data, Frame* curFrame)<br>
+{<br>
+ int mbImageWidth, mbImageHeight;<br>
+ mbImageWidth = (curFrame->m_fencPic->m_<wbr>picWidth + 16 - 1) >> 4; //AVC block sizes<br>
+ mbImageHeight = (curFrame->m_fencPic->m_<wbr>picHeight + 16 - 1) >> 4;<br>
+ if (analysis_data->sliceType == X265_TYPE_IDR || analysis_data->sliceType == X265_TYPE_I)<br>
+ {<br>
+ curFrame->m_analysisData.<wbr>sliceType = X265_TYPE_I;<br>
+ if (m_param->analysisReuseLevel < 7)<br>
+ return -1;<br>
+ curFrame->m_analysisData.<wbr>numPartitions = m_param->num4x4Partitions;<br>
+ int num16x16inCUWidth = m_param->maxCUSize >> 4;<br>
+ uint32_t ctuAddr, offset, cuPos;<br>
+ analysis_intra_data * intraData = (analysis_intra_data *)curFrame->m_analysisData.<wbr>intraData;<br>
+ analysis_intra_data * srcIntraData = (analysis_intra_data *)analysis_data->intraData;<br>
+ for (int i = 0; i < mbImageHeight; i++)<br>
+ {<br>
+ for (int j = 0; j < mbImageWidth; j++)<br>
+ {<br>
+ int mbIndex = j + i * mbImageWidth;<br>
+ ctuAddr = (j / num16x16inCUWidth + ((i / num16x16inCUWidth) * (mbImageWidth / num16x16inCUWidth)));<br>
+ offset = ((i % num16x16inCUWidth) << 5) + ((j % num16x16inCUWidth) << 4);<br>
+ if ((j % 4 >= 2) && m_param->maxCUSize == 64)<br>
+ offset += (2 * 16);<br>
+ if ((i % 4 >= 2) && m_param->maxCUSize == 64)<br>
+ offset += (2 * 32);<br>
+ cuPos = ctuAddr * curFrame->m_analysisData.<wbr>numPartitions + offset;<br>
+ memcpy(&(intraData)->depth[<wbr>cuPos], &(srcIntraData)->depth[mbIndex * 16], 16);<br>
+ memcpy(&(intraData)-><wbr>chromaModes[cuPos], &(srcIntraData)->chromaModes[<wbr>mbIndex * 16], 16);<br>
+ memcpy(&(intraData)-><wbr>partSizes[cuPos], &(srcIntraData)->partSizes[<wbr>mbIndex * 16], 16);<br>
+ memcpy(&(intraData)-><wbr>partSizes[cuPos], &(srcIntraData)->partSizes[<wbr>mbIndex * 16], 16);<br>
+ }<br>
+ }<br>
+ memcpy(&(intraData)->modes, (srcIntraData)->modes, curFrame->m_analysisData.<wbr>numPartitions * analysis_data->numCUsInFrame);<br>
+ }<br>
+ else<br>
+ {<br>
+ uint32_t numDir = analysis_data->sliceType == X265_TYPE_P ? 1 : 2;<br>
+ if (m_param->analysisReuseLevel < 7)<br>
+ return -1;<br>
+ curFrame->m_analysisData.<wbr>numPartitions = m_param->num4x4Partitions;<br>
+ int num16x16inCUWidth = m_param->maxCUSize >> 4;<br>
+ uint32_t ctuAddr, offset, cuPos;<br>
+ analysis_inter_data * interData = (analysis_inter_data *)curFrame->m_analysisData.<wbr>interData;<br>
+ analysis_inter_data * srcInterData = (analysis_inter_data*)<wbr>analysis_data->interData;<br>
+ for (int i = 0; i < mbImageHeight; i++)<br>
+ {<br>
+ for (int j = 0; j < mbImageWidth; j++)<br>
+ {<br>
+ int mbIndex = j + i * mbImageWidth;<br>
+ ctuAddr = (j / num16x16inCUWidth + ((i / num16x16inCUWidth) * (mbImageWidth / num16x16inCUWidth)));<br>
+ offset = ((i % num16x16inCUWidth) << 5) + ((j % num16x16inCUWidth) << 4);<br>
+ if ((j % 4 >= 2) && m_param->maxCUSize == 64)<br>
+ offset += (2 * 16);<br>
+ if ((i % 4 >= 2) && m_param->maxCUSize == 64)<br>
+ offset += (2 * 32);<br>
+ cuPos = ctuAddr * curFrame->m_analysisData.<wbr>numPartitions + offset;<br>
+ memcpy(&(interData)->depth[<wbr>cuPos], &(srcInterData)->depth[mbIndex * 16], 16);<br>
+ memcpy(&(interData)->modes[<wbr>cuPos], &(srcInterData)->modes[mbIndex * 16], 16);<br>
+<br>
+ memcpy(&(interData)->partSize[<wbr>cuPos], &(srcInterData)->partSize[<wbr>mbIndex * 16], 16);<br>
+<br>
+ int bytes = curFrame->m_analysisData.<wbr>numPartitions >> ((srcInterData)->depth[mbIndex * 16] * 2);<br>
+ int cuCount = 1;<br>
+ if (bytes < 16)<br>
+ cuCount = 4;<br>
+ for (int cuI = 0; cuI < cuCount; cuI++)<br>
+ {<br>
+ int numPU = nbPartsTable[(srcInterData)-><wbr>partSize[mbIndex * 16 + cuI * bytes]];<br>
+ for (int pu = 0; pu < numPU; pu++)<br>
+ {<br>
+ int cuOffset = cuI * bytes + pu;<br>
+ (interData)->mergeFlag[cuPos + cuOffset] = (srcInterData)->mergeFlag[(<wbr>mbIndex * 16) + cuOffset];<br>
+<br>
+ (interData)->interDir[cuPos + cuOffset] = (srcInterData)->interDir[(<wbr>mbIndex * 16) + cuOffset];<br>
+ for (uint32_t k = 0; k < numDir; k++)<br>
+ {<br>
+ (interData)->mvpIdx[k][cuPos + cuOffset] = (srcInterData)->mvpIdx[k][(<wbr>mbIndex * 16) + cuOffset];<br>
+ (interData)->refIdx[k][cuPos + cuOffset] = (srcInterData)->refIdx[k][(<wbr>mbIndex * 16) + cuOffset];<br>
+ memcpy(&(interData)->mv[k][<wbr>cuPos + cuOffset], &(srcInterData)->mv[k][(<wbr>mbIndex * 16) + cuOffset], sizeof(MV));<br>
+ }<br>
+ }<br>
+ }<br>
+ }<br>
+ }<br>
+ }<br>
+ return 0;<br>
+}<br>
+<br>
void Encoder::destroy()<br>
{<br>
#if ENABLE_HDR10_PLUS<br>
diff --git a/source/encoder/encoder.h b/source/encoder/encoder.h<br>
--- a/source/encoder/encoder.h<br>
+++ b/source/encoder/encoder.h<br>
@@ -209,6 +209,8 @@<br>
<br>
int getRefFrameList(PicYuv** l0, PicYuv** l1, int sliceType, int poc);<br>
<br>
+ int setAnalysisDataAfterZScan(<wbr>x265_analysis_data *analysis_data, Frame* curFrame);<br>
+<br>
void getStreamHeaders(NALList& list, Entropy& sbacCoder, Bitstream& bs);<br>
<br>
void fetchStats(x265_stats* stats, size_t statsSizeBytes);<br>
<br>
</div></div>______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">https://mailman.videolan.org/<wbr>listinfo/x265-devel</a><br>
______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">https://mailman.videolan.org/<wbr>listinfo/x265-devel</a><br>
</blockquote></div><br></div></div>