<div dir="ltr">Pushed to default.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 24, 2020 at 11:12 AM Aruna Matheswaran <<a href="mailto:aruna@multicorewareinc.com">aruna@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"># HG changeset patch<br>
# User Aruna Matheswaran <<a href="mailto:aruna@multicorewareinc.com" target="_blank">aruna@multicorewareinc.com</a>><br>
# Date 1579629937 -19800<br>
# Tue Jan 21 23:35:37 2020 +0530<br>
# Node ID ba9cb149de98b7ad753686d155155419d1ea1d50<br>
# Parent acc5d16999e2faf6e75ecc1df9a01c1953ebaf8c<br>
analysis-save/load: Enforce resolution and maxCUSize constraints in non-dyadic<br>
analysis load only if analysis-load-reuse-level > 1.<br>
<br>
This patch removes resolution and maxCUSize constraints in<br>
analysis-load-reuse-level 1 as it re-uses only frame level info.<br>
<br>
It also fixes the encoder crashes that were present earlier due to<br>
1) Unwanted analysis load validation failures in re-use level 10<br>
2) Incorrect memory allocation for multi-pass-opt-analysis/distortion<br>
<br>
diff -r acc5d16999e2 -r ba9cb149de98 source/encoder/api.cpp<br>
--- a/source/encoder/api.cpp Mon Jan 20 18:07:59 2020 +0530<br>
+++ b/source/encoder/api.cpp Tue Jan 21 23:35:37 2020 +0530<br>
@@ -812,13 +812,14 @@<br>
if (!isMultiPassOpt && !(param->bAnalysisType == AVC_INFO))<br>
CHECKED_MALLOC_ZERO(analysis->wt, x265_weight_param, numPlanes * numDir);<br>
<br>
- if (maxReuseLevel < 2)<br>
- return;<br>
+ //Allocate memory for intraData pointer<br>
+ if ((maxReuseLevel > 1) || isMultiPassOpt)<br>
+ {<br>
+ CHECKED_MALLOC_ZERO(intraData, x265_analysis_intra_data, 1);<br>
+ CHECKED_MALLOC(intraData->depth, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+ }<br>
<br>
- //Allocate memory for intraData pointer<br>
- CHECKED_MALLOC_ZERO(intraData, x265_analysis_intra_data, 1);<br>
- CHECKED_MALLOC(intraData->depth, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
- if (!isMultiPassOpt)<br>
+ if (maxReuseLevel > 1)<br>
{<br>
CHECKED_MALLOC_ZERO(intraData->modes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
CHECKED_MALLOC_ZERO(intraData->partSizes, char, analysis->numPartitions * analysis->numCUsInFrame);<br>
@@ -828,17 +829,20 @@<br>
}<br>
analysis->intraData = intraData;<br>
<br>
- //Allocate memory for interData pointer based on ReuseLevels<br>
- CHECKED_MALLOC_ZERO(interData, x265_analysis_inter_data, 1);<br>
- CHECKED_MALLOC(interData->depth, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
- CHECKED_MALLOC_ZERO(interData->modes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+ if ((maxReuseLevel > 1) || isMultiPassOpt)<br>
+ {<br>
+ //Allocate memory for interData pointer based on ReuseLevels<br>
+ CHECKED_MALLOC_ZERO(interData, x265_analysis_inter_data, 1);<br>
+ CHECKED_MALLOC(interData->depth, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+ CHECKED_MALLOC_ZERO(interData->modes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
<br>
- if (param->rc.cuTree && !isMultiPassOpt)<br>
- CHECKED_MALLOC_ZERO(interData->cuQPOff, int8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
- CHECKED_MALLOC_ZERO(interData->mvpIdx[0], uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
- CHECKED_MALLOC_ZERO(interData->mvpIdx[1], uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
- CHECKED_MALLOC_ZERO(interData->mv[0], x265_analysis_MV, analysis->numPartitions * analysis->numCUsInFrame);<br>
- CHECKED_MALLOC_ZERO(interData->mv[1], x265_analysis_MV, analysis->numPartitions * analysis->numCUsInFrame);<br>
+ if (param->rc.cuTree && !isMultiPassOpt)<br>
+ CHECKED_MALLOC_ZERO(interData->cuQPOff, int8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+ CHECKED_MALLOC_ZERO(interData->mvpIdx[0], uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+ CHECKED_MALLOC_ZERO(interData->mvpIdx[1], uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+ CHECKED_MALLOC_ZERO(interData->mv[0], x265_analysis_MV, analysis->numPartitions * analysis->numCUsInFrame);<br>
+ CHECKED_MALLOC_ZERO(interData->mv[1], x265_analysis_MV, analysis->numPartitions * analysis->numCUsInFrame);<br>
+ }<br>
<br>
if (maxReuseLevel > 4)<br>
{<br>
@@ -905,9 +909,6 @@<br>
if (!isMultiPassOpt && analysis->wt && !(param->bAnalysisType == AVC_INFO))<br>
X265_FREE(analysis->wt);<br>
<br>
- if (maxReuseLevel < 2)<br>
- return;<br>
-<br>
//Free memory for intraData pointers<br>
if (analysis->intraData)<br>
{<br>
diff -r acc5d16999e2 -r ba9cb149de98 source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp Mon Jan 20 18:07:59 2020 +0530<br>
+++ b/source/encoder/encoder.cpp Tue Jan 21 23:35:37 2020 +0530<br>
@@ -4990,8 +4990,8 @@<br>
X265_FREAD(&readValue, sizeof(int), 1, m_analysisFileIn, &(saveParam->maxCUSize));<br>
<br>
bool isScaledRes = (2 * sourceHeight == curSourceHeight) && (2 * sourceWidth == curSourceWidth);<br>
- if (!isScaledRes && (sourceHeight != curSourceHeight || sourceWidth != curSourceWidth <br>
- || readValue != (int)m_param->maxCUSize || m_param->scaleFactor))<br>
+ if (!isScaledRes && (m_param->analysisLoadReuseLevel > 1) && (sourceHeight != curSourceHeight<br>
+ || sourceWidth != curSourceWidth || readValue != (int)m_param->maxCUSize || m_param->scaleFactor))<br>
error = true;<br>
else if (isScaledRes && !m_param->scaleFactor)<br>
error = true;<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font face="georgia, serif">Regards,</font><div><b><font face="georgia, serif">Aruna Matheswaran,</font></b></div><div><font face="georgia, serif">Video Codec Engineer,</font></div><div><font face="georgia, serif">Media & AI analytics BU,</font></div><div><span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:153px;height:58px"><img src="https://lh5.googleusercontent.com/gjX5cPNIZgwUrhfqkTwQUZWztIKmmo0qs3kbwvkS5H-bDVE2ftte9pMTVnFLSjOcjYWLtfc6_OGpxW4vraLg2r5QAIf1Q3MpldFDgWtzK_gXi8ptw5B3joIbsGL6mxj-JRdjHzT5" width="96" height="36" style="margin-left: 0px; margin-top: 0px;"></span></span></span><font face="georgia, serif"><br></font></div><div><span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:153px;height:58px"><img src="https://lh5.googleusercontent.com/gjX5cPNIZgwUrhfqkTwQUZWztIKmmo0qs3kbwvkS5H-bDVE2ftte9pMTVnFLSjOcjYWLtfc6_OGpxW4vraLg2r5QAIf1Q3MpldFDgWtzK_gXi8ptw5B3joIbsGL6mxj-JRdjHzT5" style="margin-left: 0px; margin-top: 0px;"></span></span></span><font face="georgia, serif"><br></font></div><div><font face="georgia, serif"><br></font></div></div></div></div></div></div></div></div></div>