[x265] [PATCH] clean up EQT feature patch

Aruna Matheswaran aruna at multicorewareinc.com
Mon Mar 2 13:21:32 CET 2020


On Tue, Feb 25, 2020 at 11:28 AM <srikanth.kurapati at multicorewareinc.com>
wrote:

> # HG changeset patch
> # User Srikanth Kurapati
> # Date 1582284738 -19800
> #      Fri Feb 21 17:02:18 2020 +0530
> # Node ID 27ddd2d2ff94273553734e21607f17f72769cc1b
> # Parent  ecf19726600a3218c10eb28dcfded16d2a18c301
> clean up EQT feature patch.
>
> 1. Improves documentation in help and x265readthedocs for rskip cli
> options.
> 2. renames rskip variable in x265_param structure.
>
> diff -r ecf19726600a -r 27ddd2d2ff94 doc/reST/cli.rst
> --- a/doc/reST/cli.rst  Wed Jan 29 12:19:07 2020 +0530
> +++ b/doc/reST/cli.rst  Fri Feb 21 17:02:18 2020 +0530
> @@ -866,7 +866,8 @@
>  .. option:: --rskip-edge-threshold <0..100>
>
>         Denotes the minimum expected edge-density percentage within the
> CU, below which the recursion is skipped.
> -       Default: 5, requires :option:`--rskip mode 2|3` to be enabled.
> +       Default: 5, requires :option:`--rskip mode 2|3` to be enabled.
> This is a integer value representing the
> +       edge percentage within the CU and is internally converted to
> floating point type in x265 param.
>
Please mention the internal scale allowed in x265_param.

