<div dir="ltr">please ignore this patch. Will resend with few corrections.<div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 6, 2017 at 2:05 PM, <span dir="ltr"><<a href="mailto:santhoshini@multicorewareinc.com" target="_blank">santhoshini@multicorewareinc.<wbr>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 Santhoshini Sekar <<a href="mailto:santhoshini@multicorewareinc.com" target="_blank">santhoshini@multicorewareinc.<wbr>com</a>><br>
# Date 1509956542 -19800<br>
# Mon Nov 06 13:52:22 2017 +0530<br>
# Node ID 54bd61979fc47ee50d61a0f568b0d0<wbr>6efc7b6e2c<br>
# Parent 2508de5ad27440f650a6ba68a42feb<wbr>c273a2cd17<br>
add new CLI refine-mv-type<br>
<br>
diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst<br>
--- a/doc/reST/cli.rst<br>
+++ b/doc/reST/cli.rst<br>
@@ -887,6 +887,11 @@<br>
| 10 | Level 5 + Full CU analysis-info |<br>
+--------+--------------------<wbr>---------------------+<br>
<br>
+.. option:: --refine-mv-type <string><br>
+<br>
+ Reuse MV information received through API call. Currently receives information for AVC size and the accepted<br>
+ string input is "avc". Default is disabled.<br>
+<br>
.. option:: --scale-factor<br>
<br>
Factor by which input video is scaled down for analysis save mode.<br>
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt<br>
--- a/source/CMakeLists.txt<br>
+++ b/source/CMakeLists.txt<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 139)<br>
+set(X265_BUILD 140)<br>
configure_file("${PROJECT_SOU<wbr>RCE_DIR}/<a href="http://x265.def.in" rel="noreferrer" target="_blank">x265.def.in</a>"<br>
"${PROJECT_BINARY_DIR}/<a href="http://x265.de">x265.de</a><wbr>f")<br>
configure_file("${PROJECT_SOU<wbr>RCE_DIR}/<a href="http://x265_config.h.in" rel="noreferrer" target="_blank">x265_config.h.in</a>"<br>
diff --git a/source/common/param.cpp b/source/common/param.cpp<br>
--- a/source/common/param.cpp<br>
+++ b/source/common/param.cpp<br>
@@ -1458,6 +1458,8 @@<br>
TOOLVAL(param->lookaheadSlice<wbr>s, "lslices=%d");<br>
TOOLVAL(param->lookaheadThrea<wbr>ds, "lthreads=%d")<br>
TOOLVAL(param->bCTUInfo, "ctu-info=%d");<br>
+ if (param->bMVType == AVC_INFO)<br>
+ TOOLOPT(param->bMVType, "refine-mv-type=avc");<br>
if (param->maxSlices > 1)<br>
TOOLVAL(param->maxSlices, "slices=%d");<br>
if (param->bEnableLoopFilter)<br>
diff --git a/source/encoder/analysis.cpp b/source/encoder/analysis.cpp<br>
--- a/source/encoder/analysis.cpp<br>
+++ b/source/encoder/analysis.cpp<br>
@@ -250,14 +250,14 @@<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)<br>
+ else if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->analysisReuseLevel == 10) || ((m_param->bMVType == AVC_INFO) && m_param->analysisReuseLevel >= 7))<br>
{<br>
analysis_inter_data* interDataCTU = (analysis_inter_data*)m_frame-<wbr>>m_analysisData.interData;<br>
int posCTU = ctu.m_cuAddr * numPartition;<br>
memcpy(ctu.m_cuDepth, &interDataCTU->depth[posCTU], sizeof(uint8_t) * numPartition);<br>
memcpy(ctu.m_predMode, &interDataCTU->modes[posCTU], sizeof(uint8_t) * numPartition);<br>
memcpy(ctu.m_partSize, &interDataCTU->partSize[posCTU<wbr>], sizeof(uint8_t) * numPartition);<br>
- if (m_slice->m_sliceType == P_SLICE || m_param->bIntraInBFrames)<br>
+ if ((m_slice->m_sliceType == P_SLICE || m_param->bIntraInBFrames) && !(m_param->bMVType == AVC_INFO))<br>
{<br>
analysis_intra_data* intraDataCTU = (analysis_intra_data*)m_frame-<wbr>>m_analysisData.intraData;<br>
memcpy(ctu.m_lumaIntraDir, &intraDataCTU->modes[posCTU], sizeof(uint8_t) * numPartition);<br>
@@ -1227,7 +1227,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->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10))<br>
{<br>
if (mightNotSplit && depth == m_reuseDepth[cuGeom.absPartIdx<wbr>])<br>
{<br>
diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp<br>
--- a/source/encoder/api.cpp<br>
+++ b/source/encoder/api.cpp<br>
@@ -380,7 +380,7 @@<br>
pic->userSEI.payloads = NULL;<br>
pic->userSEI.numPayloads = 0;<br>
<br>
- if (param->analysisReuseMode)<br>
+ if (param->analysisReuseMode || (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 --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp<br>
+++ b/source/encoder/encoder.cpp<br>
@@ -1015,7 +1015,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)<br>
+ if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD || ((m_param->bMVType == AVC_INFO) && slice->m_sliceType != I_SLICE))<br>
freeAnalysis(&outFrame->m_ana<wbr>lysisData);<br>
<br>
if (pic_out)<br>
@@ -2937,7 +2937,8 @@<br>
{<br>
int numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2;<br>
uint32_t numPlanes = m_param->internalCsp == X265_CSP_I400 ? 1 : 3;<br>
- CHECKED_MALLOC_ZERO(analysis-><wbr>wt, WeightParam, numPlanes * numDir);<br>
+ if (!(m_param->bMVType == AVC_INFO))<br>
+ CHECKED_MALLOC_ZERO(analysis-><wbr>wt, WeightParam, numPlanes * numDir);<br>
if (m_param->analysisReuseLevel < 2)<br>
return;<br>
<br>
@@ -2993,7 +2994,7 @@<br>
X265_FREE(analysis-><wbr>lookahead.intraVbvCost);<br>
}<br>
/* Early exit freeing weights alone if level is 1 (when there is no analysis inter/intra) */<br>
- if (analysis->sliceType > X265_TYPE_I && analysis->wt)<br>
+ if (analysis->sliceType > X265_TYPE_I && analysis->wt && !(m_param->bMVType == AVC_INFO))<br>
X265_FREE(analysis->wt);<br>
if (m_param->analysisReuseLevel < 2)<br>
return;<br>
diff --git a/source/encoder/search.cpp b/source/encoder/search.cpp<br>
--- a/source/encoder/search.cpp<br>
+++ b/source/encoder/search.cpp<br>
@@ -2162,7 +2162,7 @@<br>
<br>
/* Uni-directional prediction */<br>
if ((m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)<br>
- || (m_param->analysisMultiPassRef<wbr>ine && m_param->rc.bStatRead))<br>
+ || (m_param->analysisMultiPassRef<wbr>ine && m_param->rc.bStatRead) || (m_param->bMVType == AVC_INFO))<br>
{<br>
for (int list = 0; list < numPredDir; list++)<br>
{<br>
diff --git a/source/x265.h b/source/x265.h<br>
--- a/source/x265.h<br>
+++ b/source/x265.h<br>
@@ -223,6 +223,11 @@<br>
CTU_INFO_CHANGE = 2,<br>
}CTUInfo;<br>
<br>
+typedef enum<br>
+{<br>
+ NO_INFO = 0,<br>
+ AVC_INFO = 1,<br>
+}MVRefineType;<br>
<br>
/* Arbitrary User SEI<br>
* Payload size is in bytes and the payload pointer must be non-NULL.<br>
@@ -1514,6 +1519,9 @@<br>
* This DCT approximation is less computational intensive and gives results close to<br>
* standard DCT for QP >= 23 */<br>
int bLowPassDct;<br>
+<br>
+ /* Reuse MV information obtained through API */<br>
+ int bMVType;<br>
} x265_param;<br>
<br>
/* x265_param_alloc:<br>
diff --git a/source/x265cli.h b/source/x265cli.h<br>
--- a/source/x265cli.h<br>
+++ b/source/x265cli.h<br>
@@ -283,6 +283,7 @@<br>
{ "splitrd-skip", no_argument, NULL, 0 },<br>
{ "no-splitrd-skip", no_argument, NULL, 0 },<br>
{ "lowpass-dct", no_argument, NULL, 0 },<br>
+ { "refine-mv-type", required_argument, NULL, 0 },<br>
{ 0, 0, 0, 0 },<br>
{ 0, 0, 0, 0 },<br>
{ 0, 0, 0, 0 },<br>
</blockquote></div><br></div></div>