[x265] [PATCH] stats: remove --cu-stats option

Steve Borho steve at borho.org
Wed May 27 18:06:35 CEST 2015


On 05/27, Divya Manivannan wrote:
> # HG changeset patch
> # User Divya Manivannan <divya at multicorewareinc.com>
> # Date 1432717685 -19800
> #      Wed May 27 14:38:05 2015 +0530
> # Node ID 018b54d14c0bb3a1244286d4c4489ff1e31320fa
> # Parent  68d8123c5fe7dcf543d9562d1a701c7d466e0a88
> stats: remove --cu-stats option
> 
> --cu-stats option collected data based on slicetype. This is removed and those data will be collected based on frame.
> 
> diff -r 68d8123c5fe7 -r 018b54d14c0b doc/reST/cli.rst
> --- a/doc/reST/cli.rst	Wed May 27 14:16:34 2015 +0530
> +++ b/doc/reST/cli.rst	Wed May 27 14:38:05 2015 +0530
> @@ -124,13 +124,6 @@
>  	is more of a problem for P frames where some blocks are much more
>  	expensive than others.
>  
> -
> -.. option:: --cu-stats, --no-cu-stats
> -
> -	Records statistics on how each CU was coded (split depths and other
> -	mode decisions) and reports those statistics at the end of the
> -	encode. Default disabled
> -
>  .. option:: --ssim, --no-ssim
>  
>  	Calculate and report Structural Similarity values. It is
> diff -r 68d8123c5fe7 -r 018b54d14c0b source/common/param.cpp
> --- a/source/common/param.cpp	Wed May 27 14:16:34 2015 +0530
> +++ b/source/common/param.cpp	Wed May 27 14:38:05 2015 +0530
> @@ -103,7 +103,6 @@
>      param->logLevel = X265_LOG_INFO;
>      param->csvfn = NULL;
>      param->rc.lambdaFileName = NULL;
> -    param->bLogCuStats = 0;
>      param->decodedPictureHashSEI = 0;
>  
>      /* Quality Measurement Metrics */
> @@ -581,7 +580,6 @@
>              p->logLevel = parseName(value, logLevelNames, bError) - 1;
>          }
>      }
> -    OPT("cu-stats") p->bLogCuStats = atobool(value);

To avoid breaking any work-flows that were using --cu-stats, we should
leave --cu-stats support in param2parse and the CLI getopt() list for
one major release (it can be removed on default after 1.8 is tagged).

If --cu-stats is used, it should issue a warning that the option has
been replaced, and tell the user what it has been replaced by.

This way users that just take our tagged releases see that it has been
removed in 1.8 (safely) and they have until the 1.9 tag to update their
scripts.

