<div dir="ltr"># HG changeset patch<br># User Niranjan <<a href="mailto:niranjan@multicorewareinc.com">niranjan@multicorewareinc.com</a>><br># Date 1581402757 -19800<br>#      Tue Feb 11 12:02:37 2020 +0530<br># Node ID 196a29866e4eb52a37937e517c7dc4fb85dc224d<br># Parent  fdbd4e4a2aff93bfc14b10efcd9e681a7ebae311<br>Auto AQ Mode.<br><br>This patch does the following:<br>1. Automatically decides the AQ Mode for each frame using its scene statistics<br>such as luma intensity and edge density.<br>2. Add option "--auto-aq" to enable auto detection of AQ Mode per frame.<br>3. Add AQ mode 5 which is suitable for frames with dark edge content.<br><br>diff -r fdbd4e4a2aff -r 196a29866e4e doc/reST/cli.rst<br>--- a/doc/reST/cli.rst Sat Jan 25 18:08:03 2020 +0530<br>+++ b/doc/reST/cli.rst  Tue Feb 11 12:02:37 2020 +0530<br>@@ -1687,7 +1687,7 @@<br>        ignored. Slower presets will generally achieve better compression<br>    efficiency (and generate smaller bitstreams). Default disabled.<br> <br>-.. option:: --aq-mode <0|1|2|3|4><br>+.. option:: --aq-mode <0|1|2|3|4|5><br> <br>        Adaptive Quantization operating mode. Raise or lower per-block<br>       quantization based on complexity analysis of the source image. The<br>@@ -1695,13 +1695,20 @@<br>  the tendency of the encoder to spend too many bits on complex areas<br>  and not enough in flat areas.<br> <br>-    0. disabled<br>-  1. AQ enabled <br>-       2. AQ enabled with auto-variance **(default)**<br>+       0. disabled.<br>+ 1. Uniform AQ. <br>+      2. AQ enabled with auto-variance **(default)**.<br>      3. AQ enabled with auto-variance and bias to dark scenes. This is <br>   recommended for 8-bit encodes or low-bitrate 10-bit encodes, to <br>     prevent color banding/blocking. <br>     4. AQ enabled with auto-variance and edge information.<br>+       5. Same as AQ mode 3, but uses edge density instead of auto-variance. i.e, AQ with bias towards dark scenes which have high edge density.<br>+<br>+.. option:: --auto-aq --no-auto-aq<br>+<br>+ To enable and disable automatic AQ mode detection per frame.<br>+ This option adaptively sets the AQ mode for each frame between 2, 3, 4 and 5 based on the scene statistics.<br>+  Default: disabled.<br> <br> .. option:: --aq-strength <float><br> <br>diff -r fdbd4e4a2aff -r 196a29866e4e source/CMakeLists.txt<br>--- a/source/CMakeLists.txt  Sat Jan 25 18:08:03 2020 +0530<br>+++ b/source/CMakeLists.txt     Tue Feb 11 12:02:37 2020 +0530<br>@@ -29,7 +29,7 @@<br> option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)<br> mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)<br> # X265_BUILD must be incremented each time the public API is changed<br>-set(X265_BUILD 188)<br>+set(X265_BUILD 190)<br> configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265.def.in">x265.def.in</a>"<br>                "${PROJECT_BINARY_DIR}/x265.def")<br> configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265_config.h.in">x265_config.h.in</a>"<br>diff -r fdbd4e4a2aff -r 196a29866e4e source/common/common.h<br>--- a/source/common/common.h  Sat Jan 25 18:08:03 2020 +0530<br>+++ b/source/common/common.h    Tue Feb 11 12:02:37 2020 +0530<br>@@ -130,6 +130,7 @@<br> typedef uint64_t pixel4;<br> typedef int64_t  ssum2_t;<br> #define HISTOGRAM_BINS 1024<br>+#define BRIGHTNESS_THRESHOLD 120 // The threshold above which a pixel is bright<br> #define SHIFT 1<br> #else<br> typedef uint8_t  pixel;<br>@@ -138,6 +139,7 @@<br> typedef uint32_t pixel4;<br> typedef int32_t  ssum2_t; // Signed sum<br> #define HISTOGRAM_BINS 256<br>+#define BRIGHTNESS_THRESHOLD 30 // The threshold above which a pixel is bright<br> #define SHIFT 0<br> #endif // if HIGH_BIT_DEPTH<br> <br>@@ -163,6 +165,8 @@<br> #define MIN_QPSCALE     0.21249999999999999<br> #define MAX_MAX_QPSCALE 615.46574234477100<br> <br>+#define AQ_2_THRESHOLD  50.0 // The threshold to determine whether a frame is bright.<br>+#define AQ_4_THRESHOLD  10.0 // The threshold to determine whether a frame has a lot of edges.<br> <br> template<typename T><br> inline T x265_min(T a, T b) { return a < b ? a : b; }<br>diff -r fdbd4e4a2aff -r 196a29866e4e source/common/frame.cpp<br>--- a/source/common/frame.cpp  Sat Jan 25 18:08:03 2020 +0530<br>+++ b/source/common/frame.cpp   Tue Feb 11 12:02:37 2020 +0530<br>@@ -61,6 +61,7 @@<br>     m_edgePic = NULL;<br>     m_gaussianPic = NULL;<br>     m_thetaPic = NULL;<br>+    m_frameAq = 0;<br> }<br> <br> bool Frame::create(x265_param *param, float* quantOffsets)<br>@@ -101,7 +102,7 @@<br>         CHECKED_MALLOC_ZERO(m_classifyCount, uint32_t, size);<br>     }<br> <br>-    if (param->rc.aqMode == X265_AQ_EDGE || (param->rc.zonefileCount && param->rc.aqMode != 0))<br>+    if (param->rc.aqMode == X265_AQ_EDGE || param->rc.aqMode == X265_AQ_EDGE_BIASED || param->rc.bAutoAq || (param->rc.zonefileCount && param->rc.aqMode != 0))<br>     {<br>         uint32_t numCuInWidth = (param->sourceWidth + param->maxCUSize - 1) / param->maxCUSize;<br>         uint32_t numCuInHeight = (param->sourceHeight + param->maxCUSize - 1) / param->maxCUSize;<br>@@ -261,7 +262,7 @@<br>         X265_FREE_ZERO(m_classifyCount);<br>     }<br> <br>-    if (m_param->rc.aqMode == X265_AQ_EDGE || (m_param->rc.zonefileCount && m_param->rc.aqMode != 0))<br>+    if (m_param->rc.aqMode == X265_AQ_EDGE || m_param->rc.aqMode == X265_AQ_EDGE_BIASED || m_param->rc.bAutoAq || (m_param->rc.zonefileCount && m_param->rc.aqMode != 0))<br>     {<br>         X265_FREE(m_edgePic);<br>         X265_FREE(m_gaussianPic);<br>diff -r fdbd4e4a2aff -r 196a29866e4e source/common/frame.h<br>--- a/source/common/frame.h       Sat Jan 25 18:08:03 2020 +0530<br>+++ b/source/common/frame.h     Tue Feb 11 12:02:37 2020 +0530<br>@@ -137,6 +137,9 @@<br>     pixel*                 m_gaussianPic;<br>     pixel*                 m_thetaPic;<br> <br>+    /* AQ mode for each frame */<br>+    int                    m_frameAq;<br>+<br>     Frame();<br> <br>     bool create(x265_param *param, float* quantOffsets);<br>diff -r fdbd4e4a2aff -r 196a29866e4e source/common/lowres.cpp<br>--- a/source/common/lowres.cpp       Sat Jan 25 18:08:03 2020 +0530<br>+++ b/source/common/lowres.cpp  Tue Feb 11 12:02:37 2020 +0530<br>@@ -190,6 +190,9 @@<br>         }<br>     }<br> <br>+    if (param->rc.bAutoAq)<br>+        lowresEdgePlane = X265_MALLOC(pixel, lumaStride * (lines + (origPic->m_lumaMarginY * 2)));<br>+<br>     return true;<br> <br> fail:<br>diff -r fdbd4e4a2aff -r 196a29866e4e source/common/lowres.h<br>--- a/source/common/lowres.h      Sat Jan 25 18:08:03 2020 +0530<br>+++ b/source/common/lowres.h    Tue Feb 11 12:02:37 2020 +0530<br>@@ -44,6 +44,9 @@<br>     pixel*   fpelLowerResPlane[3];<br>     pixel*   lowerResPlane[4];<br> <br>+    /* Edge Plane in Lowres */<br>+    pixel*   lowresEdgePlane;<br>+<br>     bool     isWeighted;<br>     bool     isLowres;<br>     bool     isHMELowres;<br>diff -r fdbd4e4a2aff -r 196a29866e4e source/common/param.cpp<br>--- a/source/common/param.cpp        Sat Jan 25 18:08:03 2020 +0530<br>+++ b/source/common/param.cpp   Tue Feb 11 12:02:37 2020 +0530<br>@@ -285,6 +285,7 @@<br>     param->rc.bEnableConstVbv = 0;<br>     param->bResetZoneConfig = 1;<br>     param->reconfigWindowSize = 0;<br>+    param->rc.bAutoAq = 0;<br> <br>     /* Video Usability Information (VUI) */<br>     param->vui.aspectRatioIdc = 0;<br>@@ -1226,6 +1227,7 @@<br>         OPT("multi-pass-opt-analysis") p->analysisMultiPassRefine = atobool(value);<br>         OPT("multi-pass-opt-distortion") p->analysisMultiPassDistortion = atobool(value);<br>         OPT("aq-motion") p->bAQMotion = atobool(value);<br>+        OPT("auto-aq") p->rc.bAutoAq = atobool(value);<br>         OPT("dynamic-rd") p->dynamicRd = atof(value);<br>         OPT("analysis-reuse-level")<br>         {<br>@@ -1609,7 +1611,7 @@<br>           "Lookahead depth must be less than 256");<br>     CHECK(param->lookaheadSlices > 16 || param->lookaheadSlices < 0,<br>           "Lookahead slices must between 0 and 16");<br>-    CHECK(param->rc.aqMode < X265_AQ_NONE || X265_AQ_EDGE < param->rc.aqMode,<br>+    CHECK(param->rc.aqMode < X265_AQ_NONE || param->rc.aqMode > X265_AQ_EDGE_BIASED,<br>           "Aq-Mode is out of range");<br>     CHECK(param->rc.aqStrength < 0 || param->rc.aqStrength > 3,<br>           "Aq-Strength is out of range");<br>@@ -1867,9 +1869,12 @@<br>              param->maxNumReferences, (param->limitReferences & X265_REF_LIMIT_CU) ? "on" : "off",<br>              (param->limitReferences & X265_REF_LIMIT_DEPTH) ? "on" : "off");<br> <br>-    if (param->rc.aqMode)<br>+    if (param->rc.aqMode && !param->rc.bAutoAq)<br>         x265_log(param, X265_LOG_INFO, "AQ: mode / str / qg-size / cu-tree  : %d / %0.1f / %d / %d\n", param->rc.aqMode,<br>                  param->rc.aqStrength, param->rc.qgSize, param->rc.cuTree);<br>+    else if (param->rc.bAutoAq)<br>+        x265_log(param, X265_LOG_INFO, "AQ: mode / str / qg-size / cu-tree  : Auto / %0.1f / %d / %d\n", param->rc.aqStrength,<br>+                 param->rc.qgSize, param->rc.cuTree);<br> <br>     if (param->bLossless)<br>         x265_log(param, X265_LOG_INFO, "Rate Control                        : Lossless\n");<br>@@ -2172,6 +2177,7 @@<br>     s += sprintf(s, " hist-threshold=%.2f", p->edgeTransitionThreshold);<br>     BOOL(p->bOptCUDeltaQP, "opt-cu-delta-qp");<br>     BOOL(p->bAQMotion, "aq-motion");<br>+    BOOL(p->rc.bAutoAq, "auto-aq");<br>     BOOL(p->bEmitHDR10SEI, "hdr10");<br>     BOOL(p->bHDR10Opt, "hdr10-opt");<br>     BOOL(p->bDhdr10opt, "dhdr10-opt");<br>@@ -2452,6 +2458,7 @@<br>     dst->rc.bEnableConstVbv = src->rc.bEnableConstVbv;<br>     dst->rc.hevcAq = src->rc.hevcAq;<br>     dst->rc.qpAdaptationRange = src->rc.qpAdaptationRange;<br>+    dst->rc.bAutoAq = src->rc.bAutoAq;<br> <br>     dst->vui.aspectRatioIdc = src->vui.aspectRatioIdc;<br>     dst->vui.sarWidth = src->vui.sarWidth;<br>diff -r fdbd4e4a2aff -r 196a29866e4e source/encoder/slicetype.cpp<br>--- a/source/encoder/slicetype.cpp      Sat Jan 25 18:08:03 2020 +0530<br>+++ b/source/encoder/slicetype.cpp      Tue Feb 11 12:02:37 2020 +0530<br>@@ -473,9 +473,9 @@<br>     if (!(param->rc.bStatRead && param->rc.cuTree && IS_REFERENCED(curFrame)))<br>     {<br>         /* Calculate Qp offset for each 16x16 or 8x8 block in the frame */<br>-        if (param->rc.aqMode == X265_AQ_NONE || param->rc.aqStrength == 0)<br>+        if (curFrame->m_frameAq == X265_AQ_NONE || param->rc.aqStrength == 0)<br>         {<br>-            if (param->rc.aqMode && param->rc.aqStrength == 0)<br>+            if (curFrame->m_frameAq && param->rc.aqStrength == 0)<br>             {<br>                 if (quantOffsets)<br>                 {<br>@@ -516,10 +516,11 @@<br>                 double bias_strength = 0.f;<br>                 double strength = 0.f;<br> <br>-                if (param->rc.aqMode == X265_AQ_EDGE)<br>+                if (curFrame->m_frameAq == X265_AQ_EDGE || curFrame->m_frameAq == X265_AQ_EDGE_BIASED)<br>                     edgeFilter(curFrame, param);<br> <br>-                if (param->rc.aqMode == X265_AQ_AUTO_VARIANCE || param->rc.aqMode == X265_AQ_AUTO_VARIANCE_BIASED || param->rc.aqMode == X265_AQ_EDGE)<br>+                if (curFrame->m_frameAq == X265_AQ_AUTO_VARIANCE || curFrame->m_frameAq == X265_AQ_AUTO_VARIANCE_BIASED ||<br>+                    curFrame->m_frameAq == X265_AQ_EDGE || curFrame->m_frameAq == X265_AQ_EDGE_BIASED)<br>                 {<br>                     double bit_depth_correction = 1.f / (1 << (2 * (X265_DEPTH - 8)));<br>                     for (int blockY = 0; blockY < maxRow; blockY += loopIncr)<br>@@ -528,7 +529,7 @@<br>                         {<br>                             uint32_t energy, edgeDensity, avgAngle;<br>                             energy = acEnergyCu(curFrame, blockX, blockY, param->internalCsp, param->rc.qgSize);<br>-                            if (param->rc.aqMode == X265_AQ_EDGE)<br>+                            if (curFrame->m_frameAq == X265_AQ_EDGE || curFrame->m_frameAq == X265_AQ_EDGE_BIASED)<br>                             {<br>                                 edgeDensity = edgeDensityCu(curFrame, avgAngle, blockX, blockY, param->rc.qgSize);<br>                                 if (edgeDensity)<br>@@ -568,17 +569,17 @@<br>                 {<br>                     for (int blockX = 0; blockX < maxCol; blockX += loopIncr)<br>                     {<br>-                        if (param->rc.aqMode == X265_AQ_AUTO_VARIANCE_BIASED)<br>+                        if (curFrame->m_frameAq == X265_AQ_AUTO_VARIANCE_BIASED)<br>                         {<br>                             qp_adj = curFrame->m_lowres.qpCuTreeOffset[blockXY];<br>                             qp_adj = strength * (qp_adj - avg_adj) + bias_strength * (1.f - modeTwoConst / (qp_adj * qp_adj));<br>                         }<br>-                        else if (param->rc.aqMode == X265_AQ_AUTO_VARIANCE)<br>+                        else if (curFrame->m_frameAq == X265_AQ_AUTO_VARIANCE)<br>                         {<br>                             qp_adj = curFrame->m_lowres.qpCuTreeOffset[blockXY];<br>                             qp_adj = strength * (qp_adj - avg_adj);<br>                         }<br>-                        else if (param->rc.aqMode == X265_AQ_EDGE)<br>+                        else if (curFrame->m_frameAq == X265_AQ_EDGE)<br>                         {<br>                             inclinedEdge = curFrame->m_lowres.edgeInclined[blockXY];<br>                             qp_adj = curFrame->m_lowres.qpCuTreeOffset[blockXY];<br>@@ -587,6 +588,15 @@<br>                             else<br>                                 qp_adj = strength * (qp_adj - avg_adj);<br>                         }<br>+                        else if (curFrame->m_frameAq == X265_AQ_EDGE_BIASED)<br>+                        {<br>+                            inclinedEdge = curFrame->m_lowres.edgeInclined[blockXY];<br>+                            qp_adj = curFrame->m_lowres.qpCuTreeOffset[blockXY];<br>+                            if (inclinedEdge && (qp_adj - avg_adj > 0))<br>+                                qp_adj = ((strength + AQ_EDGE_BIAS) * (qp_adj - avg_adj)) + bias_strength * (1.f - modeTwoConst / (qp_adj * qp_adj));<br>+                            else<br>+                                qp_adj = strength * (qp_adj - avg_adj) + bias_strength * (1.f - modeTwoConst / (qp_adj * qp_adj));<br>+                        }<br>                         else<br>                         {<br>                             uint32_t energy = acEnergyCu(curFrame, blockX, blockY, param->internalCsp, param->rc.qgSize);<br>@@ -1370,6 +1380,44 @@<br>     }<br> }<br> <br>+double computeBrightnessIntensity(pixel *inPlane, int width, int height, intptr_t stride)<br>+{<br>+    pixel* rowStart = inPlane;<br>+    double count = 0;<br>+<br>+    for (int i = 0; i < height; i++)<br>+    {<br>+        for (int j = 0; j < width; j++)<br>+        {<br>+            if (rowStart[j] > BRIGHTNESS_THRESHOLD)<br>+                count++;<br>+        }<br>+        rowStart += stride;<br>+    }<br>+<br>+    /* Returns the brightness percentage of the input plane */<br>+    return (count / (width * height)) * 100;<br>+}<br>+<br>+double computeEdgeIntensity(pixel *inPlane, int width, int height, intptr_t stride)<br>+{<br>+    pixel* rowStart = inPlane;<br>+    double count = 0;<br>+<br>+    for (int i = 0; i < height; i++)<br>+    {<br>+        for (int j = 0; j < width; j++)<br>+        {<br>+            if (rowStart[j] > 0)<br>+                count++;<br>+        }<br>+        rowStart += stride;<br>+    }<br>+<br>+    /* Returns the edge percentage of the input plane */<br>+    return (count / (width * height)) * 100;<br>+}<br>+<br> void PreLookaheadGroup::processTasks(int workerThreadID)<br> {<br>     if (workerThreadID < 0)<br>@@ -1384,6 +1432,36 @@<br>         ProfileScopeEvent(prelookahead);<br>         m_lock.release();<br>         preFrame->m_lowres.init(preFrame->m_fencPic, preFrame->m_poc);<br>+<br>+        /* Auto AQ */<br>+        if (preFrame->m_param->rc.bAutoAq)<br>+        {<br>+            int heightL = preFrame->m_lowres.lines;<br>+            int widthL = preFrame->m_lowres.width;<br>+            pixel *lumaPlane = preFrame->m_lowres.fpelPlane[0];<br>+            intptr_t stride = preFrame->m_lowres.lumaStride;<br>+            double brightnessIntensity = 0, edgeIntensity = 0;<br>+<br>+            /* Edge plane computation */<br>+            memset(preFrame->m_lowres.lowresEdgePlane, 0, stride * (heightL + (preFrame->m_fencPic->m_lumaMarginY * 2)) * sizeof(pixel));<br>+            pixel* lowresEdgePic = preFrame->m_lowres.lowresEdgePlane + preFrame->m_fencPic->m_lumaMarginY * stride + preFrame->m_fencPic->m_lumaMarginX;<br>+            computeEdge(lowresEdgePic, lumaPlane, NULL, stride, heightL, widthL, false);<br>+<br>+            /*Frame edge percentage computation */<br>+            edgeIntensity = computeEdgeIntensity(lowresEdgePic, widthL, heightL, stride);<br>+<br>+            /* Frame Brightness percentage computation */<br>+            brightnessIntensity = computeBrightnessIntensity(lumaPlane, widthL, heightL, stride);<br>+<br>+            /* AQ mode switch */<br>+            if (edgeIntensity < AQ_4_THRESHOLD)<br>+                preFrame->m_frameAq = brightnessIntensity > AQ_2_THRESHOLD ? X265_AQ_AUTO_VARIANCE : X265_AQ_AUTO_VARIANCE_BIASED;<br>+            else<br>+                preFrame->m_frameAq = brightnessIntensity > AQ_2_THRESHOLD ? X265_AQ_EDGE : X265_AQ_EDGE_BIASED;<br>+        }<br>+        else<br>+            preFrame->m_frameAq = preFrame->m_param->rc.aqMode;<br>+<br>         if (m_lookahead.m_bAdaptiveQuant)<br>             tld.calcAdaptiveQuantFrame(preFrame, m_lookahead.m_param);<br>         tld.lowresIntraEstimate(preFrame->m_lowres, m_lookahead.m_param->rc.qgSize);<br>@@ -1392,6 +1470,7 @@<br>         m_lock.acquire();<br>     }<br>     m_lock.release();<br>+<br> }<br> <br> /* called by API thread or worker thread with inputQueueLock acquired */<br>diff -r fdbd4e4a2aff -r 196a29866e4e source/test/regression-tests.txt<br>--- a/source/test/regression-tests.txt Sat Jan 25 18:08:03 2020 +0530<br>+++ b/source/test/regression-tests.txt  Tue Feb 11 12:02:37 2020 +0530<br>@@ -162,6 +162,8 @@<br> sintel_trailer_2k_1920x1080_24.yuv, --preset medium --hist-scenecut --hist-threshold 0.02 --frame-dup --dup-threshold 60 --hrd --bitrate 10000 --vbv-bufsize 15000 --vbv-maxrate 12000<br> sintel_trailer_2k_1920x1080_24.yuv, --preset medium --hist-scenecut --hist-threshold 0.02<br> sintel_trailer_2k_1920x1080_24.yuv, --preset ultrafast --hist-scenecut --hist-threshold 0.02<br>+ducks_take_off_420_720p50.y4m, --preset medium --auto-aq --aq-strength 1.5<br>+ducks_take_off_420_720p50.y4m, --preset slow --auto-aq --aq-strength 1.5 --aq-motion<br> <br> # Main12 intraCost overflow bug test<br> 720p50_parkrun_ter.y4m,--preset medium<br>diff -r fdbd4e4a2aff -r 196a29866e4e source/x265.h<br>--- a/source/x265.h   Sat Jan 25 18:08:03 2020 +0530<br>+++ b/source/x265.h     Tue Feb 11 12:02:37 2020 +0530<br>@@ -574,6 +574,8 @@<br> #define X265_AQ_AUTO_VARIANCE        2<br> #define X265_AQ_AUTO_VARIANCE_BIASED 3<br> #define X265_AQ_EDGE                 4<br>+#define X265_AQ_EDGE_BIASED          5<br>+<br> #define x265_ADAPT_RD_STRENGTH   4<br> #define X265_REFINE_INTER_LEVELS 3<br> /* NOTE! For this release only X265_CSP_I420 and X265_CSP_I444 are supported */<br>@@ -1475,6 +1477,9 @@<br>         /* internally enable if tune grain is set */<br>         int      bEnableConstVbv;<br> <br>+        /* automatically switch AQ mode for each frame */<br>+        int      bAutoAq;<br>+<br>     } rc;<br> <br>     /*== Video Usability Information ==*/<br>diff -r fdbd4e4a2aff -r 196a29866e4e source/x265cli.h<br>--- a/source/x265cli.h        Sat Jan 25 18:08:03 2020 +0530<br>+++ b/source/x265cli.h  Tue Feb 11 12:02:37 2020 +0530<br>@@ -172,6 +172,8 @@<br>     { "qp",             required_argument, NULL, 'q' },<br>     { "aq-mode",        required_argument, NULL, 0 },<br>     { "aq-strength",    required_argument, NULL, 0 },<br>+    { "auto-aq",              no_argument, NULL, 0 },<br>+    { "no-auto-aq",           no_argument, NULL, 0 },<br>     { "rc-grain",             no_argument, NULL, 0 },<br>     { "no-rc-grain",          no_argument, NULL, 0 },<br>     { "ipratio",        required_argument, NULL, 0 },<br>@@ -580,11 +582,19 @@<br>         "                                    - 0 : Disabled.\n"<br>         "                                    - 1 : Store/Load ctu distortion to/from the file specified in analysis-save/load.\n"<br>         "                                Default 0 - Disabled\n");<br>-    H0("   --aq-mode <integer>           Mode for Adaptive Quantization - 0:none 1:uniform AQ 2:auto variance 3:auto variance with bias to dark scenes 4:auto variance with edge information. Default %d\n", param->rc.aqMode);<br>+    H0("   --aq-mode <integer>           Mode for Adaptive Quantization.\n"<br>+       "                                     - 0 : none.\n"<br>+       "                                     - 1 : uniform AQ.\n"<br>+       "                                     - 2 : auto variance.\n"<br>+       "                                     - 3 : auto variance with bias to dark scenes.\n"<br>+       "                                     - 4 : auto variance with edge density.\n"<br>+       "                                     - 5 : auto variance with edge density and bias towards dark scenes.\n"<br>+       "                                 Default %d\n", param->rc.aqMode);<br>     H0("   --[no-]hevc-aq                Mode for HEVC Adaptive Quantization. Default %s\n", OPT(param->rc.hevcAq));<br>     H0("   --aq-strength <float>         Reduces blocking and blurring in flat and textured areas (0 to 3.0). Default %.2f\n", param->rc.aqStrength);<br>     H0("   --qp-adaptation-range <float> Delta QP range by QP adaptation based on a psycho-visual model (1.0 to 6.0). Default %.2f\n", param->rc.qpAdaptationRange);<br>     H0("   --[no-]aq-motion              Block level QP adaptation based on the relative motion between the block and the frame. Default %s\n", OPT(param->bAQMotion));<br>+    H1("   --[no-]auto-aq                Auto AQ. Default %s\n", OPT(param->rc.bAutoAq));<br>     H0("   --qg-size <int>               Specifies the size of the quantization group (64, 32, 16, 8). Default %d\n", param->rc.qgSize);<br>     H0("   --[no-]cutree                 Enable cutree for Adaptive Quantization. Default %s\n", OPT(param->rc.cuTree));<br>     H0("   --[no-]rc-grain               Enable ratecontrol mode to handle grains specifically. turned on with tune grain. Default %s\n", OPT(param->rc.bEnableGrain));<br><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><font color="#0c343d" face="verdana, sans-serif">Thanks & Regards</font><div><font color="#0c343d" face="verdana, sans-serif"><b>Niranjan Kumar B</b></font></div><div><font size="1" color="#0c343d" face="verdana, sans-serif">Video Codec Engineer </font></div><div><font size="1" color="#0c343d" face="verdana, sans-serif">Media & AI Analytics</font></div><div><font face="trebuchet ms, sans-serif" color="#0c343d">+91 958 511 1449</font></div><div><a href="https://multicorewareinc.com/" style="color:rgb(17,85,204)" target="_blank"><img src="https://docs.google.com/uc?export=download&id=1kc3RJu9M8bnIf6Xa5rUw2d-eEVUsPBE5&revid=0B7tw9XJBmynaemR1VUpQUi9DVytRVW5SVkRwVTFjb1hBMUcwPQ"></a></div></div></div></div></div></div></div></div></div>