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

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Mon Nov 18 17:34:29 CET 2013


# HG changeset patch
# User Aarthi Thirumalai<aarthi at multicorewareinc.com>
# Date 1384792447 -19800
#      Mon Nov 18 22:04:07 2013 +0530
# Node ID 8b9afa5556b315391df143e5fb6e8f3eedd17bc5
# Parent  2321ebe0bf64e5f3c0034076c7edb3ecbcd48039
cli: add aq-strength to cli input options, add validations for aq mode

diff -r 2321ebe0bf64 -r 8b9afa5556b3 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 22:04:07 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)
+    {
+        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 8b9afa5556b3 source/x265.cpp
--- a/source/x265.cpp	Mon Nov 18 11:32:06 2013 +0530
+++ b/source/x265.cpp	Mon Nov 18 22:04:07 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);


More information about the x265-devel mailing list