<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 12, 2017 at 3:17 PM, Divya Manivannan <span dir="ltr"><<a href="mailto:divya@multicorewareinc.com" target="_blank">divya@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""># HG changeset patch<br>
# User Divya Manivannan <<a href="mailto:divya@multicorewareinc.com">divya@multicorewareinc.com</a>><br>
# Date 1497012715 -19800<br>
# Fri Jun 09 18:21:55 2017 +0530<br>
</span># Node ID 12097d65c3cc2d0624ca7a2a70cee2<wbr>d53241c71d<br>
# Parent b19bc0c7b4eccfe336ecd381df2520<wbr>3ee6f57d05<br>
<span class="">Add csv feature into libx265<br></span></blockquote><div><br></div><div>This is a good feature to pull into the library. It should help folks integrating other applications with libx265 to get stats about the encode.</div><div>Pushed into default branch.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
</span>diff -r b19bc0c7b4ec -r 12097d65c3cc doc/reST/api.rst<br>
--- a/doc/reST/api.rst Tue Jun 06 11:13:19 2017 +0530<br>
<span class="">+++ b/doc/reST/api.rst Fri Jun 09 18:21:55 2017 +0530<br>
@@ -347,6 +347,14 @@<br>
Cleanup<br>
=======<br>
<br>
+At the end of the encode, the application will want to trigger logging<br>
+of the final encode statistics, if :option:`--csv` had been specified::<br>
+<br>
+ /* x265_encoder_log:<br>
+ * write a line to the configured CSV file. If a CSV filename was not<br>
+ * configured, or file open failed, this function will perform no write. */<br>
+ void x265_encoder_log(x265_encoder *encoder, int argc, char **argv);<br>
+<br>
Finally, the encoder must be closed in order to free all of its<br>
resources. An encoder that has been flushed cannot be restarted and<br>
reused. Once **x265_encoder_close()** has been called, the encoder<br>
</span>diff -r b19bc0c7b4ec -r 12097d65c3cc doc/reST/cli.rst<br>
--- a/doc/reST/cli.rst Tue Jun 06 11:13:19 2017 +0530<br>
<span class="">+++ b/doc/reST/cli.rst Fri Jun 09 18:21:55 2017 +0530<br>
@@ -52,8 +52,7 @@<br>
2. unable to open encoder<br>
3. unable to generate stream headers<br>
4. encoder abort<br>
- 5. unable to open csv file<br>
-<br>
+<br>
Logging/Statistic Options<br>
=========================<br>
<br>
@@ -182,8 +181,6 @@<br>
is more of a problem for P frames where some blocks are much more<br>
expensive than others.<br>
<br>
- **CLI ONLY**<br>
-<br>
.. option:: --csv-log-level <integer><br>
<br>
Controls the level of detail (and size) of --csv log files<br>
@@ -192,8 +189,6 @@<br>
1. frame level logging<br>
2. frame level logging with performance statistics<br>
<br>
- **CLI ONLY**<br>
-<br>
.. option:: --ssim, --no-ssim<br>
<br>
Calculate and report Structural Similarity values. It is<br>
</span>diff -r b19bc0c7b4ec -r 12097d65c3cc source/CMakeLists.txt<br>
--- a/source/CMakeLists.txt Tue Jun 06 11:13:19 2017 +0530<br>
<div><div class="h5">+++ b/source/CMakeLists.txt Fri Jun 09 18:21:55 2017 +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 121)<br>
+set(X265_BUILD 122)<br>
configure_file("${PROJECT_<wbr>SOURCE_DIR}/<a href="http://x265.def.in" rel="noreferrer" target="_blank">x265.def.in</a>"<br>
"${PROJECT_BINARY_DIR}/x265.<wbr>def")<br>
configure_file("${PROJECT_<wbr>SOURCE_DIR}/<a href="http://x265_config.h.in" rel="noreferrer" target="_blank">x265_config.h.in</a>"<br>
@@ -650,16 +650,16 @@<br>
# Xcode seems unable to link the CLI with libs, so link as one targget<br>
if(ENABLE_DYNAMIC_HDR10)<br>
add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT}<br>
- x265.cpp x265.h x265cli.h x265-extras.h x265-extras.cpp<br>
+ x265.cpp x265.h x265cli.h<br>
$<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> $<TARGET_OBJECTS:dynamicHDR10> ${ASM_OBJS} ${ASM_SRCS})<br>
else()<br>
add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT}<br>
- x265.cpp x265.h x265cli.h x265-extras.h x265-extras.cpp<br>
+ x265.cpp x265.h x265cli.h<br>
$<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${ASM_OBJS} ${ASM_SRCS})<br>
endif()<br>
else()<br>
add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT} ${X265_RC_FILE}<br>
- ${ExportDefs} x265.cpp x265.h x265cli.h x265-extras.h x265-extras.cpp)<br>
+ ${ExportDefs} x265.cpp x265.h x265cli.h)<br>
if(WIN32 OR NOT ENABLE_SHARED OR INTEL_CXX)<br>
# The CLI cannot link to the shared library on Windows, it<br>
# requires internal APIs not exported from the DLL<br>
</div></div>diff -r b19bc0c7b4ec -r 12097d65c3cc source/common/param.cpp<br>
--- a/source/common/param.cpp Tue Jun 06 11:13:19 2017 +0530<br>
<div><div class="h5">+++ b/source/common/param.cpp Fri Jun 09 18:21:55 2017 +0530<br>
@@ -110,6 +110,7 @@<br>
param->frameNumThreads = 0;<br>
<br>
param->logLevel = X265_LOG_INFO;<br>
+ param->csvLogLevel = 0;<br>
param->csvfn = NULL;<br>
param->rc.lambdaFileName = NULL;<br>
param->bLogCuStats = 0;<br>
@@ -927,6 +928,8 @@<br>
if (bExtraParams)<br>
{<br>
if (0) ;<br>
+ OPT("csv") p->csvfn = strdup(value);<br>
+ OPT("csv-log-level") p->csvLogLevel = atoi(value);<br>
OPT("qpmin") p->rc.qpMin = atoi(value);<br>
OPT("analyze-src-pics") p->bSourceReferenceEstimation = atobool(value);<br>
OPT("log2-max-poc-lsb") p->log2MaxPocLsb = atoi(value);<br>
@@ -1516,6 +1519,8 @@<br>
BOOL(p->bEnablePsnr, "psnr");<br>
BOOL(p->bEnableSsim, "ssim");<br>
s += sprintf(s, " log-level=%d", p->logLevel);<br>
+ if (p->csvfn)<br>
+ s += sprintf(s, " csvfn=%s csv-log-level=%d", p->csvfn, p->csvLogLevel);<br>
s += sprintf(s, " bitdepth=%d", p->internalBitDepth);<br>
s += sprintf(s, " input-csp=%d", p->internalCsp);<br>
s += sprintf(s, " fps=%u/%u", p->fpsNum, p->fpsDenom);<br>
</div></div>diff -r b19bc0c7b4ec -r 12097d65c3cc source/encoder/CMakeLists.txt<br>
--- a/source/encoder/CMakeLists.<wbr>txt Tue Jun 06 11:13:19 2017 +0530<br>
<span class="">+++ b/source/encoder/CMakeLists.<wbr>txt Fri Jun 09 18:21:55 2017 +0530<br>
@@ -43,4 +43,5 @@<br>
reference.cpp reference.h<br>
encoder.cpp encoder.h<br>
api.cpp<br>
- weightPrediction.cpp)<br>
+ weightPrediction.cpp<br>
+ ../x265-extras.cpp ../x265-extras.h)<br>
</span>diff -r b19bc0c7b4ec -r 12097d65c3cc source/encoder/api.cpp<br>
--- a/source/encoder/api.cpp Tue Jun 06 11:13:19 2017 +0530<br>
<div><div class="h5">+++ b/source/encoder/api.cpp Fri Jun 09 18:21:55 2017 +0530<br>
@@ -30,6 +30,7 @@<br>
#include "level.h"<br>
#include "nal.h"<br>
#include "bitcost.h"<br>
+#include "x265-extras.h"<br>
<br>
/* multilib namespace reflectors */<br>
#if LINKED_8BIT<br>
@@ -119,6 +120,17 @@<br>
}<br>
<br>
encoder->create();<br>
+ /* Try to open CSV file handle */<br>
+ if (encoder->m_param->csvfn)<br>
+ {<br>
+ encoder->m_csvfpt = x265_csvlog_open(*encoder->m_<wbr>param, encoder->m_param->csvfn, encoder->m_param->csvLogLevel)<wbr>;<br>
+ if (!encoder->m_csvfpt)<br>
+ {<br>
+ x265_log(encoder->m_param, X265_LOG_ERROR, "Unable to open CSV log file <%s>, aborting\n", encoder->m_param->csvfn);<br>
+ encoder->m_aborted = true;<br>
+ }<br>
+ }<br>
+<br>
encoder->m_latestParam = latestParam;<br>
memcpy(latestParam, param, sizeof(x265_param));<br>
if (encoder->m_aborted)<br>
@@ -144,7 +156,10 @@<br>
if (encoder->m_param->rc.<wbr>bStatRead && encoder->m_param-><wbr>bMultiPassOptRPS)<br>
{<br>
if (!encoder->computeSPSRPSIndex(<wbr>))<br>
+ {<br>
+ encoder->m_aborted = true;<br>
return -1;<br>
+ }<br>
}<br>
encoder->getStreamHeaders(<wbr>encoder->m_nalList, sbacCoder, bs);<br>
*pp_nal = &encoder->m_nalList.m_nal[0];<br>
@@ -152,6 +167,11 @@<br>
return encoder->m_nalList.m_<wbr>occupancy;<br>
}<br>
<br>
+ if (enc)<br>
+ {<br>
+ Encoder *encoder = static_cast<Encoder*>(enc);<br>
+ encoder->m_aborted = true;<br>
+ }<br>
return -1;<br>
}<br>
<br>
@@ -251,6 +271,12 @@<br>
else if (pi_nal)<br>
*pi_nal = 0;<br>
<br>
+ if (numEncoded && encoder->m_param->csvLogLevel)<br>
+ x265_csvlog_frame(encoder->m_<wbr>csvfpt, *encoder->m_param, *pic_out, encoder->m_param->csvLogLevel)<wbr>;<br>
+<br>
+ if (numEncoded < 0)<br>
+ encoder->m_aborted = true;<br>
+<br>
return numEncoded;<br>
}<br>
<br>
@@ -263,12 +289,16 @@<br>
}<br>
}<br>
<br>
-void x265_encoder_log(x265_encoder* enc, int, char **)<br>
+void x265_encoder_log(x265_encoder* enc, int argc, char **argv)<br>
{<br>
if (enc)<br>
{<br>
Encoder *encoder = static_cast<Encoder*>(enc);<br>
- x265_log(encoder->m_param, X265_LOG_WARNING, "x265_encoder_log is now deprecated\n");<br>
+ x265_stats stats;<br>
+ int padx = encoder->m_sps.<wbr>conformanceWindow.rightOffset;<br>
+ int pady = encoder->m_sps.<wbr>conformanceWindow.<wbr>bottomOffset;<br>
+ encoder->fetchStats(&stats, sizeof(stats));<br>
+ x265_csvlog_encode(encoder->m_<wbr>csvfpt, x265_version_str, *encoder->m_param, padx, pady, stats, encoder->m_param->csvLogLevel, argc, argv);<br>
}<br>
}<br>
<br>
</div></div>diff -r b19bc0c7b4ec -r 12097d65c3cc source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp Tue Jun 06 11:13:19 2017 +0530<br>
<div><div class="h5">+++ b/source/encoder/encoder.cpp Fri Jun 09 18:21:55 2017 +0530<br>
@@ -70,6 +70,7 @@<br>
m_exportedPic = NULL;<br>
m_numDelayedPic = 0;<br>
m_outputCount = 0;<br>
+ m_csvfpt = NULL;<br>
m_param = NULL;<br>
m_latestParam = NULL;<br>
m_threadPool = NULL;<br>
@@ -468,6 +469,9 @@<br>
if (m_analysisFile)<br>
fclose(m_analysisFile);<br>
<br>
+ if (m_csvfpt)<br>
+ fclose(m_csvfpt);<br>
+<br>
if (m_latestParam != NULL && m_latestParam != m_param)<br>
{<br>
if (m_latestParam->scalingLists != m_param->scalingLists)<br>
@@ -504,6 +508,7 @@<br>
free((char*)m_param->rc.<wbr>statFileName);<br>
free((char*)m_param-><wbr>analysisFileName);<br>
free((char*)m_param-><wbr>scalingLists);<br>
+ free((char*)m_param->csvfn);<br>
free((char*)m_param-><wbr>numaPools);<br>
free((char*)m_param-><wbr>masteringDisplayColorVolume);<br>
free((char*)m_param-><wbr>toneMapFile);<br>
</div></div>@@ -2605,9 +2610,6 @@<br>
<span class=""> if (p->bLogCuStats)<br>
x265_log(p, X265_LOG_WARNING, "--cu-stats option is now deprecated\n");<br>
<br>
- if (p->csvfn)<br>
- x265_log(p, X265_LOG_WARNING, "libx265 no longer supports CSV file statistics\n");<br>
-<br>
if (p->log2MaxPocLsb < 4)<br>
{<br>
x265_log(p, X265_LOG_WARNING, "maximum of the picture order count can not be less than 4\n");<br>
</span>diff -r b19bc0c7b4ec -r 12097d65c3cc source/encoder/encoder.h<br>
--- a/source/encoder/encoder.h Tue Jun 06 11:13:19 2017 +0530<br>
<span class="">+++ b/source/encoder/encoder.h Fri Jun 09 18:21:55 2017 +0530<br>
@@ -137,6 +137,7 @@<br>
x265_param* m_latestParam; // Holds latest param during a reconfigure<br>
RateControl* m_rateControl;<br>
Lookahead* m_lookahead;<br>
+ FILE* m_csvfpt;<br>
<br>
/* Collect statistics globally */<br>
EncStats m_analyzeAll;<br>
</span>diff -r b19bc0c7b4ec -r 12097d65c3cc source/x265-extras.cpp<br>
--- a/source/x265-extras.cpp Tue Jun 06 11:13:19 2017 +0530<br>
<div><div class="h5">+++ b/source/x265-extras.cpp Fri Jun 09 18:21:55 2017 +0530<br>
@@ -25,7 +25,7 @@<br>
<br>
#include "x265.h"<br>
#include "x265-extras.h"<br>
-<br>
+#include "param.h"<br>
#include "common.h"<br>
<br>
using namespace X265_NS;<br>
@@ -38,14 +38,8 @@<br>
"B count, B ave-QP, B kbps, B-PSNR Y, B-PSNR U, B-PSNR V, B-SSIM (dB), "<br>
"MaxCLL, MaxFALL, Version\n";<br>
<br>
-FILE* x265_csvlog_open(const x265_api& api, const x265_param& param, const char* fname, int level)<br>
+FILE* x265_csvlog_open(const x265_param& param, const char* fname, int level)<br>
{<br>
- if (sizeof(x265_stats) != api.sizeof_stats || sizeof(x265_picture) != api.sizeof_picture)<br>
- {<br>
- fprintf(stderr, "extras [error]: structure size skew, unable to create CSV logfile\n");<br>
- return NULL;<br>
- }<br>
-<br>
FILE *csvfp = x265_fopen(fname, "r");<br>
if (csvfp)<br>
{<br>
@@ -255,7 +249,7 @@<br>
fflush(stderr);<br>
}<br>
<br>
-void x265_csvlog_encode(FILE* csvfp, const char* version, const x265_param& param, const x265_stats& stats, int level, int argc, char** argv)<br>
+void x265_csvlog_encode(FILE* csvfp, const char* version, const x265_param& param, int padx, int pady, const x265_stats& stats, int level, int argc, char** argv)<br>
{<br>
if (!csvfp)<br>
return;<br>
@@ -268,13 +262,27 @@<br>
}<br>
<br>
// CLI arguments or other<br>
- fputc('"', csvfp);<br>
- for (int i = 1; i < argc; i++)<br>
+ if (argc)<br>
{<br>
- fputc(' ', csvfp);<br>
- fputs(argv[i], csvfp);<br>
+ fputc('"', csvfp);<br>
+ for (int i = 1; i < argc; i++)<br>
+ {<br>
+ fputc(' ', csvfp);<br>
+ fputs(argv[i], csvfp);<br>
+ }<br>
+ fputc('"', csvfp);<br>
}<br>
- fputc('"', csvfp);<br>
+ else<br>
+ {<br>
+ const x265_param* paramTemp = ¶m;<br>
+ char *opts = x265_param2string((x265_param*<wbr>)paramTemp, padx, pady);<br>
+ if (opts)<br>
+ {<br>
+ fputc('"', csvfp);<br>
+ fputs(opts, csvfp);<br>
+ fputc('"', csvfp);<br>
+ }<br>
+ }<br>
<br>
// current date and time<br>
time_t now;<br>
</div></div>diff -r b19bc0c7b4ec -r 12097d65c3cc source/x265-extras.h<br>
--- a/source/x265-extras.h Tue Jun 06 11:13:19 2017 +0530<br>
<span class="">+++ b/source/x265-extras.h Fri Jun 09 18:21:55 2017 +0530<br>
@@ -44,7 +44,7 @@<br>
* closed by the caller using fclose(). If level is 0, then no frame logging<br>
* header is written to the file. This function will return NULL if it is unable<br>
* to open the file for write or if it detects a structure size skew */<br>
-LIBAPI FILE* x265_csvlog_open(const x265_api& api, const x265_param& param, const char* fname, int level);<br>
+LIBAPI FILE* x265_csvlog_open(const x265_param& param, const char* fname, int level);<br>
<br>
/* Log frame statistics to the CSV file handle. level should have been non-zero<br>
* in the call to x265_csvlog_open() if this function is called. */<br>
@@ -53,7 +53,7 @@<br>
/* Log final encode statistics to the CSV file handle. 'argc' and 'argv' are<br>
* intended to be command line arguments passed to the encoder. Encode<br>
* statistics should be queried from the encoder just prior to closing it. */<br>
-LIBAPI void x265_csvlog_encode(FILE* csvfp, const char* version, const x265_param& param, const x265_stats& stats, int level, int argc, char** argv);<br>
+LIBAPI void x265_csvlog_encode(FILE* csvfp, const char* version, const x265_param& param, int padx, int pady, const x265_stats& stats, int level, int argc, char** argv);<br>
<br>
/* In-place downshift from a bit-depth greater than 8 to a bit-depth of 8, using<br>
* the residual bits to dither each row. */<br>
</span>diff -r b19bc0c7b4ec -r 12097d65c3cc source/x265.cpp<br>
--- a/source/x265.cpp Tue Jun 06 11:13:19 2017 +0530<br>
<div><div class="h5">+++ b/source/x265.cpp Fri Jun 09 18:21:55 2017 +0530<br>
@@ -73,15 +73,12 @@<br>
ReconFile* recon;<br>
OutputFile* output;<br>
FILE* qpfile;<br>
- FILE* csvfpt;<br>
- const char* csvfn;<br>
const char* reconPlayCmd;<br>
const x265_api* api;<br>
x265_param* param;<br>
bool bProgress;<br>
bool bForceY4m;<br>
bool bDither;<br>
- int csvLogLevel;<br>
uint32_t seek; // number of frames to skip from the beginning<br>
uint32_t framesToBeEncoded; // number of frames to encode<br>
uint64_t totalbytes;<br>
@@ -97,8 +94,6 @@<br>
recon = NULL;<br>
output = NULL;<br>
qpfile = NULL;<br>
- csvfpt = NULL;<br>
- csvfn = NULL;<br>
reconPlayCmd = NULL;<br>
api = NULL;<br>
param = NULL;<br>
@@ -109,7 +104,6 @@<br>
startTime = x265_mdate();<br>
prevUpdateTime = 0;<br>
bDither = false;<br>
- csvLogLevel = 0;<br>
}<br>
<br>
void destroy();<br>
@@ -129,9 +123,6 @@<br>
if (qpfile)<br>
fclose(qpfile);<br>
qpfile = NULL;<br>
- if (csvfpt)<br>
- fclose(csvfpt);<br>
- csvfpt = NULL;<br>
if (output)<br>
output->release();<br>
output = NULL;<br>
@@ -292,8 +283,6 @@<br>
if (0) ;<br>
OPT2("frame-skip", "seek") this->seek = (uint32_t)x265_atoi(optarg, bError);<br>
OPT("frames") this->framesToBeEncoded = (uint32_t)x265_atoi(optarg, bError);<br>
- OPT("csv") this->csvfn = optarg;<br>
- OPT("csv-log-level") this->csvLogLevel = x265_atoi(optarg, bError);<br>
OPT("no-progress") this->bProgress = false;<br>
OPT("output") outputfn = optarg;<br>
OPT("input") inputfn = optarg;<br>
@@ -530,8 +519,7 @@<br>
* 1 - unable to parse command line<br>
* 2 - unable to open encoder<br>
* 3 - unable to generate stream headers<br>
- * 4 - encoder abort<br>
- * 5 - unable to open csv file */<br>
+ * 4 - encoder abort */<br>
<br>
int main(int argc, char **argv)<br>
{<br>
@@ -586,20 +574,7 @@<br>
/* get the encoder parameters post-initialization */<br>
api->encoder_parameters(<wbr>encoder, param);<br>
<br>
- if (cliopt.csvfn)<br>
- {<br>
- cliopt.csvfpt = x265_csvlog_open(*api, *param, cliopt.csvfn, cliopt.csvLogLevel);<br>
- if (!cliopt.csvfpt)<br>
- {<br>
- x265_log_file(param, X265_LOG_ERROR, "Unable to open CSV log file <%s>, aborting\n", cliopt.csvfn);<br>
- cliopt.destroy();<br>
- if (cliopt.api)<br>
- cliopt.api->param_free(cliopt.<wbr>param);<br>
- exit(5);<br>
- }<br>
- }<br>
-<br>
- /* Control-C handler */<br>
+ /* Control-C handler */<br>
if (signal(SIGINT, sigint_handler) == SIG_ERR)<br>
x265_log(param, X265_LOG_ERROR, "Unable to register CTRL+C handler: %s\n", strerror(errno));<br>
<br>
@@ -607,7 +582,7 @@<br>
x265_picture *pic_in = &pic_orig;<br>
/* Allocate recon picture if analysisMode is enabled */<br>
std::priority_queue<int64_t>* pts_queue = cliopt.output->needPTS() ? new std::priority_queue<int64_t>() : NULL;<br>
- x265_picture *pic_recon = (cliopt.recon || !!param->analysisMode || pts_queue || reconPlay || cliopt.csvLogLevel) ? &pic_out : NULL;<br>
+ x265_picture *pic_recon = (cliopt.recon || !!param->analysisMode || pts_queue || reconPlay || param->csvLogLevel) ? &pic_out : NULL;<br>
uint32_t inFrameCount = 0;<br>
uint32_t outFrameCount = 0;<br>
x265_nal *p_nal;<br>
@@ -698,8 +673,6 @@<br>
}<br>
<br>
cliopt.printStatus(<wbr>outFrameCount);<br>
- if (numEncoded && cliopt.csvLogLevel)<br>
- x265_csvlog_frame(cliopt.<wbr>csvfpt, *param, *pic_recon, cliopt.csvLogLevel);<br>
}<br>
<br>
/* Flush the encoder */<br>
@@ -730,8 +703,6 @@<br>
}<br>
<br>
cliopt.printStatus(<wbr>outFrameCount);<br>
- if (numEncoded && cliopt.csvLogLevel)<br>
- x265_csvlog_frame(cliopt.<wbr>csvfpt, *param, *pic_recon, cliopt.csvLogLevel);<br>
<br>
if (!numEncoded)<br>
break;<br>
@@ -746,8 +717,8 @@<br>
delete reconPlay;<br>
<br>
api->encoder_get_stats(<wbr>encoder, &stats, sizeof(stats));<br>
- if (cliopt.csvfpt && !b_ctrl_c)<br>
- x265_csvlog_encode(cliopt.<wbr>csvfpt, api->version_str, *param, stats, cliopt.csvLogLevel, argc, argv);<br>
+ if (param->csvfn && !b_ctrl_c)<br>
+ api->encoder_log(encoder, argc, argv);<br>
api->encoder_close(encoder);<br>
<br>
int64_t second_largest_pts = 0;<br>
</div></div>diff -r b19bc0c7b4ec -r 12097d65c3cc source/x265.h<br>
--- a/source/x265.h Tue Jun 06 11:13:19 2017 +0530<br>
<div class="HOEnZb"><div class="h5">+++ b/source/x265.h Fri Jun 09 18:21:55 2017 +0530<br>
@@ -654,7 +654,14 @@<br>
* X265_LOG_FULL, default is X265_LOG_INFO */<br>
int logLevel;<br>
<br>
- /* Filename of CSV log. Now deprecated */<br>
+ /* Level of csv logging. 0 is summary, 1 is frame level logging,<br>
+ * 2 is frame level logging with performance statistics */<br>
+ int csvLogLevel;<br>
+<br>
+ /* filename of CSV log. If csvLogLevel is non-zero, the encoder will emit<br>
+ * per-slice statistics to this log file in encode order. Otherwise the<br>
+ * encoder will emit per-stream statistics into the log file when<br>
+ * x265_encoder_log is called (presumably at the end of the encode) */<br>
const char* csvfn;<br>
<br>
/*== Internal Picture Specification ==*/<br>
@@ -1620,7 +1627,8 @@<br>
void x265_encoder_get_stats(x265_<wbr>encoder *encoder, x265_stats *, uint32_t statsSizeBytes);<br>
<br>
/* x265_encoder_log:<br>
- * This function is deprecated */<br>
+ * write a line to the configured CSV file. If a CSV filename was not<br>
+ * configured, or file open failed, this function will perform no write. */<br>
void x265_encoder_log(x265_encoder *encoder, int argc, char **argv);<br>
<br>
/* x265_encoder_close:<br>
</div></div><br>______________________________<wbr>_________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/<wbr>listinfo/x265-devel</a><br>
<br></blockquote></div><br></div></div>