<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 22, 2017 at 2:07 PM, <span dir="ltr"><<a href="mailto:aruna@multicorewareinc.com" target="_blank">aruna@multicorewareinc.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 Aruna Matheswaran <<a href="mailto:aruna@multicorewareinc.com">aruna@multicorewareinc.com</a>><br>
# Date 1513850215 -19800<br>
# Thu Dec 21 15:26:55 2017 +0530<br>
# Node ID a3334a263d26920696091ccfcfe8e0<wbr>db8be16364<br>
# Parent 37f6c378ac90adf355bac51185a82b<wbr>2917057107<br>
analysis: Enable analysis save and load in a single run.<br>
<br>
This patch does the following,<br>
<br>
1. Deprecates the cli option --analysis-reuse-mode and introduces two new cli<br>
options --analysis-save <filename> and --analysis-load <filename>.<br>
<br>
2. Deprecates the param analysisReuseMode and introduces two new param options<br>
analysisSave and analysisLoad.<br>
<br>
diff -r 37f6c378ac90 -r a3334a263d26 doc/reST/cli.rst<br>
--- a/doc/reST/cli.rst Thu Dec 14 16:53:44 2017 +0530<br>
+++ b/doc/reST/cli.rst Thu Dec 21 15:26:55 2017 +0530<br>
@@ -863,21 +863,22 @@<br>
sequence multiple times (presumably at varying bitrates). The encoder<br>
will not reuse analysis if slice type parameters do not match.<br>
<br>
-.. option:: --analysis-reuse-mode <string|int><br>
-<br>
- This option allows reuse of analysis information from first pass to second pass.<br>
- :option:`--analysis-reuse-mode save` specifies that encoder outputs analysis information of each frame.<br>
- :option:`--analysis-reuse-mode load` specifies that encoder reuses analysis information from first pass.<br>
- There is no benefit using load mode without running encoder in save mode. Analysis data from save mode is<br>
- written to a file specified by :option:`--analysis-reuse-<wbr>file`. The amount of analysis data stored/reused<br>
- is determined by :option:`--analysis-reuse-<wbr>level`. By reading the analysis data writen by an earlier encode<br>
- of the same sequence, substantial redundant work may be avoided. Requires cutree, pmode to be off. Default 0.<br>
-<br>
- **Values:** off(0), save(1): dump analysis data, load(2): read analysis data<br>
+.. option:: --analysis-save <filename><br>
+<br>
+ Encoder outputs analysis information of each frame. Analysis data from save mode is<br>
+ written to the file specified. Requires cutree, pmode to be off. Default disabled.<br>
+<br>
+.. option:: --analysis-load <filename><br>
+<br>
+ Encoder reuses analysis information from the file specified. By reading the analysis data writen by<br>
+ an earlier encode of the same sequence, substantial redundant work may be avoided. Requires cutree, pmode<br>
+ to be off. Default disabled.<br>
+<br>
+ The amount of analysis data stored/reused is determined by :option:`--analysis-reuse-<wbr>level`.<br>
<br>
.. option:: --analysis-reuse-file <filename><br>
<br>
- Specify a filename for analysis data (see :option:`--analysis-reuse-<wbr>mode`)<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>
diff -r 37f6c378ac90 -r a3334a263d26 source/CMakeLists.txt<br>
--- a/source/CMakeLists.txt Thu Dec 14 16:53:44 2017 +0530<br>
+++ b/source/CMakeLists.txt Thu Dec 21 15:26:55 2017 +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 148)<br>
+set(X265_BUILD 149)<br>
configure_file("${PROJECT_<wbr>SOURCE_DIR}/<a href="http://x265.def.in" rel="noreferrer" target="_blank">x265.def.in</a>"<br>
"${PROJECT_BINARY_DIR}/x265.<wbr>def")<br>
configure_file("${PROJECT_<wbr>SOURCE_DIR}/<a href="http://x265_config.h.in" rel="noreferrer" target="_blank">x265_config.h.in</a>"<br>
diff -r 37f6c378ac90 -r a3334a263d26 source/common/cudata.cpp<br>
--- a/source/common/cudata.cpp Thu Dec 14 16:53:44 2017 +0530<br>
+++ b/source/common/cudata.cpp Thu Dec 21 15:26:55 2017 +0530<br>
@@ -1626,7 +1626,7 @@<br>
dir |= (1 << list);<br>
candMvField[count][list].mv = colmv;<br>
candMvField[count][list].<wbr>refIdx = refIdx;<br>
- if (m_encData->m_param-><wbr>scaleFactor && m_encData->m_param-><wbr>analysisReuseMode == X265_ANALYSIS_SAVE && m_log2CUSize[0] < 4)<br>
+ if (m_encData->m_param-><wbr>scaleFactor && m_encData->m_param-><wbr>analysisSave && m_log2CUSize[0] < 4)<br>
{<br>
MV dist(MAX_MV, MAX_MV);<br>
candMvField[count][list].mv = dist;<br>
@@ -1791,7 +1791,7 @@<br>
int curRefPOC = m_slice->m_refPOCList[picList]<wbr>[refIdx];<br>
int curPOC = m_slice->m_poc;<br>
<br>
- if (m_encData->m_param-><wbr>scaleFactor && m_encData->m_param-><wbr>analysisReuseMode == X265_ANALYSIS_SAVE && (m_log2CUSize[0] < 4))<br>
+ if (m_encData->m_param-><wbr>scaleFactor && m_encData->m_param-><wbr>analysisSave && (m_log2CUSize[0] < 4))<br>
{<br>
MV dist(MAX_MV, MAX_MV);<br>
pmv[numMvc++] = amvpCand[num++] = dist;<br>
diff -r 37f6c378ac90 -r a3334a263d26 source/common/param.cpp<br>
--- a/source/common/param.cpp Thu Dec 14 16:53:44 2017 +0530<br>
+++ b/source/common/param.cpp Thu Dec 21 15:26:55 2017 +0530<br>
@@ -197,10 +197,12 @@<br>
param->rdPenalty = 0;<br>
param->psyRd = 2.0;<br>
param->psyRdoq = 0.0;<br>
- param->analysisReuseMode = 0;<br>
+ param->analysisReuseMode = 0; /*DEPRECATED*/<br>
param->analysisMultiPassRefine = 0;<br>
param-><wbr>analysisMultiPassDistortion = 0;<br>
param->analysisReuseFileName = NULL;<br>
+ param->analysisSave = NULL;<br>
+ param->analysisLoad = NULL;<br>
param->bIntraInBFrames = 0;<br>
param->bLossless = 0;<br>
param->bCULossless = 0;<br>
@@ -850,7 +852,7 @@<br>
p->rc.bStrictCbr = atobool(value);<br>
p->rc.pbFactor = 1.0;<br>
}<br>
- OPT("analysis-reuse-mode") p->analysisReuseMode = parseName(value, x265_analysis_names, bError);<br>
+ OPT("analysis-reuse-mode") p->analysisReuseMode = parseName(value, x265_analysis_names, bError); /*DEPRECATED*/<br>
OPT("sar")<br>
{<br>
p->vui.aspectRatioIdc = parseName(value, x265_sar_names, bError);<br>
@@ -1006,6 +1008,8 @@<br>
}<br>
}<br>
OPT("gop-lookahead") p->gopLookahead = atoi(value);<br>
+ OPT("analysis-save") p->analysisSave = strdup(value);<br>
+ OPT("analysis-load") p->analysisLoad = strdup(value);<br>
else<br>
return X265_PARAM_BAD_NAME;<br>
}<br>
@@ -1344,9 +1348,7 @@<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->analysisReuseMode && (param->analysisReuseMode < X265_ANALYSIS_OFF || param->analysisReuseMode > X265_ANALYSIS_LOAD),<br>
- "Invalid analysis mode. Analysis mode 0: OFF 1: SAVE : 2 LOAD");<br>
- CHECK(param->analysisReuseMode && (param->analysisReuseLevel < 1 || param->analysisReuseLevel > 10),<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->scaleFactor > 2, "Invalid scale-factor. Supports factor <= 2");<br>
CHECK(param->rc.qpMax < QP_MIN || param->rc.qpMax > QP_MAX_MAX,<br>
@@ -1618,7 +1620,6 @@<br>
s += sprintf(s, " psy-rd=%.2f", p->psyRd);<br>
s += sprintf(s, " psy-rdoq=%.2f", p->psyRdoq);<br>
BOOL(p->bEnableRdRefine, "rd-refine");<br>
- s += sprintf(s, " analysis-reuse-mode=%d", p->analysisReuseMode);<br>
BOOL(p->bLossless, "lossless");<br>
s += sprintf(s, " cbqpoffs=%d", p->cbQpOffset);<br>
s += sprintf(s, " crqpoffs=%d", p->crQpOffset);<br>
@@ -1716,6 +1717,8 @@<br>
BOOL(p->bEmitHDRSEI, "hdr");<br>
BOOL(p->bHDROpt, "hdr-opt");<br>
BOOL(p->bDhdr10opt, "dhdr10-opt");<br>
+ s += sprintf(s, " analysis-save=%s", p->analysisSave);<br>
+ s += sprintf(s, " analysis-load=%s", p->analysisLoad);<br>
s += sprintf(s, " analysis-reuse-level=%d", p->analysisReuseLevel);<br>
s += sprintf(s, " scale-factor=%d", p->scaleFactor);<br>
s += sprintf(s, " refine-intra=%d", p->intraRefine);<br>
diff -r 37f6c378ac90 -r a3334a263d26 source/encoder/analysis.cpp<br>
--- a/source/encoder/analysis.cpp Thu Dec 14 16:53:44 2017 +0530<br>
+++ b/source/encoder/analysis.cpp Thu Dec 21 15:26:55 2017 +0530<br>
@@ -207,11 +207,11 @@<br>
}<br>
}<br>
<br>
- if (m_param->analysisReuseMode && m_slice->m_sliceType != I_SLICE && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel < 10)<br>
+ if ((m_param->analysisSave || m_param->analysisLoad) && m_slice->m_sliceType != I_SLICE && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel < 10)<br>
{<br>
int numPredDir = m_slice->isInterP() ? 1 : 2;<br>
m_reuseInterDataCTU = (analysis_inter_data*)m_frame-<wbr>>m_analysisData.interData;<br>
- m_reuseRef = &m_reuseInterDataCTU->ref[ctu.<wbr>m_cuAddr * X265_MAX_PRED_MODE_PER_CTU * numPredDir];<br>
+ m_reuseRef = &m_reuseInterDataCTU->ref [ctu.m_cuAddr * X265_MAX_PRED_MODE_PER_CTU * numPredDir];<br>
m_reuseDepth = &m_reuseInterDataCTU->depth[<wbr>ctu.m_cuAddr * ctu.m_numPartitions];<br>
m_reuseModes = &m_reuseInterDataCTU->modes[<wbr>ctu.m_cuAddr * ctu.m_numPartitions];<br>
if (m_param->analysisReuseLevel > 4)<br>
@@ -219,7 +219,7 @@<br>
m_reusePartSize = &m_reuseInterDataCTU-><wbr>partSize[ctu.m_cuAddr * ctu.m_numPartitions];<br>
m_reuseMergeFlag = &m_reuseInterDataCTU-><wbr>mergeFlag[ctu.m_cuAddr * ctu.m_numPartitions];<br>
}<br>
- if (m_param->analysisReuseMode == X265_ANALYSIS_SAVE)<br>
+ if (m_param->analysisSave && !m_param->analysisLoad)<br>
for (int i = 0; i < X265_MAX_PRED_MODE_PER_CTU * numPredDir; i++)<br>
m_reuseRef[i] = -1;<br>
}<br>
@@ -228,7 +228,7 @@<br>
if (m_slice->m_sliceType == I_SLICE)<br>
{<br>
analysis_intra_data* intraDataCTU = (analysis_intra_data*)m_frame-<wbr>>m_analysisData.intraData;<br>
- if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->analysisReuseLevel > 1)<br>
+ if (m_param->analysisLoad && m_param->analysisReuseLevel > 1)<br>
{<br>
memcpy(ctu.m_cuDepth, &intraDataCTU->depth[ctu.m_<wbr>cuAddr * numPartition], sizeof(uint8_t) * numPartition);<br>
memcpy(ctu.m_lumaIntraDir, &intraDataCTU->modes[ctu.m_<wbr>cuAddr * numPartition], sizeof(uint8_t) * numPartition);<br>
@@ -239,7 +239,7 @@<br>
}<br>
else<br>
{<br>
- bool bCopyAnalysis = ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->analysisReuseLevel == 10) || (m_param->bMVType && m_param->analysisReuseLevel >= 7 && ctu.m_numPartitions <= 16));<br>
+ bool bCopyAnalysis = ((m_param->analysisLoad && m_param->analysisReuseLevel == 10) || (m_param->bMVType && m_param->analysisReuseLevel >= 7 && ctu.m_numPartitions <= 16));<br>
bool BCompressInterCUrd0_4 = (m_param->bMVType && m_param->analysisReuseLevel >= 7 && m_param->rdLevel <= 4);<br>
bool BCompressInterCUrd5_6 = (m_param->bMVType && m_param->analysisReuseLevel >= 7 && m_param->rdLevel >= 5 && m_param->rdLevel <= 6);<br>
bCopyAnalysis = bCopyAnalysis || BCompressInterCUrd0_4 || BCompressInterCUrd5_6;<br>
@@ -280,7 +280,7 @@<br>
/* generate residual for entire CTU at once and copy to reconPic */<br>
encodeResidue(ctu, cuGeom);<br>
}<br>
- else if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->analysisReuseLevel == 10) || ((m_param->bMVType == AVC_INFO) && m_param->analysisReuseLevel >= 7 && ctu.m_numPartitions <= 16))<br>
+ else if ((m_param->analysisLoad && m_param->analysisReuseLevel == 10) || ((m_param->bMVType == AVC_INFO) && m_param->analysisReuseLevel >= 7 && ctu.m_numPartitions <= 16))<br>
{<br>
analysis_inter_data* interDataCTU = (analysis_inter_data*)m_frame-<wbr>>m_analysisData.interData;<br>
int posCTU = ctu.m_cuAddr * numPartition;<br>
@@ -651,7 +651,7 @@<br>
}<br>
<br>
/* Save Intra CUs TU depth only when analysis mode is OFF */<br>
- if ((m_limitTU & X265_TU_LIMIT_NEIGH) && cuGeom.log2CUSize >= 4 && !m_param->analysisReuseMode)<br>
+ if ((m_limitTU & X265_TU_LIMIT_NEIGH) && cuGeom.log2CUSize >= 4 && (!m_param->analysisSave && !m_param->analysisLoad))<br>
{<br>
CUData* ctu = md.bestMode->cu.m_encData-><wbr>getPicCTU(parentCTU.m_cuAddr);<br>
int8_t maxTUDepth = -1;<br>
@@ -1263,7 +1263,7 @@<br>
mightSplit &= !bDecidedDepth;<br>
}<br>
}<br>
- if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10))<br>
+ if ((m_param->analysisLoad && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10))<br>
{<br>
if (mightNotSplit && depth == m_reuseDepth[cuGeom.<wbr>absPartIdx])<br>
{<br>
@@ -1957,7 +1957,7 @@<br>
mightSplit &= !bDecidedDepth;<br>
}<br>
}<br>
- if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)<br>
+ if (m_param->analysisLoad && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)<br>
{<br>
if (mightNotSplit && depth == m_reuseDepth[cuGeom.<wbr>absPartIdx])<br>
{<br>
@@ -2890,7 +2890,7 @@<br>
interMode.cu.<wbr>setPredModeSubParts(MODE_<wbr>INTER);<br>
int numPredDir = m_slice->isInterP() ? 1 : 2;<br>
<br>
- if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_reuseInterDataCTU && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)<br>
+ if (m_param->analysisLoad && m_reuseInterDataCTU && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)<br>
{<br>
int refOffset = cuGeom.geomRecurId * 16 * numPredDir + partSize * numPredDir * 2;<br>
int index = 0;<br>
@@ -2932,7 +2932,7 @@<br>
}<br>
interMode.sa8dCost = m_rdCost.calcRdSADCost((<wbr>uint32_t)interMode.distortion, interMode.sa8dBits);<br>
<br>
- if (m_param->analysisReuseMode == X265_ANALYSIS_SAVE && m_reuseInterDataCTU && m_param->analysisReuseLevel > 1)<br>
+ if (m_param->analysisSave && m_reuseInterDataCTU && m_param->analysisReuseLevel > 1)<br>
{<br>
int refOffset = cuGeom.geomRecurId * 16 * numPredDir + partSize * numPredDir * 2;<br>
int index = 0;<br>
@@ -2954,7 +2954,7 @@<br>
interMode.cu.<wbr>setPredModeSubParts(MODE_<wbr>INTER);<br>
int numPredDir = m_slice->isInterP() ? 1 : 2;<br>
<br>
- if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_reuseInterDataCTU && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)<br>
+ if (m_param->analysisLoad && m_reuseInterDataCTU && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)<br>
{<br>
int refOffset = cuGeom.geomRecurId * 16 * numPredDir + partSize * numPredDir * 2;<br>
int index = 0;<br>
@@ -2988,7 +2988,7 @@<br>
/* predInterSearch sets interMode.sa8dBits, but this is ignored */<br>
encodeResAndCalcRdInterCU(<wbr>interMode, cuGeom);<br>
<br>
- if (m_param->analysisReuseMode == X265_ANALYSIS_SAVE && m_reuseInterDataCTU && m_param->analysisReuseLevel > 1)<br>
+ if (m_param->analysisSave && m_reuseInterDataCTU && m_param->analysisReuseLevel > 1)<br>
{<br>
int refOffset = cuGeom.geomRecurId * 16 * numPredDir + partSize * numPredDir * 2;<br>
int index = 0;<br>
diff -r 37f6c378ac90 -r a3334a263d26 source/encoder/api.cpp<br>
--- a/source/encoder/api.cpp Thu Dec 14 16:53:44 2017 +0530<br>
+++ b/source/encoder/api.cpp Thu Dec 21 15:26:55 2017 +0530<br>
@@ -398,7 +398,7 @@<br>
pic->userSEI.payloads = NULL;<br>
pic->userSEI.numPayloads = 0;<br>
<br>
- if (param->analysisReuseMode || (param->bMVType == AVC_INFO))<br>
+ if ((param->analysisSave || param->analysisLoad) || (param->bMVType == AVC_INFO))<br>
{<br>
uint32_t widthInCU = (param->sourceWidth + param->maxCUSize - 1) >> param->maxLog2CUSize;<br>
uint32_t heightInCU = (param->sourceHeight + param->maxCUSize - 1) >> param->maxLog2CUSize;<br>
diff -r 37f6c378ac90 -r a3334a263d26 source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp Thu Dec 14 16:53:44 2017 +0530<br>
+++ b/source/encoder/encoder.cpp Thu Dec 21 15:26:55 2017 +0530<br>
@@ -77,7 +77,6 @@<br>
m_param = NULL;<br>
m_latestParam = NULL;<br>
m_threadPool = NULL;<br>
- m_analysisFile = NULL;<br>
m_analysisFileIn = NULL;<br>
m_analysisFileOut = NULL;<br>
m_offsetEmergency = NULL;<br>
@@ -343,16 +342,28 @@<br>
if (!m_lookahead->create())<br>
m_aborted = true;<br>
initRefIdx();<br>
- if (m_param->analysisReuseMode && m_param->bUseAnalysisFile)<br>
+ if (m_param->analysisSave && m_param->bUseAnalysisFile)<br>
{<br>
- const char* name = m_param-><wbr>analysisReuseFileName;<br>
- if (!name)<br>
- name = defaultAnalysisFileName;<br>
- const char* mode = m_param->analysisReuseMode == X265_ANALYSIS_LOAD ? "rb" : "wb";<br>
- m_analysisFile = x265_fopen(name, mode);<br>
- if (!m_analysisFile)<br>
+ char* temp = strcatFilename(m_param-><wbr>analysisSave, ".temp");<br>
+ if (!temp)<br>
+ m_aborted = true;<br>
+ else<br>
+ {<br>
+ m_analysisFileOut = x265_fopen(temp, "wb");<br>
+ X265_FREE(temp);<br>
+ }<br>
+ if (!m_analysisFileOut)<br>
{<br>
- x265_log_file(NULL, X265_LOG_ERROR, "Analysis load/save: failed to open file %s\n", name);<br>
+ x265_log_file(NULL, X265_LOG_ERROR, "Analysis save: failed to open file %s.temp\n", m_param->analysisSave);<br>
+ m_aborted = true;<br>
+ }<br>
+ }<br>
+ if (m_param->analysisLoad && m_param->bUseAnalysisFile)<br>
+ {<br>
+ m_analysisFileIn = x265_fopen(m_param-><wbr>analysisLoad, "rb");<br>
+ if (!m_analysisFileIn)<br>
+ {<br>
+ x265_log_file(NULL, X265_LOG_ERROR, "Analysis load: failed to open file %s\n", m_param->analysisLoad);<br>
m_aborted = true;<br>
}<br>
}<br>
@@ -718,9 +729,6 @@<br>
<br>
X265_FREE(m_offsetEmergency);<br>
<br>
- if (m_analysisFile)<br>
- fclose(m_analysisFile);<br>
-<br>
if (m_latestParam != NULL && m_latestParam != m_param)<br>
{<br>
if (m_latestParam->scalingLists != m_param->scalingLists)<br>
@@ -735,7 +743,7 @@<br>
{<br>
int bError = 1;<br>
fclose(m_analysisFileOut);<br>
- const char* name = m_param-><wbr>analysisReuseFileName;<br>
+ const char* name = m_param->analysisSave ? m_param->analysisSave : m_param-><wbr>analysisReuseFileName;<br>
if (!name)<br>
name = defaultAnalysisFileName;<br>
char* temp = strcatFilename(name, ".temp");<br>
@@ -763,6 +771,8 @@<br>
free((char*)m_param-><wbr>numaPools);<br>
free((char*)m_param-><wbr>masteringDisplayColorVolume);<br>
free((char*)m_param-><wbr>toneMapFile);<br>
+ free((char*)m_param-><wbr>analysisSave);<br>
+ free((char*)m_param-><wbr>analysisLoad);<br>
PARAM_NS::x265_param_free(m_<wbr>param);<br>
}<br>
}<br>
@@ -849,7 +859,7 @@<br>
<br>
if (m_exportedPic)<br>
{<br>
- if (!m_param->bUseAnalysisFile && m_param->analysisReuseMode == X265_ANALYSIS_SAVE)<br>
+ if (!m_param->bUseAnalysisFile && m_param->analysisSave)<br>
freeAnalysis(&m_exportedPic-><wbr>m_analysisData);<br>
ATOMIC_DEC(&m_exportedPic->m_<wbr>countRefEncoders);<br>
m_exportedPic = NULL;<br>
@@ -1034,7 +1044,7 @@<br>
<br>
/* In analysisSave mode, x265_analysis_data is allocated in pic_in and inFrame points to this */<br>
/* Load analysis data before lookahead->addPicture, since sliceType has been decided */<br>
- if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD)<br>
+ if (m_param->analysisLoad)<br>
{<br>
/* readAnalysisFile reads analysis data for the frame and allocates memory based on slicetype */<br>
readAnalysisFile(&inFrame->m_<wbr>analysisData, inFrame->m_poc, pic_in);<br>
@@ -1119,7 +1129,7 @@<br>
x265_frame_stats* frameData = NULL;<br>
<br>
/* Free up pic_in->analysisData since it has already been used */<br>
- if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD || (m_param->bMVType && slice->m_sliceType != I_SLICE))<br>
+ if ((m_param->analysisLoad && !m_param->analysisSave) || (m_param->bMVType && slice->m_sliceType != I_SLICE))<br>
freeAnalysis(&outFrame->m_<wbr>analysisData);<br>
<br>
if (pic_out)<br>
@@ -1145,7 +1155,7 @@<br>
}<br>
<br>
/* Dump analysis data from pic_out to file in save mode and free */<br>
- if (m_param->analysisReuseMode == X265_ANALYSIS_SAVE)<br>
+ if (m_param->analysisSave)<br>
{<br>
pic_out->analysisData.poc = pic_out->poc;<br>
pic_out->analysisData.<wbr>sliceType = pic_out->sliceType;<br>
@@ -1354,7 +1364,7 @@<br>
slice->m_maxNumMergeCand = m_param->maxNumMergeCand;<br>
slice->m_endCUAddr = slice->realEndAddress(m_sps.<wbr>numCUsInFrame * m_param->num4x4Partitions);<br>
}<br>
- if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->bDisableLookahead)<br>
+ if (m_param->analysisLoad && m_param->bDisableLookahead)<br>
{<br>
frameEnc->m_dts = frameEnc->m_analysisData.<wbr>lookahead.dts;<br>
if (m_rateControl->m_isVbv)<br>
@@ -1423,7 +1433,7 @@<br>
frameEnc->m_encData->m_slice-><wbr>m_iNumRPSInSPS = m_sps.spsrpsNum;<br>
<br>
curEncoder->m_rce.encodeOrder = frameEnc->m_encodeOrder = m_encodedFrameNum++;<br>
- if (m_param->analysisReuseMode != X265_ANALYSIS_LOAD || !m_param->bDisableLookahead)<br>
+ if (!m_param->analysisLoad || !m_param->bDisableLookahead)<br>
{<br>
if (m_bframeDelay)<br>
{<br>
@@ -1438,7 +1448,7 @@<br>
}<br>
<br>
/* Allocate analysis data before encode in save mode. This is allocated in frameEnc */<br>
- if (m_param->analysisReuseMode == X265_ANALYSIS_SAVE)<br>
+ if (m_param->analysisSave && !m_param->analysisLoad)<br>
{<br>
x265_analysis_data* analysis = &frameEnc->m_analysisData;<br>
analysis->poc = frameEnc->m_poc;<br>
@@ -2623,23 +2633,24 @@<br>
p->rc.rfConstantMin = 0;<br>
}<br>
<br>
- if (p->analysisReuseMode && (p->bDistributeModeAnalysis || p-><wbr>bDistributeMotionEstimation))<br>
+ if ((p->analysisLoad || p->analysisSave) && (p->bDistributeModeAnalysis || p-><wbr>bDistributeMotionEstimation))<br>
{<br>
x265_log(p, X265_LOG_WARNING, "Analysis load/save options incompatible with pmode/pme, Disabling pmode/pme\n");<br>
p->bDistributeMotionEstimation = p->bDistributeModeAnalysis = 0;<br>
}<br>
<br>
- if (p->analysisReuseMode && p->rc.cuTree)<br>
+ if ((p->analysisLoad || p->analysisSave) && p->rc.cuTree)<br>
{<br>
x265_log(p, X265_LOG_WARNING, "Analysis load/save options works only with cu-tree off, Disabling cu-tree\n");<br>
p->rc.cuTree = 0;<br>
}<br>
<br>
- if (p->analysisReuseMode && (p->analysisMultiPassRefine || p-><wbr>analysisMultiPassDistortion))<br>
+ if ((p->analysisLoad || p->analysisSave) && (p->analysisMultiPassRefine || p-><wbr>analysisMultiPassDistortion))<br>
{<br>
x265_log(p, X265_LOG_WARNING, "Cannot use Analysis load/save option and multi-pass-opt-analysis/multi-<wbr>pass-opt-distortion together,"<br>
"Disabling Analysis load/save and multi-pass-opt-analysis/multi-<wbr>pass-opt-distortion\n");<br>
- p->analysisReuseMode = p->analysisMultiPassRefine = p->analysisMultiPassDistortion = 0;<br>
+ p->analysisSave = p->analysisLoad = NULL;<br>
+ p->analysisMultiPassRefine = p->analysisMultiPassDistortion = 0;<br>
}<br>
if (p->scaleFactor)<br>
{<br>
@@ -2647,16 +2658,16 @@<br>
{<br>
p->scaleFactor = 0;<br>
}<br>
- else if (!p->analysisReuseMode || p->analysisReuseLevel < 10)<br>
+ else if ((!p->analysisLoad && !p->analysisSave) || p->analysisReuseLevel < 10)<br>
{<br>
- x265_log(p, X265_LOG_WARNING, "Input scaling works with analysis-reuse-mode, analysis-reuse-level 10. Disabling scale-factor.\n");<br>
+ x265_log(p, X265_LOG_WARNING, "Input scaling works with analysis load/save, analysis-reuse-level 10. Disabling scale-factor.\n");<br>
p->scaleFactor = 0;<br>
}<br>
}<br>
<br>
if (p->intraRefine)<br>
{<br>
- if (p->analysisReuseMode!= X265_ANALYSIS_LOAD || p->analysisReuseLevel < 10 || !p->scaleFactor)<br>
+ if (!p->analysisLoad || p->analysisReuseLevel < 10 || !p->scaleFactor)<br>
{<br>
x265_log(p, X265_LOG_WARNING, "Intra refinement requires analysis load, analysis-reuse-level 10, scale factor. Disabling intra refine.\n");<br>
p->intraRefine = 0;<br>
@@ -2665,7 +2676,7 @@<br>
<br>
if (p->interRefine)<br>
{<br>
- if (p->analysisReuseMode != X265_ANALYSIS_LOAD || p->analysisReuseLevel < 10 || !p->scaleFactor)<br>
+ if (!p->analysisLoad || p->analysisReuseLevel < 10 || !p->scaleFactor)<br>
{<br>
x265_log(p, X265_LOG_WARNING, "Inter refinement requires analysis load, analysis-reuse-level 10, scale factor. Disabling inter refine.\n");<br>
p->interRefine = 0;<br>
@@ -2680,7 +2691,7 @@<br>
<br>
if (p->mvRefine)<br>
{<br>
- if (p->analysisReuseMode != X265_ANALYSIS_LOAD || p->analysisReuseLevel < 10 || !p->scaleFactor)<br>
+ if (!p->analysisLoad || p->analysisReuseLevel < 10 || !p->scaleFactor)<br>
{<br>
x265_log(p, X265_LOG_WARNING, "MV refinement requires analysis load, analysis-reuse-level 10, scale factor. Disabling MV refine.\n");<br>
p->mvRefine = 0;<br>
@@ -2781,7 +2792,7 @@<br>
m_conformanceWindow.<wbr>bottomOffset = 0;<br>
m_conformanceWindow.leftOffset = 0;<br>
/* set pad size if width is not multiple of the minimum CU size */<br>
- if (p->scaleFactor == 2 && ((p->sourceWidth / 2) & (p->minCUSize - 1)) && p->analysisReuseMode == X265_ANALYSIS_LOAD)<br>
+ if (p->scaleFactor == 2 && ((p->sourceWidth / 2) & (p->minCUSize - 1)) && p->analysisLoad)<br>
{<br>
uint32_t rem = (p->sourceWidth / 2) & (p->minCUSize - 1);<br>
uint32_t padsize = p->minCUSize - rem;<br>
@@ -2970,7 +2981,7 @@<br>
}<br>
}<br>
/* set pad size if height is not multiple of the minimum CU size */<br>
- if (p->scaleFactor == 2 && ((p->sourceHeight / 2) & (p->minCUSize - 1)) && p->analysisReuseMode == X265_ANALYSIS_LOAD)<br>
+ if (p->scaleFactor == 2 && ((p->sourceHeight / 2) & (p->minCUSize - 1)) && p->analysisLoad)<br>
{<br>
uint32_t rem = (p->sourceHeight / 2) & (p->minCUSize - 1);<br>
uint32_t padsize = p->minCUSize - rem;<br>
@@ -3268,30 +3279,30 @@<br>
static uint64_t totalConsumedBytes = 0;<br>
uint32_t depthBytes = 0;<br>
if (m_param->bUseAnalysisFile)<br>
- fseeko(m_analysisFile, totalConsumedBytes, SEEK_SET);<br>
+ fseeko(m_analysisFileIn, totalConsumedBytes, SEEK_SET);<br>
const x265_analysis_data *picData = &(picIn->analysisData);<br>
analysis_intra_data *intraPic = (analysis_intra_data *)picData->intraData;<br>
analysis_inter_data *interPic = (analysis_inter_data *)picData->interData;<br>
<br>
int poc; uint32_t frameRecordSize;<br>
- X265_FREAD(&frameRecordSize, sizeof(uint32_t), 1, m_analysisFile, &(picData->frameRecordSize));<br>
- X265_FREAD(&depthBytes, sizeof(uint32_t), 1, m_analysisFile, &(picData->depthBytes));<br>
- X265_FREAD(&poc, sizeof(int), 1, m_analysisFile, &(picData->poc));<br>
+ X265_FREAD(&frameRecordSize, sizeof(uint32_t), 1, m_analysisFileIn, &(picData->frameRecordSize));<br>
+ X265_FREAD(&depthBytes, sizeof(uint32_t), 1, m_analysisFileIn, &(picData->depthBytes));<br>
+ X265_FREAD(&poc, sizeof(int), 1, m_analysisFileIn, &(picData->poc));<br>
<br>
if (m_param->bUseAnalysisFile)<br>
{<br>
uint64_t currentOffset = totalConsumedBytes;<br>
<br>
/* Seeking to the right frame Record */<br>
- while (poc != curPoc && !feof(m_analysisFile))<br>
+ while (poc != curPoc && !feof(m_analysisFileIn))<br>
{<br>
currentOffset += frameRecordSize;<br>
- fseeko(m_analysisFile, currentOffset, SEEK_SET);<br>
- X265_FREAD(&frameRecordSize, sizeof(uint32_t), 1, m_analysisFile, &(picData->frameRecordSize));<br>
- X265_FREAD(&depthBytes, sizeof(uint32_t), 1, m_analysisFile, &(picData->depthBytes));<br>
- X265_FREAD(&poc, sizeof(int), 1, m_analysisFile, &(picData->poc));<br>
+ fseeko(m_analysisFileIn, currentOffset, SEEK_SET);<br>
+ X265_FREAD(&frameRecordSize, sizeof(uint32_t), 1, m_analysisFileIn, &(picData->frameRecordSize));<br>
+ X265_FREAD(&depthBytes, sizeof(uint32_t), 1, m_analysisFileIn, &(picData->depthBytes));<br>
+ X265_FREAD(&poc, sizeof(int), 1, m_analysisFileIn, &(picData->poc));<br>
}<br>
- if (poc != curPoc || feof(m_analysisFile))<br>
+ if (poc != curPoc || feof(m_analysisFileIn))<br>
{<br>
x265_log(NULL, X265_LOG_WARNING, "Error reading analysis data: Cannot find POC %d\n", curPoc);<br>
freeAnalysis(analysis);<br>
@@ -3302,15 +3313,15 @@<br>
/* Now arrived at the right frame, read the record */<br>
analysis->poc = poc;<br>
analysis->frameRecordSize = frameRecordSize;<br>
- X265_FREAD(&analysis-><wbr>sliceType, sizeof(int), 1, m_analysisFile, &(picData->sliceType));<br>
- X265_FREAD(&analysis-><wbr>bScenecut, sizeof(int), 1, m_analysisFile, &(picData->bScenecut));<br>
- X265_FREAD(&analysis-><wbr>satdCost, sizeof(int64_t), 1, m_analysisFile, &(picData->satdCost));<br>
- X265_FREAD(&analysis-><wbr>numCUsInFrame, sizeof(int), 1, m_analysisFile, &(picData->numCUsInFrame));<br>
- X265_FREAD(&analysis-><wbr>numPartitions, sizeof(int), 1, m_analysisFile, &(picData->numPartitions));<br>
+ X265_FREAD(&analysis-><wbr>sliceType, sizeof(int), 1, m_analysisFileIn, &(picData->sliceType));<br>
+ X265_FREAD(&analysis-><wbr>bScenecut, sizeof(int), 1, m_analysisFileIn, &(picData->bScenecut));<br>
+ X265_FREAD(&analysis-><wbr>satdCost, sizeof(int64_t), 1, m_analysisFileIn, &(picData->satdCost));<br>
+ X265_FREAD(&analysis-><wbr>numCUsInFrame, sizeof(int), 1, m_analysisFileIn, &(picData->numCUsInFrame));<br>
+ X265_FREAD(&analysis-><wbr>numPartitions, sizeof(int), 1, m_analysisFileIn, &(picData->numPartitions));<br>
if (m_param->bDisableLookahead)<br>
{<br>
- X265_FREAD(&analysis-><wbr>numCuInHeight, sizeof(uint32_t), 1, m_analysisFile, &(picData->numCuInHeight));<br>
- X265_FREAD(&analysis-><wbr>lookahead, sizeof(x265_lookahead_data), 1, m_analysisFile, &(picData->lookahead));<br>
+ X265_FREAD(&analysis-><wbr>numCuInHeight, sizeof(uint32_t), 1, m_analysisFileIn, &(picData->numCuInHeight));<br>
+ X265_FREAD(&analysis-><wbr>lookahead, sizeof(x265_lookahead_data), 1, m_analysisFileIn, &(picData->lookahead));<br>
}<br>
int scaledNumPartition = analysis->numPartitions;<br>
int factor = 1 << m_param->scaleFactor;<br>
@@ -3321,10 +3332,10 @@<br>
allocAnalysis(analysis);<br>
if (m_param->bDisableLookahead && m_rateControl->m_isVbv)<br>
{<br>
- X265_FREAD(analysis-><wbr>lookahead.intraVbvCost, sizeof(uint32_t), analysis->numCUsInFrame, m_analysisFile, picData->lookahead.<wbr>intraVbvCost);<br>
- X265_FREAD(analysis-><wbr>lookahead.vbvCost, sizeof(uint32_t), analysis->numCUsInFrame, m_analysisFile, picData->lookahead.vbvCost);<br>
- X265_FREAD(analysis-><wbr>lookahead.satdForVbv, sizeof(uint32_t), analysis->numCuInHeight, m_analysisFile, picData->lookahead.satdForVbv)<wbr>;<br>
- X265_FREAD(analysis-><wbr>lookahead.intraSatdForVbv, sizeof(uint32_t), analysis->numCuInHeight, m_analysisFile, picData->lookahead.<wbr>intraSatdForVbv);<br>
+ X265_FREAD(analysis-><wbr>lookahead.intraVbvCost, sizeof(uint32_t), analysis->numCUsInFrame, m_analysisFileIn, picData->lookahead.<wbr>intraVbvCost);<br>
+ X265_FREAD(analysis-><wbr>lookahead.vbvCost, sizeof(uint32_t), analysis->numCUsInFrame, m_analysisFileIn, picData->lookahead.vbvCost);<br>
+ X265_FREAD(analysis-><wbr>lookahead.satdForVbv, sizeof(uint32_t), analysis->numCuInHeight, m_analysisFileIn, picData->lookahead.satdForVbv)<wbr>;<br>
+ X265_FREAD(analysis-><wbr>lookahead.intraSatdForVbv, sizeof(uint32_t), analysis->numCuInHeight, m_analysisFileIn, picData->lookahead.<wbr>intraSatdForVbv);<br>
}<br>
if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I)<br>
{<br>
@@ -3338,9 +3349,9 @@<br>
modeBuf = tempBuf + depthBytes;<br>
partSizes = tempBuf + 2 * depthBytes;<br>
<br>
- X265_FREAD(depthBuf, sizeof(uint8_t), depthBytes, m_analysisFile, intraPic->depth);<br>
- X265_FREAD(modeBuf, sizeof(uint8_t), depthBytes, m_analysisFile, intraPic->chromaModes);<br>
- X265_FREAD(partSizes, sizeof(uint8_t), depthBytes, m_analysisFile, intraPic->partSizes);<br>
+ X265_FREAD(depthBuf, sizeof(uint8_t), depthBytes, m_analysisFileIn, intraPic->depth);<br>
+ X265_FREAD(modeBuf, sizeof(uint8_t), depthBytes, m_analysisFileIn, intraPic->chromaModes);<br>
+ X265_FREAD(partSizes, sizeof(uint8_t), depthBytes, m_analysisFileIn, intraPic->partSizes);<br>
<br>
size_t count = 0;<br>
for (uint32_t d = 0; d < depthBytes; d++)<br>
@@ -3361,12 +3372,12 @@<br>
<br>
if (!m_param->scaleFactor)<br>
{<br>
- X265_FREAD(((analysis_intra_<wbr>data *)analysis->intraData)->modes, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFile, intraPic->modes);<br>
+ X265_FREAD(((analysis_intra_<wbr>data *)analysis->intraData)->modes, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFileIn, intraPic->modes);<br>
}<br>
else<br>
{<br>
uint8_t *tempLumaBuf = X265_MALLOC(uint8_t, analysis->numCUsInFrame * scaledNumPartition);<br>
- X265_FREAD(tempLumaBuf, sizeof(uint8_t), analysis->numCUsInFrame * scaledNumPartition, m_analysisFile, intraPic->modes);<br>
+ X265_FREAD(tempLumaBuf, sizeof(uint8_t), analysis->numCUsInFrame * scaledNumPartition, m_analysisFileIn, intraPic->modes);<br>
for (uint32_t ctu32Idx = 0, cnt = 0; ctu32Idx < analysis->numCUsInFrame * scaledNumPartition; ctu32Idx++, cnt += factor)<br>
memset(&((analysis_intra_data *)analysis->intraData)->modes[<wbr>cnt], tempLumaBuf[ctu32Idx], factor);<br>
X265_FREE(tempLumaBuf);<br>
@@ -3379,7 +3390,7 @@<br>
{<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*)<wbr>analysis->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFile, (picIn->analysisData.wt));<br>
+ X265_FREAD((WeightParam*)<wbr>analysis->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFileIn, (picIn->analysisData.wt));<br>
if (m_param->analysisReuseLevel < 2)<br>
return;<br>
<br>
@@ -3401,33 +3412,33 @@<br>
depthBuf = tempBuf;<br>
modeBuf = tempBuf + depthBytes;<br>
<br>
- X265_FREAD(depthBuf, sizeof(uint8_t), depthBytes, m_analysisFile, interPic->depth);<br>
- X265_FREAD(modeBuf, sizeof(uint8_t), depthBytes, m_analysisFile, interPic->modes);<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>
<br>
if (m_param->analysisReuseLevel > 4)<br>
{<br>
partSize = modeBuf + depthBytes;<br>
mergeFlag = partSize + depthBytes;<br>
- X265_FREAD(partSize, sizeof(uint8_t), depthBytes, m_analysisFile, interPic->partSize);<br>
- X265_FREAD(mergeFlag, sizeof(uint8_t), depthBytes, m_analysisFile, interPic->mergeFlag);<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>
{<br>
interDir = mergeFlag + depthBytes;<br>
- X265_FREAD(interDir, sizeof(uint8_t), depthBytes, m_analysisFile, interPic->interDir);<br>
+ X265_FREAD(interDir, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->interDir);<br>
if (bIntraInInter)<br>
{<br>
chromaDir = interDir + depthBytes;<br>
- X265_FREAD(chromaDir, sizeof(uint8_t), depthBytes, m_analysisFile, intraPic->chromaModes);<br>
+ X265_FREAD(chromaDir, sizeof(uint8_t), depthBytes, m_analysisFileIn, intraPic->chromaModes);<br>
}<br>
for (uint32_t i = 0; i < numDir; i++)<br>
{<br>
mvpIdx[i] = X265_MALLOC(uint8_t, depthBytes);<br>
refIdx[i] = X265_MALLOC(int8_t, depthBytes);<br>
mv[i] = X265_MALLOC(MV, depthBytes);<br>
- X265_FREAD(mvpIdx[i], sizeof(uint8_t), depthBytes, m_analysisFile, interPic->mvpIdx[i]);<br>
- X265_FREAD(refIdx[i], sizeof(int8_t), depthBytes, m_analysisFile, interPic->refIdx[i]);<br>
- X265_FREAD(mv[i], sizeof(MV), depthBytes, m_analysisFile, interPic->mv[i]);<br>
+ X265_FREAD(mvpIdx[i], sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->mvpIdx[i]);<br>
+ X265_FREAD(refIdx[i], sizeof(int8_t), depthBytes, m_analysisFileIn, interPic->refIdx[i]);<br>
+ X265_FREAD(mv[i], sizeof(MV), depthBytes, m_analysisFileIn, interPic->mv[i]);<br>
}<br>
}<br>
}<br>
@@ -3486,12 +3497,12 @@<br>
{<br>
if (!m_param->scaleFactor)<br>
{<br>
- X265_FREAD(((analysis_intra_<wbr>data *)analysis->intraData)->modes, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFile, intraPic->modes);<br>
+ X265_FREAD(((analysis_intra_<wbr>data *)analysis->intraData)->modes, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFileIn, intraPic->modes);<br>
}<br>
else<br>
{<br>
uint8_t *tempLumaBuf = X265_MALLOC(uint8_t, analysis->numCUsInFrame * scaledNumPartition);<br>
- X265_FREAD(tempLumaBuf, sizeof(uint8_t), analysis->numCUsInFrame * scaledNumPartition, m_analysisFile, intraPic->modes);<br>
+ X265_FREAD(tempLumaBuf, sizeof(uint8_t), analysis->numCUsInFrame * scaledNumPartition, m_analysisFileIn, intraPic->modes);<br>
for (uint32_t ctu32Idx = 0, cnt = 0; ctu32Idx < analysis->numCUsInFrame * scaledNumPartition; ctu32Idx++, cnt += factor)<br>
memset(&((analysis_intra_data *)analysis->intraData)->modes[<wbr>cnt], tempLumaBuf[ctu32Idx], factor);<br>
X265_FREE(tempLumaBuf);<br>
@@ -3499,7 +3510,7 @@<br>
}<br>
}<br>
else<br>
- X265_FREAD(((analysis_inter_<wbr>data *)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFile, interPic->ref);<br>
+ X265_FREAD(((analysis_inter_<wbr>data *)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFileIn, interPic->ref);<br>
<br>
consumedBytes += frameRecordSize;<br>
if (numDir == 1)<br>
@@ -3774,51 +3785,51 @@<br>
if (!m_param->bUseAnalysisFile)<br>
return;<br>
<br>
- X265_FWRITE(&analysis-><wbr>frameRecordSize, sizeof(uint32_t), 1, m_analysisFile);<br>
- X265_FWRITE(&depthBytes, sizeof(uint32_t), 1, m_analysisFile);<br>
- X265_FWRITE(&analysis->poc, sizeof(int), 1, m_analysisFile);<br>
- X265_FWRITE(&analysis-><wbr>sliceType, sizeof(int), 1, m_analysisFile);<br>
- X265_FWRITE(&analysis-><wbr>bScenecut, sizeof(int), 1, m_analysisFile);<br>
- X265_FWRITE(&analysis-><wbr>satdCost, sizeof(int64_t), 1, m_analysisFile);<br>
- X265_FWRITE(&analysis-><wbr>numCUsInFrame, sizeof(int), 1, m_analysisFile);<br>
- X265_FWRITE(&analysis-><wbr>numPartitions, sizeof(int), 1, m_analysisFile);<br>
+ X265_FWRITE(&analysis-><wbr>frameRecordSize, sizeof(uint32_t), 1, m_analysisFileOut);<br>
+ X265_FWRITE(&depthBytes, sizeof(uint32_t), 1, m_analysisFileOut);<br>
+ X265_FWRITE(&analysis->poc, sizeof(int), 1, m_analysisFileOut);<br>
+ X265_FWRITE(&analysis-><wbr>sliceType, sizeof(int), 1, m_analysisFileOut);<br>
+ X265_FWRITE(&analysis-><wbr>bScenecut, sizeof(int), 1, m_analysisFileOut);<br>
+ X265_FWRITE(&analysis-><wbr>satdCost, sizeof(int64_t), 1, m_analysisFileOut);<br>
+ X265_FWRITE(&analysis-><wbr>numCUsInFrame, sizeof(int), 1, m_analysisFileOut);<br>
+ X265_FWRITE(&analysis-><wbr>numPartitions, sizeof(int), 1, m_analysisFileOut);<br>
if (analysis->sliceType > X265_TYPE_I)<br>
- X265_FWRITE((WeightParam*)<wbr>analysis->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFile);<br>
+ X265_FWRITE((WeightParam*)<wbr>analysis->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFileOut);<br>
<br>
if (m_param->analysisReuseLevel < 2)<br>
return;<br>
<br>
if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I)<br>
{<br>
- X265_FWRITE(((analysis_intra_<wbr>data*)analysis->intraData)-><wbr>depth, sizeof(uint8_t), depthBytes, m_analysisFile);<br>
- X265_FWRITE(((analysis_intra_<wbr>data*)analysis->intraData)-><wbr>chromaModes, sizeof(uint8_t), depthBytes, m_analysisFile);<br>
- X265_FWRITE(((analysis_intra_<wbr>data*)analysis->intraData)-><wbr>partSizes, sizeof(char), depthBytes, m_analysisFile);<br>
- X265_FWRITE(((analysis_intra_<wbr>data*)analysis->intraData)-><wbr>modes, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFile);<br>
+ X265_FWRITE(((analysis_intra_<wbr>data*)analysis->intraData)-><wbr>depth, sizeof(uint8_t), depthBytes, m_analysisFileOut);<br>
+ X265_FWRITE(((analysis_intra_<wbr>data*)analysis->intraData)-><wbr>chromaModes, sizeof(uint8_t), depthBytes, m_analysisFileOut);<br>
+ X265_FWRITE(((analysis_intra_<wbr>data*)analysis->intraData)-><wbr>partSizes, sizeof(char), depthBytes, m_analysisFileOut);<br>
+ X265_FWRITE(((analysis_intra_<wbr>data*)analysis->intraData)-><wbr>modes, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFileOut);<br>
}<br>
else<br>
{<br>
- X265_FWRITE(((analysis_inter_<wbr>data*)analysis->interData)-><wbr>depth, sizeof(uint8_t), depthBytes, m_analysisFile);<br>
- X265_FWRITE(((analysis_inter_<wbr>data*)analysis->interData)-><wbr>modes, sizeof(uint8_t), depthBytes, m_analysisFile);<br>
+ X265_FWRITE(((analysis_inter_<wbr>data*)analysis->interData)-><wbr>depth, sizeof(uint8_t), depthBytes, m_analysisFileOut);<br>
+ X265_FWRITE(((analysis_inter_<wbr>data*)analysis->interData)-><wbr>modes, sizeof(uint8_t), depthBytes, m_analysisFileOut);<br>
if (m_param->analysisReuseLevel > 4)<br>
{<br>
- X265_FWRITE(((analysis_inter_<wbr>data*)analysis->interData)-><wbr>partSize, sizeof(uint8_t), depthBytes, m_analysisFile);<br>
- X265_FWRITE(((analysis_inter_<wbr>data*)analysis->interData)-><wbr>mergeFlag, sizeof(uint8_t), depthBytes, m_analysisFile);<br>
+ X265_FWRITE(((analysis_inter_<wbr>data*)analysis->interData)-><wbr>partSize, sizeof(uint8_t), depthBytes, m_analysisFileOut);<br>
+ X265_FWRITE(((analysis_inter_<wbr>data*)analysis->interData)-><wbr>mergeFlag, sizeof(uint8_t), depthBytes, m_analysisFileOut);<br>
if (m_param->analysisReuseLevel == 10)<br>
{<br>
- X265_FWRITE(((analysis_inter_<wbr>data*)analysis->interData)-><wbr>interDir, sizeof(uint8_t), depthBytes, m_analysisFile);<br>
- if (bIntraInInter) X265_FWRITE(((analysis_intra_<wbr>data*)analysis->intraData)-><wbr>chromaModes, sizeof(uint8_t), depthBytes, m_analysisFile);<br>
+ X265_FWRITE(((analysis_inter_<wbr>data*)analysis->interData)-><wbr>interDir, sizeof(uint8_t), depthBytes, m_analysisFileOut);<br>
+ if (bIntraInInter) X265_FWRITE(((analysis_intra_<wbr>data*)analysis->intraData)-><wbr>chromaModes, sizeof(uint8_t), depthBytes, m_analysisFileOut);<br>
for (uint32_t dir = 0; dir < numDir; dir++)<br>
{<br>
- X265_FWRITE(((analysis_inter_<wbr>data*)analysis->interData)-><wbr>mvpIdx[dir], sizeof(uint8_t), depthBytes, m_analysisFile);<br>
- X265_FWRITE(((analysis_inter_<wbr>data*)analysis->interData)-><wbr>refIdx[dir], sizeof(int8_t), depthBytes, m_analysisFile);<br>
- X265_FWRITE(((analysis_inter_<wbr>data*)analysis->interData)-><wbr>mv[dir], sizeof(MV), depthBytes, m_analysisFile);<br>
+ X265_FWRITE(((analysis_inter_<wbr>data*)analysis->interData)-><wbr>mvpIdx[dir], sizeof(uint8_t), depthBytes, m_analysisFileOut);<br>
+ X265_FWRITE(((analysis_inter_<wbr>data*)analysis->interData)-><wbr>refIdx[dir], sizeof(int8_t), depthBytes, m_analysisFileOut);<br>
+ X265_FWRITE(((analysis_inter_<wbr>data*)analysis->interData)-><wbr>mv[dir], sizeof(MV), depthBytes, m_analysisFileOut);<br>
}<br>
if (bIntraInInter)<br>
- X265_FWRITE(((analysis_intra_<wbr>data*)analysis->intraData)-><wbr>modes, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFile);<br>
+ X265_FWRITE(((analysis_intra_<wbr>data*)analysis->intraData)-><wbr>modes, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFileOut);<br>
}<br>
}<br>
if (m_param->analysisReuseLevel != 10)<br>
- X265_FWRITE(((analysis_inter_<wbr>data*)analysis->interData)-><wbr>ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFile);<br>
+ X265_FWRITE(((analysis_inter_<wbr>data*)analysis->interData)-><wbr>ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFileOut);<br>
<br>
}<br>
#undef X265_FWRITE<br>
diff -r 37f6c378ac90 -r a3334a263d26 source/encoder/encoder.h<br>
--- a/source/encoder/encoder.h Thu Dec 14 16:53:44 2017 +0530<br>
+++ b/source/encoder/encoder.h Thu Dec 21 15:26:55 2017 +0530<br>
@@ -130,7 +130,6 @@<br>
FrameEncoder* m_frameEncoder[X265_MAX_FRAME_<wbr>THREADS];<br>
DPB* m_dpb;<br>
Frame* m_exportedPic;<br>
- FILE* m_analysisFile;<br>
FILE* m_analysisFileIn;<br>
FILE* m_analysisFileOut;<br>
x265_param* m_param;<br>
diff -r 37f6c378ac90 -r a3334a263d26 source/encoder/frameencoder.<wbr>cpp<br>
--- a/source/encoder/frameencoder.<wbr>cpp Thu Dec 14 16:53:44 2017 +0530<br>
+++ b/source/encoder/frameencoder.<wbr>cpp Thu Dec 21 15:26:55 2017 +0530<br>
@@ -335,7 +335,7 @@<br>
while (!m_frame->m_ctuInfo)<br>
m_frame->m_copied.wait();<br>
}<br>
- if ((m_param->bMVType == AVC_INFO) && !m_param->analysisReuseMode && !(IS_X265_TYPE_I(m_frame->m_<wbr>lowres.sliceType)))<br>
+ if ((m_param->bMVType == AVC_INFO) && !m_param->analysisSave && !m_param->analysisLoad && !(IS_X265_TYPE_I(m_frame->m_<wbr>lowres.sliceType)))<br>
{<br>
while (((m_frame->m_analysisData.<wbr>interData == NULL && m_frame->m_analysisData.<wbr>intraData == NULL) || (uint32_t)m_frame->m_poc != m_frame->m_analysisData.poc))<br>
m_frame->m_copyMVType.wait();<br>
@@ -430,7 +430,7 @@<br>
bool bUseWeightB = slice->m_sliceType == B_SLICE && slice->m_pps-><wbr>bUseWeightedBiPred;<br>
<br>
WeightParam* reuseWP = NULL;<br>
- if (m_param->analysisReuseMode && (bUseWeightP || bUseWeightB))<br>
+ if (m_param->analysisLoad && (bUseWeightP || bUseWeightB))<br>
reuseWP = (WeightParam*)m_frame->m_<wbr>analysisData.wt;<br>
<br>
if (bUseWeightP || bUseWeightB)<br>
@@ -439,7 +439,7 @@<br>
m_cuStats.countWeightAnalyze++<wbr>;<br>
ScopedElapsedTime time(m_cuStats.<wbr>weightAnalyzeTime);<br>
#endif<br>
- if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD)<br>
+ if (m_param->analysisLoad)<br>
{<br>
for (int list = 0; list < slice->isInterB() + 1; list++)<br>
{<br>
@@ -466,6 +466,8 @@<br>
else<br>
slice->disableWeights();<br>
<br>
+ if (m_param->analysisSave && (bUseWeightP || bUseWeightB))<br>
+ reuseWP = (WeightParam*)m_frame->m_<wbr>analysisData.wt;<br>
// Generate motion references<br>
int numPredDir = slice->isInterP() ? 1 : slice->isInterB() ? 2 : 0;<br>
for (int l = 0; l < numPredDir; l++)<br>
@@ -478,7 +480,7 @@<br>
slice->m_refReconPicList[l][<wbr>ref] = slice->m_refFrameList[l][ref]-<wbr>>m_reconPic;<br>
m_mref[l][ref].init(slice->m_<wbr>refReconPicList[l][ref], w, *m_param);<br>
}<br>
- if (m_param->analysisReuseMode == X265_ANALYSIS_SAVE && (bUseWeightP || bUseWeightB))<br>
+ if (m_param->analysisSave && (bUseWeightP || bUseWeightB))<br>
{<br>
for (int i = 0; i < (m_param->internalCsp != X265_CSP_I400 ? 3 : 1); i++)<br>
*(reuseWP++) = slice->m_weightPredTable[l][0]<wbr>[i];<br>
@@ -1411,7 +1413,7 @@<br>
/* TODO: use defines from slicetype.h for lowres block size */<br>
uint32_t block_y = (ctu->m_cuPelY >> m_param->maxLog2CUSize) * noOfBlocks;<br>
uint32_t block_x = (ctu->m_cuPelX >> m_param->maxLog2CUSize) * noOfBlocks;<br>
- if (m_param->analysisReuseMode != X265_ANALYSIS_LOAD || !m_param->bDisableLookahead)<br>
+ if (!m_param->analysisLoad || !m_param->bDisableLookahead)<br>
{<br>
cuStat.vbvCost = 0;<br>
cuStat.intraVbvCost = 0;<br>
diff -r 37f6c378ac90 -r a3334a263d26 source/encoder/search.cpp<br>
--- a/source/encoder/search.cpp Thu Dec 14 16:53:44 2017 +0530<br>
+++ b/source/encoder/search.cpp Thu Dec 21 15:26:55 2017 +0530<br>
@@ -2073,7 +2073,7 @@<br>
int mvpIdx = selectMVP(interMode.cu, pu, amvp, list, ref);<br>
MV mvmin, mvmax, outmv, mvp = amvp[mvpIdx];<br>
<br>
- if (!m_param->analysisReuseMode) /* Prevents load/save outputs from diverging if lowresMV is not available */<br>
+ if (!m_param->analysisSave && !m_param->analysisLoad) /* Prevents load/save outputs from diverging if lowresMV is not available */<br>
{<br>
MV lmv = getLowresMV(interMode.cu, pu, list, ref);<br>
if (lmv.notZero())<br>
@@ -2161,7 +2161,7 @@<br>
cu.getNeighbourMV(puIdx, pu.puAbsPartIdx, interMode.interNeighbours);<br>
<br>
/* Uni-directional prediction */<br>
- if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)<br>
+ if ((m_param->analysisLoad && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)<br>
|| (m_param-><wbr>analysisMultiPassRefine && m_param->rc.bStatRead) || (m_param->bMVType == AVC_INFO))<br>
{<br>
for (int list = 0; list < numPredDir; list++)<br>
@@ -2297,7 +2297,7 @@<br>
int mvpIdx = selectMVP(cu, pu, amvp, list, ref);<br>
MV mvmin, mvmax, outmv, mvp = amvp[mvpIdx];<br>
<br>
- if (!m_param->analysisReuseMode) /* Prevents load/save outputs from diverging when lowresMV is not available */<br>
+ if (!m_param->analysisSave && !m_param->analysisLoad) /* Prevents load/save outputs from diverging when lowresMV is not available */<br>
{<br>
MV lmv = getLowresMV(cu, pu, list, ref);<br>
if (lmv.notZero())<br>
diff -r 37f6c378ac90 -r a3334a263d26 source/encoder/slicetype.cpp<br>
--- a/source/encoder/slicetype.cpp Thu Dec 14 16:53:44 2017 +0530<br>
+++ b/source/encoder/slicetype.cpp Thu Dec 21 15:26:55 2017 +0530<br>
@@ -746,7 +746,7 @@<br>
/* Called by API thread */<br>
void Lookahead::addPicture(Frame& curFrame, int sliceType)<br>
{<br>
- if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->bDisableLookahead)<br>
+ if (m_param->analysisLoad && m_param->bDisableLookahead)<br>
{<br>
if (!m_filled)<br>
m_filled = true;<br>
@@ -847,7 +847,7 @@<br>
return out;<br>
}<br>
<br>
- if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->bDisableLookahead)<br>
+ if (m_param->analysisLoad && m_param->bDisableLookahead)<br>
return NULL;<br>
<br>
findJob(-1); /* run slicetypeDecide() if necessary */<br>
@@ -906,13 +906,13 @@<br>
default:<br>
return;<br>
}<br>
- if (m_param->analysisReuseMode != X265_ANALYSIS_LOAD || !m_param->bDisableLookahead)<br>
+ if (!m_param->analysisLoad || !m_param->bDisableLookahead)<br>
{<br>
X265_CHECK(curFrame->m_lowres.<wbr>costEst[b - p0][p1 - b] > 0, "Slice cost not estimated\n")<br>
if (m_param->rc.cuTree && !m_param->rc.bStatRead)<br>
/* update row satds based on cutree offsets */<br>
curFrame->m_lowres.satdCost = frameCostRecalculate(frames, p0, p1, b);<br>
- else if (m_param->analysisReuseMode != X265_ANALYSIS_LOAD || m_param->scaleFactor)<br>
+ else if (!m_param->analysisLoad || m_param->scaleFactor)<br>
{<br>
if (m_param->rc.aqMode)<br>
curFrame->m_lowres.satdCost = curFrame->m_lowres.costEstAq[b - p0][p1 - b];<br>
@@ -1056,7 +1056,7 @@<br>
{<br>
slicetypeAnalyse(frames, false);<br>
bool bIsVbv = m_param->rc.vbvBufferSize > 0 && m_param->rc.vbvMaxBitrate > 0;<br>
- if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->scaleFactor && bIsVbv)<br>
+ if (m_param->analysisLoad && m_param->scaleFactor && bIsVbv)<br>
{<br>
int numFrames;<br>
for (numFrames = 0; numFrames < maxSearch; numFrames++)<br>
@@ -1252,7 +1252,7 @@<br>
frames[j + 1] = NULL;<br>
slicetypeAnalyse(frames, true);<br>
bool bIsVbv = m_param->rc.vbvBufferSize > 0 && m_param->rc.vbvMaxBitrate > 0;<br>
- if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->scaleFactor && bIsVbv)<br>
+ if (m_param->analysisLoad && m_param->scaleFactor && bIsVbv)<br>
{<br>
int numFrames;<br>
for (numFrames = 0; numFrames < maxSearch; numFrames++)<br>
diff -r 37f6c378ac90 -r a3334a263d26 source/test/regression-tests.<wbr>txt<br>
--- a/source/test/regression-<wbr>tests.txt Thu Dec 14 16:53:44 2017 +0530<br>
+++ b/source/test/regression-<wbr>tests.txt Thu Dec 21 15:26:55 2017 +0530<br>
@@ -18,17 +18,17 @@<br>
BasketballDrive_1920x1080_50.<wbr>y4m,--preset faster --aq-strength 2 --merange 190 --slices 3<br>
BasketballDrive_1920x1080_50.<wbr>y4m,--preset medium --ctu 16 --max-tu-size 8 --subme 7 --qg-size 16 --cu-lossless --tu-inter-depth 3 --limit-tu 1<br>
BasketballDrive_1920x1080_50.<wbr>y4m,--preset medium --keyint -1 --nr-inter 100 -F4 --no-sao<br>
-BasketballDrive_1920x1080_50.<wbr>y4m,--preset medium --no-cutree --analysis-reuse-mode=save --analysis-reuse-level 2 --bitrate 7000 --limit-modes::--preset medium --no-cutree --analysis-reuse-mode=load --analysis-reuse-level 2 --bitrate 7000 --limit-modes<br>
+BasketballDrive_1920x1080_50.<wbr>y4m,--preset medium --no-cutree --analysis-save x265_analysis.dat --analysis-reuse-level 2 --bitrate 7000 --limit-modes::--preset medium --no-cutree --analysis-load x265_analysis.dat --analysis-reuse-level 2 --bitrate 7000 --limit-modes<br>
BasketballDrive_1920x1080_50.<wbr>y4m,--preset slow --nr-intra 100 -F4 --aq-strength 3 --qg-size 16 --limit-refs 1<br>
BasketballDrive_1920x1080_50.<wbr>y4m,--preset slower --lossless --chromaloc 3 --subme 0 --limit-tu 4<br>
-BasketballDrive_1920x1080_50.<wbr>y4m,--preset slower --no-cutree --analysis-reuse-mode=save --analysis-reuse-level 10 --bitrate 7000 --limit-tu 0::--preset slower --no-cutree --analysis-reuse-mode=load --analysis-reuse-level 10 --bitrate 7000 --limit-tu 0<br>
+BasketballDrive_1920x1080_50.<wbr>y4m,--preset slower --no-cutree --analysis-save x265_analysis.dat --analysis-reuse-level 10 --bitrate 7000 --limit-tu 0::--preset slower --no-cutree --analysis-load x265_analysis.dat --analysis-reuse-level 10 --bitrate 7000 --limit-tu 0<br>
BasketballDrive_1920x1080_50.<wbr>y4m,--preset veryslow --crf 4 --cu-lossless --pmode --limit-refs 1 --aq-mode 3 --limit-tu 3<br>
-BasketballDrive_1920x1080_50.<wbr>y4m,--preset veryslow --no-cutree --analysis-reuse-mode=save --bitrate 7000 --tskip-fast --limit-tu 4::--preset veryslow --no-cutree --analysis-reuse-mode=load --bitrate 7000 --tskip-fast --limit-tu 4<br>
+BasketballDrive_1920x1080_50.<wbr>y4m,--preset veryslow --no-cutree --analysis-save x265_analysis.dat --bitrate 7000 --tskip-fast --limit-tu 4::--preset veryslow --no-cutree --analysis-load x265_analysis.dat --bitrate 7000 --tskip-fast --limit-tu 4<br>
BasketballDrive_1920x1080_50.<wbr>y4m,--preset veryslow --recon-y4m-exec "ffplay -i pipe:0 -autoexit"<br>
Coastguard-4k.y4m,--preset ultrafast --recon-y4m-exec "ffplay -i pipe:0 -autoexit"<br>
Coastguard-4k.y4m,--preset superfast --tune grain --overscan=crop<br>
Coastguard-4k.y4m,--preset superfast --tune grain --pme --aq-strength 2 --merange 190<br>
-Coastguard-4k.y4m,--preset veryfast --no-cutree --analysis-reuse-mode=save --analysis-reuse-level 1 --bitrate 15000::--preset veryfast --no-cutree --analysis-reuse-mode=load --analysis-reuse-level 1 --bitrate 15000<br>
+Coastguard-4k.y4m,--preset veryfast --no-cutree --analysis-save x265_analysis.dat --analysis-reuse-level 1 --bitrate 15000::--preset veryfast --no-cutree --analysis-load x265_analysis.dat --analysis-reuse-level 1 --bitrate 15000<br>
Coastguard-4k.y4m,--preset medium --rdoq-level 1 --tune ssim --no-signhide --me umh --slices 2<br>
Coastguard-4k.y4m,--preset slow --tune psnr --cbqpoffs -1 --crqpoffs 1 --limit-refs 1<br>
CrowdRun_1920x1080_50_10bit_<wbr>422.yuv,--preset ultrafast --weightp --tune zerolatency --qg-size 16<br>
@@ -52,7 +52,7 @@<br>
DucksAndLegs_1920x1080_60_<wbr>10bit_444.yuv,--preset veryfast --weightp --nr-intra 1000 -F4<br>
DucksAndLegs_1920x1080_60_<wbr>10bit_444.yuv,--preset medium --nr-inter 500 -F4 --no-psy-rdoq<br>
DucksAndLegs_1920x1080_60_<wbr>10bit_444.yuv,--preset slower --no-weightp --rdoq-level 0 --limit-refs 3 --tu-inter-depth 4 --limit-tu 3<br>
-DucksAndLegs_1920x1080_60_<wbr>10bit_422.yuv,--preset fast --no-cutree --analysis-reuse-mode=save --bitrate 3000 --early-skip --tu-inter-depth 3 --limit-tu 1::--preset fast --no-cutree --analysis-reuse-mode=load --bitrate 3000 --early-skip --tu-inter-depth 3 --limit-tu 1<br>
+DucksAndLegs_1920x1080_60_<wbr>10bit_422.yuv,--preset fast --no-cutree --analysis-save x265_analysis.dat --bitrate 3000 --early-skip --tu-inter-depth 3 --limit-tu 1::--preset fast --no-cutree --analysis-load x265_analysis.dat --bitrate 3000 --early-skip --tu-inter-depth 3 --limit-tu 1<br>
FourPeople_1280x720_60.y4m,--<wbr>preset superfast --no-wpp --lookahead-slices 2<br>
FourPeople_1280x720_60.y4m,--<wbr>preset veryfast --aq-mode 2 --aq-strength 1.5 --qg-size 8<br>
FourPeople_1280x720_60.y4m,--<wbr>preset medium --qp 38 --no-psy-rd<br>
@@ -69,8 +69,8 @@<br>
KristenAndSara_1280x720_60.<wbr>y4m,--preset slower --pmode --max-tu-size 8 --limit-refs 0 --limit-modes --limit-tu 1<br>
NebutaFestival_2560x1600_60_<wbr>10bit_crop.yuv,--preset superfast --tune psnr<br>
NebutaFestival_2560x1600_60_<wbr>10bit_crop.yuv,--preset medium --tune grain --limit-refs 2<br>
-NebutaFestival_2560x1600_60_<wbr>10bit_crop.yuv,--preset slow --no-cutree --analysis-reuse-mode=save --rd 5 --analysis-reuse-level 10 --bitrate 9000::--preset slow --no-cutree --analysis-reuse-mode=load --rd 5 --analysis-reuse-level 10 --bitrate 9000<br>
-News-4k.y4m,--preset ultrafast --no-cutree --analysis-reuse-mode=save --analysis-reuse-level 2 --bitrate 15000::--preset ultrafast --no-cutree --analysis-reuse-mode=load --analysis-reuse-level 2 --bitrate 15000<br>
+NebutaFestival_2560x1600_60_<wbr>10bit_crop.yuv,--preset slow --no-cutree --analysis-save x265_analysis.dat --rd 5 --analysis-reuse-level 10 --bitrate 9000::--preset slow --no-cutree --analysis-load x265_analysis.dat --rd 5 --analysis-reuse-level 10 --bitrate 9000<br>
+News-4k.y4m,--preset ultrafast --no-cutree --analysis-save x265_analysis.dat --analysis-reuse-level 2 --bitrate 15000::--preset ultrafast --no-cutree --analysis-load x265_analysis.dat --analysis-reuse-level 2 --bitrate 15000<br>
News-4k.y4m,--preset superfast --lookahead-slices 6 --aq-mode 0<br>
News-4k.y4m,--preset superfast --slices 4 --aq-mode 0<br>
News-4k.y4m,--preset medium --tune ssim --no-sao --qg-size 16<br>
@@ -125,7 +125,7 @@<br>
old_town_cross_444_720p50.y4m,<wbr>--preset superfast --weightp --min-cu 16 --limit-modes<br>
old_town_cross_444_720p50.y4m,<wbr>--preset veryfast --qp 1 --tune ssim<br>
old_town_cross_444_720p50.y4m,<wbr>--preset faster --rd 1 --tune zero-latency<br>
-old_town_cross_444_720p50.<wbr>y4m,--preset fast --no-cutree --analysis-reuse-mode=save --analysis-reuse-level 1 --bitrate 3000 --early-skip::--preset fast --no-cutree --analysis-reuse-mode=load --analysis-reuse-level 1 --bitrate 3000 --early-skip<br>
+old_town_cross_444_720p50.<wbr>y4m,--preset fast --no-cutree --analysis-save pass1_analysis.dat --analysis-reuse-level 1 --bitrate 3000 --early-skip::--preset fast --no-cutree --analysis-load pass1_analysis.dat --analysis-save pass2_analysis.dat --analysis-reuse-level 1 --bitrate 3000 --early-skip::--preset fast --no-cutree --analysis-load pass2_analysis.dat --analysis-reuse-level 1 --bitrate 3000 --early-skip<br>
old_town_cross_444_720p50.y4m,<wbr>--preset medium --keyint -1 --no-weightp --ref 6<br>
old_town_cross_444_720p50.y4m,<wbr>--preset slow --rdoq-level 1 --early-skip --ref 7 --no-b-pyramid<br>
old_town_cross_444_720p50.y4m,<wbr>--preset slower --crf 4 --cu-lossless<br>
@@ -151,6 +151,7 @@<br>
Kimono1_1920x1080_24_400.yuv,-<wbr>-preset veryslow --crf 4 --cu-lossless --slices 2 --limit-refs 3 --limit-modes<br>
Kimono1_1920x1080_24_400.yuv,-<wbr>-preset placebo --ctu 32 --max-tu-size 8 --limit-tu 2<br>
big_buck_bunny_360p24.y4m, --keyint 60 --min-keyint 40 --gop-lookahead 14<br>
+<br>
# Main12 intraCost overflow bug test<br>
720p50_parkrun_ter.y4m,--<wbr>preset medium<br>
<br>
diff -r 37f6c378ac90 -r a3334a263d26 source/x265.cpp<br>
--- a/source/x265.cpp Thu Dec 14 16:53:44 2017 +0530<br>
+++ b/source/x265.cpp Thu Dec 21 15:26:55 2017 +0530<br>
@@ -585,9 +585,9 @@<br>
<br>
x265_picture pic_orig, pic_out;<br>
x265_picture *pic_in = &pic_orig;<br>
- /* Allocate recon picture if analysisReuseMode is enabled */<br>
+ /* Allocate recon picture if analysis save/load is enabled */<br>
std::priority_queue<int64_t>* pts_queue = cliopt.output->needPTS() ? new std::priority_queue<int64_t>() : NULL;<br>
- x265_picture *pic_recon = (cliopt.recon || !!param->analysisReuseMode || pts_queue || reconPlay || param->csvLogLevel) ? &pic_out : NULL;<br>
+ x265_picture *pic_recon = (cliopt.recon || param->analysisSave || param->analysisLoad || pts_queue || reconPlay || param->csvLogLevel) ? &pic_out : NULL;<br>
uint32_t inFrameCount = 0;<br>
uint32_t outFrameCount = 0;<br>
x265_nal *p_nal;<br>
diff -r 37f6c378ac90 -r a3334a263d26 source/x265.h<br>
--- a/source/x265.h Thu Dec 14 16:53:44 2017 +0530<br>
+++ b/source/x265.h Thu Dec 21 15:26:55 2017 +0530<br>
@@ -327,15 +327,15 @@<br>
* to allow the encoder to determine base QP */<br>
int forceqp;<br>
<br>
- /* If param.analysisReuseMode is X265_ANALYSIS_OFF this field is ignored on input<br>
- * and output. Else the user must call x265_alloc_analysis_data() to<br>
- * allocate analysis buffers for every picture passed to the encoder.<br>
+ /* If param.analysisLoad and param.analysisSave are disabled, this field is<br>
+ * ignored on input and output. Else the user must call x265_alloc_analysis_data()<br>
+ * to allocate analysis buffers for every picture passed to the encoder.<br>
*<br>
- * On input when param.analysisReuseMode is X265_ANALYSIS_LOAD and analysisData<br>
+ * On input when param.analysisLoad is enabled and analysisData<br>
* member pointers are valid, the encoder will use the data stored here to<br>
* reduce encoder work.<br>
*<br>
- * On output when param.analysisReuseMode is X265_ANALYSIS_SAVE and analysisData<br>
+ * On output when param.analysisSave is enabled and analysisData<br>
* member pointers are valid, the encoder will write output analysis into<br>
* this data structure */<br>
x265_analysis_data analysisData;<br>
@@ -484,11 +484,6 @@<br>
<br>
#define X265_EXTENDED_SAR 255 /* aspect ratio explicitly specified as width:height */<br>
<br>
-/* Analysis options */<br>
-#define X265_ANALYSIS_OFF 0<br>
-#define X265_ANALYSIS_SAVE 1<br>
-#define X265_ANALYSIS_LOAD 2<br>
-<br>
typedef struct x265_cli_csp<br>
{<br>
int planes;<br>
@@ -1129,13 +1124,13 @@<br>
* Default disabled */<br>
int bEnableRdRefine;<br>
<br>
- /* If X265_ANALYSIS_SAVE, write per-frame analysis information into analysis<br>
- * buffers. if X265_ANALYSIS_LOAD, read analysis information into analysis<br>
- * buffer and use this analysis information to reduce the amount of work<br>
- * the encoder must perform. Default X265_ANALYSIS_OFF */<br>
+ /* If save, write per-frame analysis information into analysis buffers.<br>
+ * If load, read analysis information into analysis buffer and use this<br>
+ * analysis information to reduce the amount of work the encoder must perform.<br>
+ * Default disabled. Now deprecated*/<br>
int analysisReuseMode;<br>
<br>
- /* Filename for analysisReuseMode save/load. Default name is "x265_analysis.dat" */<br>
+ /* Filename for multi-pass-opt-analysis/<wbr>distortion. Default name is "x265_analysis.dat" */<br>
const char* analysisReuseFileName;<br>
<br>
/*== Rate Control ==*/<br>
@@ -1455,7 +1450,7 @@<br>
int bHDROpt;<br>
<br>
/* A value between 1 and 10 (both inclusive) determines the level of<br>
- * information stored/reused in save/load analysis-reuse-mode. Higher the refine<br>
+ * information stored/reused in analysis save/load. Higher the refine<br>
* level higher the information stored/reused. Default is 5 */<br>
int analysisReuseLevel;<br>
<br>
@@ -1539,7 +1534,16 @@<br>
* within this from the gop boundary set by keyint, the GOP will be extented until such a point,<br>
* otherwise the GOP will be terminated as set by keyint*/<br>
int gopLookahead;<br>
+<br>
+ /*Write per-frame analysis information into analysis buffers. Default disabled. */<br>
+ const char* analysisSave;<br>
+<br>
+ /* Read analysis information into analysis buffer and use this analysis information<br>
+ * to reduce the amount of work the encoder must perform. Default disabled. */<br>
+ const char* analysisLoad;<br>
+<br>
} x265_param;<br>
+<br>
/* x265_param_alloc:<br>
* Allocates an x265_param instance. The returned param structure is not<br>
* special in any way, but using this method together with x265_param_free()<br>
diff -r 37f6c378ac90 -r a3334a263d26 source/x265cli.h<br>
--- a/source/x265cli.h Thu Dec 14 16:53:44 2017 +0530<br>
+++ b/source/x265cli.h Thu Dec 21 15:26:55 2017 +0530<br>
@@ -254,9 +254,11 @@<br>
{ "no-slow-firstpass", no_argument, NULL, 0 },<br>
{ "multi-pass-opt-rps", no_argument, NULL, 0 },<br>
{ "no-multi-pass-opt-rps", no_argument, NULL, 0 },<br>
- { "analysis-reuse-mode", required_argument, NULL, 0 },<br>
- { "analysis-reuse-file", required_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-save", required_argument, NULL, 0 },<br>
+ { "analysis-load", required_argument, NULL, 0 },<br>
{ "scale-factor", required_argument, NULL, 0 },<br>
{ "refine-intra", required_argument, NULL, 0 },<br>
{ "refine-inter", required_argument, NULL, 0 },<br>
@@ -465,18 +467,19 @@<br>
H0(" --[no-]analyze-src-pics Motion estimation uses source frame planes. Default disable\n");<br>
H0(" --[no-]slow-firstpass Enable a slow first pass in a multipass rate control mode. Default %s\n", OPT(param->rc.<wbr>bEnableSlowFirstPass));<br>
H0(" --[no-]strict-cbr Enable stricter conditions and tolerance for bitrate deviations in CBR mode. Default %s\n", OPT(param->rc.bStrictCbr));<br>
- H0(" --analysis-reuse-mode <string|int> save - Dump analysis info into file, load - Load analysis buffers from the file. Default %d\n", param->analysisReuseMode);<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(" --refine-mv-type <string> Reuse MV information received through API call. Supported option is avc. Default disabled - %d\n", param->bMVType);<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..3> Enable intra refinement for encode that uses analysis-reuse-mode=load.\n"<br>
+ H0(" --refine-intra <0..3> Enable intra refinement for encode that uses analysis-load.\n"<br>
" - 0 : Forces both mode and depth from the save encode.\n"<br>
" - 1 : Functionality of (0) + evaluate all intra modes at min-cu-size's depth when current depth is one smaller than min-cu-size's depth.\n"<br>
" - 2 : Functionality of (1) + irrespective of size evaluate all angular modes when the save encode decides the best mode as angular.\n"<br>
" - 3 : Functionality of (1) + irrespective of size evaluate all intra modes.\n"<br>
" Default:%d\n", param->intraRefine);<br>
- H0(" --refine-inter <0..3> Enable inter refinement for encode that uses analysis-reuse-mode=load.\n"<br>
+ H0(" --refine-inter <0..3> Enable inter refinement for encode that uses analysis-load.\n"<br>
" - 0 : Forces both mode and depth from the save encode.\n"<br>
" - 1 : Functionality of (0) + evaluate all inter modes at min-cu-size's depth when current depth is one smaller than\n"<br>
" min-cu-size's depth. When save encode decides the current block as skip(for all sizes) evaluate skip/merge.\n"<br>
<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>
<br></blockquote></div><br></div><div class="gmail_extra">Pushed. </div></div>