<div dir="ltr"><div dir="ltr"><br></div>Patch looks good to me. Just a couple of comments.<br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 10, 2020 at 5:22 PM 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 1578655868 -19800<br>
# Fri Jan 10 17:01:08 2020 +0530<br>
# Node ID a28fd843b302128cff31172fe140aac19f93ce80<br>
# Parent 4fcd8f1701a6dd7a502c4e48f04a27bb397664cf<br>
De-couple analysis reuse levels of --analysis-save and --analysis-load.<br>
<br>
Currently, analysis reuse level of the load encode has to be the same as that of<br>
the reuse level of the save encode. This commit de-couples the reuse level<br>
constraints and let the load encode re-use a subset of the available analysis<br>
info.<br>
<br>
Two CLI and x265_param options are introduced to get the desired reuse level<br>
during save and load.<br>
<br>
The existing option --analysis-reuse-level is deprecated.<br>
<br>
diff -r 4fcd8f1701a6 -r a28fd843b302 doc/reST/cli.rst<br>
--- a/doc/reST/cli.rst Fri Jan 10 14:16:04 2020 +0530<br>
+++ b/doc/reST/cli.rst Fri Jan 10 17:01:08 2020 +0530<br>
@@ -918,12 +918,14 @@<br>
Specify a filename for `multi-pass-opt-analysis` and `multi-pass-opt-distortion`.<br>
If no filename is specified, x265_analysis.dat is used.<br>
<br>
-.. option:: --analysis-reuse-level <1..10><br>
-<br>
- Amount of information stored/reused in :option:`--analysis-reuse-mode` is distributed across levels.<br>
+.. option:: --analysis-save-reuse-level <1..10>, --analysis-load-reuse-level <1..10><br>
+<br>
+ :option:`--analysis-save-reuse-level` denotes the amount of information stored during :option:`--analysis-save` and<br>
+ :option:`--analysis-load-reuse-level` denotes the amount of information reused during :option:`--analysis-load`.<br>
Higher the value, higher the information stored/reused, faster the encode. Default 5.</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
- Note that --analysis-reuse-level must be paired with analysis-reuse-mode.<br>
+ Note that :option:`--analysis-save-reuse-level` and :option:`--analysis-load-reuse-level` must be paired<br>
+ with :option:`--analysis-save` and :option:`--analysis-load` respectively.<br>
<br>
+--------------+------------------------------------------+<br>
| Level | Description |<br>
diff -r 4fcd8f1701a6 -r a28fd843b302 source/CMakeLists.txt<br>
--- a/source/CMakeLists.txt Fri Jan 10 14:16:04 2020 +0530<br>
+++ b/source/CMakeLists.txt Fri Jan 10 17:01:08 2020 +0530<br>
@@ -29,7 +29,7 @@<br>
option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)<br>
mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)<br>
# X265_BUILD must be incremented each time the public API is changed<br>
-set(X265_BUILD 186)<br>
+set(X265_BUILD 187)<br>
configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265.def.in" rel="noreferrer" target="_blank">x265.def.in</a>"<br>
"${PROJECT_BINARY_DIR}/x265.def")<br>
configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265_config.h.in" rel="noreferrer" target="_blank">x265_config.h.in</a>"<br>
diff -r 4fcd8f1701a6 -r a28fd843b302 source/common/param.cpp<br>
--- a/source/common/param.cpp Fri Jan 10 14:16:04 2020 +0530<br>
+++ b/source/common/param.cpp Fri Jan 10 17:01:08 2020 +0530<br>
@@ -321,7 +321,9 @@<br>
param->bAQMotion = 0;<br>
param->bHDROpt = 0; /*DEPRECATED*/<br>
param->bHDR10Opt = 0;<br>
- param->analysisReuseLevel = 5;<br>
+ param->analysisReuseLevel = 0; /*DEPRECATED*/<br>
+ param->analysisSaveReuseLevel = 0;<br>
+ param->analysisLoadReuseLevel = 0;<br>
param->toneMapFile = NULL;<br>
param->bDhdr10opt = 0;<br>
param->dolbyProfile = 0;<br>
@@ -1221,7 +1223,14 @@<br>
OPT("multi-pass-opt-distortion") p->analysisMultiPassDistortion = atobool(value);<br>
OPT("aq-motion") p->bAQMotion = atobool(value);<br>
OPT("dynamic-rd") p->dynamicRd = atof(value);<br>
- OPT("analysis-reuse-level") p->analysisReuseLevel = atoi(value);<br>
+ OPT("analysis-reuse-level")<br>
+ {<br>
+ p->analysisReuseLevel = atoi(value);<br>
+ p->analysisSaveReuseLevel = atoi(value);<br>
+ p->analysisLoadReuseLevel = atoi(value);<br>
+ }<br>
+ OPT("analysis-save-reuse-level") p->analysisSaveReuseLevel = atoi(value);<br>
+ OPT("analysis-load-reuse-level") p->analysisLoadReuseLevel = atoi(value);<br>
OPT("ssim-rd")<br>
{<br>
int bval = atobool(value);<br>
@@ -1264,7 +1273,7 @@<br>
}<br>
else if (strcmp(strdup(value), "off") == 0)<br>
{<br>
- p->bAnalysisType = NO_INFO;<br>
+ p->bAnalysisType = DEFAULT;<br>
}<br>
else<br>
{<br>
@@ -1700,8 +1709,10 @@<br>
"Constant QP is incompatible with 2pass");<br>
CHECK(param->rc.bStrictCbr && (param->rc.bitrate <= 0 || param->rc.vbvBufferSize <=0),<br>
"Strict-cbr cannot be applied without specifying target bitrate or vbv bufsize");<br>
- CHECK((param->analysisSave || param->analysisLoad) && (param->analysisReuseLevel < 1 || param->analysisReuseLevel > 10),<br>
- "Invalid analysis refine level. Value must be between 1 and 10 (inclusive)");<br>
+ CHECK(param->analysisSave && (param->analysisSaveReuseLevel < 1 || param->analysisSaveReuseLevel > 10),<br>
+ "Invalid analysis save refine level. Value must be between 1 and 10 (inclusive)");<br>
+ CHECK(param->analysisLoad && (param->analysisLoadReuseLevel < 1 || param->analysisLoadReuseLevel > 10),<br>
+ "Invalid analysis load refine level. Value must be between 1 and 10 (inclusive)");<br>
CHECK(param->analysisLoad && (param->mvRefine < 1 || param->mvRefine > 3),<br>
"Invalid mv refinement level. Value must be between 1 and 3 (inclusive)");<br>
CHECK(param->scaleFactor > 2, "Invalid scale-factor. Supports factor <= 2");<br>
@@ -2164,6 +2175,8 @@<br>
if (p->analysisLoad)<br>
s += sprintf(s, " analysis-load");<br>
s += sprintf(s, " analysis-reuse-level=%d", p->analysisReuseLevel);<br>
+ s += sprintf(s, " analysis-save-reuse-level=%d", p->analysisSaveReuseLevel);<br>
+ s += sprintf(s, " analysis-load-reuse-level=%d", p->analysisLoadReuseLevel);<br>
s += sprintf(s, " scale-factor=%d", p->scaleFactor);<br>
s += sprintf(s, " refine-intra=%d", p->intraRefine);<br>
s += sprintf(s, " refine-inter=%d", p->interRefine);<br>
@@ -2482,6 +2495,8 @@<br>
dst->bHDROpt = src->bHDROpt; /*DEPRECATED*/<br>
dst->bHDR10Opt = src->bHDR10Opt;<br>
dst->analysisReuseLevel = src->analysisReuseLevel;<br>
+ dst->analysisSaveReuseLevel = src->analysisSaveReuseLevel;<br>
+ dst->analysisLoadReuseLevel = src->analysisLoadReuseLevel;<br>
dst->bLimitSAO = src->bLimitSAO;<br>
if (src->toneMapFile) dst->toneMapFile = strdup(src->toneMapFile);<br>
else dst->toneMapFile = NULL;<br>
diff -r 4fcd8f1701a6 -r a28fd843b302 source/encoder/analysis.cpp<br>
--- a/source/encoder/analysis.cpp Fri Jan 10 14:16:04 2020 +0530<br>
+++ b/source/encoder/analysis.cpp Fri Jan 10 17:01:08 2020 +0530<br>
@@ -202,14 +202,17 @@<br>
m_reuseDepth = &m_reuseInterDataCTU->depth[ctu.m_cuAddr * ctu.m_numPartitions];<br>
}<br>
<br>
- if ((m_param->analysisSave || m_param->analysisLoad) && m_slice->m_sliceType != I_SLICE && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel < 10)<br>
+ int reuseLevel = X265_MAX(m_param->analysisSaveReuseLevel, m_param->analysisLoadReuseLevel);<br>
+ if ((m_param->analysisSave || m_param->analysisLoad) && m_slice->m_sliceType != I_SLICE && reuseLevel > 1 && reuseLevel < 10)<br>
{<br>
int numPredDir = m_slice->isInterP() ? 1 : 2;<br>
m_reuseInterDataCTU = m_frame->m_analysisData.interData;<br>
- m_reuseRef = &m_reuseInterDataCTU->ref [ctu.m_cuAddr * X265_MAX_PRED_MODE_PER_CTU * numPredDir];<br>
+ if (((m_param->analysisSaveReuseLevel > 1) && (m_param->analysisSaveReuseLevel < 7)) ||<br>
+ ((m_param->analysisLoadReuseLevel > 1) && (m_param->analysisLoadReuseLevel < 7)))<br>
+ m_reuseRef = &m_reuseInterDataCTU->ref[ctu.m_cuAddr * X265_MAX_PRED_MODE_PER_CTU * numPredDir];<br>
m_reuseDepth = &m_reuseInterDataCTU->depth[ctu.m_cuAddr * ctu.m_numPartitions];<br>
m_reuseModes = &m_reuseInterDataCTU->modes[ctu.m_cuAddr * ctu.m_numPartitions];<br>
- if (m_param->analysisReuseLevel > 4)<br>
+ if (reuseLevel > 4)<br>
{<br>
m_reusePartSize = &m_reuseInterDataCTU->partSize[ctu.m_cuAddr * ctu.m_numPartitions];<br>
m_reuseMergeFlag = &m_reuseInterDataCTU->mergeFlag[ctu.m_cuAddr * ctu.m_numPartitions];<br>
@@ -223,7 +226,7 @@<br>
if (m_slice->m_sliceType == I_SLICE)<br>
{<br>
x265_analysis_intra_data* intraDataCTU = m_frame->m_analysisData.intraData;<br>
- if (m_param->analysisLoad && m_param->analysisReuseLevel > 1)<br>
+ if (m_param->analysisLoadReuseLevel > 1)<br>
{<br>
memcpy(ctu.m_cuDepth, &intraDataCTU->depth[ctu.m_cuAddr * numPartition], sizeof(uint8_t) * numPartition);<br>
memcpy(ctu.m_lumaIntraDir, &intraDataCTU->modes[ctu.m_cuAddr * numPartition], sizeof(uint8_t) * numPartition);<br>
@@ -234,9 +237,9 @@<br>
}<br>
else<br>
{<br>
- bool bCopyAnalysis = ((m_param->analysisLoad && m_param->analysisReuseLevel == 10) || (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel >= 7 && ctu.m_numPartitions <= 16));<br>
- bool BCompressInterCUrd0_4 = (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel >= 7 && m_param->rdLevel <= 4);<br>
- bool BCompressInterCUrd5_6 = (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel >= 7 && m_param->rdLevel >= 5 && m_param->rdLevel <= 6);<br>
+ bool bCopyAnalysis = ((m_param->analysisLoadReuseLevel == 10) || (m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel >= 7 && ctu.m_numPartitions <= 16));<br>
+ bool BCompressInterCUrd0_4 = (m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel >= 7 && m_param->rdLevel <= 4);<br>
+ bool BCompressInterCUrd5_6 = (m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel >= 7 && m_param->rdLevel >= 5 && m_param->rdLevel <= 6);<br></blockquote><div>[KS] Can you rename these 2 bool variables? they do not follow the convention. I know your didn't was not the cause but can you fix?</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
bCopyAnalysis = bCopyAnalysis || BCompressInterCUrd0_4 || BCompressInterCUrd5_6;<br>
<br>
if (bCopyAnalysis)<br>
@@ -275,8 +278,8 @@<br>
/* generate residual for entire CTU at once and copy to reconPic */<br>
encodeResidue(ctu, cuGeom);<br>
}<br>
- else if ((m_param->analysisLoad && m_param->analysisReuseLevel == 10 && (!(m_param->bAnalysisType == HEVC_INFO) || m_slice->m_sliceType != P_SLICE)) ||<br>
- ((m_param->bAnalysisType == AVC_INFO) && m_param->analysisReuseLevel >= 7 && ctu.m_numPartitions <= 16))<br>
+ else if ((m_param->analysisLoadReuseLevel == 10 && (!(m_param->bAnalysisType == HEVC_INFO) || m_slice->m_sliceType != P_SLICE)) ||<br>
+ ((m_param->bAnalysisType == AVC_INFO) && m_param->analysisLoadReuseLevel >= 7 && ctu.m_numPartitions <= 16))<br>
{<br>
x265_analysis_inter_data* interDataCTU = m_frame->m_analysisData.interData;<br>
int posCTU = ctu.m_cuAddr * numPartition;<br>
@@ -456,7 +459,7 @@<br>
int bestCUQP = qp;<br>
int lambdaQP = lqp;<br>
bool doQPRefine = (bDecidedDepth && depth <= m_slice->m_pps->maxCuDQPDepth) || (!bDecidedDepth && depth == m_slice->m_pps->maxCuDQPDepth);<br>
- if (m_param->analysisReuseLevel >= 7)<br>
+ if (m_param->analysisLoadReuseLevel >= 7)<br>
doQPRefine = false;<br>
if (doQPRefine)<br>
{<br>
@@ -1164,7 +1167,7 @@<br>
SplitData splitCUData;<br>
<br>
bool bHEVCBlockAnalysis = (m_param->bAnalysisType == AVC_INFO && cuGeom.numPartitions > 16);<br>
- bool bRefineAVCAnalysis = (m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1]));<br>
+ bool bRefineAVCAnalysis = (m_param->analysisLoadReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1]));<br>
bool bNooffloading = !(m_param->bAnalysisType == AVC_INFO);<br>
<br>
if (bHEVCBlockAnalysis || bRefineAVCAnalysis || bNooffloading)<br>
@@ -1259,7 +1262,7 @@<br>
mightSplit &= !bDecidedDepth;<br>
}<br>
}<br>
- if ((m_param->analysisLoad && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10))<br>
+ if ((m_param->analysisLoadReuseLevel > 1 && m_param->analysisLoadReuseLevel != 10))<br>
{<br>
if (mightNotSplit && depth == m_reuseDepth[cuGeom.absPartIdx])<br>
{<br>
@@ -1273,7 +1276,7 @@<br>
if (m_param->rdLevel)<br>
skipModes = m_param->bEnableEarlySkip && md.bestMode;<br>
}<br>
- if (m_param->analysisReuseLevel > 4 && m_reusePartSize[cuGeom.absPartIdx] == SIZE_2Nx2N)<br>
+ if (m_param->analysisLoadReuseLevel > 4 && m_reusePartSize[cuGeom.absPartIdx] == SIZE_2Nx2N)<br>
{<br>
if (m_reuseModes[cuGeom.absPartIdx] != MODE_INTRA && m_reuseModes[cuGeom.absPartIdx] != 4)<br>
{<br>
@@ -1300,7 +1303,8 @@<br>
}<br>
}<br>
/* Step 1. Evaluate Merge/Skip candidates for likely early-outs, if skip mode was not set above */<br>
- if ((mightNotSplit && depth >= minDepth && !md.bestMode && !bCtuInfoCheck) || (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1]))) /* TODO: Re-evaluate if analysis load/save still works */<br>
+ if ((mightNotSplit && depth >= minDepth && !md.bestMode && !bCtuInfoCheck) || (m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1])))<br>
+ /* TODO: Re-evaluate if analysis load/save still works */<br>
{<br>
/* Compute Merge Cost */<br>
md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);<br>
@@ -1310,7 +1314,7 @@<br>
skipModes = (m_param->bEnableEarlySkip || m_refineLevel == 2)<br>
&& md.bestMode && md.bestMode->cu.isSkipped(0); // TODO: sa8d threshold per depth<br>
}<br>
- if (md.bestMode && m_param->bEnableRecursionSkip && !bCtuInfoCheck && !(m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1])))<br>
+ if (md.bestMode && m_param->bEnableRecursionSkip && !bCtuInfoCheck && !(m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1])))<br>
{<br>
skipRecursion = md.bestMode->cu.isSkipped(0);<br>
if (mightSplit && depth >= minDepth && !skipRecursion)<br>
@@ -1321,7 +1325,7 @@<br>
skipRecursion = complexityCheckCU(*md.bestMode);<br>
}<br>
}<br>
- if (m_param->bAnalysisType == AVC_INFO && md.bestMode && cuGeom.numPartitions <= 16 && m_param->analysisReuseLevel == 7)<br>
+ if (m_param->bAnalysisType == AVC_INFO && md.bestMode && cuGeom.numPartitions <= 16 && m_param->analysisLoadReuseLevel == 7)<br>
skipRecursion = true;<br>
/* Step 2. Evaluate each of the 4 split sub-blocks in series */<br>
if (mightSplit && !skipRecursion)<br>
@@ -1378,7 +1382,7 @@<br>
splitPred->sa8dCost = m_rdCost.calcRdSADCost((uint32_t)splitPred->distortion, splitPred->sa8dBits);<br>
}<br>
/* If analysis mode is simple do not Evaluate other modes */<br>
- if (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel == 7)<br>
+ if (m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel == 7)<br>
{<br>
if (m_slice->m_sliceType == P_SLICE)<br>
{<br>
@@ -1857,7 +1861,7 @@<br>
SplitData splitCUData;<br>
<br>
bool bHEVCBlockAnalysis = (m_param->bAnalysisType == AVC_INFO && cuGeom.numPartitions > 16);<br>
- bool bRefineAVCAnalysis = (m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1]));<br>
+ bool bRefineAVCAnalysis = (m_param->analysisLoadReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1]));<br>
bool bNooffloading = !(m_param->bAnalysisType == AVC_INFO);<br>
<br>
if (bHEVCBlockAnalysis || bRefineAVCAnalysis || bNooffloading)<br>
@@ -1953,7 +1957,7 @@<br>
mightSplit &= !bDecidedDepth;<br>
}<br>
}<br>
- if (m_param->analysisLoad && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)<br>
+ if (m_param->analysisLoadReuseLevel > 1 && m_param->analysisLoadReuseLevel != 10)<br>
{<br>
if (mightNotSplit && depth == m_reuseDepth[cuGeom.absPartIdx])<br>
{<br>
@@ -1971,7 +1975,7 @@<br>
if (m_param->bEnableRecursionSkip && depth && m_modeDepth[depth - 1].bestMode)<br>
skipRecursion = md.bestMode && !md.bestMode->cu.getQtRootCbf(0);<br>
}<br>
- if (m_param->analysisReuseLevel > 4 && m_reusePartSize[cuGeom.absPartIdx] == SIZE_2Nx2N)<br>
+ if (m_param->analysisLoadReuseLevel > 4 && m_reusePartSize[cuGeom.absPartIdx] == SIZE_2Nx2N)<br>
skipRectAmp = true && !!md.bestMode;<br>
}<br>
}<br>
@@ -1999,7 +2003,7 @@<br>
}<br>
/* Step 1. Evaluate Merge/Skip candidates for likely early-outs */<br>
if ((mightNotSplit && !md.bestMode && !bCtuInfoCheck) ||<br>
- (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1])))<br>
+ (m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1])))<br>
{<br>
md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);<br>
md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);<br>
@@ -2014,7 +2018,7 @@<br>
if (m_param->bEnableRecursionSkip && depth && m_modeDepth[depth - 1].bestMode)<br>
skipRecursion = md.bestMode && !md.bestMode->cu.getQtRootCbf(0);<br>
}<br>
- if (m_param->bAnalysisType == AVC_INFO && md.bestMode && cuGeom.numPartitions <= 16 && m_param->analysisReuseLevel == 7)<br>
+ if (m_param->bAnalysisType == AVC_INFO && md.bestMode && cuGeom.numPartitions <= 16 && m_param->analysisLoadReuseLevel == 7)<br>
skipRecursion = true;<br>
// estimate split cost<br>
/* Step 2. Evaluate each of the 4 split sub-blocks in series */<br>
@@ -2068,7 +2072,7 @@<br>
checkDQPForSplitPred(*splitPred, cuGeom);<br>
}<br>
/* If analysis mode is simple do not Evaluate other modes */<br>
- if (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel == 7)<br>
+ if (m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel == 7)<br>
{<br>
if (m_slice->m_sliceType == P_SLICE)<br>
{<br>
@@ -2461,7 +2465,7 @@<br>
for (uint32_t part = 0; part < numPU; part++)<br>
{<br>
PredictionUnit pu(<a href="http://mode.cu" rel="noreferrer" target="_blank">mode.cu</a>, cuGeom, part);<br>
- if ((m_param->analysisLoad && m_param->analysisReuseLevel == 10) || (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel >= 7))<br>
+ if (m_param->analysisLoadReuseLevel == 10 || (m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel >= 7))<br>
{<br>
x265_analysis_inter_data* interDataCTU = m_frame->m_analysisData.interData;<br>
int cuIdx = (mode.cu.m_cuAddr * parentCTU.m_numPartitions) + cuGeom.absPartIdx;<br>
@@ -2552,7 +2556,7 @@<br>
checkDQPForSplitPred(*md.bestMode, cuGeom);<br>
}<br>
<br>
- if (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel == 7)<br>
+ if (m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel == 7)<br>
{<br>
for (int list = 0; list < m_slice->isInterB() + 1; list++)<br>
{<br>
@@ -2607,7 +2611,7 @@<br>
if (m_slice->m_pps->bUseDQP && nextDepth <= m_slice->m_pps->maxCuDQPDepth)<br>
nextQP = setLambdaFromQP(parentCTU, calculateQpforCuSize(parentCTU, childGeom));<br>
<br>
- int lamdaQP = (m_param->analysisReuseLevel >= 7) ? nextQP : lqp;<br>
+ int lamdaQP = (m_param->analysisLoadReuseLevel >= 7) ? nextQP : lqp;<br>
<br>
if (split)<br>
m_param->rdLevel > 4 ? compressInterCU_rd5_6(parentCTU, childGeom, nextQP) : compressInterCU_rd0_4(parentCTU, childGeom, nextQP);<br>
@@ -3013,7 +3017,7 @@<br>
interMode.cu.setPredModeSubParts(MODE_INTER);<br>
int numPredDir = m_slice->isInterP() ? 1 : 2;<br>
<br>
- if (m_param->analysisLoad && m_reuseInterDataCTU && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)<br>
+ if (m_param->analysisLoadReuseLevel > 1 && m_param->analysisLoadReuseLevel != 10 && m_reuseInterDataCTU)<br>
{<br>
int refOffset = cuGeom.geomRecurId * 16 * numPredDir + partSize * numPredDir * 2;<br>
int index = 0;<br>
@@ -3056,7 +3060,7 @@<br>
}<br>
interMode.sa8dCost = m_rdCost.calcRdSADCost((uint32_t)interMode.distortion, interMode.sa8dBits);<br>
<br>
- if (m_param->analysisSave && m_reuseInterDataCTU && m_param->analysisReuseLevel > 1)<br>
+ if (m_param->analysisSaveReuseLevel > 1 && m_reuseInterDataCTU)<br>
{<br>
int refOffset = cuGeom.geomRecurId * 16 * numPredDir + partSize * numPredDir * 2;<br>
int index = 0;<br>
@@ -3078,7 +3082,7 @@<br>
interMode.cu.setPredModeSubParts(MODE_INTER);<br>
int numPredDir = m_slice->isInterP() ? 1 : 2;<br>
<br>
- if (m_param->analysisLoad && m_reuseInterDataCTU && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)<br>
+ if (m_param->analysisLoadReuseLevel > 1 && m_param->analysisLoadReuseLevel != 10 && m_reuseInterDataCTU)<br>
{<br>
int refOffset = cuGeom.geomRecurId * 16 * numPredDir + partSize * numPredDir * 2;<br>
int index = 0;<br>
@@ -3113,7 +3117,7 @@<br>
/* predInterSearch sets interMode.sa8dBits, but this is ignored */<br>
encodeResAndCalcRdInterCU(interMode, cuGeom);<br>
<br>
- if (m_param->analysisSave && m_reuseInterDataCTU && m_param->analysisReuseLevel > 1)<br>
+ if (m_param->analysisSaveReuseLevel > 1 && m_reuseInterDataCTU)<br>
{<br>
int refOffset = cuGeom.geomRecurId * 16 * numPredDir + partSize * numPredDir * 2;<br>
int index = 0;<br>
@@ -3612,7 +3616,7 @@<br>
qp += distortionData->offset[ctu.m_cuAddr];<br>
}<br>
<br>
- if (m_param->analysisLoad && m_param->analysisReuseLevel == 10 && m_param->rc.cuTree)<br>
+ if (m_param->analysisLoadReuseLevel == 10 && m_param->rc.cuTree)<br>
{<br>
int cuIdx = (ctu.m_cuAddr * ctu.m_numPartitions) + cuGeom.absPartIdx;<br>
if (ctu.m_slice->m_sliceType == I_SLICE)<br>
diff -r 4fcd8f1701a6 -r a28fd843b302 source/encoder/api.cpp<br>
--- a/source/encoder/api.cpp Fri Jan 10 14:16:04 2020 +0530<br>
+++ b/source/encoder/api.cpp Fri Jan 10 17:01:08 2020 +0530<br>
@@ -771,6 +771,12 @@<br>
int numDir = 2; //irrespective of P or B slices set direction as 2<br>
uint32_t numPlanes = param->internalCsp == X265_CSP_I400 ? 1 : 3;<br>
<br>
+ int maxReuseLevel = X265_MAX(param->analysisSaveReuseLevel, param->analysisLoadReuseLevel);<br>
+ int minReuseLevel = (param->analysisSaveReuseLevel && param->analysisLoadReuseLevel) ?<br>
+ X265_MIN(param->analysisSaveReuseLevel, param->analysisLoadReuseLevel) : maxReuseLevel;<br>
+<br>
+ bool isMultiPassOpt = param->analysisMultiPassRefine || param->analysisMultiPassDistortion;<br>
+ <br>
#if X265_DEPTH < 10 && (LINKED_10BIT || LINKED_12BIT)<br>
uint32_t numCUs_sse_t = param->internalBitDepth > 8 ? analysis->numCUsInFrame << 1 : analysis->numCUsInFrame;<br>
#elif X265_DEPTH >= 10 && LINKED_8BIT<br>
@@ -778,7 +784,7 @@<br>
#else<br>
uint32_t numCUs_sse_t = analysis->numCUsInFrame;<br>
#endif<br>
- if (param->analysisMultiPassRefine || param->analysisMultiPassDistortion || param->ctuDistortionRefine)<br>
+ if (isMultiPassOpt || param->ctuDistortionRefine)<br>
{<br>
//Allocate memory for distortionData pointer<br>
CHECKED_MALLOC_ZERO(distortionData, x265_analysis_distortion_data, 1);<br>
@@ -792,7 +798,7 @@<br>
analysis->distortionData = distortionData;<br>
}<br>
<br>
- if (param->bDisableLookahead && isVbv)<br>
+ if (!isMultiPassOpt && param->bDisableLookahead && isVbv)<br>
{<br>
CHECKED_MALLOC_ZERO(analysis->lookahead.intraSatdForVbv, uint32_t, analysis->numCuInHeight);<br>
CHECKED_MALLOC_ZERO(analysis->lookahead.satdForVbv, uint32_t, analysis->numCuInHeight);<br>
@@ -801,20 +807,23 @@<br>
}<br>
<br>
//Allocate memory for weightParam pointer<br>
- if (!(param->bAnalysisType == AVC_INFO))<br>
+ if (!isMultiPassOpt && !(param->bAnalysisType == AVC_INFO))<br>
CHECKED_MALLOC_ZERO(analysis->wt, x265_weight_param, numPlanes * numDir);<br>
<br>
- if (param->analysisReuseLevel < 2)<br>
+ if (maxReuseLevel < 2)<br>
return;<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>
- CHECKED_MALLOC_ZERO(intraData->modes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
- CHECKED_MALLOC_ZERO(intraData->partSizes, char, analysis->numPartitions * analysis->numCUsInFrame);<br>
- CHECKED_MALLOC_ZERO(intraData->chromaModes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
- if (param->rc.cuTree)<br>
- CHECKED_MALLOC_ZERO(intraData->cuQPOff, int8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+ if (!isMultiPassOpt)<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>
+ CHECKED_MALLOC_ZERO(intraData->chromaModes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+ if (param->rc.cuTree)<br>
+ CHECKED_MALLOC_ZERO(intraData->cuQPOff, int8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+ }<br>
analysis->intraData = intraData;<br>
<br>
//Allocate memory for interData pointer based on ReuseLevels<br>
@@ -822,19 +831,19 @@<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)<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>
- if (param->analysisReuseLevel > 4)<br>
+ if (maxReuseLevel > 4)<br>
{<br>
CHECKED_MALLOC_ZERO(interData->partSize, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
CHECKED_MALLOC_ZERO(interData->mergeFlag, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
}<br>
- if (param->analysisReuseLevel >= 7)<br>
+ if (maxReuseLevel >= 7)<br>
{<br>
CHECKED_MALLOC_ZERO(interData->interDir, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
CHECKED_MALLOC_ZERO(interData->sadCost, int64_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
@@ -844,14 +853,13 @@<br>
CHECKED_MALLOC_ZERO(analysis->modeFlag[dir], uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
}<br>
}<br>
- else<br>
+ if ((minReuseLevel >= 2) && (minReuseLevel <= 6))<br>
{<br>
- if (param->analysisMultiPassRefine || param->analysisMultiPassDistortion){<br>
- CHECKED_MALLOC_ZERO(interData->ref, int32_t, 2 * analysis->numPartitions * analysis->numCUsInFrame);<br>
- }<br>
- else<br>
- CHECKED_MALLOC_ZERO(interData->ref, int32_t, analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir);<br>
+ CHECKED_MALLOC_ZERO(interData->ref, int32_t, analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir);<br>
}<br>
+ if (isMultiPassOpt)<br>
+ CHECKED_MALLOC_ZERO(interData->ref, int32_t, 2 * analysis->numPartitions * analysis->numCUsInFrame);<br>
+<br>
analysis->interData = interData;<br>
<br>
return;<br>
@@ -862,10 +870,15 @@<br>
<br>
void x265_free_analysis_data(x265_param *param, x265_analysis_data* analysis)<br>
{<br>
+ int maxReuseLevel = X265_MAX(param->analysisSaveReuseLevel, param->analysisLoadReuseLevel);<br>
+ int minReuseLevel = (param->analysisSaveReuseLevel && param->analysisLoadReuseLevel) ?<br>
+ X265_MIN(param->analysisSaveReuseLevel, param->analysisLoadReuseLevel) : maxReuseLevel;<br>
+<br>
bool isVbv = param->rc.vbvMaxBitrate > 0 && param->rc.vbvBufferSize > 0;<br>
+ bool isMultiPassOpt = param->analysisMultiPassRefine || param->analysisMultiPassDistortion;<br>
<br>
//Free memory for Lookahead pointers<br>
- if (param->bDisableLookahead && isVbv)<br>
+ if (!isMultiPassOpt && param->bDisableLookahead && isVbv)<br>
{<br>
X265_FREE(analysis->lookahead.satdForVbv);<br>
X265_FREE(analysis->lookahead.intraSatdForVbv);<br>
@@ -887,21 +900,24 @@<br>
}<br>
<br>
/* Early exit freeing weights alone if level is 1 (when there is no analysis inter/intra) */<br>
- if (analysis->wt && !(param->bAnalysisType == AVC_INFO))<br>
+ if (!isMultiPassOpt && analysis->wt && !(param->bAnalysisType == AVC_INFO))<br>
X265_FREE(analysis->wt);<br>
<br>
- if (param->analysisReuseLevel < 2)<br>
+ if (maxReuseLevel < 2)<br>
return;<br>
<br>
//Free memory for intraData pointers<br>
if (analysis->intraData)<br>
{<br>
X265_FREE((analysis->intraData)->depth);<br>
- X265_FREE((analysis->intraData)->modes);<br>
- X265_FREE((analysis->intraData)->partSizes);<br>
- X265_FREE((analysis->intraData)->chromaModes);<br>
- if (param->rc.cuTree)<br>
- X265_FREE((analysis->intraData)->cuQPOff);<br>
+ if (!isMultiPassOpt)<br>
+ {<br>
+ X265_FREE((analysis->intraData)->modes);<br>
+ X265_FREE((analysis->intraData)->partSizes);<br>
+ X265_FREE((analysis->intraData)->chromaModes);<br>
+ if (param->rc.cuTree)<br>
+ X265_FREE((analysis->intraData)->cuQPOff);<br>
+ }<br>
X265_FREE(analysis->intraData);<br>
analysis->intraData = NULL;<br>
}<br>
@@ -911,19 +927,19 @@<br>
{<br>
X265_FREE((analysis->interData)->depth);<br>
X265_FREE((analysis->interData)->modes);<br>
- if (param->rc.cuTree)<br>
+ if (!isMultiPassOpt && param->rc.cuTree)<br>
X265_FREE((analysis->interData)->cuQPOff);<br>
X265_FREE((analysis->interData)->mvpIdx[0]);<br>
X265_FREE((analysis->interData)->mvpIdx[1]);<br>
X265_FREE((analysis->interData)->mv[0]);<br>
X265_FREE((analysis->interData)->mv[1]);<br>
<br>
- if (param->analysisReuseLevel > 4)<br>
+ if (maxReuseLevel > 4)<br>
{<br>
X265_FREE((analysis->interData)->mergeFlag);<br>
X265_FREE((analysis->interData)->partSize);<br>
}<br>
- if (param->analysisReuseLevel >= 7)<br>
+ if (maxReuseLevel >= 7)<br>
{<br>
int numDir = 2;<br>
X265_FREE((analysis->interData)->interDir);<br>
@@ -932,13 +948,13 @@<br>
{<br>
X265_FREE((analysis->interData)->refIdx[dir]);<br>
if (analysis->modeFlag[dir] != NULL)<br>
- {<br>
+ { <br>
X265_FREE(analysis->modeFlag[dir]);<br>
analysis->modeFlag[dir] = NULL;<br>
}<br>
}<br>
}<br>
- else<br>
+ if (((minReuseLevel >= 2) && (minReuseLevel <= 6)) || isMultiPassOpt)<br>
X265_FREE((analysis->interData)->ref);<br>
X265_FREE(analysis->interData);<br>
analysis->interData = NULL;<br>
diff -r 4fcd8f1701a6 -r a28fd843b302 source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp Fri Jan 10 14:16:04 2020 +0530<br>
+++ b/source/encoder/encoder.cpp Fri Jan 10 17:01:08 2020 +0530<br>
@@ -650,7 +650,7 @@<br>
if (analysis_data->sliceType == X265_TYPE_IDR || analysis_data->sliceType == X265_TYPE_I)<br>
{<br>
curFrame->m_analysisData.sliceType = X265_TYPE_I;<br>
- if (m_param->analysisReuseLevel < 7)<br>
+ if (m_param->analysisLoadReuseLevel < 7)<br>
return -1;<br>
curFrame->m_analysisData.numPartitions = m_param->num4x4Partitions;<br>
int num16x16inCUWidth = m_param->maxCUSize >> 4;<br>
@@ -680,7 +680,7 @@<br>
else<br>
{<br>
uint32_t numDir = analysis_data->sliceType == X265_TYPE_P ? 1 : 2;<br>
- if (m_param->analysisReuseLevel < 7)<br>
+ if (m_param->analysisLoadReuseLevel < 7)<br>
return -1;<br>
curFrame->m_analysisData.numPartitions = m_param->num4x4Partitions;<br>
int num16x16inCUWidth = m_param->maxCUSize >> 4;<br>
@@ -722,7 +722,7 @@<br>
(interData)->mvpIdx[k][cuPos + cuOffset] = (srcInterData)->mvpIdx[k][(mbIndex * 16) + cuOffset];<br>
(interData)->refIdx[k][cuPos + cuOffset] = (srcInterData)->refIdx[k][(mbIndex * 16) + cuOffset];<br>
memcpy(&(interData)->mv[k][cuPos + cuOffset], &(srcInterData)->mv[k][(mbIndex * 16) + cuOffset], sizeof(MV));<br>
- if (m_param->analysisReuseLevel == 7 && numPU == PU_2Nx2N &&<br>
+ if (m_param->analysisLoadReuseLevel == 7 && numPU == PU_2Nx2N &&<br>
((interData)->depth[cuPos + cuOffset] == (m_param->maxCUSize >> 5)))<br>
{<br>
int mv_x = (interData)->mv[k][cuPos + cuOffset].x;<br>
@@ -756,7 +756,7 @@<br>
if (analysis_data->sliceType == X265_TYPE_IDR || analysis_data->sliceType == X265_TYPE_I)<br>
{<br>
curFrame->m_analysisData.sliceType = X265_TYPE_I;<br>
- if (m_param->analysisReuseLevel < 2)<br>
+ if (m_param->analysisLoadReuseLevel < 2)<br>
return -1;<br>
<br>
curFrame->m_analysisData.numPartitions = m_param->num4x4Partitions;<br>
@@ -777,7 +777,7 @@<br>
else<br>
{<br>
uint32_t numDir = analysis_data->sliceType == X265_TYPE_P ? 1 : 2;<br>
- if (m_param->analysisReuseLevel < 2)<br>
+ if (m_param->analysisLoadReuseLevel < 2)<br>
return -1;<br>
<br>
curFrame->m_analysisData.numPartitions = m_param->num4x4Partitions;<br>
@@ -790,7 +790,7 @@<br>
memset(&(currInterData)->depth[count], (interData)->depth[d], bytes);<br>
memset(&(currInterData)->modes[count], (interData)->modes[d], bytes);<br>
memcpy(&(currInterData)->sadCost[count], &(analysis_data->interData)->sadCost[d], bytes);<br>
- if (m_param->analysisReuseLevel > 4)<br>
+ if (m_param->analysisLoadReuseLevel > 4)<br>
{<br>
memset(&(currInterData)->partSize[count], (interData)->partSize[d], bytes);<br>
int numPU = nbPartsTable[(interData)->partSize[d]];<br>
@@ -798,7 +798,7 @@<br>
{<br>
if (pu) d++;<br>
(currInterData)->mergeFlag[count + pu] = (interData)->mergeFlag[d];<br>
- if (m_param->analysisReuseLevel >= 7)<br>
+ if (m_param->analysisLoadReuseLevel >= 7)<br>
{<br>
(currInterData)->interDir[count + pu] = (interData)->interDir[d];<br>
for (uint32_t i = 0; i < numDir; i++)<br>
@@ -806,7 +806,7 @@<br>
(currInterData)->mvpIdx[i][count + pu] = (interData)->mvpIdx[i][d];<br>
(currInterData)->refIdx[i][count + pu] = (interData)->refIdx[i][d];<br>
memcpy(&(currInterData)->mv[i][count + pu], &(interData)->mv[i][d], sizeof(MV));<br>
- if (m_param->analysisReuseLevel == 7 && numPU == PU_2Nx2N && m_param->num4x4Partitions <= 16)<br>
+ if (m_param->analysisLoadReuseLevel == 7 && numPU == PU_2Nx2N && m_param->num4x4Partitions <= 16)<br>
{<br>
int mv_x = (currInterData)->mv[i][count + pu].x;<br>
int mv_y = (currInterData)->mv[i][count + pu].y;<br>
@@ -3577,10 +3577,46 @@<br>
p->rc.rfConstantMin = 0;<br>
}<br>
<br>
- if (!(p->bAnalysisType == HEVC_INFO) && (p->analysisLoad || p->analysisSave) && p->rc.cuTree && p->analysisReuseLevel < 10)<br>
- {<br>
- x265_log(p, X265_LOG_WARNING, "cu-tree works only with analysis reuse level 10, Disabling cu-tree\n");<br>
- p->rc.cuTree = 0;<br>
+ if (p->analysisSaveReuseLevel && !p->analysisSave)<br>
+ {<br>
+ x265_log(p, X265_LOG_WARNING, "analysis-save-reuse-level can be set only when analysis-save is enabled."<br>
+ " Resetting analysis-save-reuse-level to 0.\n");<br>
+ p->analysisSaveReuseLevel = 0;<br>
+ }<br>
+<br>
+ if (p->analysisLoadReuseLevel && !p->analysisLoad)<br>
+ {<br>
+ x265_log(p, X265_LOG_WARNING, "analysis-load-reuse-level can be set only when analysis-load is enabled."<br>
+ " Resetting analysis-load-reuse-level to 0.\n");<br>
+ p->analysisLoadReuseLevel = 0;<br>
+ }<br>
+<br>
+ if (p->analysisSave && !p->analysisSaveReuseLevel)<br>
+ {<br>
+ x265_log(p, X265_LOG_WARNING, "analysis-save-reuse-level must be set when analysis-save is enabled."<br>
+ " Setting analysis-save-reuse-level to 5.\n");<br>
+ p->analysisSaveReuseLevel = 5;<br>
+ }<br>
+<br>
+ if (p->analysisLoad && !p->analysisLoadReuseLevel)<br>
+ {<br>
+ x265_log(p, X265_LOG_WARNING, "analysis-load-reuse-level must be set when analysis-load is enabled."<br>
+ " Setting analysis-load-reuse-level to 5.\n");<br>
+ p->analysisLoadReuseLevel = 5;<br>
+ }<br></blockquote><div>
[KS] X265 check fails if reuse-level is 0 (default). Never reaches this point. Hence this patch makes it mandatory for the users to set reuse level along with save/load option.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ if ((p->bAnalysisType == DEFAULT) && p->rc.cuTree)<br>
+ {<br>
+ if (p->analysisSaveReuseLevel && p->analysisSaveReuseLevel < 10)<br>
+ {<br>
+ x265_log(p, X265_LOG_WARNING, "cu-tree works only with analysis-save-reuse-level 10, Disabling cu-tree\n");<br>
+ p->rc.cuTree = 0;<br>
+ }<br>
+ if (p->analysisLoadReuseLevel && p->analysisLoadReuseLevel < 10)<br>
+ {<br>
+ x265_log(p, X265_LOG_WARNING, "cu-tree works only with analysis-load-reuse-level 10, Disabling cu-tree\n");<br>
+ p->rc.cuTree = 0;<br>
+ }<br>
}<br>
<br>
if ((p->analysisLoad || p->analysisSave) && (p->bDistributeModeAnalysis || p->bDistributeMotionEstimation))<br>
@@ -3602,45 +3638,37 @@<br>
{<br>
p->scaleFactor = 0;<br>
}<br>
- else if ((!p->analysisLoad && !p->analysisSave) || (p->analysisReuseLevel > 6 && p->analysisReuseLevel != 10))<br>
+ else if ((p->analysisSaveReuseLevel > 6 && p->analysisSaveReuseLevel != 10) || (p->analysisLoadReuseLevel > 6 && p->analysisLoadReuseLevel != 10))<br>
{<br>
- x265_log(p, X265_LOG_WARNING, "Input scaling works with analysis load/save and analysis-reuse-level 1-6 and 10. Disabling scale-factor.\n");<br>
+ x265_log(p, X265_LOG_WARNING, "Input scaling works with analysis-save/load and analysis-save/load-reuse-level 1-6 and 10. Disabling scale-factor.\n");<br>
p->scaleFactor = 0;<br>
}<br>
}<br>
<br>
- if (p->intraRefine)<br>
- {<br>
- if (!p->analysisLoad || p->analysisReuseLevel < 10)<br>
- {<br>
- x265_log(p, X265_LOG_WARNING, "Intra refinement requires analysis load, analysis-reuse-level 10. Disabling intra refine.\n");<br>
- p->intraRefine = 0;<br>
- }<br>
- }<br>
-<br>
- if (p->interRefine)<br>
- {<br>
- if (!p->analysisLoad || p->analysisReuseLevel < 10)<br>
- {<br>
- x265_log(p, X265_LOG_WARNING, "Inter refinement requires analysis load, analysis-reuse-level 10. Disabling inter refine.\n");<br>
- p->interRefine = 0;<br>
- }<br>
- }<br>
-<br>
- if (p->bDynamicRefine)<br>
- {<br>
- if (!p->analysisLoad || p->analysisReuseLevel < 10)<br>
- {<br>
- x265_log(p, X265_LOG_WARNING, "Dynamic refinement requires analysis load, analysis-reuse-level 10. Disabling dynamic refine.\n");<br>
- p->bDynamicRefine = 0;<br>
- }<br>
+ if (p->intraRefine && p->analysisLoadReuseLevel && p->analysisLoadReuseLevel < 10)<br>
+ {<br>
+ x265_log(p, X265_LOG_WARNING, "Intra refinement requires analysis load, analysis-load-reuse-level 10. Disabling intra refine.\n");<br>
+ p->intraRefine = 0;<br>
+ }<br>
+<br>
+ if (p->interRefine && p->analysisLoadReuseLevel && p->analysisLoadReuseLevel < 10)<br>
+ {<br>
+ x265_log(p, X265_LOG_WARNING, "Inter refinement requires analysis load, analysis-load-reuse-level 10. Disabling inter refine.\n");<br>
+ p->interRefine = 0;<br>
+ }<br>
+<br>
+ if (p->bDynamicRefine && p->analysisLoadReuseLevel && p->analysisLoadReuseLevel < 10)<br>
+ {<br>
+ x265_log(p, X265_LOG_WARNING, "Dynamic refinement requires analysis load, analysis-load-reuse-level 10. Disabling dynamic refine.\n");<br>
+ p->bDynamicRefine = 0;<br>
+<br>
if (p->interRefine)<br>
{<br>
x265_log(p, X265_LOG_WARNING, "Inter refine cannot be used with dynamic refine. Disabling refine-inter.\n");<br>
p->interRefine = 0;<br>
}<br>
}<br>
- if (p->scaleFactor && p->analysisLoad && !p->interRefine && !p->bDynamicRefine && p->analysisReuseLevel == 10)<br>
+ if (p->scaleFactor && !p->interRefine && !p->bDynamicRefine && p->analysisLoadReuseLevel == 10)<br>
{<br>
x265_log(p, X265_LOG_WARNING, "Inter refinement 0 is not supported with scaling and analysis-reuse-level=10. Enabling refine-inter 1.\n");<br>
p->interRefine = 1;<br>
@@ -4205,7 +4233,7 @@<br>
{<br>
if (m_param->bAnalysisType == HEVC_INFO)<br>
return;<br>
- if (m_param->analysisReuseLevel < 2)<br>
+ if (m_param->analysisLoadReuseLevel < 2)<br>
return;<br>
<br>
uint8_t *tempBuf = NULL, *depthBuf = NULL, *modeBuf = NULL, *partSizes = NULL;<br>
@@ -4265,7 +4293,7 @@<br>
uint32_t numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2;<br>
uint32_t numPlanes = m_param->internalCsp == X265_CSP_I400 ? 1 : 3;<br>
X265_FREAD((WeightParam*)analysis->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFileIn, (picIn->analysisData.wt));<br>
- if (m_param->analysisReuseLevel < 2)<br>
+ if (m_param->analysisLoadReuseLevel < 2)<br>
return;<br>
<br>
uint8_t *tempBuf = NULL, *depthBuf = NULL, *modeBuf = NULL, *partSize = NULL, *mergeFlag = NULL;<br>
@@ -4274,9 +4302,9 @@<br>
int8_t* refIdx[2];<br>
int8_t* cuQPBuf = NULL;<br>
<br>
- int numBuf = m_param->analysisReuseLevel > 4 ? 4 : 2;<br>
+ int numBuf = m_param->analysisLoadReuseLevel > 4 ? 4 : 2;<br>
bool bIntraInInter = false;<br>
- if (m_param->analysisReuseLevel == 10)<br>
+ if (m_param->analysisLoadReuseLevel == 10)<br>
{<br>
numBuf++;<br>
bIntraInInter = (analysis->sliceType == X265_TYPE_P || m_param->bIntraInBFrames);<br>
@@ -4299,14 +4327,14 @@<br>
X265_FREAD(modeBuf, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->modes);<br>
if (m_param->rc.cuTree) { X265_FREAD(cuQPBuf, sizeof(int8_t), depthBytes, m_analysisFileIn, interPic->cuQPOff); }<br>
<br>
- if (m_param->analysisReuseLevel > 4)<br>
+ if (m_param->analysisLoadReuseLevel > 4)<br>
{<br>
partSize = modeBuf + depthBytes;<br>
mergeFlag = partSize + depthBytes;<br>
X265_FREAD(partSize, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->partSize);<br>
X265_FREAD(mergeFlag, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->mergeFlag);<br>
<br>
- if (m_param->analysisReuseLevel == 10)<br>
+ if (m_param->analysisLoadReuseLevel == 10)<br>
{<br>
interDir = mergeFlag + depthBytes;<br>
X265_FREAD(interDir, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->interDir);<br>
@@ -4337,7 +4365,7 @@<br>
memset(&(analysis->interData)->modes[count], modeBuf[d], bytes);<br>
if (m_param->rc.cuTree)<br>
memset(&(analysis->interData)->cuQPOff[count], cuQPBuf[d], bytes);<br>
- if (m_param->analysisReuseLevel > 4)<br>
+ if (m_param->analysisLoadReuseLevel > 4)<br>
{<br>
if (m_param->scaleFactor && modeBuf[d] == MODE_INTRA && partSize[d] == SIZE_NxN)<br>
partSize[d] = SIZE_2Nx2N;<br>
@@ -4347,7 +4375,7 @@<br>
{<br>
if (pu) d++;<br>
(analysis->interData)->mergeFlag[count + pu] = mergeFlag[d];<br>
- if (m_param->analysisReuseLevel == 10)<br>
+ if (m_param->analysisLoadReuseLevel == 10)<br>
{<br>
(analysis->interData)->interDir[count + pu] = interDir[d];<br>
for (uint32_t i = 0; i < numDir; i++)<br>
@@ -4363,7 +4391,7 @@<br>
}<br>
}<br>
}<br>
- if (m_param->analysisReuseLevel == 10 && bIntraInInter)<br>
+ if (m_param->analysisLoadReuseLevel == 10 && bIntraInInter)<br>
memset(&(analysis->intraData)->chromaModes[count], chromaDir[d], bytes);<br>
}<br>
count += bytes;<br>
@@ -4373,7 +4401,7 @@<br>
X265_FREE(cuQPBuf);<br>
X265_FREE(tempBuf);<br>
}<br>
- if (m_param->analysisReuseLevel == 10)<br>
+ if (m_param->analysisLoadReuseLevel == 10)<br>
{<br>
if (m_param->bAnalysisType != HEVC_INFO)<br>
{<br>
@@ -4556,7 +4584,7 @@<br>
<br>
if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I)<br>
{<br>
- if (m_param->analysisReuseLevel < 2)<br>
+ if (m_param->analysisLoadReuseLevel < 2)<br>
return;<br>
<br>
uint8_t *tempBuf = NULL, *depthBuf = NULL, *modeBuf = NULL, *partSizes = NULL;<br>
@@ -4625,7 +4653,7 @@<br>
uint32_t numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2;<br>
uint32_t numPlanes = m_param->internalCsp == X265_CSP_I400 ? 1 : 3;<br>
X265_FREAD((WeightParam*)analysis->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFileIn, (picIn->analysisData.wt));<br>
- if (m_param->analysisReuseLevel < 2)<br>
+ if (m_param->analysisLoadReuseLevel < 2)<br>
return;<br>
<br>
uint8_t *tempBuf = NULL, *depthBuf = NULL, *modeBuf = NULL, *partSize = NULL, *mergeFlag = NULL;<br>
@@ -4634,9 +4662,9 @@<br>
int8_t* refIdx[2];<br>
int8_t* cuQPBuf = NULL;<br>
<br>
- int numBuf = m_param->analysisReuseLevel > 4 ? 4 : 2;<br>
+ int numBuf = m_param->analysisLoadReuseLevel > 4 ? 4 : 2;<br>
bool bIntraInInter = false;<br>
- if (m_param->analysisReuseLevel == 10)<br>
+ if (m_param->analysisLoadReuseLevel == 10)<br>
{<br>
numBuf++;<br>
bIntraInInter = (analysis->sliceType == X265_TYPE_P || m_param->bIntraInBFrames);<br>
@@ -4652,13 +4680,13 @@<br>
X265_FREAD(depthBuf, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->depth);<br>
X265_FREAD(modeBuf, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->modes);<br>
if (m_param->rc.cuTree) { X265_FREAD(cuQPBuf, sizeof(int8_t), depthBytes, m_analysisFileIn, interPic->cuQPOff); }<br>
- if (m_param->analysisReuseLevel > 4)<br>
+ if (m_param->analysisLoadReuseLevel > 4)<br>
{<br>
partSize = modeBuf + depthBytes;<br>
mergeFlag = partSize + depthBytes;<br>
X265_FREAD(partSize, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->partSize);<br>
X265_FREAD(mergeFlag, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->mergeFlag);<br>
- if (m_param->analysisReuseLevel == 10)<br>
+ if (m_param->analysisLoadReuseLevel == 10)<br>
{<br>
interDir = mergeFlag + depthBytes;<br>
X265_FREAD(interDir, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->interDir);<br>
@@ -4702,10 +4730,10 @@<br>
memset(&(analysis->interData)->modes[count], modeBuf[d], bytes);<br>
if (m_param->rc.cuTree)<br>
memset(&(analysis->interData)->cuQPOff[count], cuQPBuf[d], bytes);<br>
- if (m_param->analysisReuseLevel == 10 && bIntraInInter)<br>
+ if (m_param->analysisLoadReuseLevel == 10 && bIntraInInter)<br>
memset(&(analysis->intraData)->chromaModes[count], chromaDir[d], bytes);<br>
<br>
- if (m_param->analysisReuseLevel > 4)<br>
+ if (m_param->analysisLoadReuseLevel > 4)<br>
{<br>
puOrientation puOrient;<br>
puOrient.init();<br>
@@ -4731,7 +4759,7 @@<br>
d++;<br>
<br>
(analysis->interData)->mergeFlag[count + pu] = mergeFlag[d];<br>
- if (m_param->analysisReuseLevel == 10)<br>
+ if (m_param->analysisLoadReuseLevel == 10)<br>
{<br>
(analysis->interData)->interDir[count + pu] = interDir[d];<br>
MV mvCopy[2];<br>
@@ -4766,7 +4794,7 @@<br>
X265_FREE(cuQPBuf);<br>
X265_FREE(tempBuf);<br>
<br>
- if (m_param->analysisReuseLevel == 10)<br>
+ if (m_param->analysisLoadReuseLevel == 10)<br>
{<br>
for (uint32_t i = 0; i < numDir; i++)<br>
{<br>
@@ -4855,7 +4883,6 @@<br>
<br>
X265_PARAM_VALIDATE(saveParam->intraRefresh, sizeof(int), 1, &m_param->bIntraRefresh, intra-refresh);<br>
X265_PARAM_VALIDATE(saveParam->maxNumReferences, sizeof(int), 1, &m_param->maxNumReferences, ref);<br>
- X265_PARAM_VALIDATE(saveParam->analysisReuseLevel, sizeof(int), 1, &m_param->analysisReuseLevel, analysis-reuse-level);<br>
X265_PARAM_VALIDATE(saveParam->keyframeMax, sizeof(int), 1, &m_param->keyframeMax, keyint);<br>
X265_PARAM_VALIDATE(saveParam->keyframeMin, sizeof(int), 1, &m_param->keyframeMin, min-keyint);<br>
X265_PARAM_VALIDATE(saveParam->openGOP, sizeof(int), 1, &m_param->bOpenGOP, open-gop);<br>
@@ -4871,6 +4898,7 @@<br>
int sourceHeight, sourceWidth;<br>
if (writeFlag)<br>
{<br>
+ X265_PARAM_VALIDATE(saveParam->analysisReuseLevel, sizeof(int), 1, &m_param->analysisSaveReuseLevel, analysis - save - reuse - level);<br>
sourceHeight = m_param->sourceHeight - m_conformanceWindow.bottomOffset;<br>
sourceWidth = m_param->sourceWidth - m_conformanceWindow.rightOffset;<br>
X265_PARAM_VALIDATE(saveParam->sourceWidth, sizeof(int), 1, &sourceWidth, res-width);<br>
@@ -4880,10 +4908,35 @@<br>
else<br>
{<br>
fileOffset = m_analysisFileIn;<br>
+<br>
+ int saveLevel = 0;<br>
+ bool isIncompatibleReuseLevel = false;<br>
+ int loadLevel = m_param->analysisLoadReuseLevel;<br>
+<br>
+ X265_FREAD(&saveLevel, sizeof(int), 1, m_analysisFileIn, &(saveParam->analysisReuseLevel));<br>
+ <br>
+ if (loadLevel == 10 && saveLevel != 10)<br>
+ isIncompatibleReuseLevel = true;<br>
+ else if (((loadLevel >= 7) && (loadLevel <= 9)) && ((saveLevel < 7) || (saveLevel > 9)))<br>
+ isIncompatibleReuseLevel = true;<br>
+ else if ((loadLevel == 5 || loadLevel == 6) && ((saveLevel != 5) && (saveLevel != 6)))<br>
+ isIncompatibleReuseLevel = true;<br>
+ else if ((loadLevel >= 2 && loadLevel <= 4) && (saveLevel < 2 || saveLevel > 6))<br>
+ isIncompatibleReuseLevel = true;<br>
+ else if (!saveLevel)<br>
+ isIncompatibleReuseLevel = true;<br>
+<br>
+ if (isIncompatibleReuseLevel)<br>
+ {<br>
+ x265_log(NULL, X265_LOG_ERROR, "Error reading analysis data. Incompatible reuse-levels.\n");<br>
+ m_aborted = true;<br>
+ return -1;<br>
+ }<br>
+<br>
bool error = false;<br>
int curSourceHeight = m_param->sourceHeight - m_conformanceWindow.bottomOffset;<br>
int curSourceWidth = m_param->sourceWidth - m_conformanceWindow.rightOffset;<br>
-<br>
+ <br>
X265_FREAD(&sourceWidth, sizeof(int), 1, m_analysisFileIn, &(saveParam->sourceWidth));<br>
X265_FREAD(&sourceHeight, sizeof(int), 1, m_analysisFileIn, &(saveParam->sourceHeight));<br>
X265_FREAD(&readValue, sizeof(int), 1, m_analysisFileIn, &(saveParam->maxCUSize));<br>
@@ -5205,7 +5258,7 @@<br>
analysis->frameRecordSize += analysis->numCUsInFrame * sizeof(sse_t);<br>
}<br>
<br>
- if (m_param->analysisReuseLevel > 1)<br>
+ if (m_param->analysisSaveReuseLevel > 1)<br>
{<br>
<br>
if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I)<br>
@@ -5258,14 +5311,14 @@<br>
interDataCTU->depth[depthBytes] = depth;<br>
<br>
predMode = ctu->m_predMode[absPartIdx];<br>
- if (m_param->analysisReuseLevel != 10 && ctu->m_refIdx[1][absPartIdx] != -1)<br>
+ if (m_param->analysisSaveReuseLevel != 10 && ctu->m_refIdx[1][absPartIdx] != -1)<br>
predMode = 4; // used as indicator if the block is coded as bidir<br>
<br>
interDataCTU->modes[depthBytes] = predMode;<br>
if (m_param->rc.cuTree)<br>
interDataCTU->cuQPOff[depthBytes] = (int8_t)(ctu->m_qpAnalysis[absPartIdx] - baseQP);<br>
<br>
- if (m_param->analysisReuseLevel > 4)<br>
+ if (m_param->analysisSaveReuseLevel > 4)<br>
{<br>
partSize = ctu->m_partSize[absPartIdx];<br>
interDataCTU->partSize[depthBytes] = partSize;<br>
@@ -5278,7 +5331,7 @@<br>
if (puIdx) depthBytes++;<br>
interDataCTU->mergeFlag[depthBytes] = ctu->m_mergeFlag[puabsPartIdx];<br>
<br>
- if (m_param->analysisReuseLevel == 10)<br>
+ if (m_param->analysisSaveReuseLevel == 10)<br>
{<br>
interDataCTU->interDir[depthBytes] = ctu->m_interDir[puabsPartIdx];<br>
for (uint32_t dir = 0; dir < numDir; dir++)<br>
@@ -5289,12 +5342,12 @@<br>
}<br>
}<br>
}<br>
- if (m_param->analysisReuseLevel == 10 && bIntraInInter)<br>
+ if (m_param->analysisSaveReuseLevel == 10 && bIntraInInter)<br>
intraDataCTU->chromaModes[depthBytes] = ctu->m_chromaIntraDir[absPartIdx];<br>
}<br>
absPartIdx += ctu->m_numPartitions >> (depth * 2);<br>
}<br>
- if (m_param->analysisReuseLevel == 10 && bIntraInInter)<br>
+ if (m_param->analysisSaveReuseLevel == 10 && bIntraInInter)<br>
memcpy(&intraDataCTU->modes[ctu->m_cuAddr * ctu->m_numPartitions], ctu->m_lumaIntraDir, sizeof(uint8_t)* ctu->m_numPartitions);<br>
}<br>
}<br>
@@ -5309,10 +5362,10 @@<br>
analysis->frameRecordSize += depthBytes * 2;<br>
if (m_param->rc.cuTree)<br>
analysis->frameRecordSize += (sizeof(int8_t) * depthBytes);<br>
- if (m_param->analysisReuseLevel > 4)<br>
+ if (m_param->analysisSaveReuseLevel > 4)<br>
analysis->frameRecordSize += (depthBytes * 2);<br>
<br>
- if (m_param->analysisReuseLevel == 10)<br>
+ if (m_param->analysisSaveReuseLevel == 10)<br>
{<br>
/* Add Size of interDir, mvpIdx, refIdx, mv, luma and chroma modes */<br>
analysis->frameRecordSize += depthBytes;<br>
@@ -5344,7 +5397,7 @@<br>
if (analysis->sliceType > X265_TYPE_I)<br>
X265_FWRITE((WeightParam*)analysis->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFileOut);<br>
<br>
- if (m_param->analysisReuseLevel < 2)<br>
+ if (m_param->analysisSaveReuseLevel < 2)<br>
return;<br>
<br>
if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I)<br>
@@ -5362,11 +5415,11 @@<br>
X265_FWRITE((analysis->interData)->modes, sizeof(uint8_t), depthBytes, m_analysisFileOut);<br>
if (m_param->rc.cuTree)<br>
X265_FWRITE((analysis->interData)->cuQPOff, sizeof(int8_t), depthBytes, m_analysisFileOut);<br>
- if (m_param->analysisReuseLevel > 4)<br>
+ if (m_param->analysisSaveReuseLevel > 4)<br>
{<br>
X265_FWRITE((analysis->interData)->partSize, sizeof(uint8_t), depthBytes, m_analysisFileOut);<br>
X265_FWRITE((analysis->interData)->mergeFlag, sizeof(uint8_t), depthBytes, m_analysisFileOut);<br>
- if (m_param->analysisReuseLevel == 10)<br>
+ if (m_param->analysisSaveReuseLevel == 10)<br>
{<br>
X265_FWRITE((analysis->interData)->interDir, sizeof(uint8_t), depthBytes, m_analysisFileOut);<br>
if (bIntraInInter) X265_FWRITE((analysis->intraData)->chromaModes, sizeof(uint8_t), depthBytes, m_analysisFileOut);<br>
@@ -5380,7 +5433,7 @@<br>
X265_FWRITE((analysis->intraData)->modes, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFileOut);<br>
}<br>
}<br>
- if (m_param->analysisReuseLevel != 10)<br>
+ if (m_param->analysisSaveReuseLevel != 10)<br>
X265_FWRITE((analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFileOut);<br>
<br>
}<br>
diff -r 4fcd8f1701a6 -r a28fd843b302 source/encoder/search.cpp<br>
--- a/source/encoder/search.cpp Fri Jan 10 14:16:04 2020 +0530<br>
+++ b/source/encoder/search.cpp Fri Jan 10 17:01:08 2020 +0530<br>
@@ -2208,7 +2208,7 @@<br>
x265_analysis_inter_data* interDataCTU = NULL;<br>
int cuIdx;<br>
cuIdx = (interMode.cu.m_cuAddr * m_param->num4x4Partitions) + cuGeom.absPartIdx;<br>
- if (m_param->analysisReuseLevel == 10 && m_param->interRefine > 1)<br>
+ if (m_param->analysisLoadReuseLevel == 10 && m_param->interRefine > 1)<br>
{<br>
interDataCTU = m_frame->m_analysisData.interData;<br>
if ((cu.m_predMode[pu.puAbsPartIdx] == interDataCTU->modes[cuIdx + pu.puAbsPartIdx])<br>
@@ -2227,7 +2227,7 @@<br>
<br>
cu.getNeighbourMV(puIdx, pu.puAbsPartIdx, interMode.interNeighbours);<br>
/* Uni-directional prediction */<br>
- if ((m_param->analysisLoad && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)<br>
+ if ((m_param->analysisLoadReuseLevel > 1 && m_param->analysisLoadReuseLevel != 10)<br>
|| (m_param->analysisMultiPassRefine && m_param->rc.bStatRead) || (m_param->bAnalysisType == AVC_INFO) || (useAsMVP))<br>
{<br>
for (int list = 0; list < numPredDir; list++)<br>
diff -r 4fcd8f1701a6 -r a28fd843b302 source/x265.h<br>
--- a/source/x265.h Fri Jan 10 14:16:04 2020 +0530<br>
+++ b/source/x265.h Fri Jan 10 17:01:08 2020 +0530<br>
@@ -320,7 +320,7 @@<br>
<br>
typedef enum<br>
{<br>
- NO_INFO = 0,<br>
+ DEFAULT = 0,<br>
AVC_INFO = 1,<br>
HEVC_INFO = 2,<br>
}AnalysisRefineType;<br>
@@ -1656,7 +1656,7 @@<br>
<br>
/* A value between 1 and 10 (both inclusive) determines the level of<br>
* information stored/reused in analysis save/load. Higher the refine<br>
- * level higher the information stored/reused. Default is 5 */<br>
+ * level higher the information stored/reused. Default is 5. Now deprecated. */<br>
int analysisReuseLevel;<br>
<br>
/* Limit Sample Adaptive Offset filter computation by early terminating SAO<br>
@@ -1867,6 +1867,16 @@<br>
* Auto-enabled when max-cll, max-fall, or mastering display info is specified.<br>
* Default is disabled */<br>
int bEmitHDR10SEI;<br>
+<br>
+ /* A value between 1 and 10 (both inclusive) determines the level of<br>
+ * analysis information stored in analysis-save. Higher the refine level higher<br>
+ * the information stored. Default is 5 */<br>
+ int analysisSaveReuseLevel;<br>
+ <br>
+ /* A value between 1 and 10 (both inclusive) determines the level of<br>
+ * analysis information reused in analysis-load. Higher the refine level higher<br>
+ * the information reused. Default is 5 */<br>
+ int analysisLoadReuseLevel;<br>
} x265_param;<br>
<br>
/* x265_param_alloc:<br>
diff -r 4fcd8f1701a6 -r a28fd843b302 source/x265cli.h<br>
--- a/source/x265cli.h Fri Jan 10 14:16:04 2020 +0530<br>
+++ b/source/x265cli.h Fri Jan 10 17:01:08 2020 +0530<br>
@@ -275,7 +275,9 @@<br>
{ "no-multi-pass-opt-rps", no_argument, NULL, 0 },<br>
{ "analysis-reuse-mode", required_argument, NULL, 0 }, /* DEPRECATED */<br>
{ "analysis-reuse-file", required_argument, NULL, 0 },<br>
- { "analysis-reuse-level", required_argument, NULL, 0 },<br>
+ { "analysis-reuse-level", required_argument, NULL, 0 }, /* DEPRECATED */<br>
+ { "analysis-save-reuse-level", required_argument, NULL, 0 },<br>
+ { "analysis-load-reuse-level", required_argument, NULL, 0 },<br>
{ "analysis-save", required_argument, NULL, 0 },<br>
{ "analysis-load", required_argument, NULL, 0 },<br>
{ "scale-factor", required_argument, NULL, 0 },<br>
@@ -553,7 +555,9 @@<br>
H0(" --analysis-save <filename> Dump analysis info into the specified file. Default Disabled\n");<br>
H0(" --analysis-load <filename> Load analysis buffers from the file specified. Default Disabled\n");<br>
H0(" --analysis-reuse-file <filename> Specify file name used for either dumping or reading analysis data. Deault x265_analysis.dat\n");<br>
- H0(" --analysis-reuse-level <1..10> Level of analysis reuse indicates amount of info stored/reused in save/load mode, 1:least..10:most. Default %d\n", param->analysisReuseLevel);<br>
+ H0(" --analysis-reuse-level <1..10> Level of analysis reuse indicates amount of info stored/reused in save/load mode, 1:least..10:most. Now deprecated. Default %d\n", param->analysisReuseLevel);<br>
+ H0(" --analysis-save-reuse-level <1..10> Indicates the amount of analysis info stored in save mode, 1:least..10:most. Default %d\n", param->analysisSaveReuseLevel);<br>
+ H0(" --analysis-load-reuse-level <1..10> Indicates the amount of analysis info reused in load mode, 1:least..10:most. Default %d\n", param->analysisLoadReuseLevel);<br>
H0(" --refine-analysis-type <string> Reuse anlaysis information received through API call. Supported options are avc and hevc. Default disabled - %d\n", param->bAnalysisType);<br>
H0(" --scale-factor <int> Specify factor by which input video is scaled down for analysis save mode. Default %d\n", param->scaleFactor);<br>
H0(" --refine-intra <0..4> Enable intra refinement for encode that uses analysis-load.\n"<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" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><span style="color:rgb(0,0,0)">Regards,<br>Kavitha</span></div></div></div></div></div>