>
>  .. option:: --splitrd-skip, --no-splitrd-skip
>
> diff -r ecf19726600a -r 27ddd2d2ff94 source/common/frame.cpp
> --- a/source/common/frame.cpp   Wed Jan 29 12:19:07 2020 +0530
> +++ b/source/common/frame.cpp   Fri Feb 21 17:02:18 2020 +0530
> @@ -117,7 +117,7 @@
>          m_thetaPic = X265_MALLOC(pixel, m_stride * (maxHeight +
> (m_lumaMarginY * 2)));
>      }
>
> -    if (param->enableRecursionSkip >= EDGE_BASED_RSKIP)
> +    if (param->recursionSkipMode >= EDGE_BASED_RSKIP)
>      {
>          uint32_t numCuInWidth = (param->sourceWidth + param->maxCUSize -
> 1) / param->maxCUSize;
>          uint32_t numCuInHeight = (param->sourceHeight + param->maxCUSize
> - 1) / param->maxCUSize;
> @@ -283,7 +283,7 @@
>          X265_FREE(m_thetaPic);
>      }
>
> -    if (m_param->enableRecursionSkip >= EDGE_BASED_RSKIP)
> +    if (m_param->recursionSkipMode >= EDGE_BASED_RSKIP)
>      {
>          X265_FREE_ZERO(m_edgeBitPlane);
>          m_edgeBitPic = NULL;
> diff -r ecf19726600a -r 27ddd2d2ff94 source/common/param.cpp
> --- a/source/common/param.cpp   Wed Jan 29 12:19:07 2020 +0530
> +++ b/source/common/param.cpp   Fri Feb 21 17:02:18 2020 +0530
> @@ -198,7 +198,7 @@
>      param->bEnableWeightedPred = 1;
>      param->bEnableWeightedBiPred = 0;
>      param->bEnableEarlySkip = 1;
> -    param->enableRecursionSkip = 1;
> +    param->recursionSkipMode = 1;
>      param->edgeVarThreshold = 0.05f;
>      param->bEnableAMP = 0;
>      param->bEnableRectInter = 0;
> @@ -547,7 +547,7 @@
>              param->maxNumMergeCand = 5;
>              param->searchMethod = X265_STAR_SEARCH;
>              param->bEnableTransformSkip = 1;
> -            param->enableRecursionSkip = 0;
> +            param->recursionSkipMode = 0;
>              param->maxNumReferences = 5;
>              param->limitReferences = 0;
>              param->lookaheadSlices = 0; // disabled for best quality
> @@ -599,7 +599,7 @@
>              param->rc.hevcAq = 0;
>              param->rc.qpStep = 1;
>              param->rc.bEnableGrain = 1;
> -            param->enableRecursionSkip = 0;
> +            param->recursionSkipMode = 0;
>              param->psyRd = 4.0;
>              param->psyRdoq = 10.0;
>              param->bEnableSAO = 0;
> @@ -703,7 +703,7 @@
>      OPT("ref") p->maxNumReferences = atoi(value);
>      OPT("fast-intra") p->bEnableFastIntra = atobool(value);
>      OPT("early-skip") p->bEnableEarlySkip = atobool(value);
> -    OPT("rskip") p->enableRecursionSkip = atoi(value);
> +    OPT("rskip") p->recursionSkipMode = atoi(value);
>      OPT("rskip-edge-threshold") p->edgeVarThreshold = atoi(value)/100.0f;
>      OPT("me") p->searchMethod = parseName(value, x265_motion_est_names,
> bError);
>      OPT("subme") p->subpelRefine = atoi(value);
> @@ -921,7 +921,7 @@
>      OPT("max-merge") p->maxNumMergeCand = (uint32_t)atoi(value);
>      OPT("temporal-mvp") p->bEnableTemporalMvp = atobool(value);
>      OPT("early-skip") p->bEnableEarlySkip = atobool(value);
> -    OPT("rskip") p->enableRecursionSkip = atoi(value);
> +    OPT("rskip") p->recursionSkipMode = atoi(value);
>      OPT("rdpenalty") p->rdPenalty = atoi(value);
>      OPT("tskip") p->bEnableTransformSkip = atobool(value);
>      OPT("no-tskip-fast") p->bEnableTSkipFast = atobool(value);
> @@ -1602,9 +1602,9 @@
>            "RDOQ Level is out of range");
>      CHECK(param->dynamicRd < 0 || param->dynamicRd >
> x265_ADAPT_RD_STRENGTH,
>            "Dynamic RD strength must be between 0 and 4");
> -    CHECK(param->enableRecursionSkip > 3 || param->enableRecursionSkip <
> 0,
> +    CHECK(param->recursionSkipMode > 3 || param->recursionSkipMode < 0,
>            "Invalid Recursion skip mode. Valid modes 0,1,2,3");
> -    if (param->enableRecursionSkip >= EDGE_BASED_RSKIP)
> +    if (param->recursionSkipMode >= EDGE_BASED_RSKIP)
>      {
>          CHECK(param->edgeVarThreshold < 0.0f || param->edgeVarThreshold >
> 1.0f,
>                "Minimum edge density percentage for a CU should be an
> integer between 0 to 100");
> @@ -1918,8 +1918,8 @@
>      TOOLVAL(param->psyRdoq, "psy-rdoq=%.2lf");
>      TOOLOPT(param->bEnableRdRefine, "rd-refine");
>      TOOLOPT(param->bEnableEarlySkip, "early-skip");
> -    TOOLVAL(param->enableRecursionSkip, "rskip mode=%d");
> -    if (param->enableRecursionSkip >= EDGE_BASED_RSKIP)
> +    TOOLVAL(param->recursionSkipMode, "rskip mode=%d");
> +    if (param->recursionSkipMode >= EDGE_BASED_RSKIP)
>          TOOLVAL(param->edgeVarThreshold, "rskip-edge-threshold=%.2f");
>      TOOLOPT(param->bEnableSplitRdSkip, "splitrd-skip");
>      TOOLVAL(param->noiseReductionIntra, "nr-intra=%d");
> @@ -2078,8 +2078,8 @@
>      s += sprintf(s, " rd=%d", p->rdLevel);
>      s += sprintf(s, " selective-sao=%d", p->selectiveSAO);
>      BOOL(p->bEnableEarlySkip, "early-skip");
> -    BOOL(p->enableRecursionSkip, "rskip");
> -    if (p->enableRecursionSkip >= EDGE_BASED_RSKIP)
> +    BOOL(p->recursionSkipMode, "rskip");
> +    if (p->recursionSkipMode >= EDGE_BASED_RSKIP)
>          s += sprintf(s, " rskip-edge-threshold=%f", p->edgeVarThreshold);
>
>      BOOL(p->bEnableFastIntra, "fast-intra");
> @@ -2388,7 +2388,7 @@
>      dst->bSaoNonDeblocked = src->bSaoNonDeblocked;
>      dst->rdLevel = src->rdLevel;
>      dst->bEnableEarlySkip = src->bEnableEarlySkip;
> -    dst->enableRecursionSkip = src->enableRecursionSkip;
> +    dst->recursionSkipMode = src->recursionSkipMode;
>      dst->edgeVarThreshold = src->edgeVarThreshold;
>      dst->bEnableFastIntra = src->bEnableFastIntra;
>      dst->bEnableTSkipFast = src->bEnableTSkipFast;
> diff -r ecf19726600a -r 27ddd2d2ff94 source/encoder/analysis.cpp
> --- a/source/encoder/analysis.cpp       Wed Jan 29 12:19:07 2020 +0530
> +++ b/source/encoder/analysis.cpp       Fri Feb 21 17:02:18 2020 +0530
> @@ -1272,7 +1272,7 @@
>                      md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom,
> qp);
>                      checkMerge2Nx2N_rd0_4(md.pred[PRED_SKIP],
> md.pred[PRED_MERGE], cuGeom);
>
> -                    skipRecursion = !!m_param->enableRecursionSkip &&
> md.bestMode;
> +                    skipRecursion = !!m_param->recursionSkipMode &&
> md.bestMode;
>                      if (m_param->rdLevel)
>                          skipModes = m_param->bEnableEarlySkip &&
> md.bestMode;
>                  }
> @@ -1296,7 +1296,7 @@
>                      md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom,
> qp);
>                      checkMerge2Nx2N_rd0_4(md.pred[PRED_SKIP],
> md.pred[PRED_MERGE], cuGeom);
>
> -                    skipRecursion = !!m_param->enableRecursionSkip &&
> md.bestMode;
> +                    skipRecursion = !!m_param->recursionSkipMode &&
> md.bestMode;
>                      if (m_param->rdLevel)
>                          skipModes = m_param->bEnableEarlySkip &&
> md.bestMode;
>                  }
> @@ -1314,23 +1314,23 @@
>                  skipModes = (m_param->bEnableEarlySkip || m_refineLevel
> == 2)
>                  && md.bestMode && md.bestMode->cu.isSkipped(0); // TODO:
> sa8d threshold per depth
>          }
> -        if (md.bestMode && m_param->enableRecursionSkip && !bCtuInfoCheck
> && !(m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel
> == 7 && (m_modeFlag[0] || m_modeFlag[1])))
> +        if (md.bestMode && m_param->recursionSkipMode && !bCtuInfoCheck
> && !(m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel
> == 7 && (m_modeFlag[0] || m_modeFlag[1])))
>          {
>              skipRecursion = md.bestMode->cu.isSkipped(0);
>              if (mightSplit && !skipRecursion)
>              {
> -                if (depth >= minDepth && m_param->enableRecursionSkip ==
> RDCOST_BASED_RSKIP)
> +                if (depth >= minDepth && m_param->recursionSkipMode ==
> RDCOST_BASED_RSKIP)
>                  {
>                      if (depth)
>                          skipRecursion = recursionDepthCheck(parentCTU,
> cuGeom, *md.bestMode);
>                      if (m_bHD && !skipRecursion && m_param->rdLevel == 2
> && md.fencYuv.m_size != MAX_CU_SIZE)
>                          skipRecursion = complexityCheckCU(*md.bestMode);
>                  }
> -                else if (cuGeom.log2CUSize >= MAX_LOG2_CU_SIZE - 1 &&
> m_param->enableRecursionSkip >= EDGE_BASED_RSKIP)
> +                else if (cuGeom.log2CUSize >= MAX_LOG2_CU_SIZE - 1 &&
> m_param->recursionSkipMode >= EDGE_BASED_RSKIP)
>                  {
>                      skipRecursion = complexityCheckCU(*md.bestMode);
>                  }
> -                else if (m_param->enableRecursionSkip > EDGE_BASED_RSKIP)
> +                else if (m_param->recursionSkipMode > EDGE_BASED_RSKIP)
>                      skipRecursion = true;
>              }
>          }
> @@ -1981,7 +1981,7 @@
>                      checkInter_rd5_6(md.pred[PRED_2Nx2N], cuGeom,
> SIZE_2Nx2N, refMasks);
>                      checkBestMode(md.pred[PRED_2Nx2N], cuGeom.depth);
>
> -                    if (m_param->enableRecursionSkip && depth &&
> m_modeDepth[depth - 1].bestMode)
> +                    if (m_param->recursionSkipMode && depth &&
> m_modeDepth[depth - 1].bestMode)
>                          skipRecursion = md.bestMode &&
> !md.bestMode->cu.getQtRootCbf(0);
>                  }
>                  if (m_param->analysisLoadReuseLevel > 4 &&
> m_reusePartSize[cuGeom.absPartIdx] == SIZE_2Nx2N)
> @@ -2005,7 +2005,7 @@
>                      checkInter_rd5_6(md.pred[PRED_2Nx2N], cuGeom,
> SIZE_2Nx2N, refMasks);
>                      checkBestMode(md.pred[PRED_2Nx2N], cuGeom.depth);
>
> -                    if (m_param->enableRecursionSkip && depth &&
> m_modeDepth[depth - 1].bestMode)
> +                    if (m_param->recursionSkipMode && depth &&
> m_modeDepth[depth - 1].bestMode)
>                          skipRecursion = md.bestMode &&
> !md.bestMode->cu.getQtRootCbf(0);
>                  }
>              }
> @@ -2024,11 +2024,11 @@
>              checkInter_rd5_6(md.pred[PRED_2Nx2N], cuGeom, SIZE_2Nx2N,
> refMasks);
>              checkBestMode(md.pred[PRED_2Nx2N], cuGeom.depth);
>
> -            if (m_param->enableRecursionSkip == RDCOST_BASED_RSKIP &&
> depth && m_modeDepth[depth - 1].bestMode)
> +            if (m_param->recursionSkipMode == RDCOST_BASED_RSKIP && depth
> && m_modeDepth[depth - 1].bestMode)
>                  skipRecursion = md.bestMode &&
> !md.bestMode->cu.getQtRootCbf(0);
> -            else if (cuGeom.log2CUSize >= MAX_LOG2_CU_SIZE - 1 &&
> m_param->enableRecursionSkip >= EDGE_BASED_RSKIP)
> +            else if (cuGeom.log2CUSize >= MAX_LOG2_CU_SIZE - 1 &&
> m_param->recursionSkipMode >= EDGE_BASED_RSKIP)
>                  skipRecursion = md.bestMode &&
> complexityCheckCU(*md.bestMode);
> -            else if (m_param->enableRecursionSkip > EDGE_BASED_RSKIP)
> +            else if (m_param->recursionSkipMode > EDGE_BASED_RSKIP)
>                  skipRecursion = true;
>          }
>          if (m_param->bAnalysisType == AVC_INFO && md.bestMode &&
> cuGeom.numPartitions <= 16 && m_param->analysisLoadReuseLevel == 7)
> @@ -3538,7 +3538,7 @@
>
>  bool Analysis::complexityCheckCU(const Mode& bestMode)
>  {
> -    if (m_param->enableRecursionSkip == RDCOST_BASED_RSKIP)
> +    if (m_param->recursionSkipMode == RDCOST_BASED_RSKIP)
>      {
>          uint32_t mean = 0;
>          uint32_t homo = 0;
> diff -r ecf19726600a -r 27ddd2d2ff94 source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp        Wed Jan 29 12:19:07 2020 +0530
> +++ b/source/encoder/encoder.cpp        Fri Feb 21 17:02:18 2020 +0530
> @@ -1752,7 +1752,7 @@
>                          }
>                      }
>                  }
> -                if (m_param->enableRecursionSkip >= EDGE_BASED_RSKIP &&
> m_param->bHistBasedSceneCut)
> +                if (m_param->recursionSkipMode >= EDGE_BASED_RSKIP &&
> m_param->bHistBasedSceneCut)
>                  {
>                      pixel* src = m_edgePic;
>                      primitives.planecopy_pp_shr(src,
> inFrame->m_fencPic->m_picWidth, inFrame->m_edgeBitPic,
> inFrame->m_fencPic->m_stride,
> @@ -2420,7 +2420,7 @@
>          encParam->maxNumReferences = param->maxNumReferences; // never
> uses more refs than specified in stream headers
>          encParam->bEnableFastIntra = param->bEnableFastIntra;
>          encParam->bEnableEarlySkip = param->bEnableEarlySkip;
> -        encParam->enableRecursionSkip = param->enableRecursionSkip;
> +        encParam->recursionSkipMode = param->recursionSkipMode;
>          encParam->searchMethod = param->searchMethod;
>          /* Scratch buffer prevents me_range from being increased for
> esa/tesa */
>          if (param->searchRange < encParam->searchRange)
> @@ -3406,7 +3406,7 @@
>          p->maxNumReferences = zone->maxNumReferences;
>          p->bEnableFastIntra = zone->bEnableFastIntra;
>          p->bEnableEarlySkip = zone->bEnableEarlySkip;
> -        p->enableRecursionSkip = zone->enableRecursionSkip;
> +        p->recursionSkipMode = zone->recursionSkipMode;
>          p->searchMethod = zone->searchMethod;
>          p->searchRange = zone->searchRange;
>          p->subpelRefine = zone->subpelRefine;
> @@ -5707,7 +5707,7 @@
>      TOOLCMP(oldParam->maxNumReferences, newParam->maxNumReferences,
> "ref=%d to %d\n");
>      TOOLCMP(oldParam->bEnableFastIntra, newParam->bEnableFastIntra,
> "fast-intra=%d to %d\n");
>      TOOLCMP(oldParam->bEnableEarlySkip, newParam->bEnableEarlySkip,
> "early-skip=%d to %d\n");
> -    TOOLCMP(oldParam->enableRecursionSkip, newParam->enableRecursionSkip,
> "rskip=%d to %d\n");
> +    TOOLCMP(oldParam->recursionSkipMode, newParam->recursionSkipMode,
> "rskip=%d to %d\n");
>      TOOLCMP(oldParam->searchMethod, newParam->searchMethod, "me=%d to
> %d\n");
>      TOOLCMP(oldParam->searchRange, newParam->searchRange, "merange=%d to
> %d\n");
>      TOOLCMP(oldParam->subpelRefine, newParam->subpelRefine, "subme= %d to
> %d\n");
> diff -r ecf19726600a -r 27ddd2d2ff94 source/encoder/frameencoder.cpp
> --- a/source/encoder/frameencoder.cpp   Wed Jan 29 12:19:07 2020 +0530
> +++ b/source/encoder/frameencoder.cpp   Fri Feb 21 17:02:18 2020 +0530
> @@ -448,7 +448,7 @@
>      m_ssimCnt = 0;
>      memset(&(m_frame->m_encData->m_frameStats), 0,
> sizeof(m_frame->m_encData->m_frameStats));
>
> -    if (!m_param->bHistBasedSceneCut && m_param->rc.aqMode !=
> X265_AQ_EDGE && m_param->enableRecursionSkip >= EDGE_BASED_RSKIP)
> +    if (!m_param->bHistBasedSceneCut && m_param->rc.aqMode !=
> X265_AQ_EDGE && m_param->recursionSkipMode >= EDGE_BASED_RSKIP)
>      {
>          int height = m_frame->m_fencPic->m_picHeight;
>          int width = m_frame->m_fencPic->m_picWidth;
> diff -r ecf19726600a -r 27ddd2d2ff94 source/encoder/slicetype.cpp
> --- a/source/encoder/slicetype.cpp      Wed Jan 29 12:19:07 2020 +0530
> +++ b/source/encoder/slicetype.cpp      Fri Feb 21 17:02:18 2020 +0530
> @@ -519,7 +519,7 @@
>                  if (param->rc.aqMode == X265_AQ_EDGE)
>                      edgeFilter(curFrame, param);
>
> -                if (param->rc.aqMode == X265_AQ_EDGE &&
> !param->bHistBasedSceneCut && param->enableRecursionSkip >=
> EDGE_BASED_RSKIP)
> +                if (param->rc.aqMode == X265_AQ_EDGE &&
> !param->bHistBasedSceneCut && param->recursionSkipMode >= EDGE_BASED_RSKIP)
>                  {
>                      pixel* src = curFrame->m_edgePic +
> curFrame->m_fencPic->m_lumaMarginY * curFrame->m_fencPic->m_stride +
> curFrame->m_fencPic->m_lumaMarginX;
>                      primitives.planecopy_pp_shr(src,
> curFrame->m_fencPic->m_stride, curFrame->m_edgeBitPic,
> diff -r ecf19726600a -r 27ddd2d2ff94 source/x265.h
> --- a/source/x265.h     Wed Jan 29 12:19:07 2020 +0530
> +++ b/source/x265.h     Fri Feb 21 17:02:18 2020 +0530
> @@ -1257,7 +1257,7 @@
>
>      /* Enable early CU size decisions to avoid recursing to higher depths.
>       * Default is enabled */
> -    int       enableRecursionSkip;
> +    int       recursionSkipMode;
>
>      /* Use a faster search method to find the best intra mode. Default is
> 0 */
>      int       bEnableFastIntra;
> diff -r ecf19726600a -r 27ddd2d2ff94 source/x265cli.h
> --- a/source/x265cli.h  Wed Jan 29 12:19:07 2020 +0530
> +++ b/source/x265cli.h  Fri Feb 21 17:02:18 2020 +0530
> @@ -457,8 +457,8 @@
>      H0("   --[no-]ssim-rd                Enable ssim rate distortion
> optimization, 0 to disable. Default %s\n", OPT(param->bSsimRd));
>      H0("   --[no-]rd-refine              Enable QP based RD refinement
> for rd levels 5 and 6. Default %s\n", OPT(param->bEnableRdRefine));
>      H0("   --[no-]early-skip             Enable early SKIP detection.
> Default %s\n", OPT(param->bEnableEarlySkip));
> -    H0("   --rskip <mode>                Set mode for early exit from
> recursion. Mode 1: exit using rdcost. Mode 2: exit using edge density. Mode
> 3: exit using edge density with forceful skip for small sized CU's."
> -       "                                          Mode 0: disabled.
> Default %s\n", OPT(param->enableRecursionSkip));
> +    H0("   --rskip <mode>                Set mode for early exit from
> recursion. Mode 1: exit using rdcost. Mode 2: exit using edge density. Mode
> 3: exit using edge density with forceful skip for small sized CU's.\n"
> +       "                                 Mode 0: disabled. Default %d\n",
> param->recursionSkipMode);
>      H1("   --rskip-edge-threshold        Threshold in terms of percentage
> (integer of range [0,100]) for minimum edge density in CUs to prun the
> recursion depth. Applicable only for rskip modes 2 and 3. Default: %.f\n",
> param->edgeVarThreshold*100.0f);
>      H1("   --[no-]tskip-fast             Enable fast intra transform
> skipping. Default %s\n", OPT(param->bEnableTSkipFast));
>      H1("   --[no-]splitrd-skip           Enable skipping split RD
> analysis when sum of split CU rdCost larger than one split CU rdCost for
> Intra CU. Default %s\n", OPT(param->bEnableSplitRdSkip));
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>


-- 
Regards,
*Aruna Matheswaran,*
Video Codec Engineer,
Media & AI analytics BU,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20200302/8f2b1d23/attachment-0001.html>


More information about the x265-devel mailing list