[x265] [PATCH] stats: add frame level csv printing
Divya Manivannan
divya at multicorewareinc.com
Thu Jun 11 12:23:52 CEST 2015
# HG changeset patch
# User Divya Manivannan <divya at multicorewareinc.com>
# Date 1433943002 -19800
# Wed Jun 10 19:00:02 2015 +0530
# Node ID 674b9a17e34d9daa94f45821779eea211cb2d562
# Parent 1a8237500ea1e19d4e3ca18bd97fa68e3c87162f
stats: add frame level csv printing
diff -r 1a8237500ea1 -r 674b9a17e34d source/x265.cpp
--- a/source/x265.cpp Wed Jun 10 18:55:08 2015 +0530
+++ b/source/x265.cpp Wed Jun 10 19:00:02 2015 +0530
@@ -124,6 +124,7 @@
void destroy();
bool parseCSVFile();
void writeLog(int argc, char **argv, x265_stats* stats);
+ void writeFrameLog(x265_frame_stats* frameStats);
void printStatus(uint32_t frameNum);
bool parse(int argc, char **argv);
bool parseQPFile(x265_picture &pic_org);
@@ -162,7 +163,19 @@
/* new CSV file, write header */
csvfpt = fopen(csvfn, "wb");
if (csvfpt)
- fputs(summaryCSVHeader, csvfpt);
+ {
+ if (csvData > 0)
+ {
+ fprintf(csvfpt, "Encode Order, Type, POC, QP, Bits, ");
+ if (param->rc.rateControlMode == X265_RC_CRF)
+ fprintf(csvfpt, "RateFactor, ");
+ fprintf(csvfpt, "Y PSNR, U PSNR, V PSNR, YUV PSNR, SSIM, SSIM (dB), List 0, List 1");
+ /* detailed performance statistics */
+ fprintf(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, csvfpt);
+ }
}
if (!csvfpt)
@@ -177,6 +190,12 @@
{
if (csvfpt)
{
+ if (csvData > 0)
+ {
+ // adding summary to a per-frame csv log file needs a summary header
+ fprintf(csvfpt, "\nSummary\n");
+ fputs(summaryCSVHeader, csvfpt);
+ }
// CLI arguments or other
for (int i = 1; i < argc; i++)
{
@@ -257,6 +276,39 @@
}
}
+void CLIOptions::writeFrameLog(x265_frame_stats* frameStats)
+{
+ if (csvfpt)
+ {
+ // per frame CSV logging if the file handle is valid
+ fprintf(csvfpt, "%d, %c-SLICE, %4d, %2.2lf, %10d,", frameStats->encoderOrder, frameStats->sliceType, frameStats->poc, frameStats->qp, (int)frameStats->bits);
+ if (param->rc.rateControlMode == X265_RC_CRF)
+ fprintf(csvfpt, "%.3lf,", frameStats->rateFactor);
+ if (param->bEnablePsnr)
+ fprintf(csvfpt, "%.3lf, %.3lf, %.3lf, %.3lf,", frameStats->psnrY, frameStats->psnrU, frameStats->psnrV, frameStats->psnr);
+ else
+ fputs(" -, -, -, -,", csvfpt);
+ if (param->bEnableSsim)
+ fprintf(csvfpt, " %.6f, %6.3f,", frameStats->ssim, x265_ssim2dB(frameStats->ssim));
+ else
+ fputs(" -, -,", csvfpt);
+ if (frameStats->sliceType == 'I')
+ fputs(" -, -,", csvfpt);
+ else
+ {
+ fprintf(csvfpt, " %s,", frameStats->list1Buf);
+ if (frameStats->sliceType != 'P')
+ fprintf(csvfpt, " %s,", frameStats->list2Buf);
+ else
+ fputs(" -,", csvfpt);
+ }
+ fprintf(csvfpt, " %.1lf, %.1lf, %.1lf, %.1lf, %.1lf, %.1lf,", frameStats->decideWaitTime, frameStats->row0WaitTime, frameStats->wallTime, frameStats->refWaitWallTime, frameStats->totalCTUTime, frameStats->stallTime);
+ fprintf(csvfpt, " %.3lf, %d", frameStats->avgWPP, frameStats->countRowBlocks);
+ fprintf(csvfpt, "\n");
+ fflush(stderr);
+ }
+}
+
void CLIOptions::printStatus(uint32_t frameNum)
{
char buf[200];
@@ -767,6 +819,8 @@
}
cliopt.printStatus(outFrameCount);
+ if (numEncoded && cliopt.csvData > 0)
+ cliopt.writeFrameLog(&(pic_recon->frameData));
}
/* Flush the encoder */
@@ -797,6 +851,8 @@
}
cliopt.printStatus(outFrameCount);
+ if (numEncoded && cliopt.csvData > 0)
+ cliopt.writeFrameLog(&(pic_recon->frameData));
if (!numEncoded)
break;
More information about the x265-devel
mailing list