# HG changeset patch # User Santhoshini Sekar <santhosh...@multicorewareinc.com> # Date 1509956542 -19800 # Mon Nov 06 13:52:22 2017 +0530 # Node ID e6ad0fc2639ae0fb6579e8b3e480c43f2464f9d8 # 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 @@ -291,6 +291,7 @@ /* DCT Approximations */ param->bLowPassDct = 0; + param->bMVType = 0; } int x265_param_default_preset(x265_param* param, const char* preset, const char* tune) @@ -981,7 +982,22 @@ OPT("refine-mv")p->mvRefine = atobool(value); OPT("force-flush")p->forceFlush = atoi(value); OPT("splitrd-skip") p->bEnableSplitRdSkip = atobool(value); - OPT("lowpass-dct") p->bLowPassDct = atobool(value); + OPT("lowpass-dct") p->bLowPassDct = atobool(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; } @@ -1458,6 +1474,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) @@ -1681,6 +1699,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 @@ -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 },
# HG changeset patch # User Santhoshini Sekar <santhosh...@multicorewareinc.com> # Date 1509956542 -19800 # Mon Nov 06 13:52:22 2017 +0530 # Node ID e6ad0fc2639ae0fb6579e8b3e480c43f2464f9d8 # 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 @@ -291,6 +291,7 @@ /* DCT Approximations */ param->bLowPassDct = 0; + param->bMVType = 0; } int x265_param_default_preset(x265_param* param, const char* preset, const char* tune) @@ -981,7 +982,22 @@ OPT("refine-mv")p->mvRefine = atobool(value); OPT("force-flush")p->forceFlush = atoi(value); OPT("splitrd-skip") p->bEnableSplitRdSkip = atobool(value); - OPT("lowpass-dct") p->bLowPassDct = atobool(value); + OPT("lowpass-dct") p->bLowPassDct = atobool(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; } @@ -1458,6 +1474,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) @@ -1681,6 +1699,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 @@ -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 },
_______________________________________________ x265-devel mailing list x265-devel@videolan.org https://mailman.videolan.org/listinfo/x265-devel