Re: [x265] [PATCH 2 of 4] add new CLI refine-mv-type

2017-11-08 Thread Santhoshini Sekar
Thanks for pointing this out. I'll make the change.



On Wed, Nov 8, 2017 at 3:17 PM, Mario *LigH* Rohkrämer 
wrote:

> A CLI help line is yet missing, even in full output level.
>
> --
>
> Fun and success!
> Mario *LigH* Rohkrämer
> mailto:cont...@ligh.de
>
> ___
> x265-devel mailing list
> x265-devel@videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH 2 of 4] add new CLI refine-mv-type

2017-11-08 Thread Mario *LigH* Rohkrämer

A CLI help line is yet missing, even in full output level.

--

Fun and success!
Mario *LigH* Rohkrämer
mailto:cont...@ligh.de

___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH 2 of 4] add new CLI refine-mv-type

2017-11-06 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar 
# 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 
+
+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], 
s

Re: [x265] [PATCH 2 of 4] add new CLI refine-mv-type

2017-11-06 Thread Santhoshini Sekar
please ignore this patch. Will resend with few corrections.

On Mon, Nov 6, 2017 at 2:05 PM,  wrote:

> # HG changeset patch
> # User Santhoshini Sekar 
> # Date 1509956542 -19800
> #  Mon Nov 06 13:52:22 2017 +0530
> # Node ID 54bd61979fc47ee50d61a0f568b0d06efc7b6e2c
> # Parent  2508de5ad27440f650a6ba68a42febc273a2cd17
> 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 
> +
> +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 139)
> +set(X265_BUILD 140)
>  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/param.cpp b/source/common/param.cpp
> --- a/source/common/param.cpp
> +++ b/source/common/param.cpp
> @@ -1458,6 +1458,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)
> 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_

[x265] [PATCH 2 of 4] add new CLI refine-mv-type

2017-11-06 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar 
# Date 1509956542 -19800
#  Mon Nov 06 13:52:22 2017 +0530
# Node ID 54bd61979fc47ee50d61a0f568b0d06efc7b6e2c
# Parent  2508de5ad27440f650a6ba68a42febc273a2cd17
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 
+
+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 139)
+set(X265_BUILD 140)
 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/param.cpp b/source/common/param.cpp
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -1458,6 +1458,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)
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 == AVC_INFO) && 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