[x265] [PATCH] cli: add aq-strength to cli input options, add validations for aq mode

Steve Borho steve at borho.org
Mon Nov 18 16:23:57 CET 2013


On Nov 18, 2013, at 5:26 AM, Aarthi Thirumalai <aarthi at multicorewareinc.com> wrote:

> # HG changeset patch
> # User Aarthi Thirumalai
> # Date 1384773969 -19800
> #      Mon Nov 18 16:56:09 2013 +0530
> # Node ID 78225cfaa696fad7f2870c4064c8f0f387e5ba8d
> # Parent  2321ebe0bf64e5f3c0034076c7edb3ecbcd48039
> cli: add aq-strength to cli input options, add validations for aq mode
> 
> diff -r 2321ebe0bf64 -r 78225cfaa696 source/common/common.cpp
> --- a/source/common/common.cpp	Mon Nov 18 11:32:06 2013 +0530
> +++ b/source/common/common.cpp	Mon Nov 18 16:56:09 2013 +0530
> @@ -519,8 +519,10 @@
>           "max consecutive bframe count must be 16 or smaller");
>     CHECK(param->lookaheadDepth > X265_LOOKAHEAD_MAX,
>           "Lookahead depth must be less than 256");
> -    CHECK(param->rc.aqMode<X265_AQ_NONE || param->rc.aqMode> X265_AQ_VARIANCE,
> +    CHECK(param->rc.aqMode < X265_AQ_NONE || param->rc.aqMode > X265_AQ_VARIANCE,
>           "Aq-Mode is out of range");
> +    CHECK(param->rc.aqStrength < 0 || param->rc.aqStrength > 3,
> +          "Aq-Strength is out of range");
> 
>     // max CU size should be power of 2
>     uint32_t i = param->maxCUSize;
> @@ -532,6 +534,16 @@
>     }
> 
>     CHECK(param->bEnableWavefront < 0, "WaveFrontSynchro cannot be negative");
> +    if(param->rc.rateControlMode == X265_RC_CQP )

white-space

> +    {
> +        param->rc.aqMode = X265_AQ_NONE;
> +        param->rc.bitrate = 0;
> +    }
> +    if(param->rc.aqStrength == 0)
> +    {
> +        x265_log(param, X265_LOG_WARNING, "Aq mode specified, but Aq strength is  0, ignored\n" );
> +        param->rc.aqMode = 0;
> +    }
> 
>     return check_failed;
> }
> @@ -652,7 +664,8 @@
>     }
>     TOOLOPT(param->bEnableWeightedPred, "weightp");
>     TOOLOPT(param->bEnableWeightedBiPred, "weightbp");
> -    TOOLOPT(param->rc.aqMode, "aq");
> +    TOOLOPT(param->rc.aqMode, "aq-mode");
> +    fprintf(stderr, "aq-strength=%.2f ", param->rc.aqStrength);
>     fprintf(stderr, "\n");
>     fflush(stderr);
> }
> @@ -729,6 +742,7 @@
>     OPT("psnr") p->bEnablePsnr = bvalue;
>     OPT("hash") p->decodedPictureHashSEI = atoi(value);
>     OPT("aq-mode") p->rc.aqMode = atoi(value);
> +    OPT("aq-strength") p->rc.aqStrength = atof(value);
>     OPT("crf")
>     {
>         p->rc.rfConstant = atof(value);
> @@ -794,6 +808,8 @@
>     BOOL(p->bEnableWeightedPred, "weightp");
>     s += sprintf(s, " bitrate=%d", p->rc.bitrate);
>     s += sprintf(s, " qp=%d", p->rc.qp);
> +    s += sprintf(s, " aq-mode=%d", p->rc.aqMode);
> +    s += sprintf(s, " aq-strength=%.2f", p->rc.aqStrength);
>     s += sprintf(s, " cbqpoffs=%d", p->cbQpOffset);
>     s += sprintf(s, " crqpoffs=%d", p->crQpOffset);
>     s += sprintf(s, " rd=%d", p->rdLevel);
> diff -r 2321ebe0bf64 -r 78225cfaa696 source/x265.cpp
> --- a/source/x265.cpp	Mon Nov 18 11:32:06 2013 +0530
> +++ b/source/x265.cpp	Mon Nov 18 16:56:09 2013 +0530
> @@ -123,6 +123,7 @@
>     { "bitrate",        required_argument, NULL, 0 },
>     { "qp",             required_argument, NULL, 'q' },
>     { "aq-mode",        required_argument, NULL, 0 },
> +    { "aq-strength",    required_argument, NULL, 0 },
>     { "cbqpoffs",       required_argument, NULL, 0 },
>     { "crqpoffs",       required_argument, NULL, 0 },
>     { "rd",             required_argument, NULL, 0 },
> @@ -310,6 +311,7 @@
>     H0("   --crf                         Quality-based VBR (0-51). Default %f\n", param->rc.rfConstant);
>     H0("-q/--qp                          Base QP for CQP mode. Default %d\n", param->rc.qp);
>     H0("   --aq-mode                     Mode for Adaptive Quantization - 0:none 1:aqVariance Default %d\n", param->rc.aqMode);
> +    H0("   --aq-strength                 Reduces blocking and blurring in flat and textured areas.(0 to 3.0)<double> . Default %f\n", param->rc.aqStrength);
>     H0("   --cbqpoffs                    Chroma Cb QP Offset. Default %d\n", param->cbQpOffset);
>     H0("   --crqpoffs                    Chroma Cr QP Offset. Default %d\n", param->crQpOffset);
>     H0("   --rd                          Level of RD in mode decision 0:least....2:full RDO. Default %d\n", param->rdLevel);
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20131118/7e8aa46a/attachment.sig>


More information about the x265-devel mailing list