[x265] [PATCH 2 of 2] aq: add cli option to turn on AQ

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Tue Nov 5 16:45:17 CET 2013


# HG changeset patch
# User Aarthi Thirumalai<aarthi at multicorewareinc.com>
# Date 1383666290 -19800
#      Tue Nov 05 21:14:50 2013 +0530
# Node ID 27290566848b71fddbf3a9147d269a7fec118bbb
# Parent  00a0690f4e3efb69f80a5750ea3a7f0ec493e013
aq: add cli option to turn on AQ.

diff -r 00a0690f4e3e -r 27290566848b source/common/common.cpp
--- a/source/common/common.cpp	Tue Nov 05 21:11:59 2013 +0530
+++ b/source/common/common.cpp	Tue Nov 05 21:14:50 2013 +0530
@@ -194,7 +194,7 @@
     param->rc.qpStep = 4;
     param->rc.rateControlMode = X265_RC_CQP;
     param->rc.qp = 32;
-    param->rc.aqMode = 0;
+    param->rc.aqMode = X265_AQ_NONE;
     param->rc.aqStrength = 1.0;
 
     /* Quality Measurement Metrics */
@@ -389,10 +389,12 @@
     {
         if (!strcmp(tune, "psnr"))
         {
-            // nop; currently the default
+            //currently the default
+            param->rc.aqMode = X265_AQ_NONE;
         }
         else if (!strcmp(tune, "ssim"))
         {
+            param->rc.aqMode = X265_AQ_VARIANCE;
             // not yet supported
         }
         else if (!strcmp(tune, "zero-latency"))
@@ -484,6 +486,8 @@
           "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,
+          "Aq-Mode is out of range");
 
     // max CU size should be power of 2
     uint32_t i = param->maxCUSize;
@@ -615,6 +619,7 @@
     }
     TOOLOPT(param->bEnableWeightedPred, "weightp");
     TOOLOPT(param->bEnableWeightedBiPred, "weightbp");
+    TOOLOPT(param->rc.aqMode, "aq");
     fprintf(stderr, "\n");
     fflush(stderr);
 }
@@ -725,6 +730,11 @@
     {
         p->rc.qp = atoi(value);
         p->rc.rateControlMode = X265_RC_CQP;
+        p->rc.aqMode = X265_AQ_NONE;
+    }
+    OPT("aq-mode")
+    {
+        p->rc.aqMode = atoi(value);
     }
     OPT("cbqpoffs")
         p->cbQpOffset = atoi(value);
diff -r 00a0690f4e3e -r 27290566848b source/x265.cpp
--- a/source/x265.cpp	Tue Nov 05 21:11:59 2013 +0530
+++ b/source/x265.cpp	Tue Nov 05 21:14:50 2013 +0530
@@ -120,6 +120,7 @@
     { "crf",            required_argument, NULL, 0 },
     { "bitrate",        required_argument, NULL, 0 },
     { "qp",             required_argument, NULL, 'q' },
+    { "aq-mode",        required_argument, NULL, 0 },
     { "cbqpoffs",       required_argument, NULL, 0 },
     { "crqpoffs",       required_argument, NULL, 0 },
     { "rd",             required_argument, NULL, 0 },
@@ -310,6 +311,7 @@
     H0("   --bitrate                     Target bitrate (kbps), implies ABR. Default %d\n", param->rc.bitrate);
     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                     Aq Mode for Adaptive Quantization - 0:none 1:aqVariance Default %d\n", param->rc.aqMode);
     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);
diff -r 00a0690f4e3e -r 27290566848b source/x265.h
--- a/source/x265.h	Tue Nov 05 21:11:59 2013 +0530
+++ b/source/x265.h	Tue Nov 05 21:14:50 2013 +0530
@@ -206,6 +206,8 @@
 #define X265_TYPE_BREF          0x0004  /* Non-disposable B-frame */
 #define X265_TYPE_B             0x0005
 #define X265_TYPE_KEYFRAME      0x0006  /* IDR or I depending on b_open_gop option */
+#define X265_AQ_NONE                 0
+#define X265_AQ_VARIANCE             1
 #define IS_X265_TYPE_I(x) ((x) == X265_TYPE_I || (x) == X265_TYPE_IDR)
 #define IS_X265_TYPE_B(x) ((x) == X265_TYPE_B || (x) == X265_TYPE_BREF)
 


More information about the x265-devel mailing list