[x265] [PATCH] analysis: Introduce refine-intra level 4

Ashok Kumar Mishra ashok at multicorewareinc.com
Mon Mar 5 10:37:46 CET 2018


On Wed, Feb 28, 2018 at 5:06 PM, <bhavna at multicorewareinc.com> wrote:

> # HG changeset patch
> # User Bhavna Hariharan <bhavna at multicorewareinc.com>
> # Date 1519723941 -19800
> #      Tue Feb 27 15:02:21 2018 +0530
> # Node ID 4d8777a67a59658e4f2c01b7f0fb2fbef06cd047
> # Parent  a12d4abf477016158397064730afa160a067c3e9
> analysis: Introduce refine-intra level 4
>
> refine-intra 4 does not reuse any analysis information from the save
> encode.
> Analysis is re-done for all I-frames and intra in inter blocks in the load
> run,
> this improves the quality of the subsequent inter frames.
>
> diff -r a12d4abf4770 -r 4d8777a67a59 doc/reST/cli.rst
> --- a/doc/reST/cli.rst  Thu Jan 25 11:37:21 2018 +0530
> +++ b/doc/reST/cli.rst  Tue Feb 27 15:02:21 2018 +0530
> @@ -915,7 +915,7 @@
>         This option should be coupled with analysis-reuse-mode option,
> --analysis-reuse-level 10.
>         The ctu size of load should be double the size of save. Default 0.
>
> -.. option:: --refine-intra <0..3>
> +.. option:: --refine-intra <0..4>
>
>         Enables refinement of intra blocks in current encode.
>
> @@ -931,6 +931,8 @@
>
>         Level 3 - Perform analysis of intra modes for depth reused from
> first encode.
>
> +       Level 4 - Does not reuse any analysis information - redo analysis
> for the intra block.
> +
>         Default 0.
>
>  .. option:: --refine-inter <0..3>
> diff -r a12d4abf4770 -r 4d8777a67a59 source/CMakeLists.txt
> --- a/source/CMakeLists.txt     Thu Jan 25 11:37:21 2018 +0530
> +++ b/source/CMakeLists.txt     Tue Feb 27 15:02:21 2018 +0530
> @@ -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 151)
> +set(X265_BUILD 152)
>  configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
>                 "${PROJECT_BINARY_DIR}/x265.def")
>  configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
> diff -r a12d4abf4770 -r 4d8777a67a59 source/common/param.cpp
> --- a/source/common/param.cpp   Thu Jan 25 11:37:21 2018 +0530
> +++ b/source/common/param.cpp   Tue Feb 27 15:02:21 2018 +0530
> @@ -1365,7 +1365,7 @@
>          "Supported values for bCTUInfo are 0, 1, 2, 4, 6");
>      CHECK(param->interRefine > 3 || param->interRefine < 0,
>          "Invalid refine-inter value, refine-inter levels 0 to 3
> supported");
> -    CHECK(param->intraRefine > 3 || param->intraRefine < 0,
> +    CHECK(param->intraRefine > 4 || param->intraRefine < 0,
>          "Invalid refine-intra value, refine-intra levels 0 to 3
> supported");
>  #if !X86_64
>      CHECK(param->searchMethod == X265_SEA && (param->sourceWidth > 840 ||
> param->sourceHeight > 480),
> diff -r a12d4abf4770 -r 4d8777a67a59 source/encoder/analysis.cpp
> --- a/source/encoder/analysis.cpp       Thu Jan 25 11:37:21 2018 +0530
> +++ b/source/encoder/analysis.cpp       Tue Feb 27 15:02:21 2018 +0530
> @@ -518,10 +518,10 @@
>      bool mightSplit = !(cuGeom.flags & CUGeom::LEAF);
>      bool mightNotSplit = !(cuGeom.flags & CUGeom::SPLIT_MANDATORY);
>
> -    bool bAlreadyDecided = parentCTU.m_lumaIntraDir[cuGeom.absPartIdx]
> != (uint8_t)ALL_IDX;
> -    bool bDecidedDepth = parentCTU.m_cuDepth[cuGeom.absPartIdx] == depth;
> +    bool bAlreadyDecided = m_param->intraRefine != 4 &&
> parentCTU.m_lumaIntraDir[cuGeom.absPartIdx] != (uint8_t)ALL_IDX;
> +    bool bDecidedDepth = m_param->intraRefine != 4 &&
> parentCTU.m_cuDepth[cuGeom.absPartIdx] == depth;
>      int split = 0;
> -    if (m_param->intraRefine)
> +    if (m_param->intraRefine && m_param->intraRefine != 4)
>      {
>          split = ((cuGeom.log2CUSize == (uint32_t)(g_log2Size[m_param->minCUSize]
> + 1)) && bDecidedDepth);
>          if (cuGeom.log2CUSize == (uint32_t)(g_log2Size[m_param->minCUSize])
> && !bDecidedDepth)
> @@ -2425,14 +2425,19 @@
>          PartSize size = (PartSize)parentCTU.m_
> partSize[cuGeom.absPartIdx];
>          if (parentCTU.isIntra(cuGeom.absPartIdx) && m_param->interRefine
> < 2)
>          {
> -            bool reuseModes = !((m_param->intraRefine == 3) ||
> -                                (m_param->intraRefine == 2 &&
> parentCTU.m_lumaIntraDir[cuGeom.absPartIdx] > DC_IDX));
> -            if (reuseModes)
> +            if (m_param->intraRefine == 4)
> +                compressIntraCU(parentCTU, cuGeom, qp);
> +            else
>              {
> -                memcpy(mode.cu.m_lumaIntraDir, parentCTU.m_lumaIntraDir +
> cuGeom.absPartIdx, cuGeom.numPartitions);
> -                memcpy(mode.cu.m_chromaIntraDir,
> parentCTU.m_chromaIntraDir + cuGeom.absPartIdx, cuGeom.numPartitions);
> +                bool reuseModes = !((m_param->intraRefine == 3) ||
> +                    (m_param->intraRefine == 2 &&
> parentCTU.m_lumaIntraDir[cuGeom.absPartIdx] > DC_IDX));
> +                if (reuseModes)
> +                {
> +                    memcpy(mode.cu.m_lumaIntraDir,
> parentCTU.m_lumaIntraDir + cuGeom.absPartIdx, cuGeom.numPartitions);
> +                    memcpy(mode.cu.m_chromaIntraDir,
> parentCTU.m_chromaIntraDir + cuGeom.absPartIdx, cuGeom.numPartitions);
> +                }
> +                checkIntra(mode, cuGeom, size);
>              }
> -            checkIntra(mode, cuGeom, size);
>          }
>          else if (!parentCTU.isIntra(cuGeom.absPartIdx) &&
> m_param->interRefine < 2)
>          {
> diff -r a12d4abf4770 -r 4d8777a67a59 source/x265cli.h
> --- a/source/x265cli.h  Thu Jan 25 11:37:21 2018 +0530
> +++ b/source/x265cli.h  Tue Feb 27 15:02:21 2018 +0530
> @@ -475,11 +475,12 @@
>      H0("   --analysis-reuse-level <1..10>      Level of analysis reuse
> indicates amount of info stored/reused in save/load mode, 1:least..10:most.
> Default %d\n", param->analysisReuseLevel);
>      H0("   --refine-mv-type <string>     Reuse MV information received
> through API call. Supported option is avc. Default disabled - %d\n",
> param->bMVType);
>      H0("   --scale-factor <int>          Specify factor by which input
> video is scaled down for analysis save mode. Default %d\n",
> param->scaleFactor);
> -    H0("   --refine-intra <0..3>         Enable intra refinement for
> encode that uses analysis-load.\n"
> +    H0("   --refine-intra <0..4>         Enable intra refinement for
> encode that uses analysis-load.\n"
>          "                                    - 0 : Forces both mode and
> depth from the save encode.\n"
>          "                                    - 1 : Functionality of (0) +
> evaluate all intra modes at min-cu-size's depth when current depth is one
> smaller than min-cu-size's depth.\n"
>          "                                    - 2 : Functionality of (1) +
> irrespective of size evaluate all angular modes when the save encode
> decides the best mode as angular.\n"
>          "                                    - 3 : Functionality of (1) +
> irrespective of size evaluate all intra modes.\n"
> +        "                                    - 4 : Re-evaluate all intra
> blocks, does not reuse data from save encode.\n"
>          "                                Default:%d\n",
> param->intraRefine);
>      H0("   --refine-inter <0..3>         Enable inter refinement for
> encode that uses analysis-load.\n"
>          "                                    - 0 : Forces both mode and
> depth from the save encode.\n"
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
>
Pushed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20180305/cbfb66b9/attachment.html>


More information about the x265-devel mailing list