[x265] [PATCH]Auto AQ Mode

Niranjan Bala niranjan at multicorewareinc.com
Thu Feb 27 09:53:42 CET 2020


On Fri, Feb 21, 2020 at 11:29 AM Pradeep Ramachandran <
pradeep at multicorewareinc.com> wrote:

>
> On Wed, Feb 19, 2020 at 11:16 AM Niranjan Bala <
> niranjan at multicorewareinc.com> wrote:
>
>> # HG changeset patch
>> # User Niranjan <niranjan at multicorewareinc.com>
>> # Date 1581402757 -19800
>> #      Tue Feb 11 12:02:37 2020 +0530
>> # Node ID 196a29866e4eb52a37937e517c7dc4fb85dc224d
>> # Parent  fdbd4e4a2aff93bfc14b10efcd9e681a7ebae311
>> Auto AQ Mode.
>>
>
> This patch implements aq-mode 5 & auto-aq. Either split into two patches
> (preferred), or update the commit message accordingly.
>
Split into two patches.

>
> Needs to be rebased to apply on current tip of default.
>
Rebased on top of the current tip of default.

>
>
>>
>> This patch does the following:
>> 1. Automatically decides the AQ Mode for each frame using its scene
>> statistics
>> such as luma intensity and edge density.
>> 2. Add option "--auto-aq" to enable auto detection of AQ Mode per frame.
>> 3. Add AQ mode 5 which is suitable for frames with dark edge content.
>>
>> diff -r fdbd4e4a2aff -r 196a29866e4e doc/reST/cli.rst
>> --- a/doc/reST/cli.rst Sat Jan 25 18:08:03 2020 +0530
>> +++ b/doc/reST/cli.rst Tue Feb 11 12:02:37 2020 +0530
>> @@ -1687,7 +1687,7 @@
>>   ignored. Slower presets will generally achieve better compression
>>   efficiency (and generate smaller bitstreams). Default disabled.
>>
>> -.. option:: --aq-mode <0|1|2|3|4>
>> +.. option:: --aq-mode <0|1|2|3|4|5>
>>
>>   Adaptive Quantization operating mode. Raise or lower per-block
>>   quantization based on complexity analysis of the source image. The
>> @@ -1695,13 +1695,20 @@
>>   the tendency of the encoder to spend too many bits on complex areas
>>   and not enough in flat areas.
>>
>> - 0. disabled
>> - 1. AQ enabled
>> - 2. AQ enabled with auto-variance **(default)**
>> + 0. disabled.
>> + 1. Uniform AQ.
>> + 2. AQ enabled with auto-variance **(default)**.
>>   3. AQ enabled with auto-variance and bias to dark scenes. This is
>>   recommended for 8-bit encodes or low-bitrate 10-bit encodes, to
>>   prevent color banding/blocking.
>>   4. AQ enabled with auto-variance and edge information.
>> + 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.
>> +
>> +.. option:: --auto-aq --no-auto-aq
>> +
>> + To enable and disable automatic AQ mode detection per frame.
>> + This option adaptively sets the AQ mode for each frame between 2, 3, 4
>> and 5 based on the scene statistics.
>> + Default: disabled.
>>
>>  .. option:: --aq-strength <float>
>>
>> diff -r fdbd4e4a2aff -r 196a29866e4e source/CMakeLists.txt
>> --- a/source/CMakeLists.txt Sat Jan 25 18:08:03 2020 +0530
>> +++ b/source/CMakeLists.txt Tue Feb 11 12:02:37 2020 +0530
>> @@ -29,7 +29,7 @@
>>  option(STATIC_LINK_CRT "Statically link C runtime for release builds"
>> OFF)
>>  mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
>>  # X265_BUILD must be incremented each time the public API is changed
>> -set(X265_BUILD 188)
>> +set(X265_BUILD 190)
>>  configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
>>                 "${PROJECT_BINARY_DIR}/x265.def")
>>  configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
>> diff -r fdbd4e4a2aff -r 196a29866e4e source/common/common.h
>> --- a/source/common/common.h Sat Jan 25 18:08:03 2020 +0530
>> +++ b/source/common/common.h Tue Feb 11 12:02:37 2020 +0530
>> @@ -130,6 +130,7 @@
>>  typedef uint64_t pixel4;
>>  typedef int64_t  ssum2_t;
>>  #define HISTOGRAM_BINS 1024
>> +#define BRIGHTNESS_THRESHOLD 120 // The threshold above which a pixel is
>> bright
>>  #define SHIFT 1
>>  #else
>>  typedef uint8_t  pixel;
>> @@ -138,6 +139,7 @@
>>  typedef uint32_t pixel4;
>>  typedef int32_t  ssum2_t; // Signed sum
>>  #define HISTOGRAM_BINS 256
>> +#define BRIGHTNESS_THRESHOLD 30 // The threshold above which a pixel is
>> bright
>>  #define SHIFT 0
>>  #endif // if HIGH_BIT_DEPTH
>>
>> @@ -163,6 +165,8 @@
>>  #define MIN_QPSCALE     0.21249999999999999
>>  #define MAX_MAX_QPSCALE 615.46574234477100
>>
>> +#define AQ_2_THRESHOLD  50.0 // The threshold to determine whether a
>> frame is bright.
>> +#define AQ_4_THRESHOLD  10.0 // The threshold to determine whether a
>> frame has a lot of edges.
>>
>
> Rename above macros to denote 'what they represent', and not what the
> decision taken based on the threshold is.
>
Renamed the macros.

