[x265] [PATCH 2 of 4] add new CLI refine-mv-type
santhoshini at multicorewareinc.com
santhoshini at multicorewareinc.com
Tue Nov 7 07:52:39 CET 2017
# HG changeset patch
# User Santhoshini Sekar <santhoshini at multicorewareinc.com>
# Date 1509956542 -19800
# Mon Nov 06 13:52:22 2017 +0530
# Node ID 429abad792be670195e22782b772eea814100f61
# Parent dea515c3180ab2e45c1682bd258683fdf2f16ae6
add new CLI refine-mv-type
diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst
--- a/doc/reST/cli.rst
+++ b/doc/reST/cli.rst
@@ -887,6 +887,11 @@
| 10 | Level 5 + Full CU analysis-info |
+--------+-----------------------------------------+
+.. option:: --refine-mv-type <string>
+
+ Reuse MV information received through API call. Currently receives information for AVC size and the accepted
+ string input is "avc". Default is disabled.
+
.. option:: --scale-factor
Factor by which input video is scaled down for analysis save mode.
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -29,7 +29,7 @@
option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
# X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 140)
+set(X265_BUILD 141)
configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff --git a/source/common/frame.cpp b/source/common/frame.cpp
--- a/source/common/frame.cpp
+++ b/source/common/frame.cpp
@@ -77,6 +77,14 @@
}
}
+ if (param->bMVType == AVC_INFO)
+ {
+ m_analysisData.wt = NULL;
+ m_analysisData.intraData = NULL;
+ m_analysisData.interData = NULL;
+ m_analysis2Pass.analysisFramedata = NULL;
+ }
+
if (m_fencPic->create(param) && m_lowres.create(m_fencPic, param->bframes, !!param->rc.aqMode || !!param->bAQMotion, param->rc.qgSize))
{
X265_CHECK((m_reconColCount == NULL), "m_reconColCount was initialized");
diff --git a/source/common/param.cpp b/source/common/param.cpp
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -293,6 +293,7 @@
/* DCT Approximations */
param->bLowPassDct = 0;
+ param->bMVType = 0;
}
int x265_param_default_preset(x265_param* param, const char* preset, const char* tune)
@@ -986,6 +987,21 @@
OPT("lowpass-dct") p->bLowPassDct = atobool(value);
OPT("vbv-end") p->vbvBufferEnd = atof(value);
OPT("vbv-end-fr-adj") p->vbvEndFrameAdjust = atof(value);
+ OPT("refine-mv-type")
+ {
+ if (strcmp(strdup(value), "avc") == 0)
+ {
+ p->bMVType = AVC_INFO;
+ }
+ else if (strcmp(strdup(value), "off") == 0)
+ {
+ p->bMVType = NO_INFO;
+ }
+ else
+ {
+ bError = true;
+ }
+ }
else
return X265_PARAM_BAD_NAME;
}
@@ -1474,6 +1490,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->maxSlices > 1)
TOOLVAL(param->maxSlices, "slices=%d");
if (param->bEnableLoopFilter)
@@ -1699,6 +1717,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);
#undef BOOL
return buf;
}
diff --git a/source/encoder/analysis.cpp b/source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp
+++ b/source/encoder/analysis.cpp
@@ -250,14 +250,14 @@
/* generate residual for entire CTU at once and copy to reconPic */
encodeResidue(ctu, cuGeom);
}
- else if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->analysisReuseLevel == 10)
+ else if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->analysisReuseLevel == 10) || ((m_param->bMVType == AVC_INFO) && m_param->analysisReuseLevel >= 7))
{
analysis_inter_data* interDataCTU = (analysis_inter_data*)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)
+ if ((m_slice->m_sliceType == P_SLICE || m_param->bIntraInBFrames) && !(m_param->bMVType == AVC_INFO))
{
analysis_intra_data* intraDataCTU = (analysis_intra_data*)m_frame->m_analysisData.intraData;
memcpy(ctu.m_lumaIntraDir, &intraDataCTU->modes[posCTU], sizeof(uint8_t) * numPartition);
@@ -1227,7 +1227,7 @@
mightSplit &= !bDecidedDepth;
}
}
- if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)
+ if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10))
{
if (mightNotSplit && depth == m_reuseDepth[cuGeom.absPartIdx])
{
diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp
--- a/source/encoder/api.cpp
+++ b/source/encoder/api.cpp
@@ -380,7 +380,7 @@
pic->userSEI.payloads = NULL;
pic->userSEI.numPayloads = 0;
- if (param->analysisReuseMode)
+ if (param->analysisReuseMode || (param->bMVType == AVC_INFO))
{
uint32_t widthInCU = (param->sourceWidth + param->maxCUSize - 1) >> param->maxLog2CUSize;
uint32_t heightInCU = (param->sourceHeight + param->maxCUSize - 1) >> param->maxLog2CUSize;
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -1015,7 +1015,7 @@
x265_frame_stats* frameData = NULL;
/* Free up pic_in->analysisData since it has already been used */
- if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD)
+ if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD || (m_param->bMVType && slice->m_sliceType != I_SLICE))
freeAnalysis(&outFrame->m_analysisData);
if (pic_out)
@@ -2937,7 +2937,8 @@
{
int numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2;
uint32_t numPlanes = m_param->internalCsp == X265_CSP_I400 ? 1 : 3;
- CHECKED_MALLOC_ZERO(analysis->wt, WeightParam, numPlanes * numDir);
+ if (!(m_param->bMVType == AVC_INFO))
+ CHECKED_MALLOC_ZERO(analysis->wt, WeightParam, numPlanes * numDir);
if (m_param->analysisReuseLevel < 2)
return;
@@ -2993,7 +2994,7 @@
X265_FREE(analysis->lookahead.intraVbvCost);
}
/* Early exit freeing weights alone if level is 1 (when there is no analysis inter/intra) */
- if (analysis->sliceType > X265_TYPE_I && analysis->wt)
+ if (analysis->sliceType > X265_TYPE_I && analysis->wt && !(m_param->bMVType == AVC_INFO))
X265_FREE(analysis->wt);
if (m_param->analysisReuseLevel < 2)
return;
diff --git a/source/encoder/search.cpp b/source/encoder/search.cpp
--- a/source/encoder/search.cpp
+++ b/source/encoder/search.cpp
@@ -2162,7 +2162,7 @@
/* Uni-directional prediction */
if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)
- || (m_param->analysisMultiPassRefine && m_param->rc.bStatRead))
+ || (m_param->analysisMultiPassRefine && m_param->rc.bStatRead) || (m_param->bMVType == AVC_INFO))
{
for (int list = 0; list < numPredDir; list++)
{
diff --git a/source/x265.h b/source/x265.h
--- a/source/x265.h
+++ b/source/x265.h
@@ -223,6 +223,11 @@
CTU_INFO_CHANGE = 2,
}CTUInfo;
+typedef enum
+{
+ NO_INFO = 0,
+ AVC_INFO = 1,
+}MVRefineType;
/* Arbitrary User SEI
* Payload size is in bytes and the payload pointer must be non-NULL.
@@ -1524,6 +1529,9 @@
/* Frame from which qp has to be adjusted to hit final decode buffer emptiness.
* Specified as a fraction of the total frames. Default 0 */
double vbvEndFrameAdjust;
+
+ /* Reuse MV information obtained through API */
+ int bMVType;
} x265_param;
/* x265_param_alloc:
diff --git a/source/x265cli.h b/source/x265cli.h
--- a/source/x265cli.h
+++ b/source/x265cli.h
@@ -285,6 +285,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 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265-2.patch
Type: text/x-patch
Size: 9065 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20171107/8b35f5db/attachment.bin>
More information about the x265-devel
mailing list