[x265] [PATCH] noiseReduction: allow separate strengths to be specified for intra and inter CUs
Steve Borho
steve at borho.org
Thu Dec 4 17:28:49 CET 2014
On 12/04, deepthi at multicorewareinc.com wrote:
> # HG changeset patch
> # User Deepthi Nandakumar <deepthi at multicorewareinc.com>
> # Date 1417668578 -19800
> # Thu Dec 04 10:19:38 2014 +0530
> # Node ID 40ab64845edff9d5a9659875e1f8030cf179d0cb
> # Parent 2f66c3284c35935df8e4b32e38d826e14277e365
> noiseReduction: allow separate strengths to be specified for intra and inter CUs
>
> diff -r 2f66c3284c35 -r 40ab64845edf source/CMakeLists.txt
> --- a/source/CMakeLists.txt Wed Dec 03 21:35:10 2014 -0600
> +++ b/source/CMakeLists.txt Thu Dec 04 10:19:38 2014 +0530
> @@ -21,7 +21,7 @@
> include(CheckCXXCompilerFlag)
>
> # X265_BUILD must be incremented each time the public API is changed
> -set(X265_BUILD 39)
> +set(X265_BUILD 40)
> configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
> "${PROJECT_BINARY_DIR}/x265.def")
> configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
> diff -r 2f66c3284c35 -r 40ab64845edf source/common/param.cpp
> --- a/source/common/param.cpp Wed Dec 03 21:35:10 2014 -0600
> +++ b/source/common/param.cpp Thu Dec 04 10:19:38 2014 +0530
> @@ -766,7 +766,8 @@
> &p->vui.defDispWinRightOffset,
> &p->vui.defDispWinBottomOffset) != 4;
> }
> - OPT("nr") p->noiseReduction = atoi(value);
> + OPT("nr-intra") p->noiseReductionIntra = atoi(value);
> + OPT("nr-inter") p->noiseReductionInter = atoi(value);
> OPT("pass")
> {
> int pass = Clip3(0, 3, atoi(value));
> @@ -1078,8 +1079,10 @@
> "Target bitrate can not be less than zero");
> CHECK(param->rc.qCompress < 0.5 || param->rc.qCompress > 1.0,
> "qCompress must be between 0.5 and 1.0");
> - if (param->noiseReduction)
> - CHECK(0 > param->noiseReduction || param->noiseReduction > 2000, "Valid noise reduction range 0 - 2000");
> + if (param->noiseReductionIntra)
> + CHECK(0 > param->noiseReductionIntra || param->noiseReductionIntra > 2000, "Valid noise reduction range 0 - 2000");
> + if (param->noiseReductionInter)
> + CHECK(0 > param->noiseReductionInter || param->noiseReductionInter > 2000, "Valid noise reduction range 0 - 2000");
> CHECK(param->rc.rateControlMode == X265_RC_CRF && param->rc.bStatRead,
> "Constant rate-factor is incompatible with 2pass");
> CHECK(param->rc.rateControlMode == X265_RC_CQP && param->rc.bStatRead,
> @@ -1201,8 +1204,10 @@
> fprintf(stderr, "psy-rdoq=%.2lf ", param->psyRdoq);
> TOOLOPT(param->bEnableEarlySkip, "early-skip");
> TOOLOPT(param->bEnableCbfFastMode, "fast-cbf");
> - if (param->noiseReduction)
> - fprintf(stderr, "nr=%d ", param->noiseReduction);
> + if (param->noiseReductionIntra)
> + fprintf(stderr, "nr-intra=%d ", param->noiseReductionIntra);
> + if (param->noiseReductionInter)
> + fprintf(stderr, "nr-inter=%d ", param->noiseReductionInter);
> if (param->bEnableLoopFilter)
> {
> if (param->deblockingFilterBetaOffset || param->deblockingFilterTCOffset)
> diff -r 2f66c3284c35 -r 40ab64845edf source/encoder/frameencoder.cpp
> --- a/source/encoder/frameencoder.cpp Wed Dec 03 21:35:10 2014 -0600
> +++ b/source/encoder/frameencoder.cpp Thu Dec 04 10:19:38 2014 +0530
> @@ -126,12 +126,12 @@
> ok &= m_rce.picTimingSEI && m_rce.hrdTiming;
> }
>
> - if (m_param->noiseReduction)
> + if (m_param->noiseReductionIntra || m_param->noiseReductionInter)
> m_nr = X265_MALLOC(NoiseReduction, 1);
> if (m_nr)
> memset(m_nr, 0, sizeof(NoiseReduction));
> else
> - m_param->noiseReduction = 0;
> + m_param->noiseReductionIntra = m_param->noiseReductionInter = 0;
>
> start();
> return ok;
> @@ -1083,7 +1083,8 @@
> m_nr->count[cat] >>= 1;
> }
>
> - uint64_t scaledCount = (uint64_t)m_param->noiseReduction * m_nr->count[cat];
> + int nrStrength = cat < 8 ? m_param->noiseReductionIntra : m_param->noiseReductionInter;
> + uint64_t scaledCount = (uint64_t)nrStrength * m_nr->count[cat];
>
> for (int i = 0; i < coefCount; i++)
> {
> diff -r 2f66c3284c35 -r 40ab64845edf source/encoder/search.cpp
> --- a/source/encoder/search.cpp Wed Dec 03 21:35:10 2014 -0600
> +++ b/source/encoder/search.cpp Thu Dec 04 10:19:38 2014 +0530
> @@ -72,7 +72,7 @@
> m_me.subpelRefine = param.subpelRefine;
>
> bool ok = m_quant.init(m_bEnableRDOQ, param.psyRdoq, scalingList, m_entropyCoder);
> - if (m_param->noiseReduction)
> + if (m_param->noiseReductionIntra || m_param->noiseReductionInter)
> ok &= m_quant.allocNoiseReduction(param);
>
> ok &= Predict::allocBuffers(param.internalCsp); /* sets m_hChromaShift & m_vChromaShift */
> diff -r 2f66c3284c35 -r 40ab64845edf source/x265.cpp
> --- a/source/x265.cpp Wed Dec 03 21:35:10 2014 -0600
> +++ b/source/x265.cpp Thu Dec 04 10:19:38 2014 +0530
> @@ -210,7 +210,8 @@
> { "lambda-file", required_argument, NULL, 0 },
> { "b-intra", no_argument, NULL, 0 },
> { "no-b-intra", no_argument, NULL, 0 },
> - { "nr", required_argument, NULL, 0 },
> + { "nr-intra", required_argument, NULL, 0 },
> + { "nr-inter", required_argument, NULL, 0 },
> { "stats", required_argument, NULL, 0 },
> { "pass", required_argument, NULL, 0 },
> { "slow-firstpass", no_argument, NULL, 0 },
> @@ -401,7 +402,8 @@
> H0(" --[no-]early-skip Enable early SKIP detection. Default %s\n", OPT(param->bEnableEarlySkip));
> H1(" --[no-]fast-cbf Enable early outs based on whether residual is coded. Default %s\n", OPT(param->bEnableCbfFastMode));
> H1(" --[no-]tskip-fast Enable fast intra transform skipping. Default %s\n", OPT(param->bEnableTSkipFast));
> - H1(" --nr <integer> An integer value in range of 0 to 2000, which denotes strength of noise reduction. Default 0\n");
> + H1(" --nr-intra <integer> An integer value in range of 0 to 2000, which denotes strength of noise reduction in intra CUs. Default 0\n");
> + H1(" --nr-inter <integer> An integer value in range of 0 to 2000, which denotes strength of noise reduction in inter CUs. Default 0\n");
> H0("\nCoding tools:\n");
> H0("-w/--[no-]weightp Enable weighted prediction in P slices. Default %s\n", OPT(param->bEnableWeightedPred));
> H0(" --[no-]weightb Enable weighted prediction in B slices. Default %s\n", OPT(param->bEnableWeightedBiPred));
> diff -r 2f66c3284c35 -r 40ab64845edf source/x265.h
> --- a/source/x265.h Wed Dec 03 21:35:10 2014 -0600
> +++ b/source/x265.h Thu Dec 04 10:19:38 2014 +0530
> @@ -755,9 +755,13 @@
> * regardless of this setting. */
> int bIntraInBFrames;
>
> - /* An integer value in range of 0 to 1000, which denotes strength of noise
> - * reduction. 0 means disabled */
> - int noiseReduction;
> + /* An integer value in range of 0 to 2000, which denotes strength of noise
> + * reduction in intra CUs. 0 means disabled */
> + int noiseReductionIntra;
> +
> + /* An integer value in range of 0 to 2000, which denotes strength of noise
> + * reduction in intra CUs. 0 means disabled */
Queued with this copy-paste error corrected, and reST docs updated
> + int noiseReductionInter;
>
> /* The lossless flag enables true lossless coding, by bypassing scaling,
> * transform, quantization and in-loop filter processes. This is used for
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
--
Steve Borho
More information about the x265-devel
mailing list