>
>
>>
>>  template<typename T>
>>  inline T x265_min(T a, T b) { return a < b ? a : b; }
>> diff -r fdbd4e4a2aff -r 196a29866e4e source/common/frame.cpp
>> --- a/source/common/frame.cpp Sat Jan 25 18:08:03 2020 +0530
>> +++ b/source/common/frame.cpp Tue Feb 11 12:02:37 2020 +0530
>> @@ -61,6 +61,7 @@
>>      m_edgePic = NULL;
>>      m_gaussianPic = NULL;
>>      m_thetaPic = NULL;
>> +    m_frameAq = 0;
>>
>
> Use macro X265_AQ_NONE instead of 0 as default value.
>
The default value is set as X265_AQ_NONE .

>
>  }
>>
>>  bool Frame::create(x265_param *param, float* quantOffsets)
>> @@ -101,7 +102,7 @@
>>          CHECKED_MALLOC_ZERO(m_classifyCount, uint32_t, size);
>>      }
>>
>> -    if (param->rc.aqMode == X265_AQ_EDGE || (param->rc.zonefileCount &&
>> param->rc.aqMode != 0))
>> +    if (param->rc.aqMode == X265_AQ_EDGE || param->rc.aqMode ==
>> X265_AQ_EDGE_BIASED || param->rc.bAutoAq || (param->rc.zonefileCount &&
>> param->rc.aqMode != 0))
>>      {
>>          uint32_t numCuInWidth = (param->sourceWidth + param->maxCUSize -
>> 1) / param->maxCUSize;
>>          uint32_t numCuInHeight = (param->sourceHeight + param->maxCUSize
>> - 1) / param->maxCUSize;
>> @@ -261,7 +262,7 @@
>>          X265_FREE_ZERO(m_classifyCount);
>>      }
>>
>> -    if (m_param->rc.aqMode == X265_AQ_EDGE || (m_param->rc.zonefileCount
>> && m_param->rc.aqMode != 0))
>> +    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))
>>
>
> Given that X265_FREE() already checks for valid pointer before free-ing,
> is the above if() even required?
>
Removed the extra if() check.

>
>
>>      {
>>          X265_FREE(m_edgePic);
>>          X265_FREE(m_gaussianPic);
>> diff -r fdbd4e4a2aff -r 196a29866e4e source/common/frame.h
>> --- a/source/common/frame.h Sat Jan 25 18:08:03 2020 +0530
>> +++ b/source/common/frame.h Tue Feb 11 12:02:37 2020 +0530
>> @@ -137,6 +137,9 @@
>>      pixel*                 m_gaussianPic;
>>      pixel*                 m_thetaPic;
>>
>> +    /* AQ mode for each frame */
>> +    int                    m_frameAq;
>> +
>>      Frame();
>>
>>      bool create(x265_param *param, float* quantOffsets);
>> diff -r fdbd4e4a2aff -r 196a29866e4e source/common/lowres.cpp
>> --- a/source/common/lowres.cpp Sat Jan 25 18:08:03 2020 +0530
>> +++ b/source/common/lowres.cpp Tue Feb 11 12:02:37 2020 +0530
>> @@ -190,6 +190,9 @@
>>          }
>>      }
>>
>> +    if (param->rc.bAutoAq)
>> +        lowresEdgePlane = X265_MALLOC(pixel, lumaStride * (lines +
>> (origPic->m_lumaMarginY * 2)));
>> +
>>
>
> Needs to be freed in destructor if allocated
>
The memory allocated is freed in the destructor.