>      OPT("annexb") p->bAnnexB = atobool(value);
>      OPT("repeat-headers") p->bRepeatHeaders = atobool(value);
>      OPT("wpp") p->bEnableWavefront = atobool(value);
> diff -r 68d8123c5fe7 -r 018b54d14c0b source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp	Wed May 27 14:16:34 2015 +0530
> +++ b/source/encoder/encoder.cpp	Wed May 27 14:38:05 2015 +0530
> @@ -1048,143 +1048,6 @@
>  #undef ELAPSED_SEC
>  #undef ELAPSED_MSEC
>  #endif
> -
> -    if (!m_param->bLogCuStats)
> -        return;
> -
> -    for (int sliceType = 2; sliceType >= 0; sliceType--)
> -    {
> -        if (sliceType == P_SLICE && !m_analyzeP.m_numPics)
> -            continue;
> -        if (sliceType == B_SLICE && !m_analyzeB.m_numPics)
> -            continue;
> -
> -        StatisticLog finalLog;
> -        for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)
> -        {
> -            int cuSize = g_maxCUSize >> depth;
> -
> -            for (int i = 0; i < m_param->frameNumThreads; i++)
> -            {
> -                StatisticLog& enclog = m_frameEncoder[i]->m_sliceTypeLog[sliceType];
> -                if (!depth)
> -                    finalLog.totalCu += enclog.totalCu;
> -                finalLog.cntIntra[depth] += enclog.cntIntra[depth];
> -                for (int m = 0; m < INTER_MODES; m++)
> -                {
> -                    if (m < INTRA_MODES)
> -                        finalLog.cuIntraDistribution[depth][m] += enclog.cuIntraDistribution[depth][m];
> -                    finalLog.cuInterDistribution[depth][m] += enclog.cuInterDistribution[depth][m];
> -                }
> -
> -                if (cuSize == 8 && m_sps.quadtreeTULog2MinSize < 3)
> -                    finalLog.cntIntraNxN += enclog.cntIntraNxN;
> -                if (sliceType != I_SLICE)
> -                {
> -                    finalLog.cntTotalCu[depth] += enclog.cntTotalCu[depth];
> -                    finalLog.cntInter[depth] += enclog.cntInter[depth];
> -                    finalLog.cntSkipCu[depth] += enclog.cntSkipCu[depth];
> -                }
> -            }
> -
> -            uint64_t cntInter, cntSkipCu, cntIntra = 0, cntIntraNxN = 0, encCu = 0;
> -            uint64_t cuInterDistribution[INTER_MODES], cuIntraDistribution[INTRA_MODES];
> -
> -            // check for 0/0, if true assign 0 else calculate percentage
> -            for (int n = 0; n < INTER_MODES; n++)
> -            {
> -                if (!finalLog.cntInter[depth])
> -                    cuInterDistribution[n] = 0;
> -                else
> -                    cuInterDistribution[n] = (finalLog.cuInterDistribution[depth][n] * 100) / finalLog.cntInter[depth];
> -
> -                if (n < INTRA_MODES)
> -                {
> -                    if (!finalLog.cntIntra[depth])
> -                    {
> -                        cntIntraNxN = 0;
> -                        cuIntraDistribution[n] = 0;
> -                    }
> -                    else
> -                    {
> -                        cntIntraNxN = (finalLog.cntIntraNxN * 100) / finalLog.cntIntra[depth];
> -                        cuIntraDistribution[n] = (finalLog.cuIntraDistribution[depth][n] * 100) / finalLog.cntIntra[depth];
> -                    }
> -                }
> -            }
> -
> -            if (!finalLog.totalCu)
> -                encCu = 0;
> -            else if (sliceType == I_SLICE)
> -            {
> -                cntIntra = (finalLog.cntIntra[depth] * 100) / finalLog.totalCu;
> -                cntIntraNxN = (finalLog.cntIntraNxN * 100) / finalLog.totalCu;
> -            }
> -            else
> -                encCu = ((finalLog.cntIntra[depth] + finalLog.cntInter[depth]) * 100) / finalLog.totalCu;
> -
> -            if (sliceType == I_SLICE)
> -            {
> -                cntInter = 0;
> -                cntSkipCu = 0;
> -            }
> -            else if (!finalLog.cntTotalCu[depth])
> -            {
> -                cntInter = 0;
> -                cntIntra = 0;
> -                cntSkipCu = 0;
> -            }
> -            else
> -            {
> -                cntInter = (finalLog.cntInter[depth] * 100) / finalLog.cntTotalCu[depth];
> -                cntIntra = (finalLog.cntIntra[depth] * 100) / finalLog.cntTotalCu[depth];
> -                cntSkipCu = (finalLog.cntSkipCu[depth] * 100) / finalLog.cntTotalCu[depth];
> -            }
> -
> -            // print statistics
> -            char stats[256] = { 0 };
> -            int len = 0;
> -            if (sliceType != I_SLICE)
> -                len += sprintf(stats + len, " EncCU "X265_LL "%% Merge "X265_LL "%%", encCu, cntSkipCu);
> -
> -            if (cntInter)
> -            {
> -                len += sprintf(stats + len, " Inter "X265_LL "%%", cntInter);
> -                if (m_param->bEnableAMP)
> -                    len += sprintf(stats + len, "(%dx%d "X265_LL "%% %dx%d "X265_LL "%% %dx%d "X265_LL "%% AMP "X265_LL "%%)",
> -                                   cuSize, cuSize, cuInterDistribution[0],
> -                                   cuSize / 2, cuSize, cuInterDistribution[2],
> -                                   cuSize, cuSize / 2, cuInterDistribution[1],
> -                                   cuInterDistribution[3]);
> -                else if (m_param->bEnableRectInter)
> -                    len += sprintf(stats + len, "(%dx%d "X265_LL "%% %dx%d "X265_LL "%% %dx%d "X265_LL "%%)",
> -                                   cuSize, cuSize, cuInterDistribution[0],
> -                                   cuSize / 2, cuSize, cuInterDistribution[2],
> -                                   cuSize, cuSize / 2, cuInterDistribution[1]);
> -            }
> -            if (cntIntra)
> -            {
> -                len += sprintf(stats + len, " Intra "X265_LL "%%(DC "X265_LL "%% P "X265_LL "%% Ang "X265_LL "%%",
> -                               cntIntra, cuIntraDistribution[0],
> -                               cuIntraDistribution[1], cuIntraDistribution[2]);
> -                if (sliceType != I_SLICE)
> -                {
> -                    if (cuSize == 8 && m_sps.quadtreeTULog2MinSize < 3)
> -                        len += sprintf(stats + len, " %dx%d "X265_LL "%%", cuSize / 2, cuSize / 2, cntIntraNxN);
> -                }
> -
> -                len += sprintf(stats + len, ")");
> -                if (sliceType == I_SLICE)
> -                {
> -                    if (cuSize == 8 && m_sps.quadtreeTULog2MinSize < 3)
> -                        len += sprintf(stats + len, " %dx%d: "X265_LL "%%", cuSize / 2, cuSize / 2, cntIntraNxN);
> -                }
> -            }
> -            const char slicechars[] = "BPI";
> -            if (stats[0])
> -                x265_log(m_param, X265_LOG_INFO, "%c%-2d:%s\n", slicechars[sliceType], cuSize, stats);
> -        }
> -    }
>  }
>  
>  void Encoder::fetchStats(x265_stats *stats, size_t statsSizeBytes)
> diff -r 68d8123c5fe7 -r 018b54d14c0b source/encoder/frameencoder.cpp
> --- a/source/encoder/frameencoder.cpp	Wed May 27 14:16:34 2015 +0530
> +++ b/source/encoder/frameencoder.cpp	Wed May 27 14:38:05 2015 +0530
> @@ -904,7 +904,7 @@
>          // Completed CU processing
>          curRow.completed++;
>  
> -        if (m_param->bLogCuStats || m_param->rc.bStatWrite)
> +        if (m_param->rc.bStatWrite)
>              curEncData.m_rowStat[row].sumQpAq += collectCTUStatistics(*ctu, qTreeInterCnt, qTreeIntraCnt, qTreeSkipCnt);
>          else if (m_param->rc.aqMode)
>              curEncData.m_rowStat[row].sumQpAq += calcCTUQP(*ctu);
> diff -r 68d8123c5fe7 -r 018b54d14c0b source/x265.h
> --- a/source/x265.h	Wed May 27 14:16:34 2015 +0530
> +++ b/source/x265.h	Wed May 27 14:38:05 2015 +0530
> @@ -439,10 +439,6 @@
>  
>      /*== Logging Features ==*/
>  
> -    /* Enable analysis and logging distribution of CUs encoded across various
> -     * modes during mode decision. Default disabled */
> -    int       bLogCuStats;
> -
>      /* Enable the measurement and reporting of PSNR. Default is enabled */
>      int       bEnablePsnr;
>  
> diff -r 68d8123c5fe7 -r 018b54d14c0b source/x265cli.h
> --- a/source/x265cli.h	Wed May 27 14:16:34 2015 +0530
> +++ b/source/x265cli.h	Wed May 27 14:38:05 2015 +0530
> @@ -54,8 +54,6 @@
>      { "allow-non-conformance",no_argument, NULL, 0 },
>      { "no-allow-non-conformance",no_argument, NULL, 0 },
>      { "csv",            required_argument, NULL, 0 },
> -    { "no-cu-stats",          no_argument, NULL, 0 },
> -    { "cu-stats",             no_argument, NULL, 0 },

so leave this in place

>      { "y4m",                  no_argument, NULL, 0 },
>      { "no-progress",          no_argument, NULL, 0 },
>      { "output",         required_argument, NULL, 'o' },
> @@ -247,7 +245,6 @@
>      H0("-D/--output-depth 8|10           Output bit depth (also internal bit depth). Default %d\n", param->internalBitDepth);
>      H0("   --log-level <string>          Logging level: none error warning info debug full. Default %s\n", x265::logLevelNames[param->logLevel + 1]);
>      H0("   --no-progress                 Disable CLI progress reports\n");
> -    H0("   --[no-]cu-stats               Enable logging stats about distribution of cu across all modes. Default %s\n",OPT(param->bLogCuStats));

but remove this

>      H1("   --csv <filename>              Comma separated log file, log level >= 3 frame log, else one line per run\n");
>      H0("\nInput Options:\n");
>      H0("   --input <filename>            Raw YUV or Y4M input file name. `-` for stdin\n");
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel

obviously before this gets pushed it would need to include an API bump.

-- 
Steve Borho


More information about the x265-devel mailing list