[x265] [PATCH] cli: modify --csv as CLI only option and move csv printing to x265.cpp

Steve Borho steve at borho.org
Wed Jun 10 17:40:22 CEST 2015


On 06/10, Divya Manivannan wrote:
> # HG changeset patch
> # User Divya Manivannan <divya at multicorewareinc.com>
> # Date 1433941776 -19800
> #      Wed Jun 10 18:39:36 2015 +0530
> # Node ID fd1018a48cc60d7ff6359a8a18ed01d6ae46324b
> # Parent  fbd752fe09427150250cdc13c30506c17d330052
> cli: modify --csv as CLI only option and move csv printing to x265.cpp
> 
> diff -r fbd752fe0942 -r fd1018a48cc6 doc/reST/api.rst
> --- a/doc/reST/api.rst	Wed Jun 10 17:32:11 2015 +0530
> +++ b/doc/reST/api.rst	Wed Jun 10 18:39:36 2015 +0530
> @@ -338,15 +338,6 @@
>  Cleanup
>  =======
>  
> -At the end of the encode, the application will want to trigger logging
> -of the final encode statistics, if :option:`--csv` had been specified::
> -
> -	/* x265_encoder_log:
> -	 *       write a line to the configured CSV file.  If a CSV filename was not
> -	 *       configured, or file open failed, or the log level indicated frame level
> -	 *       logging, this function will perform no write. */
> -	void x265_encoder_log(x265_encoder *encoder, int argc, char **argv);
> -
>  Finally, the encoder must be closed in order to free all of its
>  resources. An encoder that has been flushed cannot be restarted and
>  reused. Once **x265_encoder_close()** has been called, the encoder
> diff -r fbd752fe0942 -r fd1018a48cc6 doc/reST/cli.rst
> --- a/doc/reST/cli.rst	Wed Jun 10 17:32:11 2015 +0530
> +++ b/doc/reST/cli.rst	Wed Jun 10 18:39:36 2015 +0530
> @@ -52,6 +52,7 @@
>  	2. unable to open encoder
>  	3. unable to generate stream headers
>  	4. encoder abort
> +	5. unable to open csv file
>  
>  Logging/Statistic Options
>  =========================
> @@ -123,6 +124,8 @@
>  	enough ahead for the necessary reference data to be available. This
>  	is more of a problem for P frames where some blocks are much more
>  	expensive than others.
> +	
> +	**CLI ONLY**
>  
>  .. option:: --ssim, --no-ssim
>  
> diff -r fbd752fe0942 -r fd1018a48cc6 source/CMakeLists.txt
> --- a/source/CMakeLists.txt	Wed Jun 10 17:32:11 2015 +0530
> +++ b/source/CMakeLists.txt	Wed Jun 10 18:39:36 2015 +0530
> @@ -30,7 +30,7 @@
>  mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
>  
>  # X265_BUILD must be incremented each time the public API is changed
> -set(X265_BUILD 61)
> +set(X265_BUILD 62)
>  configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
>                 "${PROJECT_BINARY_DIR}/x265.def")
>  configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
> diff -r fbd752fe0942 -r fd1018a48cc6 source/common/param.cpp
> --- a/source/common/param.cpp	Wed Jun 10 17:32:11 2015 +0530
> +++ b/source/common/param.cpp	Wed Jun 10 18:39:36 2015 +0530
> @@ -109,7 +109,6 @@
>      param->frameNumThreads = 0;
>  
>      param->logLevel = X265_LOG_INFO;
> -    param->csvfn = NULL;
>      param->rc.lambdaFileName = NULL;
>      param->bLogCuStats = 0;
>      param->decodedPictureHashSEI = 0;
> @@ -857,7 +856,6 @@
>          p->rc.bStatRead = pass & 2;
>      }
>      OPT("stats") p->rc.statFileName = strdup(value);
> -    OPT("csv") p->csvfn = strdup(value);
>      OPT("scaling-list") p->scalingLists = strdup(value);
>      OPT2("pools", "numa-pools") p->numaPools = strdup(value);
>      OPT("lambda-file") p->rc.lambdaFileName = strdup(value);
> diff -r fbd752fe0942 -r fd1018a48cc6 source/encoder/api.cpp
> --- a/source/encoder/api.cpp	Wed Jun 10 17:32:11 2015 +0530
> +++ b/source/encoder/api.cpp	Wed Jun 10 18:39:36 2015 +0530
> @@ -190,15 +190,6 @@
>      }
>  }
>  
> -void x265_encoder_log(x265_encoder* enc, int argc, char **argv)
> -{
> -    if (enc)
> -    {
> -        Encoder *encoder = static_cast<Encoder*>(enc);
> -        encoder->writeLog(argc, argv);
> -    }
> -}
> -
>  void x265_encoder_close(x265_encoder *enc)
>  {
>      if (enc)
> @@ -279,7 +270,6 @@
>      &x265_encoder_headers,
>      &x265_encoder_encode,
>      &x265_encoder_get_stats,
> -    &x265_encoder_log,
>      &x265_encoder_close,
>      &x265_cleanup,
>  };
> diff -r fbd752fe0942 -r fd1018a48cc6 source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp	Wed Jun 10 17:32:11 2015 +0530
> +++ b/source/encoder/encoder.cpp	Wed Jun 10 18:39:36 2015 +0530
> @@ -39,18 +39,14 @@
>  
>  #include "x265.h"
>  
> +#if _MSC_VER
> +#pragma warning (disable: 4996) // POSIX functions are just fine, thanks
> +#endif
> +
>  namespace X265_NS {
>  const char g_sliceTypeToChar[] = {'B', 'P', 'I'};
>  }
>  
> -static const char* summaryCSVHeader =
> -    "Command, Date/Time, Elapsed Time, FPS, Bitrate, "
> -    "Y PSNR, U PSNR, V PSNR, Global PSNR, SSIM, SSIM (dB), "
> -    "I count, I ave-QP, I kpbs, I-PSNR Y, I-PSNR U, I-PSNR V, I-SSIM (dB), "
> -    "P count, P ave-QP, P kpbs, P-PSNR Y, P-PSNR U, P-PSNR V, P-SSIM (dB), "
> -    "B count, B ave-QP, B kpbs, B-PSNR Y, B-PSNR U, B-PSNR V, B-SSIM (dB), "
> -    "Version\n";
> -
>  static const char* defaultAnalysisFileName = "x265_analysis.dat";
>  
>  using namespace X265_NS;
> @@ -72,7 +68,6 @@
>      m_exportedPic = NULL;
>      m_numDelayedPic = 0;
>      m_outputCount = 0;
> -    m_csvfpt = NULL;
>      m_param = NULL;
>      m_latestParam = NULL;
>      m_cuOffsetY = NULL;
> @@ -223,43 +218,6 @@
>      initSPS(&m_sps);
>      initPPS(&m_pps);
>  
> -    /* Try to open CSV file handle */
> -    if (m_param->csvfn)
> -    {
> -        m_csvfpt = fopen(m_param->csvfn, "r");
> -        if (m_csvfpt)
> -        {
> -            /* file already exists, re-open for append */
> -            fclose(m_csvfpt);
> -            m_csvfpt = fopen(m_param->csvfn, "ab");
> -        }
> -        else
> -        {
> -            /* new CSV file, write header */
> -            m_csvfpt = fopen(m_param->csvfn, "wb");
> -            if (m_csvfpt)
> -            {
> -                if (m_param->logLevel >= X265_LOG_FRAME)
> -                {
> -                    fprintf(m_csvfpt, "Encode Order, Type, POC, QP, Bits, ");
> -                    if (m_param->rc.rateControlMode == X265_RC_CRF)
> -                        fprintf(m_csvfpt, "RateFactor, ");
> -                    fprintf(m_csvfpt, "Y PSNR, U PSNR, V PSNR, YUV PSNR, SSIM, SSIM (dB),  List 0, List 1");
> -                    /* detailed performance statistics */
> -                    fprintf(m_csvfpt, ", DecideWait (ms), Row0Wait (ms), Wall time (ms), Ref Wait Wall (ms), Total CTU time (ms), Stall Time (ms), Avg WPP, Row Blocks\n");
> -                }
> -                else
> -                    fputs(summaryCSVHeader, m_csvfpt);
> -            }
> -        }
> -
> -        if (!m_csvfpt)
> -        {
> -            x265_log(m_param, X265_LOG_ERROR, "Unable to open CSV log file <%s>, aborting\n", m_param->csvfn);
> -            m_aborted = true;
> -        }
> -    }
> -
>      int numRows = (m_param->sourceHeight + g_maxCUSize - 1) / g_maxCUSize;
>      int numCols = (m_param->sourceWidth  + g_maxCUSize - 1) / g_maxCUSize;
>      for (int i = 0; i < m_param->frameNumThreads; i++)
> @@ -371,8 +329,6 @@
>  
>      if (m_analysisFile)
>          fclose(m_analysisFile);
> -    if (m_csvfpt)
> -        fclose(m_csvfpt);
>  
>      if (m_param)
>      {
> @@ -381,7 +337,6 @@
>          free((char*)m_param->rc.statFileName);
>          free((char*)m_param->analysisFileName);
>          free((char*)m_param->scalingLists);
> -        free((char*)m_param->csvfn);
>          free((char*)m_param->numaPools);
>          free((char*)m_param->masteringDisplayColorVolume);
>          free((char*)m_param->contentLightLevelInfo);
> @@ -1075,6 +1030,10 @@
>              stats->bitrate = 0;
>              stats->elapsedVideoTime = 0;
>          }
> +        char buff[100];
> +        stats->buffI = strdup(statsCSVString(m_analyzeI, buff));
> +        stats->buffP = strdup(statsCSVString(m_analyzeP, buff));
> +        stats->buffB = strdup(statsCSVString(m_analyzeB, buff));
>      }
>  
>      /* If new statistics are added to x265_stats, we must check here whether the
> @@ -1082,57 +1041,6 @@
>       * future safety) */
>  }
>  
> -void Encoder::writeLog(int argc, char **argv)
> -{
> -    if (m_csvfpt)
> -    {
> -        if (m_param->logLevel >= X265_LOG_FRAME)
> -        {
> -            // adding summary to a per-frame csv log file needs a summary header
> -            fprintf(m_csvfpt, "\nSummary\n");
> -            fputs(summaryCSVHeader, m_csvfpt);
> -        }
> -        // CLI arguments or other
> -        for (int i = 1; i < argc; i++)
> -        {
> -            if (i) fputc(' ', m_csvfpt);
> -            fputs(argv[i], m_csvfpt);
> -        }
> -
> -        // current date and time
> -        time_t now;
> -        struct tm* timeinfo;
> -        time(&now);
> -        timeinfo = localtime(&now);
> -        char buffer[200];
> -        strftime(buffer, 128, "%c", timeinfo);
> -        fprintf(m_csvfpt, ", %s, ", buffer);
> -
> -        x265_stats stats;
> -        fetchStats(&stats, sizeof(stats));
> -
> -        // elapsed time, fps, bitrate
> -        fprintf(m_csvfpt, "%.2f, %.2f, %.2f,",
> -                stats.elapsedEncodeTime, stats.encodedPictureCount / stats.elapsedEncodeTime, stats.bitrate);
> -
> -        if (m_param->bEnablePsnr)
> -            fprintf(m_csvfpt, " %.3lf, %.3lf, %.3lf, %.3lf,",
> -                    stats.globalPsnrY / stats.encodedPictureCount, stats.globalPsnrU / stats.encodedPictureCount,
> -                    stats.globalPsnrV / stats.encodedPictureCount, stats.globalPsnr);
> -        else
> -            fprintf(m_csvfpt, " -, -, -, -,");
> -        if (m_param->bEnableSsim)
> -            fprintf(m_csvfpt, " %.6f, %6.3f,", stats.globalSsim, x265_ssim2dB(stats.globalSsim));
> -        else
> -            fprintf(m_csvfpt, " -, -,");
> -
> -        fputs(statsCSVString(m_analyzeI, buffer), m_csvfpt);
> -        fputs(statsCSVString(m_analyzeP, buffer), m_csvfpt);
> -        fputs(statsCSVString(m_analyzeB, buffer), m_csvfpt);
> -        fprintf(m_csvfpt, " %s\n", x265_version_str);
> -    }
> -}
> -
>  /**
>   * Produce an ascii(hex) representation of picture digest.
>   *
> @@ -1281,59 +1189,6 @@
>  
>          x265_log(m_param, X265_LOG_DEBUG, "%s\n", buf);
>      }
> -
> -    if (m_param->logLevel >= X265_LOG_FRAME && m_csvfpt)
> -    {
> -        // per frame CSV logging if the file handle is valid
> -        fprintf(m_csvfpt, "%d, %c-SLICE, %4d, %2.2lf, %10d,", m_outputCount++, c, poc, curEncData.m_avgQpAq, (int)bits);
> -        if (m_param->rc.rateControlMode == X265_RC_CRF)
> -            fprintf(m_csvfpt, "%.3lf,", curEncData.m_rateFactor);
> -        double psnr = (psnrY * 6 + psnrU + psnrV) / 8;
> -        if (m_param->bEnablePsnr)
> -            fprintf(m_csvfpt, "%.3lf, %.3lf, %.3lf, %.3lf,", psnrY, psnrU, psnrV, psnr);
> -        else
> -            fputs(" -, -, -, -,", m_csvfpt);
> -        if (m_param->bEnableSsim)
> -            fprintf(m_csvfpt, " %.6f, %6.3f", ssim, x265_ssim2dB(ssim));
> -        else
> -            fputs(" -, -", m_csvfpt);
> -        if (slice->isIntra())
> -            fputs(", -, -", m_csvfpt);
> -        else
> -        {
> -            int numLists = slice->isInterP() ? 1 : 2;
> -            for (int list = 0; list < numLists; list++)
> -            {
> -                fprintf(m_csvfpt, ", ");
> -                for (int ref = 0; ref < slice->m_numRefIdx[list]; ref++)
> -                {
> -                    int k = slice->m_refPOCList[list][ref] - slice->m_lastIDR;
> -                    fprintf(m_csvfpt, " %d", k);
> -                }
> -            }
> -
> -            if (numLists == 1)
> -                fputs(", -", m_csvfpt);
> -        }
> -
> -#define ELAPSED_MSEC(start, end) (((double)(end) - (start)) / 1000)
> -
> -        // detailed frame statistics
> -        fprintf(m_csvfpt, ", %.1lf, %.1lf, %.1lf, %.1lf, %.1lf, %.1lf",
> -            ELAPSED_MSEC(0, curEncoder->m_slicetypeWaitTime),
> -            ELAPSED_MSEC(curEncoder->m_startCompressTime, curEncoder->m_row0WaitTime),
> -            ELAPSED_MSEC(curEncoder->m_row0WaitTime, curEncoder->m_endCompressTime),
> -            ELAPSED_MSEC(curEncoder->m_row0WaitTime, curEncoder->m_allRowsAvailableTime),
> -            ELAPSED_MSEC(0, curEncoder->m_totalWorkerElapsedTime),
> -            ELAPSED_MSEC(0, curEncoder->m_totalNoWorkerTime));
> -        if (curEncoder->m_totalActiveWorkerCount)
> -            fprintf(m_csvfpt, ", %.3lf", (double)curEncoder->m_totalActiveWorkerCount / curEncoder->m_activeWorkerCountSamples);
> -        else
> -            fputs(", 1", m_csvfpt);
> -        fprintf(m_csvfpt, ", %d", curEncoder->m_countRowBlocks);
> -        fprintf(m_csvfpt, "\n");
> -        fflush(stderr);
> -    }
>  }
>  
>  #if defined(_MSC_VER)
> diff -r fbd752fe0942 -r fd1018a48cc6 source/encoder/encoder.h
> --- a/source/encoder/encoder.h	Wed Jun 10 17:32:11 2015 +0530
> +++ b/source/encoder/encoder.h	Wed Jun 10 18:39:36 2015 +0530
> @@ -105,7 +105,6 @@
>      EncStats           m_analyzeI;
>      EncStats           m_analyzeP;
>      EncStats           m_analyzeB;
> -    FILE*              m_csvfpt;
>      int64_t            m_encodeStartTime;
>  
>      // weighted prediction
> @@ -149,8 +148,6 @@
>  
>      void fetchStats(x265_stats* stats, size_t statsSizeBytes);
>  
> -    void writeLog(int argc, char **argv);
> -
>      void printSummary();
>  
>      char* statsString(EncStats&, char*);
> diff -r fbd752fe0942 -r fd1018a48cc6 source/x265.cpp
> --- a/source/x265.cpp	Wed Jun 10 17:32:11 2015 +0530
> +++ b/source/x265.cpp	Wed Jun 10 18:39:36 2015 +0530
> @@ -68,12 +68,22 @@
>      b_ctrl_c = 1;
>  }
>  
> +static const char* summaryCSVHeader =
> +    "Command, Date/Time, Elapsed Time, FPS, Bitrate, "
> +    "Y PSNR, U PSNR, V PSNR, Global PSNR, SSIM, SSIM (dB), "
> +    "I count, I ave-QP, I kpbs, I-PSNR Y, I-PSNR U, I-PSNR V, I-SSIM (dB), "
> +    "P count, P ave-QP, P kpbs, P-PSNR Y, P-PSNR U, P-PSNR V, P-SSIM (dB), "
> +    "B count, B ave-QP, B kpbs, B-PSNR Y, B-PSNR U, B-PSNR V, B-SSIM (dB), "
> +    "Version\n";
> +
>  struct CLIOptions
>  {
>      InputFile* input;
>      ReconFile* recon;
>      OutputFile* output;
>      FILE*       qpfile;
> +    FILE*       csvfpt;
> +    const char* csvfn;
>      const char* reconPlayCmd;
>      const x265_api* api;
>      x265_param* param;
> @@ -95,6 +105,8 @@
>          recon = NULL;
>          output = NULL;
>          qpfile = NULL;
> +        csvfpt = NULL;
> +        csvfn = NULL;
>          reconPlayCmd = NULL;
>          api = NULL;
>          param = NULL;
> @@ -108,6 +120,8 @@
>      }
>  
>      void destroy();
> +    bool parseCSVFile();
> +    void printLog(int argc, char **argv, x265_stats stats);
>      void printStatus(uint32_t frameNum);
>      bool parse(int argc, char **argv);
>      bool parseQPFile(x265_picture &pic_org);
> @@ -124,11 +138,81 @@
>      if (qpfile)
>          fclose(qpfile);
>      qpfile = NULL;
> +    if (csvfpt)
> +        fclose(csvfpt);
> +    csvfpt = NULL;
>      if (output)
>          output->release();
>      output = NULL;
>  }
>  
> +bool CLIOptions::parseCSVFile()
> +{
> +    csvfpt = fopen(csvfn, "r");
> +    if (csvfpt)
> +    {
> +        /* file already exists, re-open for append */
> +        fclose(csvfpt);
> +        csvfpt = fopen(csvfn, "ab");
> +    }
> +    else
> +    {
> +        /* new CSV file, write header */
> +        csvfpt = fopen(csvfn, "wb");
> +        if (csvfpt)
> +            fputs(summaryCSVHeader, csvfpt);
> +    }
> +
> +    if (!csvfpt)
> +    {
> +        x265_log(param, X265_LOG_ERROR, "Unable to open CSV log file <%s>, aborting\n", csvfn);
> +        return true;
> +    }
> +    return false;
> +}
> +
> +void CLIOptions::printLog(int argc, char **argv, x265_stats stats)
> +{
> +    if (csvfpt)
> +    {
> +        // CLI arguments or other
> +        for (int i = 1; i < argc; i++)
> +        {
> +            if (i) fputc(' ', csvfpt);
> +            fputs(argv[i], csvfpt);
> +        }
> +
> +        // current date and time
> +        time_t now;
> +        struct tm* timeinfo;
> +        time(&now);
> +        timeinfo = localtime(&now);
> +        char buffer[200];
> +        strftime(buffer, 128, "%c", timeinfo);
> +        fprintf(csvfpt, ", %s, ", buffer);
> +
> +        // elapsed time, fps, bitrate
> +        fprintf(csvfpt, "%.2f, %.2f, %.2f,",
> +            stats.elapsedEncodeTime, stats.encodedPictureCount / stats.elapsedEncodeTime, stats.bitrate);
> +
> +        if (param->bEnablePsnr)
> +            fprintf(csvfpt, " %.3lf, %.3lf, %.3lf, %.3lf,",
> +            stats.globalPsnrY / stats.encodedPictureCount, stats.globalPsnrU / stats.encodedPictureCount,
> +            stats.globalPsnrV / stats.encodedPictureCount, stats.globalPsnr);
> +        else
> +            fprintf(csvfpt, " -, -, -, -,");
> +        if (param->bEnableSsim)
> +            fprintf(csvfpt, " %.6f, %6.3f,", stats.globalSsim, x265_ssim2dB(stats.globalSsim));
> +        else
> +            fprintf(csvfpt, " -, -,");
> +
> +        fputs(stats.buffI, csvfpt);
> +        fputs(stats.buffP, csvfpt);
> +        fputs(stats.buffB, csvfpt);
> +        fprintf(csvfpt, " %s\n", x265_version_str);
> +    }
> +}
> +
>  void CLIOptions::printStatus(uint32_t frameNum)
>  {
>      char buf[200];
> @@ -271,6 +355,7 @@
>              if (0) ;
>              OPT2("frame-skip", "seek") this->seek = (uint32_t)x265_atoi(optarg, bError);
>              OPT("frames") this->framesToBeEncoded = (uint32_t)x265_atoi(optarg, bError);
> +            OPT("csv") this->csvfn = optarg;
>              OPT("no-progress") this->bProgress = false;
>              OPT("output") outputfn = optarg;
>              OPT("input") inputfn = optarg;
> @@ -475,7 +560,8 @@
>   * 1 - unable to parse command line
>   * 2 - unable to open encoder
>   * 3 - unable to generate stream headers
> - * 4 - encoder abort */
> + * 4 - encoder abort
> + * 5 - unable to open csv file */
>  
>  int main(int argc, char **argv)
>  {
> @@ -509,6 +595,17 @@
>      if (cliopt.reconPlayCmd)
>          reconPlay = new ReconPlay(cliopt.reconPlayCmd, *param);
>  
> +    if (cliopt.csvfn)
> +    {
> +        if (cliopt.parseCSVFile())
> +        {
> +            cliopt.destroy();
> +            if (cliopt.api)
> +                cliopt.api->param_free(cliopt.param);
> +            exit(5);
> +        }
> +    }
> +
>      /* note: we could try to acquire a different libx265 API here based on
>       * the profile found during option parsing, but it must be done before
>       * opening an encoder */
> @@ -669,8 +766,8 @@
>      delete reconPlay;
>  
>      api->encoder_get_stats(encoder, &stats, sizeof(stats));
> -    if (param->csvfn && !b_ctrl_c)
> -        api->encoder_log(encoder, argc, argv);
> +    if (cliopt.csvfn && !b_ctrl_c)
> +        cliopt.printLog(argc, argv, stats);
>      api->encoder_close(encoder);
>  
>      int64_t second_largest_pts = 0;
> diff -r fbd752fe0942 -r fd1018a48cc6 source/x265.def.in
> --- a/source/x265.def.in	Wed Jun 10 17:32:11 2015 +0530
> +++ b/source/x265.def.in	Wed Jun 10 18:39:36 2015 +0530
> @@ -17,7 +17,6 @@
>  x265_encoder_reconfig
>  x265_encoder_encode
>  x265_encoder_get_stats
> -x265_encoder_log
>  x265_encoder_close
>  x265_cleanup
>  x265_api_get_${X265_BUILD}
> diff -r fbd752fe0942 -r fd1018a48cc6 source/x265.h
> --- a/source/x265.h	Wed Jun 10 17:32:11 2015 +0530
> +++ b/source/x265.h	Wed Jun 10 18:39:36 2015 +0530
> @@ -316,6 +316,9 @@
>      uint64_t  accBits;              /* total bits output thus far */
>      uint32_t  encodedPictureCount;  /* number of output pictures thus far */
>      uint32_t  totalWPFrames;        /* number of uni-directional weighted frames used */
> +    char*     buffI;
> +    char*     buffP;
> +    char*     buffB;

these desperately need comments, and I really doubt they should be
strings

>  } x265_stats;
>  
>  /* String values accepted by x265_param_parse() (and CLI) for various parameters */
> @@ -453,13 +456,6 @@
>       * X265_LOG_FULL, default is X265_LOG_INFO */
>      int       logLevel;
>  
> -    /* filename of CSV log. If logLevel greater than or equal to X265_LOG_FRAME,
> -     * the encoder will emit per-slice statistics to this log file in encode
> -     * order. Otherwise the encoder will emit per-stream statistics into the log
> -     * file when x265_encoder_log is called (presumably at the end of the
> -     * encode) */
> -    const char* csvfn;
> -
>      /*== Internal Picture Specification ==*/
>  
>      /* Internal encoder bit depth. If x265 was compiled to use 8bit pixels
> @@ -1262,12 +1258,6 @@
>   *       returns encoder statistics */
>  void x265_encoder_get_stats(x265_encoder *encoder, x265_stats *, uint32_t statsSizeBytes);
>  
> -/* x265_encoder_log:
> - *       write a line to the configured CSV file.  If a CSV filename was not
> - *       configured, or file open failed, or the log level indicated frame level
> - *       logging, this function will perform no write. */
> -void x265_encoder_log(x265_encoder *encoder, int argc, char **argv);
> -
>  /* x265_encoder_close:
>   *      close an encoder handler */
>  void x265_encoder_close(x265_encoder *);
> @@ -1314,7 +1304,6 @@
>      int           (*encoder_headers)(x265_encoder*, x265_nal**, uint32_t*);
>      int           (*encoder_encode)(x265_encoder*, x265_nal**, uint32_t*, x265_picture*, x265_picture*);
>      void          (*encoder_get_stats)(x265_encoder*, x265_stats*, uint32_t);
> -    void          (*encoder_log)(x265_encoder*, int, char**);
>      void          (*encoder_close)(x265_encoder*);
>      void          (*cleanup)(void);
>      /* add new pointers to the end, or increment X265_MAJOR_VERSION */

non-backward compatible changes to x265_api require X265_MAJOR_VERSION
to be incremented.

As an alternative, you can leave x265_encoder_log() in place, but mark
it as obsolete in the header and have the function simply emit a warning
message if called.  In the future, when we do need to bump
X265_MAJOR_VERSION for some really compelling reason, we will remove the
obsolete function.

-- 
Steve Borho


More information about the x265-devel mailing list