>
>
>>      return true;
>>
>>  fail:
>> diff -r fdbd4e4a2aff -r 196a29866e4e source/common/lowres.h
>> --- a/source/common/lowres.h Sat Jan 25 18:08:03 2020 +0530
>> +++ b/source/common/lowres.h Tue Feb 11 12:02:37 2020 +0530
>> @@ -44,6 +44,9 @@
>>      pixel*   fpelLowerResPlane[3];
>>      pixel*   lowerResPlane[4];
>>
>> +    /* Edge Plane in Lowres */
>> +    pixel*   lowresEdgePlane;
>> +
>>      bool     isWeighted;
>>      bool     isLowres;
>>      bool     isHMELowres;
>> diff -r fdbd4e4a2aff -r 196a29866e4e source/common/param.cpp
>> --- a/source/common/param.cpp Sat Jan 25 18:08:03 2020 +0530
>> +++ b/source/common/param.cpp Tue Feb 11 12:02:37 2020 +0530
>> @@ -285,6 +285,7 @@
>>      param->rc.bEnableConstVbv = 0;
>>      param->bResetZoneConfig = 1;
>>      param->reconfigWindowSize = 0;
>> +    param->rc.bAutoAq = 0;
>>
>>      /* Video Usability Information (VUI) */
>>      param->vui.aspectRatioIdc = 0;
>> @@ -1226,6 +1227,7 @@
>>          OPT("multi-pass-opt-analysis") p->analysisMultiPassRefine =
>> atobool(value);
>>          OPT("multi-pass-opt-distortion") p->analysisMultiPassDistortion
>> = atobool(value);
>>          OPT("aq-motion") p->bAQMotion = atobool(value);
>> +        OPT("auto-aq") p->rc.bAutoAq = atobool(value);
>>          OPT("dynamic-rd") p->dynamicRd = atof(value);
>>          OPT("analysis-reuse-level")
>>          {
>> @@ -1609,7 +1611,7 @@
>>            "Lookahead depth must be less than 256");
>>      CHECK(param->lookaheadSlices > 16 || param->lookaheadSlices < 0,
>>            "Lookahead slices must between 0 and 16");
>> -    CHECK(param->rc.aqMode < X265_AQ_NONE || X265_AQ_EDGE <
>> param->rc.aqMode,
>> +    CHECK(param->rc.aqMode < X265_AQ_NONE || param->rc.aqMode >
>> X265_AQ_EDGE_BIASED,
>>            "Aq-Mode is out of range");
>>      CHECK(param->rc.aqStrength < 0 || param->rc.aqStrength > 3,
>>            "Aq-Strength is out of range");
>> @@ -1867,9 +1869,12 @@
>>               param->maxNumReferences, (param->limitReferences &
>> X265_REF_LIMIT_CU) ? "on" : "off",
>>               (param->limitReferences & X265_REF_LIMIT_DEPTH) ? "on" :
>> "off");
>>
>> -    if (param->rc.aqMode)
>> +    if (param->rc.aqMode && !param->rc.bAutoAq)
>>          x265_log(param, X265_LOG_INFO, "AQ: mode / str / qg-size /
>> cu-tree  : %d / %0.1f / %d / %d\n", param->rc.aqMode,
>>                   param->rc.aqStrength, param->rc.qgSize,
>> param->rc.cuTree);
>> +    else if (param->rc.bAutoAq)
>> +        x265_log(param, X265_LOG_INFO, "AQ: mode / str / qg-size /
>> cu-tree  : Auto / %0.1f / %d / %d\n", param->rc.aqStrength,
>> +                 param->rc.qgSize, param->rc.cuTree);
>>
>
> Nice!
>
>
>>
>>      if (param->bLossless)
>>          x265_log(param, X265_LOG_INFO, "Rate Control
>>    : Lossless\n");
>> @@ -2172,6 +2177,7 @@
>>      s += sprintf(s, " hist-threshold=%.2f", p->edgeTransitionThreshold);
>>      BOOL(p->bOptCUDeltaQP, "opt-cu-delta-qp");
>>      BOOL(p->bAQMotion, "aq-motion");
>> +    BOOL(p->rc.bAutoAq, "auto-aq");
>>      BOOL(p->bEmitHDR10SEI, "hdr10");
>>      BOOL(p->bHDR10Opt, "hdr10-opt");
>>      BOOL(p->bDhdr10opt, "dhdr10-opt");
>> @@ -2452,6 +2458,7 @@
>>      dst->rc.bEnableConstVbv = src->rc.bEnableConstVbv;
>>      dst->rc.hevcAq = src->rc.hevcAq;
>>      dst->rc.qpAdaptationRange = src->rc.qpAdaptationRange;
>> +    dst->rc.bAutoAq = src->rc.bAutoAq;
>>
>>      dst->vui.aspectRatioIdc = src->vui.aspectRatioIdc;
>>      dst->vui.sarWidth = src->vui.sarWidth;
>> diff -r fdbd4e4a2aff -r 196a29866e4e source/encoder/slicetype.cpp
>> --- a/source/encoder/slicetype.cpp Sat Jan 25 18:08:03 2020 +0530
>> +++ b/source/encoder/slicetype.cpp Tue Feb 11 12:02:37 2020 +0530
>> @@ -473,9 +473,9 @@
>>      if (!(param->rc.bStatRead && param->rc.cuTree &&
>> IS_REFERENCED(curFrame)))
>>      {
>>          /* Calculate Qp offset for each 16x16 or 8x8 block in the frame
>> */
>> -        if (param->rc.aqMode == X265_AQ_NONE || param->rc.aqStrength ==
>> 0)
>> +        if (curFrame->m_frameAq == X265_AQ_NONE || param->rc.aqStrength
>> == 0)
>>          {
>> -            if (param->rc.aqMode && param->rc.aqStrength == 0)
>> +            if (curFrame->m_frameAq && param->rc.aqStrength == 0)
>>              {
>>                  if (quantOffsets)
>>                  {
>> @@ -516,10 +516,11 @@
>>                  double bias_strength = 0.f;
>>                  double strength = 0.f;
>>
>> -                if (param->rc.aqMode == X265_AQ_EDGE)
>> +                if (curFrame->m_frameAq == X265_AQ_EDGE ||
>> curFrame->m_frameAq == X265_AQ_EDGE_BIASED)
>>                      edgeFilter(curFrame, param);
>>
>> -                if (param->rc.aqMode == X265_AQ_AUTO_VARIANCE ||
>> param->rc.aqMode == X265_AQ_AUTO_VARIANCE_BIASED || param->rc.aqMode ==
>> X265_AQ_EDGE)
>> +                if (curFrame->m_frameAq == X265_AQ_AUTO_VARIANCE ||
>> curFrame->m_frameAq == X265_AQ_AUTO_VARIANCE_BIASED ||
>> +                    curFrame->m_frameAq == X265_AQ_EDGE ||
>> curFrame->m_frameAq == X265_AQ_EDGE_BIASED)
>>                  {
>>                      double bit_depth_correction = 1.f / (1 << (2 *
>> (X265_DEPTH - 8)));
>>                      for (int blockY = 0; blockY < maxRow; blockY +=
>> loopIncr)
>> @@ -528,7 +529,7 @@
>>                          {
>>                              uint32_t energy, edgeDensity, avgAngle;
>>                              energy = acEnergyCu(curFrame, blockX,
>> blockY, param->internalCsp, param->rc.qgSize);
>> -                            if (param->rc.aqMode == X265_AQ_EDGE)
>> +                            if (curFrame->m_frameAq == X265_AQ_EDGE ||
>> curFrame->m_frameAq == X265_AQ_EDGE_BIASED)
>>                              {
>>                                  edgeDensity = edgeDensityCu(curFrame,
>> avgAngle, blockX, blockY, param->rc.qgSize);
>>                                  if (edgeDensity)
>> @@ -568,17 +569,17 @@
>>                  {
>>                      for (int blockX = 0; blockX < maxCol; blockX +=
>> loopIncr)
>>                      {
>> -                        if (param->rc.aqMode ==
>> X265_AQ_AUTO_VARIANCE_BIASED)
>> +                        if (curFrame->m_frameAq ==
>> X265_AQ_AUTO_VARIANCE_BIASED)
>>                          {
>>                              qp_adj =
>> curFrame->m_lowres.qpCuTreeOffset[blockXY];
>>                              qp_adj = strength * (qp_adj - avg_adj) +
>> bias_strength * (1.f - modeTwoConst / (qp_adj * qp_adj));
>>                          }
>> -                        else if (param->rc.aqMode ==
>> X265_AQ_AUTO_VARIANCE)
>> +                        else if (curFrame->m_frameAq ==
>> X265_AQ_AUTO_VARIANCE)
>>                          {
>>                              qp_adj =
>> curFrame->m_lowres.qpCuTreeOffset[blockXY];
>>                              qp_adj = strength * (qp_adj - avg_adj);
>>                          }
>> -                        else if (param->rc.aqMode == X265_AQ_EDGE)
>> +                        else if (curFrame->m_frameAq == X265_AQ_EDGE)
>>                          {
>>                              inclinedEdge =
>> curFrame->m_lowres.edgeInclined[blockXY];
>>                              qp_adj =
>> curFrame->m_lowres.qpCuTreeOffset[blockXY];
>> @@ -587,6 +588,15 @@
>>                              else
>>                                  qp_adj = strength * (qp_adj - avg_adj);
>>                          }
>> +                        else if (curFrame->m_frameAq ==
>> X265_AQ_EDGE_BIASED)
>> +                        {
>> +                            inclinedEdge =
>> curFrame->m_lowres.edgeInclined[blockXY];
>> +                            qp_adj =
>> curFrame->m_lowres.qpCuTreeOffset[blockXY];
>> +                            if (inclinedEdge && (qp_adj - avg_adj > 0))
>> +                                qp_adj = ((strength + AQ_EDGE_BIAS) *
>> (qp_adj - avg_adj)) + bias_strength * (1.f - modeTwoConst / (qp_adj *
>> qp_adj));
>> +                            else
>> +                                qp_adj = strength * (qp_adj - avg_adj) +
>> bias_strength * (1.f - modeTwoConst / (qp_adj * qp_adj));
>> +                        }
>>                          else
>>                          {
>>                              uint32_t energy = acEnergyCu(curFrame,
>> blockX, blockY, param->internalCsp, param->rc.qgSize);
>> @@ -1370,6 +1380,44 @@
>>      }
>>  }
>>
>> +double computeBrightnessIntensity(pixel *inPlane, int width, int height,
>> intptr_t stride)
>> +{
>> +    pixel* rowStart = inPlane;
>> +    double count = 0;
>> +
>> +    for (int i = 0; i < height; i++)
>> +    {
>> +        for (int j = 0; j < width; j++)
>> +        {
>> +            if (rowStart[j] > BRIGHTNESS_THRESHOLD)
>> +                count++;
>> +        }
>> +        rowStart += stride;
>> +    }
>> +
>> +    /* Returns the brightness percentage of the input plane */
>> +    return (count / (width * height)) * 100;
>> +}
>> +
>> +double computeEdgeIntensity(pixel *inPlane, int width, int height,
>> intptr_t stride)
>> +{
>> +    pixel* rowStart = inPlane;
>> +    double count = 0;
>> +
>> +    for (int i = 0; i < height; i++)
>> +    {
>> +        for (int j = 0; j < width; j++)
>> +        {
>> +            if (rowStart[j] > 0)
>> +                count++;
>> +        }
>> +        rowStart += stride;
>> +    }
>> +
>> +    /* Returns the edge percentage of the input plane */
>> +    return (count / (width * height)) * 100;
>> +}
>> +
>>  void PreLookaheadGroup::processTasks(int workerThreadID)
>>  {
>>      if (workerThreadID < 0)
>> @@ -1384,6 +1432,36 @@
>>          ProfileScopeEvent(prelookahead);
>>          m_lock.release();
>>          preFrame->m_lowres.init(preFrame->m_fencPic, preFrame->m_poc);
>> +
>> +        /* Auto AQ */
>> +        if (preFrame->m_param->rc.bAutoAq)
>> +        {
>> +            int heightL = preFrame->m_lowres.lines;
>> +            int widthL = preFrame->m_lowres.width;
>> +            pixel *lumaPlane = preFrame->m_lowres.fpelPlane[0];
>> +            intptr_t stride = preFrame->m_lowres.lumaStride;
>> +            double brightnessIntensity = 0, edgeIntensity = 0;
>> +
>> +            /* Edge plane computation */
>> +            memset(preFrame->m_lowres.lowresEdgePlane, 0, stride *
>> (heightL + (preFrame->m_fencPic->m_lumaMarginY * 2)) * sizeof(pixel));
>> +            pixel* lowresEdgePic = preFrame->m_lowres.lowresEdgePlane +
>> preFrame->m_fencPic->m_lumaMarginY * stride +
>> preFrame->m_fencPic->m_lumaMarginX;
>> +            computeEdge(lowresEdgePic, lumaPlane, NULL, stride, heightL,
>> widthL, false);
>> +
>> +            /*Frame edge percentage computation */
>> +            edgeIntensity = computeEdgeIntensity(lowresEdgePic, widthL,
>> heightL, stride);
>> +
>> +            /* Frame Brightness percentage computation */
>> +            brightnessIntensity = computeBrightnessIntensity(lumaPlane,
>> widthL, heightL, stride);
>> +
>> +            /* AQ mode switch */
>> +            if (edgeIntensity < AQ_4_THRESHOLD)
>> +                preFrame->m_frameAq = brightnessIntensity >
>> AQ_2_THRESHOLD ? X265_AQ_AUTO_VARIANCE : X265_AQ_AUTO_VARIANCE_BIASED;
>> +            else
>> +                preFrame->m_frameAq = brightnessIntensity >
>> AQ_2_THRESHOLD ? X265_AQ_EDGE : X265_AQ_EDGE_BIASED;
>> +        }
>> +        else
>> +            preFrame->m_frameAq = preFrame->m_param->rc.aqMode;
>> +
>>          if (m_lookahead.m_bAdaptiveQuant)
>>              tld.calcAdaptiveQuantFrame(preFrame, m_lookahead.m_param);
>>          tld.lowresIntraEstimate(preFrame->m_lowres,
>> m_lookahead.m_param->rc.qgSize);
>> @@ -1392,6 +1470,7 @@
>>          m_lock.acquire();
>>      }
>>      m_lock.release();
>> +
>>  }
>>
>>  /* called by API thread or worker thread with inputQueueLock acquired */
>> diff -r fdbd4e4a2aff -r 196a29866e4e source/test/regression-tests.txt
>> --- a/source/test/regression-tests.txt Sat Jan 25 18:08:03 2020 +0530
>> +++ b/source/test/regression-tests.txt Tue Feb 11 12:02:37 2020 +0530
>> @@ -162,6 +162,8 @@
>>  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
>>  sintel_trailer_2k_1920x1080_24.yuv, --preset medium --hist-scenecut
>> --hist-threshold 0.02
>>  sintel_trailer_2k_1920x1080_24.yuv, --preset ultrafast --hist-scenecut
>> --hist-threshold 0.02
>> +ducks_take_off_420_720p50.y4m, --preset medium --auto-aq --aq-strength
>> 1.5
>>
>
> I don't see a reason to have this command-line regressed in addition to
> the one below; please remove.
>
Removed. Added another one for aq-mode 5.

>
>
>> +ducks_take_off_420_720p50.y4m, --preset slow --auto-aq --aq-strength 1.5
>> --aq-motion
>>
>>  # Main12 intraCost overflow bug test
>>  720p50_parkrun_ter.y4m,--preset medium
>> diff -r fdbd4e4a2aff -r 196a29866e4e source/x265.h
>> --- a/source/x265.h Sat Jan 25 18:08:03 2020 +0530
>> +++ b/source/x265.h Tue Feb 11 12:02:37 2020 +0530
>> @@ -574,6 +574,8 @@
>>  #define X265_AQ_AUTO_VARIANCE        2
>>  #define X265_AQ_AUTO_VARIANCE_BIASED 3
>>  #define X265_AQ_EDGE                 4
>> +#define X265_AQ_EDGE_BIASED          5
>> +
>>  #define x265_ADAPT_RD_STRENGTH   4
>>  #define X265_REFINE_INTER_LEVELS 3
>>  /* NOTE! For this release only X265_CSP_I420 and X265_CSP_I444 are
>> supported */
>> @@ -1475,6 +1477,9 @@
>>          /* internally enable if tune grain is set */
>>          int      bEnableConstVbv;
>>
>> +        /* automatically switch AQ mode for each frame */
>> +        int      bAutoAq;
>> +
>>      } rc;
>>
>>      /*== Video Usability Information ==*/
>> diff -r fdbd4e4a2aff -r 196a29866e4e source/x265cli.h
>> --- a/source/x265cli.h Sat Jan 25 18:08:03 2020 +0530
>> +++ b/source/x265cli.h Tue Feb 11 12:02:37 2020 +0530
>> @@ -172,6 +172,8 @@
>>      { "qp",             required_argument, NULL, 'q' },
>>      { "aq-mode",        required_argument, NULL, 0 },
>>      { "aq-strength",    required_argument, NULL, 0 },
>> +    { "auto-aq",              no_argument, NULL, 0 },
>> +    { "no-auto-aq",           no_argument, NULL, 0 },
>>      { "rc-grain",             no_argument, NULL, 0 },
>>      { "no-rc-grain",          no_argument, NULL, 0 },
>>      { "ipratio",        required_argument, NULL, 0 },
>> @@ -580,11 +582,19 @@
>>          "                                    - 0 : Disabled.\n"
>>          "                                    - 1 : Store/Load ctu
>> distortion to/from the file specified in analysis-save/load.\n"
>>          "                                Default 0 - Disabled\n");
>> -    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);
>> +    H0("   --aq-mode <integer>           Mode for Adaptive
>> Quantization.\n"
>> +       "                                     - 0 : none.\n"
>> +       "                                     - 1 : uniform AQ.\n"
>> +       "                                     - 2 : auto variance.\n"
>> +       "                                     - 3 : auto variance with
>> bias to dark scenes.\n"
>> +       "                                     - 4 : auto variance with
>> edge density.\n"
>> +       "                                     - 5 : auto variance with
>> edge density and bias towards dark scenes.\n"
>> +       "                                 Default %d\n",
>> param->rc.aqMode);
>>      H0("   --[no-]hevc-aq                Mode for HEVC Adaptive
>> Quantization. Default %s\n", OPT(param->rc.hevcAq));
>>      H0("   --aq-strength <float>         Reduces blocking and blurring
>> in flat and textured areas (0 to 3.0). Default %.2f\n",
>> param->rc.aqStrength);
>>      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);
>>      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));
>> +    H1("   --[no-]auto-aq                Auto AQ. Default %s\n",
>> OPT(param->rc.bAutoAq));
>>
>
> Please add more info in help to give a 1-liner about the feature
>
Added.

>
>
>>      H0("   --qg-size <int>               Specifies the size of the
>> quantization group (64, 32, 16, 8). Default %d\n", param->rc.qgSize);
>>      H0("   --[no-]cutree                 Enable cutree for Adaptive
>> Quantization. Default %s\n", OPT(param->rc.cuTree));
>>      H0("   --[no-]rc-grain               Enable ratecontrol mode to
>> handle grains specifically. turned on with tune grain. Default %s\n",
>> OPT(param->rc.bEnableGrain));
>> Thanks & Regards
>> *Niranjan Kumar B*
>> Video Codec Engineer
>> Media & AI Analytics
>> +91 958 511 1449
>> <https://multicorewareinc.com/>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20200227/f6d0a7b7/attachment-0001.html>


More information about the x265-devel mailing list