[x265] [PATCH 1 of 2] Rename refine-mv-type to accommodate reuse of CU depth functionality
jayashri at multicorewareinc.com
jayashri at multicorewareinc.com
Fri Dec 28 10:17:27 CET 2018
# HG changeset patch
# User Jayashri Murugan
# Date 1537392648 25200
# Wed Sep 19 14:30:48 2018 -0700
# Node ID 23a8a7456916d98040b56a09a93ce3b1149613d9
# Parent 3cd0b5ed0b91bcb3d5d6cfa1395cb502fc6d01ca
Rename refine-mv-type to accommodate reuse of CU depth functionality
diff -r 3cd0b5ed0b91 -r 23a8a7456916 source/common/frame.cpp
--- a/source/common/frame.cpp Thu Dec 27 14:43:54 2018 +0530
+++ b/source/common/frame.cpp Wed Sep 19 14:30:48 2018 -0700
@@ -80,7 +80,7 @@
}
}
- if (param->bMVType == AVC_INFO)
+ if (param->bAnalysisType == AVC_INFO)
{
m_analysisData.wt = NULL;
m_analysisData.intraData = NULL;
diff -r 3cd0b5ed0b91 -r 23a8a7456916 source/common/param.cpp
--- a/source/common/param.cpp Thu Dec 27 14:43:54 2018 +0530
+++ b/source/common/param.cpp Wed Sep 19 14:30:48 2018 -0700
@@ -311,7 +311,7 @@
/* DCT Approximations */
param->bLowPassDct = 0;
- param->bMVType = 0;
+ param->bAnalysisType = 0;
param->bSingleSeiNal = 0;
/* SEI messages */
@@ -1151,15 +1151,15 @@
OPT("vbv-end") p->vbvBufferEnd = atof(value);
OPT("vbv-end-fr-adj") p->vbvEndFrameAdjust = atof(value);
OPT("copy-pic") p->bCopyPicToFrame = atobool(value);
- OPT("refine-mv-type")
+ OPT("refine-analysis-type")
{
if (strcmp(strdup(value), "avc") == 0)
{
- p->bMVType = AVC_INFO;
+ p->bAnalysisType = AVC_INFO;
}
else if (strcmp(strdup(value), "off") == 0)
{
- p->bMVType = NO_INFO;
+ p->bAnalysisType = NO_INFO;
}
else
{
@@ -1713,8 +1713,8 @@
TOOLVAL(param->lookaheadSlices, "lslices=%d");
TOOLVAL(param->lookaheadThreads, "lthreads=%d")
TOOLVAL(param->bCTUInfo, "ctu-info=%d");
- if (param->bMVType == AVC_INFO)
- TOOLOPT(param->bMVType, "refine-mv-type=avc");
+ if (param->bAnalysisType == AVC_INFO)
+ TOOLOPT(param->bAnalysisType, "refine-analysis-type=avc");
TOOLOPT(param->bDynamicRefine, "dynamic-refine");
if (param->maxSlices > 1)
TOOLVAL(param->maxSlices, "slices=%d");
@@ -1958,7 +1958,7 @@
BOOL(p->bLimitSAO, "limit-sao");
s += sprintf(s, " ctu-info=%d", p->bCTUInfo);
BOOL(p->bLowPassDct, "lowpass-dct");
- s += sprintf(s, " refine-mv-type=%d", p->bMVType);
+ s += sprintf(s, " refine-analysis-type=%d", p->bAnalysisType);
s += sprintf(s, " copy-pic=%d", p->bCopyPicToFrame);
s += sprintf(s, " max-ausize-factor=%.1f", p->maxAUSizeFactor);
BOOL(p->bDynamicRefine, "dynamic-refine");
diff -r 3cd0b5ed0b91 -r 23a8a7456916 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp Thu Dec 27 14:43:54 2018 +0530
+++ b/source/encoder/analysis.cpp Wed Sep 19 14:30:48 2018 -0700
@@ -234,9 +234,9 @@
}
else
{
- bool bCopyAnalysis = ((m_param->analysisLoad && m_param->analysisReuseLevel == 10) || (m_param->bMVType && m_param->analysisReuseLevel >= 7 && ctu.m_numPartitions <= 16));
- bool BCompressInterCUrd0_4 = (m_param->bMVType && m_param->analysisReuseLevel >= 7 && m_param->rdLevel <= 4);
- bool BCompressInterCUrd5_6 = (m_param->bMVType && m_param->analysisReuseLevel >= 7 && m_param->rdLevel >= 5 && m_param->rdLevel <= 6);
+ bool bCopyAnalysis = ((m_param->analysisLoad && m_param->analysisReuseLevel == 10) || (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel >= 7 && ctu.m_numPartitions <= 16));
+ bool BCompressInterCUrd0_4 = (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel >= 7 && m_param->rdLevel <= 4);
+ bool BCompressInterCUrd5_6 = (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel >= 7 && m_param->rdLevel >= 5 && m_param->rdLevel <= 6);
bCopyAnalysis = bCopyAnalysis || BCompressInterCUrd0_4 || BCompressInterCUrd5_6;
if (bCopyAnalysis)
@@ -249,7 +249,7 @@
for (int list = 0; list < m_slice->isInterB() + 1; list++)
memcpy(ctu.m_skipFlag[list], &m_frame->m_analysisData.modeFlag[list][posCTU], sizeof(uint8_t) * numPartition);
- if ((m_slice->m_sliceType == P_SLICE || m_param->bIntraInBFrames) && !m_param->bMVType)
+ if ((m_slice->m_sliceType == P_SLICE || m_param->bIntraInBFrames) && !(m_param->bAnalysisType == AVC_INFO))
{
x265_analysis_intra_data* intraDataCTU = m_frame->m_analysisData.intraData;
memcpy(ctu.m_lumaIntraDir, &intraDataCTU->modes[posCTU], sizeof(uint8_t) * numPartition);
@@ -275,14 +275,14 @@
/* generate residual for entire CTU at once and copy to reconPic */
encodeResidue(ctu, cuGeom);
}
- else if ((m_param->analysisLoad && m_param->analysisReuseLevel == 10) || ((m_param->bMVType == AVC_INFO) && m_param->analysisReuseLevel >= 7 && ctu.m_numPartitions <= 16))
+ else if ((m_param->analysisLoad && m_param->analysisReuseLevel == 10) || ((m_param->bAnalysisType == AVC_INFO) && m_param->analysisReuseLevel >= 7 && ctu.m_numPartitions <= 16))
{
x265_analysis_inter_data* interDataCTU = m_frame->m_analysisData.interData;
int posCTU = ctu.m_cuAddr * numPartition;
memcpy(ctu.m_cuDepth, &interDataCTU->depth[posCTU], sizeof(uint8_t) * numPartition);
memcpy(ctu.m_predMode, &interDataCTU->modes[posCTU], sizeof(uint8_t) * numPartition);
memcpy(ctu.m_partSize, &interDataCTU->partSize[posCTU], sizeof(uint8_t) * numPartition);
- if ((m_slice->m_sliceType == P_SLICE || m_param->bIntraInBFrames) && !(m_param->bMVType == AVC_INFO))
+ if ((m_slice->m_sliceType == P_SLICE || m_param->bIntraInBFrames) && !(m_param->bAnalysisType == AVC_INFO))
{
x265_analysis_intra_data* intraDataCTU = m_frame->m_analysisData.intraData;
memcpy(ctu.m_lumaIntraDir, &intraDataCTU->modes[posCTU], sizeof(uint8_t) * numPartition);
@@ -1162,9 +1162,9 @@
PicYuv& reconPic = *m_frame->m_reconPic;
SplitData splitCUData;
- bool bHEVCBlockAnalysis = (m_param->bMVType && cuGeom.numPartitions > 16);
+ bool bHEVCBlockAnalysis = (m_param->bAnalysisType == AVC_INFO && cuGeom.numPartitions > 16);
bool bRefineAVCAnalysis = (m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1]));
- bool bNooffloading = !m_param->bMVType;
+ bool bNooffloading = !(m_param->bAnalysisType == AVC_INFO);
if (bHEVCBlockAnalysis || bRefineAVCAnalysis || bNooffloading)
{
@@ -1299,7 +1299,7 @@
}
}
/* Step 1. Evaluate Merge/Skip candidates for likely early-outs, if skip mode was not set above */
- if ((mightNotSplit && depth >= minDepth && !md.bestMode && !bCtuInfoCheck) || (m_param->bMVType && m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1]))) /* TODO: Re-evaluate if analysis load/save still works */
+ 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 */
{
/* Compute Merge Cost */
md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
@@ -1309,7 +1309,7 @@
skipModes = (m_param->bEnableEarlySkip || m_refineLevel == 2)
&& md.bestMode && md.bestMode->cu.isSkipped(0); // TODO: sa8d threshold per depth
}
- if (md.bestMode && m_param->bEnableRecursionSkip && !bCtuInfoCheck && !(m_param->bMVType && m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1])))
+ if (md.bestMode && m_param->bEnableRecursionSkip && !bCtuInfoCheck && !(m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1])))
{
skipRecursion = md.bestMode->cu.isSkipped(0);
if (mightSplit && depth >= minDepth && !skipRecursion)
@@ -1320,7 +1320,7 @@
skipRecursion = complexityCheckCU(*md.bestMode);
}
}
- if (m_param->bMVType && md.bestMode && cuGeom.numPartitions <= 16 && m_param->analysisReuseLevel == 7)
+ if (m_param->bAnalysisType == AVC_INFO && md.bestMode && cuGeom.numPartitions <= 16 && m_param->analysisReuseLevel == 7)
skipRecursion = true;
/* Step 2. Evaluate each of the 4 split sub-blocks in series */
if (mightSplit && !skipRecursion)
@@ -1377,7 +1377,7 @@
splitPred->sa8dCost = m_rdCost.calcRdSADCost((uint32_t)splitPred->distortion, splitPred->sa8dBits);
}
/* If analysis mode is simple do not Evaluate other modes */
- if (m_param->bMVType && m_param->analysisReuseLevel == 7)
+ if (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel == 7)
{
if (m_slice->m_sliceType == P_SLICE)
{
@@ -1794,7 +1794,7 @@
}
else
{
- if (m_param->bMVType && cuGeom.numPartitions <= 16)
+ if (m_param->bAnalysisType == AVC_INFO && cuGeom.numPartitions <= 16)
{
qprdRefine(parentCTU, cuGeom, qp, qp);
@@ -1855,9 +1855,9 @@
SplitData splitCUData;
- bool bHEVCBlockAnalysis = (m_param->bMVType && cuGeom.numPartitions > 16);
+ bool bHEVCBlockAnalysis = (m_param->bAnalysisType == AVC_INFO && cuGeom.numPartitions > 16);
bool bRefineAVCAnalysis = (m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1]));
- bool bNooffloading = !m_param->bMVType;
+ bool bNooffloading = !(m_param->bAnalysisType == AVC_INFO);
if (bHEVCBlockAnalysis || bRefineAVCAnalysis || bNooffloading)
{
@@ -1998,7 +1998,7 @@
}
/* Step 1. Evaluate Merge/Skip candidates for likely early-outs */
if ((mightNotSplit && !md.bestMode && !bCtuInfoCheck) ||
- (m_param->bMVType && m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1])))
+ (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1])))
{
md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);
md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
@@ -2013,7 +2013,7 @@
if (m_param->bEnableRecursionSkip && depth && m_modeDepth[depth - 1].bestMode)
skipRecursion = md.bestMode && !md.bestMode->cu.getQtRootCbf(0);
}
- if (m_param->bMVType && md.bestMode && cuGeom.numPartitions <= 16 && m_param->analysisReuseLevel == 7)
+ if (m_param->bAnalysisType == AVC_INFO && md.bestMode && cuGeom.numPartitions <= 16 && m_param->analysisReuseLevel == 7)
skipRecursion = true;
// estimate split cost
/* Step 2. Evaluate each of the 4 split sub-blocks in series */
@@ -2067,7 +2067,7 @@
checkDQPForSplitPred(*splitPred, cuGeom);
}
/* If analysis mode is simple do not Evaluate other modes */
- if (m_param->bMVType && m_param->analysisReuseLevel == 7)
+ if (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel == 7)
{
if (m_slice->m_sliceType == P_SLICE)
{
@@ -2362,7 +2362,7 @@
}
else
{
- if (m_param->bMVType && cuGeom.numPartitions <= 16)
+ if (m_param->bAnalysisType == AVC_INFO && cuGeom.numPartitions <= 16)
{
qprdRefine(parentCTU, cuGeom, qp, qp);
@@ -2454,7 +2454,7 @@
for (uint32_t part = 0; part < numPU; part++)
{
PredictionUnit pu(mode.cu, cuGeom, part);
- if ((m_param->analysisLoad && m_param->analysisReuseLevel == 10) || (m_param->bMVType == AVC_INFO && m_param->analysisReuseLevel >= 7))
+ if ((m_param->analysisLoad && m_param->analysisReuseLevel == 10) || (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel >= 7))
{
x265_analysis_inter_data* interDataCTU = m_frame->m_analysisData.interData;
int cuIdx = (mode.cu.m_cuAddr * parentCTU.m_numPartitions) + cuGeom.absPartIdx;
@@ -2541,7 +2541,7 @@
checkDQPForSplitPred(*md.bestMode, cuGeom);
}
- if (m_param->bMVType && m_param->analysisReuseLevel == 7)
+ if (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel == 7)
{
for (int list = 0; list < m_slice->isInterB() + 1; list++)
{
diff -r 3cd0b5ed0b91 -r 23a8a7456916 source/encoder/api.cpp
--- a/source/encoder/api.cpp Thu Dec 27 14:43:54 2018 +0530
+++ b/source/encoder/api.cpp Wed Sep 19 14:30:48 2018 -0700
@@ -454,7 +454,7 @@
}
//Allocate memory for weightParam pointer
- if (!(param->bMVType == AVC_INFO))
+ if (!(param->bAnalysisType == AVC_INFO))
CHECKED_MALLOC_ZERO(analysis->wt, x265_weight_param, numPlanes * numDir);
if (param->analysisReuseLevel < 2)
@@ -540,7 +540,7 @@
}
/* Early exit freeing weights alone if level is 1 (when there is no analysis inter/intra) */
- if (analysis->wt && !(param->bMVType == AVC_INFO))
+ if (analysis->wt && !(param->bAnalysisType == AVC_INFO))
X265_FREE(analysis->wt);
if (param->analysisReuseLevel < 2)
@@ -621,7 +621,7 @@
pic->rpu.payloadSize = 0;
pic->rpu.payload = NULL;
- if ((param->analysisSave || param->analysisLoad) || (param->bMVType == AVC_INFO))
+ if ((param->analysisSave || param->analysisLoad) || (param->bAnalysisType == AVC_INFO))
{
uint32_t widthInCU = (param->sourceWidth + param->maxCUSize - 1) >> param->maxLog2CUSize;
uint32_t heightInCU = (param->sourceHeight + param->maxCUSize - 1) >> param->maxLog2CUSize;
diff -r 3cd0b5ed0b91 -r 23a8a7456916 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Thu Dec 27 14:43:54 2018 +0530
+++ b/source/encoder/encoder.cpp Wed Sep 19 14:30:48 2018 -0700
@@ -1253,7 +1253,7 @@
x265_frame_stats* frameData = NULL;
/* Free up pic_in->analysisData since it has already been used */
- if ((m_param->analysisLoad && !m_param->analysisSave) || (m_param->bMVType && slice->m_sliceType != I_SLICE))
+ if ((m_param->analysisLoad && !m_param->analysisSave) || ((m_param->bAnalysisType == AVC_INFO) && slice->m_sliceType != I_SLICE))
x265_free_analysis_data(m_param, &outFrame->m_analysisData);
if (pic_out)
@@ -2710,17 +2710,17 @@
void Encoder::configure(x265_param *p)
{
this->m_param = p;
- if (p->bMVType == AVC_INFO)
+ if (p->bAnalysisType == AVC_INFO)
this->m_externalFlush = true;
else
this->m_externalFlush = false;
- if (p->bMVType == AVC_INFO && (p->limitTU == 3 || p->limitTU == 4))
+ if (p->bAnalysisType == AVC_INFO && (p->limitTU == 3 || p->limitTU == 4))
{
x265_log(p, X265_LOG_WARNING, "limit TU = 3 or 4 with MVType AVCINFO produces inconsistent output\n");
}
- if (p->bMVType == AVC_INFO && p->minCUSize != 8)
+ if (p->bAnalysisType == AVC_INFO && p->minCUSize != 8)
{
p->minCUSize = 8;
x265_log(p, X265_LOG_WARNING, "Setting minCuSize = 8, AVCINFO expects 8x8 blocks\n");
diff -r 3cd0b5ed0b91 -r 23a8a7456916 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp Thu Dec 27 14:43:54 2018 +0530
+++ b/source/encoder/frameencoder.cpp Wed Sep 19 14:30:48 2018 -0700
@@ -335,7 +335,7 @@
while (!m_frame->m_ctuInfo)
m_frame->m_copied.wait();
}
- if ((m_param->bMVType == AVC_INFO) && !m_param->analysisSave && !m_param->analysisLoad && !(IS_X265_TYPE_I(m_frame->m_lowres.sliceType)))
+ if ((m_param->bAnalysisType == AVC_INFO) && !m_param->analysisSave && !m_param->analysisLoad && !(IS_X265_TYPE_I(m_frame->m_lowres.sliceType)))
{
while (((m_frame->m_analysisData.interData == NULL && m_frame->m_analysisData.intraData == NULL) || (uint32_t)m_frame->m_poc != m_frame->m_analysisData.poc))
m_frame->m_copyMVType.wait();
diff -r 3cd0b5ed0b91 -r 23a8a7456916 source/encoder/search.cpp
--- a/source/encoder/search.cpp Thu Dec 27 14:43:54 2018 +0530
+++ b/source/encoder/search.cpp Wed Sep 19 14:30:48 2018 -0700
@@ -2201,7 +2201,7 @@
cu.getNeighbourMV(puIdx, pu.puAbsPartIdx, interMode.interNeighbours);
/* Uni-directional prediction */
if ((m_param->analysisLoad && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)
- || (m_param->analysisMultiPassRefine && m_param->rc.bStatRead) || (m_param->bMVType == AVC_INFO) || (useAsMVP))
+ || (m_param->analysisMultiPassRefine && m_param->rc.bStatRead) || (m_param->bAnalysisType == AVC_INFO) || (useAsMVP))
{
for (int list = 0; list < numPredDir; list++)
{
diff -r 3cd0b5ed0b91 -r 23a8a7456916 source/x265.h
--- a/source/x265.h Thu Dec 27 14:43:54 2018 +0530
+++ b/source/x265.h Wed Sep 19 14:30:48 2018 -0700
@@ -317,7 +317,7 @@
{
NO_INFO = 0,
AVC_INFO = 1,
-}MVRefineType;
+}AnalysisRefineType;
/* Arbitrary User SEI
* Payload size is in bytes and the payload pointer must be non-NULL.
@@ -1701,7 +1701,7 @@
double vbvEndFrameAdjust;
/* Reuse MV information obtained through API */
- int bMVType;
+ int bAnalysisType;
/* Allow the encoder to have a copy of the planes of x265_picture in Frame */
int bCopyPicToFrame;
diff -r 3cd0b5ed0b91 -r 23a8a7456916 source/x265cli.h
--- a/source/x265cli.h Thu Dec 27 14:43:54 2018 +0530
+++ b/source/x265cli.h Wed Sep 19 14:30:48 2018 -0700
@@ -297,7 +297,7 @@
{ "splitrd-skip", no_argument, NULL, 0 },
{ "no-splitrd-skip", no_argument, NULL, 0 },
{ "lowpass-dct", no_argument, NULL, 0 },
- { "refine-mv-type", required_argument, NULL, 0 },
+ { "refine-analysis-type", required_argument, NULL, 0 },
{ "copy-pic", no_argument, NULL, 0 },
{ "no-copy-pic", no_argument, NULL, 0 },
{ "max-ausize-factor", required_argument, NULL, 0 },
@@ -501,7 +501,7 @@
H0(" --analysis-load <filename> Load analysis buffers from the file specified. Default Disabled\n");
H0(" --analysis-reuse-file <filename> Specify file name used for either dumping or reading analysis data. Deault x265_analysis.dat\n");
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);
- H0(" --refine-mv-type <string> Reuse MV information received through API call. Supported option is avc. Default disabled - %d\n", param->bMVType);
+ H0(" --refine-analysis-type <string> Reuse anlaysis information received through API call. Supported options are avc. Default disabled - %d\n", param->bAnalysisType);
H0(" --scale-factor <int> Specify factor by which input video is scaled down for analysis save mode. Default %d\n", param->scaleFactor);
H0(" --refine-intra <0..4> Enable intra refinement for encode that uses analysis-load.\n"
" - 0 : Forces both mode and depth from the save encode.\n"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265-3-1.patch
Type: text/x-patch
Size: 19449 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20181228/2440fbab/attachment-0001.bin>
More information about the x265-devel
mailing list