[x265] [PATCH 2 of 4] add new CLI refine-mv-type
Santhoshini Sekar
santhoshini at multicorewareinc.com
Mon Nov 6 10:37:24 CET 2017
please ignore this patch. Will resend with few corrections.
On Mon, Nov 6, 2017 at 2:05 PM, <santhoshini at multicorewareinc.com> wrote:
> # HG changeset patch
> # User Santhoshini Sekar <santhoshini at multicorewareinc.com>
> # 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 <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 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 == 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.
> @@ -1514,6 +1519,9 @@
> * This DCT approximation is less computational intensive and gives
> results close to
> * standard DCT for QP >= 23 */
> int bLowPassDct;
> +
> + /* 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
> @@ -283,6 +283,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 --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20171106/de8b0553/attachment-0001.html>
More information about the x265-devel
mailing list