<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 13, 2017 at 2:00 AM, Ma0 <span dir="ltr"><<a href="mailto:mateuszb@poczta.onet.pl" target="_blank">mateuszb@poczta.onet.pl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Ma0 <<a href="mailto:mateuszb@poczta.onet.pl">mateuszb@poczta.onet.pl</a>><br>
# Date 1510517111 -3600<br>
# Sun Nov 12 21:05:11 2017 +0100<br>
# Node ID 06d89671aec95337c3b458985bd1f5<wbr>361bf61bb0<br>
# Parent 563cbe1f4a21dcfe2117ccaa874b71<wbr>3d94434f92<br>
x265.h: change references into pointers for C compatibility<br>
<br>
Commit 563cbe1 'api: move csv and dither functions into api structure'<br>
inserts to x265.h C++ only specific code (references) that broke<br>
compatibility with C compilers. This patch fixes this by changing<br>
code style only.<br></blockquote><div><br></div><div>Pushed to default. Thanks for the critical fix!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
diff -r 563cbe1f4a21 -r 06d89671aec9 source/encoder/api.cpp<br>
--- a/source/encoder/api.cpp Wed Nov 08 17:08:18 2017 +0530<br>
+++ b/source/encoder/api.cpp Sun Nov 12 21:05:11 2017 +0100<br>
@@ -127,7 +127,7 @@<br>
/* Try to open CSV file handle */<br>
if (encoder->m_param->csvfn)<br>
{<br>
- encoder->m_param->csvfpt = x265_csvlog_open(*encoder->m_<wbr>param);<br>
+ encoder->m_param->csvfpt = x265_csvlog_open(encoder->m_<wbr>param);<br>
if (!encoder->m_param->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>
@@ -287,7 +287,7 @@<br>
*pi_nal = 0;<br>
<br>
if (numEncoded && encoder->m_param->csvLogLevel)<br>
- x265_csvlog_frame(*encoder->m_<wbr>param, *pic_out);<br>
+ x265_csvlog_frame(encoder->m_<wbr>param, pic_out);<br>
<br>
if (numEncoded < 0)<br>
encoder->m_aborted = true;<br>
@@ -311,7 +311,7 @@<br>
Encoder *encoder = static_cast<Encoder*>(enc);<br>
x265_stats stats;<br>
encoder->fetchStats(&stats, sizeof(stats));<br>
- x265_csvlog_encode(enc, stats, argc, argv);<br>
+ x265_csvlog_encode(enc, &stats, argc, argv);<br>
}<br>
}<br>
<br>
@@ -638,86 +638,86 @@<br>
return &libapi;<br>
}<br>
<br>
-FILE* x265_csvlog_open(const x265_param& param)<br>
+FILE* x265_csvlog_open(const x265_param* param)<br>
{<br>
- FILE *csvfp = x265_fopen(param.csvfn, "r");<br>
+ FILE *csvfp = x265_fopen(param->csvfn, "r");<br>
if (csvfp)<br>
{<br>
/* file already exists, re-open for append */<br>
fclose(csvfp);<br>
- return x265_fopen(param.csvfn, "ab");<br>
+ return x265_fopen(param->csvfn, "ab");<br>
}<br>
else<br>
{<br>
/* new CSV file, write header */<br>
- csvfp = x265_fopen(param.csvfn, "wb");<br>
+ csvfp = x265_fopen(param->csvfn, "wb");<br>
if (csvfp)<br>
{<br>
- if (param.csvLogLevel)<br>
+ if (param->csvLogLevel)<br>
{<br>
fprintf(csvfp, "Encode Order, Type, POC, QP, Bits, Scenecut, ");<br>
- if (param.csvLogLevel >= 2)<br>
+ if (param->csvLogLevel >= 2)<br>
fprintf(csvfp, "I/P cost ratio, ");<br>
- if (param.rc.rateControlMode == X265_RC_CRF)<br>
+ if (param->rc.rateControlMode == X265_RC_CRF)<br>
fprintf(csvfp, "RateFactor, ");<br>
- if (param.rc.vbvBufferSize)<br>
+ if (param->rc.vbvBufferSize)<br>
fprintf(csvfp, "BufferFill, ");<br>
- if (param.bEnablePsnr)<br>
+ if (param->bEnablePsnr)<br>
fprintf(csvfp, "Y PSNR, U PSNR, V PSNR, YUV PSNR, ");<br>
- if (param.bEnableSsim)<br>
+ if (param->bEnableSsim)<br>
fprintf(csvfp, "SSIM, SSIM(dB), ");<br>
fprintf(csvfp, "Latency, ");<br>
fprintf(csvfp, "List 0, List 1");<br>
- uint32_t size = param.maxCUSize;<br>
- for (uint32_t depth = 0; depth <= param.maxCUDepth; depth++)<br>
+ uint32_t size = param->maxCUSize;<br>
+ for (uint32_t depth = 0; depth <= param->maxCUDepth; depth++)<br>
{<br>
fprintf(csvfp, ", Intra %dx%d DC, Intra %dx%d Planar, Intra %dx%d Ang", size, size, size, size, size, size);<br>
size /= 2;<br>
}<br>
fprintf(csvfp, ", 4x4");<br>
- size = param.maxCUSize;<br>
- if (param.bEnableRectInter)<br>
+ size = param->maxCUSize;<br>
+ if (param->bEnableRectInter)<br>
{<br>
- for (uint32_t depth = 0; depth <= param.maxCUDepth; depth++)<br>
+ for (uint32_t depth = 0; depth <= param->maxCUDepth; depth++)<br>
{<br>
fprintf(csvfp, ", Inter %dx%d, Inter %dx%d (Rect)", size, size, size, size);<br>
- if (param.bEnableAMP)<br>
+ if (param->bEnableAMP)<br>
fprintf(csvfp, ", Inter %dx%d (Amp)", size, size);<br>
size /= 2;<br>
}<br>
}<br>
else<br>
{<br>
- for (uint32_t depth = 0; depth <= param.maxCUDepth; depth++)<br>
+ for (uint32_t depth = 0; depth <= param->maxCUDepth; depth++)<br>
{<br>
fprintf(csvfp, ", Inter %dx%d", size, size);<br>
size /= 2;<br>
}<br>
}<br>
- size = param.maxCUSize;<br>
- for (uint32_t depth = 0; depth <= param.maxCUDepth; depth++)<br>
+ size = param->maxCUSize;<br>
+ for (uint32_t depth = 0; depth <= param->maxCUDepth; depth++)<br>
{<br>
fprintf(csvfp, ", Skip %dx%d", size, size);<br>
size /= 2;<br>
}<br>
- size = param.maxCUSize;<br>
- for (uint32_t depth = 0; depth <= param.maxCUDepth; depth++)<br>
+ size = param->maxCUSize;<br>
+ for (uint32_t depth = 0; depth <= param->maxCUDepth; depth++)<br>
{<br>
fprintf(csvfp, ", Merge %dx%d", size, size);<br>
size /= 2;<br>
}<br>
<br>
- if (param.csvLogLevel >= 2)<br>
+ if (param->csvLogLevel >= 2)<br>
{<br>
fprintf(csvfp, ", Avg Luma Distortion, Avg Chroma Distortion, Avg psyEnergy, Avg Residual Energy,"<br>
" Min Luma Level, Max Luma Level, Avg Luma Level");<br>
<br>
- if (param.internalCsp != X265_CSP_I400)<br>
+ if (param->internalCsp != X265_CSP_I400)<br>
fprintf(csvfp, ", Min Cb Level, Max Cb Level, Avg Cb Level, Min Cr Level, Max Cr Level, Avg Cr Level");<br>
<br>
/* PU statistics */<br>
- size = param.maxCUSize;<br>
- for (uint32_t i = 0; i< param.maxLog2CUSize - (uint32_t)g_log2Size[param.<wbr>minCUSize] + 1; i++)<br>
+ size = param->maxCUSize;<br>
+ for (uint32_t i = 0; i< param->maxLog2CUSize - (uint32_t)g_log2Size[param-><wbr>minCUSize] + 1; i++)<br>
{<br>
fprintf(csvfp, ", Intra %dx%d", size, size);<br>
fprintf(csvfp, ", Skip %dx%d", size, size);<br>
@@ -731,7 +731,7 @@<br>
size /= 2;<br>
}<br>
<br>
- if ((uint32_t)g_log2Size[param.<wbr>minCUSize] == 3)<br>
+ if ((uint32_t)g_log2Size[param-><wbr>minCUSize] == 3)<br>
fprintf(csvfp, ", 4x4");<br>
<br>
/* detailed performance statistics */<br>
@@ -748,113 +748,113 @@<br>
}<br>
<br>
// per frame CSV logging<br>
-void x265_csvlog_frame(const x265_param& param, const x265_picture& pic)<br>
+void x265_csvlog_frame(const x265_param* param, const x265_picture* pic)<br>
{<br>
- if (!param.csvfpt)<br>
+ if (!param->csvfpt)<br>
return;<br>
<br>
- const x265_frame_stats* frameStats = &pic.frameData;<br>
- fprintf(param.csvfpt, "%d, %c-SLICE, %4d, %2.2lf, %10d, %d,", frameStats->encoderOrder, frameStats->sliceType, frameStats->poc,<br>
- frameStats->qp, (int)frameStats->bits, frameStats->bScenecut);<br>
- if (param.csvLogLevel >= 2)<br>
- fprintf(param.csvfpt, "%.2f,", frameStats->ipCostRatio);<br>
- if (param.rc.rateControlMode == X265_RC_CRF)<br>
- fprintf(param.csvfpt, "%.3lf,", frameStats->rateFactor);<br>
- if (param.rc.vbvBufferSize)<br>
- fprintf(param.csvfpt, "%.3lf,", frameStats->bufferFill);<br>
- if (param.bEnablePsnr)<br>
- fprintf(param.csvfpt, "%.3lf, %.3lf, %.3lf, %.3lf,", frameStats->psnrY, frameStats->psnrU, frameStats->psnrV, frameStats->psnr);<br>
- if (param.bEnableSsim)<br>
- fprintf(param.csvfpt, " %.6f, %6.3f,", frameStats->ssim, x265_ssim2dB(frameStats->ssim)<wbr>);<br>
- fprintf(param.csvfpt, "%d, ", frameStats->frameLatency);<br>
+ const x265_frame_stats* frameStats = &pic->frameData;<br>
+ fprintf(param->csvfpt, "%d, %c-SLICE, %4d, %2.2lf, %10d, %d,", frameStats->encoderOrder, frameStats->sliceType, frameStats->poc,<br>
+ frameStats->qp, (int)frameStats->bits, frameStats->bScenecut);<br>
+ if (param->csvLogLevel >= 2)<br>
+ fprintf(param->csvfpt, "%.2f,", frameStats->ipCostRatio);<br>
+ if (param->rc.rateControlMode == X265_RC_CRF)<br>
+ fprintf(param->csvfpt, "%.3lf,", frameStats->rateFactor);<br>
+ if (param->rc.vbvBufferSize)<br>
+ fprintf(param->csvfpt, "%.3lf,", frameStats->bufferFill);<br>
+ if (param->bEnablePsnr)<br>
+ fprintf(param->csvfpt, "%.3lf, %.3lf, %.3lf, %.3lf,", frameStats->psnrY, frameStats->psnrU, frameStats->psnrV, frameStats->psnr);<br>
+ if (param->bEnableSsim)<br>
+ fprintf(param->csvfpt, " %.6f, %6.3f,", frameStats->ssim, x265_ssim2dB(frameStats->ssim)<wbr>);<br>
+ fprintf(param->csvfpt, "%d, ", frameStats->frameLatency);<br>
if (frameStats->sliceType == 'I' || frameStats->sliceType == 'i')<br>
- fputs(" -, -,", param.csvfpt);<br>
+ fputs(" -, -,", param->csvfpt);<br>
else<br>
{<br>
int i = 0;<br>
while (frameStats->list0POC[i] != -1)<br>
- fprintf(param.csvfpt, "%d ", frameStats->list0POC[i++]);<br>
- fprintf(param.csvfpt, ",");<br>
+ fprintf(param->csvfpt, "%d ", frameStats->list0POC[i++]);<br>
+ fprintf(param->csvfpt, ",");<br>
if (frameStats->sliceType != 'P')<br>
{<br>
i = 0;<br>
while (frameStats->list1POC[i] != -1)<br>
- fprintf(param.csvfpt, "%d ", frameStats->list1POC[i++]);<br>
- fprintf(param.csvfpt, ",");<br>
+ fprintf(param->csvfpt, "%d ", frameStats->list1POC[i++]);<br>
+ fprintf(param->csvfpt, ",");<br>
}<br>
else<br>
- fputs(" -,", param.csvfpt);<br>
+ fputs(" -,", param->csvfpt);<br>
}<br>
<br>
- if (param.csvLogLevel)<br>
+ if (param->csvLogLevel)<br>
{<br>
- for (uint32_t depth = 0; depth <= param.maxCUDepth; depth++)<br>
- fprintf(param.csvfpt, "%5.2lf%%, %5.2lf%%, %5.2lf%%,", frameStats->cuStats.<wbr>percentIntraDistribution[<wbr>depth][0],<br>
- frameStats->cuStats.<wbr>percentIntraDistribution[<wbr>depth][1],<br>
- frameStats->cuStats.<wbr>percentIntraDistribution[<wbr>depth][2]);<br>
- fprintf(param.csvfpt, "%5.2lf%%", frameStats->cuStats.<wbr>percentIntraNxN);<br>
- if (param.bEnableRectInter)<br>
+ for (uint32_t depth = 0; depth <= param->maxCUDepth; depth++)<br>
+ fprintf(param->csvfpt, "%5.2lf%%, %5.2lf%%, %5.2lf%%,", frameStats->cuStats.<wbr>percentIntraDistribution[<wbr>depth][0],<br>
+ frameStats->cuStats.<wbr>percentIntraDistribution[<wbr>depth][1],<br>
+ frameStats->cuStats.<wbr>percentIntraDistribution[<wbr>depth][2]);<br>
+ fprintf(param->csvfpt, "%5.2lf%%", frameStats->cuStats.<wbr>percentIntraNxN);<br>
+ if (param->bEnableRectInter)<br>
{<br>
- for (uint32_t depth = 0; depth <= param.maxCUDepth; depth++)<br>
+ for (uint32_t depth = 0; depth <= param->maxCUDepth; depth++)<br>
{<br>
- fprintf(param.csvfpt, ", %5.2lf%%, %5.2lf%%", frameStats->cuStats.<wbr>percentInterDistribution[<wbr>depth][0],<br>
- frameStats->cuStats.<wbr>percentInterDistribution[<wbr>depth][1]);<br>
- if (param.bEnableAMP)<br>
- fprintf(param.csvfpt, ", %5.2lf%%", frameStats->cuStats.<wbr>percentInterDistribution[<wbr>depth][2]);<br>
+ fprintf(param->csvfpt, ", %5.2lf%%, %5.2lf%%", frameStats->cuStats.<wbr>percentInterDistribution[<wbr>depth][0],<br>
+ frameStats->cuStats.<wbr>percentInterDistribution[<wbr>depth][1]);<br>
+ if (param->bEnableAMP)<br>
+ fprintf(param->csvfpt, ", %5.2lf%%", frameStats->cuStats.<wbr>percentInterDistribution[<wbr>depth][2]);<br>
}<br>
}<br>
else<br>
{<br>
- for (uint32_t depth = 0; depth <= param.maxCUDepth; depth++)<br>
- fprintf(param.csvfpt, ", %5.2lf%%", frameStats->cuStats.<wbr>percentInterDistribution[<wbr>depth][0]);<br>
+ for (uint32_t depth = 0; depth <= param->maxCUDepth; depth++)<br>
+ fprintf(param->csvfpt, ", %5.2lf%%", frameStats->cuStats.<wbr>percentInterDistribution[<wbr>depth][0]);<br>
}<br>
- for (uint32_t depth = 0; depth <= param.maxCUDepth; depth++)<br>
- fprintf(param.csvfpt, ", %5.2lf%%", frameStats->cuStats.<wbr>percentSkipCu[depth]);<br>
- for (uint32_t depth = 0; depth <= param.maxCUDepth; depth++)<br>
- fprintf(param.csvfpt, ", %5.2lf%%", frameStats->cuStats.<wbr>percentMergeCu[depth]);<br>
+ for (uint32_t depth = 0; depth <= param->maxCUDepth; depth++)<br>
+ fprintf(param->csvfpt, ", %5.2lf%%", frameStats->cuStats.<wbr>percentSkipCu[depth]);<br>
+ for (uint32_t depth = 0; depth <= param->maxCUDepth; depth++)<br>
+ fprintf(param->csvfpt, ", %5.2lf%%", frameStats->cuStats.<wbr>percentMergeCu[depth]);<br>
}<br>
<br>
- if (param.csvLogLevel >= 2)<br>
+ if (param->csvLogLevel >= 2)<br>
{<br>
- fprintf(param.csvfpt, ", %.2lf, %.2lf, %.2lf, %.2lf ", frameStats->avgLumaDistortion,<br>
- frameStats-><wbr>avgChromaDistortion,<br>
- frameStats->avgPsyEnergy,<br>
- frameStats->avgResEnergy);<br>
+ fprintf(param->csvfpt, ", %.2lf, %.2lf, %.2lf, %.2lf ", frameStats->avgLumaDistortion,<br>
+ frameStats-><wbr>avgChromaDistortion,<br>
+ frameStats->avgPsyEnergy,<br>
+ frameStats->avgResEnergy);<br>
<br>
- fprintf(param.csvfpt, ", %d, %d, %.2lf", frameStats->minLumaLevel, frameStats->maxLumaLevel, frameStats->avgLumaLevel);<br>
+ fprintf(param->csvfpt, ", %d, %d, %.2lf", frameStats->minLumaLevel, frameStats->maxLumaLevel, frameStats->avgLumaLevel);<br>
<br>
- if (param.internalCsp != X265_CSP_I400)<br>
+ if (param->internalCsp != X265_CSP_I400)<br>
{<br>
- fprintf(param.csvfpt, ", %d, %d, %.2lf", frameStats->minChromaULevel, frameStats->maxChromaULevel, frameStats->avgChromaULevel);<br>
- fprintf(param.csvfpt, ", %d, %d, %.2lf", frameStats->minChromaVLevel, frameStats->maxChromaVLevel, frameStats->avgChromaVLevel);<br>
+ fprintf(param->csvfpt, ", %d, %d, %.2lf", frameStats->minChromaULevel, frameStats->maxChromaULevel, frameStats->avgChromaULevel);<br>
+ fprintf(param->csvfpt, ", %d, %d, %.2lf", frameStats->minChromaVLevel, frameStats->maxChromaVLevel, frameStats->avgChromaVLevel);<br>
}<br>
<br>
- for (uint32_t i = 0; i < param.maxLog2CUSize - (uint32_t)g_log2Size[param.<wbr>minCUSize] + 1; i++)<br>
+ for (uint32_t i = 0; i < param->maxLog2CUSize - (uint32_t)g_log2Size[param-><wbr>minCUSize] + 1; i++)<br>
{<br>
- fprintf(param.csvfpt, ", %.2lf%%", frameStats->puStats.<wbr>percentIntraPu[i]);<br>
- fprintf(param.csvfpt, ", %.2lf%%", frameStats->puStats.<wbr>percentSkipPu[i]);<br>
- fprintf(param.csvfpt, ",%.2lf%%", frameStats->puStats.<wbr>percentAmpPu[i]);<br>
+ fprintf(param->csvfpt, ", %.2lf%%", frameStats->puStats.<wbr>percentIntraPu[i]);<br>
+ fprintf(param->csvfpt, ", %.2lf%%", frameStats->puStats.<wbr>percentSkipPu[i]);<br>
+ fprintf(param->csvfpt, ",%.2lf%%", frameStats->puStats.<wbr>percentAmpPu[i]);<br>
for (uint32_t j = 0; j < 3; j++)<br>
{<br>
- fprintf(param.csvfpt, ", %.2lf%%", frameStats->puStats.<wbr>percentInterPu[i][j]);<br>
- fprintf(param.csvfpt, ", %.2lf%%", frameStats->puStats.<wbr>percentMergePu[i][j]);<br>
+ fprintf(param->csvfpt, ", %.2lf%%", frameStats->puStats.<wbr>percentInterPu[i][j]);<br>
+ fprintf(param->csvfpt, ", %.2lf%%", frameStats->puStats.<wbr>percentMergePu[i][j]);<br>
}<br>
}<br>
- if ((uint32_t)g_log2Size[param.<wbr>minCUSize] == 3)<br>
- fprintf(param.csvfpt, ",%.2lf%%", frameStats->puStats.<wbr>percentNxN);<br>
+ if ((uint32_t)g_log2Size[param-><wbr>minCUSize] == 3)<br>
+ fprintf(param->csvfpt, ",%.2lf%%", frameStats->puStats.<wbr>percentNxN);<br>
<br>
- fprintf(param.csvfpt, ", %.1lf, %.1lf, %.1lf, %.1lf, %.1lf, %.1lf, %.1lf,", frameStats->decideWaitTime, frameStats->row0WaitTime,<br>
- frameStats->wallTime, frameStats->refWaitWallTime,<br>
- frameStats->totalCTUTime, frameStats->stallTime,<br>
- frameStats->totalFrameTime);<br>
+ fprintf(param->csvfpt, ", %.1lf, %.1lf, %.1lf, %.1lf, %.1lf, %.1lf, %.1lf,", frameStats->decideWaitTime, frameStats->row0WaitTime,<br>
+ frameStats->wallTime, frameStats->refWaitWallTime,<br>
+ frameStats->totalCTUTime, frameStats->stallTime,<br>
+ frameStats->totalFrameTime);<br>
<br>
- fprintf(param.csvfpt, " %.3lf, %d", frameStats->avgWPP, frameStats->countRowBlocks);<br>
+ fprintf(param->csvfpt, " %.3lf, %d", frameStats->avgWPP, frameStats->countRowBlocks);<br>
}<br>
- fprintf(param.csvfpt, "\n");<br>
+ fprintf(param->csvfpt, "\n");<br>
fflush(stderr);<br>
}<br>
<br>
-void x265_csvlog_encode(x265_<wbr>encoder *enc, const x265_stats& stats, int argc, char** argv)<br>
+void x265_csvlog_encode(x265_<wbr>encoder *enc, const x265_stats* stats, int argc, char** argv)<br>
{<br>
if (enc)<br>
{<br>
@@ -907,65 +907,65 @@<br>
<br>
// elapsed time, fps, bitrate<br>
fprintf(encoder->m_param-><wbr>csvfpt, "%.2f, %.2f, %.2f,",<br>
- stats.elapsedEncodeTime, stats.encodedPictureCount / stats.elapsedEncodeTime, stats.bitrate);<br>
+ stats->elapsedEncodeTime, stats->encodedPictureCount / stats->elapsedEncodeTime, stats->bitrate);<br>
<br>
if (encoder->m_param-><wbr>bEnablePsnr)<br>
fprintf(encoder->m_param-><wbr>csvfpt, " %.3lf, %.3lf, %.3lf, %.3lf,",<br>
- stats.globalPsnrY / stats.encodedPictureCount, stats.globalPsnrU / stats.encodedPictureCount,<br>
- stats.globalPsnrV / stats.encodedPictureCount, stats.globalPsnr);<br>
+ stats->globalPsnrY / stats->encodedPictureCount, stats->globalPsnrU / stats->encodedPictureCount,<br>
+ stats->globalPsnrV / stats->encodedPictureCount, stats->globalPsnr);<br>
else<br>
fprintf(encoder->m_param-><wbr>csvfpt, " -, -, -, -,");<br>
if (encoder->m_param-><wbr>bEnableSsim)<br>
- fprintf(encoder->m_param-><wbr>csvfpt, " %.6f, %6.3f,", stats.globalSsim, x265_ssim2dB(stats.globalSsim)<wbr>);<br>
+ fprintf(encoder->m_param-><wbr>csvfpt, " %.6f, %6.3f,", stats->globalSsim, x265_ssim2dB(stats-><wbr>globalSsim));<br>
else<br>
fprintf(encoder->m_param-><wbr>csvfpt, " -, -,");<br>
<br>
- if (stats.statsI.numPics)<br>
+ if (stats->statsI.numPics)<br>
{<br>
- fprintf(encoder->m_param-><wbr>csvfpt, " %-6u, %2.2lf, %-8.2lf,", stats.statsI.numPics, stats.statsI.avgQp, stats.statsI.bitrate);<br>
+ fprintf(encoder->m_param-><wbr>csvfpt, " %-6u, %2.2lf, %-8.2lf,", stats->statsI.numPics, stats->statsI.avgQp, stats->statsI.bitrate);<br>
if (encoder->m_param-><wbr>bEnablePsnr)<br>
- fprintf(encoder->m_param-><wbr>csvfpt, " %.3lf, %.3lf, %.3lf,", stats.statsI.psnrY, stats.statsI.psnrU, stats.statsI.psnrV);<br>
+ fprintf(encoder->m_param-><wbr>csvfpt, " %.3lf, %.3lf, %.3lf,", stats->statsI.psnrY, stats->statsI.psnrU, stats->statsI.psnrV);<br>
else<br>
fprintf(encoder->m_param-><wbr>csvfpt, " -, -, -,");<br>
if (encoder->m_param-><wbr>bEnableSsim)<br>
- fprintf(encoder->m_param-><wbr>csvfpt, " %.3lf,", stats.statsI.ssim);<br>
+ fprintf(encoder->m_param-><wbr>csvfpt, " %.3lf,", stats->statsI.ssim);<br>
else<br>
fprintf(encoder->m_param-><wbr>csvfpt, " -,");<br>
}<br>
else<br>
fprintf(encoder->m_param-><wbr>csvfpt, " -, -, -, -, -, -, -,");<br>
<br>
- if (stats.statsP.numPics)<br>
+ if (stats->statsP.numPics)<br>
{<br>
- fprintf(encoder->m_param-><wbr>csvfpt, " %-6u, %2.2lf, %-8.2lf,", stats.statsP.numPics, stats.statsP.avgQp, stats.statsP.bitrate);<br>
+ fprintf(encoder->m_param-><wbr>csvfpt, " %-6u, %2.2lf, %-8.2lf,", stats->statsP.numPics, stats->statsP.avgQp, stats->statsP.bitrate);<br>
if (encoder->m_param-><wbr>bEnablePsnr)<br>
- fprintf(encoder->m_param-><wbr>csvfpt, " %.3lf, %.3lf, %.3lf,", stats.statsP.psnrY, stats.statsP.psnrU, stats.statsP.psnrV);<br>
+ fprintf(encoder->m_param-><wbr>csvfpt, " %.3lf, %.3lf, %.3lf,", stats->statsP.psnrY, stats->statsP.psnrU, stats->statsP.psnrV);<br>
else<br>
fprintf(encoder->m_param-><wbr>csvfpt, " -, -, -,");<br>
if (encoder->m_param-><wbr>bEnableSsim)<br>
- fprintf(encoder->m_param-><wbr>csvfpt, " %.3lf,", stats.statsP.ssim);<br>
+ fprintf(encoder->m_param-><wbr>csvfpt, " %.3lf,", stats->statsP.ssim);<br>
else<br>
fprintf(encoder->m_param-><wbr>csvfpt, " -,");<br>
}<br>
else<br>
fprintf(encoder->m_param-><wbr>csvfpt, " -, -, -, -, -, -, -,");<br>
<br>
- if (stats.statsB.numPics)<br>
+ if (stats->statsB.numPics)<br>
{<br>
- fprintf(encoder->m_param-><wbr>csvfpt, " %-6u, %2.2lf, %-8.2lf,", stats.statsB.numPics, stats.statsB.avgQp, stats.statsB.bitrate);<br>
+ fprintf(encoder->m_param-><wbr>csvfpt, " %-6u, %2.2lf, %-8.2lf,", stats->statsB.numPics, stats->statsB.avgQp, stats->statsB.bitrate);<br>
if (encoder->m_param-><wbr>bEnablePsnr)<br>
- fprintf(encoder->m_param-><wbr>csvfpt, " %.3lf, %.3lf, %.3lf,", stats.statsB.psnrY, stats.statsB.psnrU, stats.statsB.psnrV);<br>
+ fprintf(encoder->m_param-><wbr>csvfpt, " %.3lf, %.3lf, %.3lf,", stats->statsB.psnrY, stats->statsB.psnrU, stats->statsB.psnrV);<br>
else<br>
fprintf(encoder->m_param-><wbr>csvfpt, " -, -, -,");<br>
if (encoder->m_param-><wbr>bEnableSsim)<br>
- fprintf(encoder->m_param-><wbr>csvfpt, " %.3lf,", stats.statsB.ssim);<br>
+ fprintf(encoder->m_param-><wbr>csvfpt, " %.3lf,", stats->statsB.ssim);<br>
else<br>
fprintf(encoder->m_param-><wbr>csvfpt, " -,");<br>
}<br>
else<br>
fprintf(encoder->m_param-><wbr>csvfpt, " -, -, -, -, -, -, -,");<br>
<br>
- fprintf(encoder->m_param-><wbr>csvfpt, " %-6u, %-6u, %s\n", stats.maxCLL, stats.maxFALL, api->version_str);<br>
+ fprintf(encoder->m_param-><wbr>csvfpt, " %-6u, %-6u, %s\n", stats->maxCLL, stats->maxFALL, api->version_str);<br>
}<br>
}<br>
<br>
@@ -1011,7 +1011,7 @@<br>
}<br>
}<br>
<br>
-void x265_dither_image(x265_<wbr>picture& picIn, int picWidth, int picHeight, int16_t *errorBuf, int bitDepth)<br>
+void x265_dither_image(x265_<wbr>picture* picIn, int picWidth, int picHeight, int16_t *errorBuf, int bitDepth)<br>
{<br>
const x265_api* api = x265_api_get(0);<br>
<br>
@@ -1021,27 +1021,27 @@<br>
return;<br>
}<br>
<br>
- if (picIn.bitDepth <= 8)<br>
+ if (picIn->bitDepth <= 8)<br>
{<br>
fprintf(stderr, "extras [error]: dither support enabled only for input bitdepth > 8\n");<br>
return;<br>
}<br>
<br>
- if (picIn.bitDepth == bitDepth)<br>
+ if (picIn->bitDepth == bitDepth)<br>
{<br>
fprintf(stderr, "extras[error]: dither support enabled only if encoder depth is different from picture depth\n");<br>
return;<br>
}<br>
<br>
/* This portion of code is from readFrame in x264. */<br>
- for (int i = 0; i < x265_cli_csps[picIn.<wbr>colorSpace].planes; i++)<br>
+ for (int i = 0; i < x265_cli_csps[picIn-><wbr>colorSpace].planes; i++)<br>
{<br>
- if (picIn.bitDepth < 16)<br>
+ if (picIn->bitDepth < 16)<br>
{<br>
/* upconvert non 16bit high depth planes to 16bit */<br>
- uint16_t *plane = (uint16_t*)picIn.planes[i];<br>
- uint32_t pixelCount = x265_picturePlaneSize(picIn.<wbr>colorSpace, picWidth, picHeight, i);<br>
- int lShift = 16 - picIn.bitDepth;<br>
+ uint16_t *plane = (uint16_t*)picIn->planes[i];<br>
+ uint32_t pixelCount = x265_picturePlaneSize(picIn-><wbr>colorSpace, picWidth, picHeight, i);<br>
+ int lShift = 16 - picIn->bitDepth;<br>
<br>
/* This loop assumes width is equal to stride which<br>
* happens to be true for file reader outputs */<br>
@@ -1049,10 +1049,10 @@<br>
plane[j] = plane[j] << lShift;<br>
}<br>
<br>
- int height = (int)(picHeight >> x265_cli_csps[picIn.<wbr>colorSpace].height[i]);<br>
- int width = (int)(picWidth >> x265_cli_csps[picIn.<wbr>colorSpace].width[i]);<br>
+ int height = (int)(picHeight >> x265_cli_csps[picIn-><wbr>colorSpace].height[i]);<br>
+ int width = (int)(picWidth >> x265_cli_csps[picIn-><wbr>colorSpace].width[i]);<br>
<br>
- ditherPlane(((uint16_t*)picIn.<wbr>planes[i]), picIn.stride[i] / 2, width, height, errorBuf, bitDepth);<br>
+ ditherPlane(((uint16_t*)picIn-<wbr>>planes[i]), picIn->stride[i] / 2, width, height, errorBuf, bitDepth);<br>
}<br>
}<br>
<br>
diff -r 563cbe1f4a21 -r 06d89671aec9 source/x265.cpp<br>
--- a/source/x265.cpp Wed Nov 08 17:08:18 2017 +0530<br>
+++ b/source/x265.cpp Sun Nov 12 21:05:11 2017 +0100<br>
@@ -638,7 +638,7 @@<br>
{<br>
if (pic_in->bitDepth > param->internalBitDepth && cliopt.bDither)<br>
{<br>
- x265_dither_image(*pic_in, cliopt.input->getWidth(), cliopt.input->getHeight(), errorBuf, param->internalBitDepth);<br>
+ x265_dither_image(pic_in, cliopt.input->getWidth(), cliopt.input->getHeight(), errorBuf, param->internalBitDepth);<br>
pic_in->bitDepth = param->internalBitDepth;<br>
}<br>
/* Overwrite PTS */<br>
diff -r 563cbe1f4a21 -r 06d89671aec9 source/x265.h<br>
--- a/source/x265.h Wed Nov 08 17:08:18 2017 +0530<br>
+++ b/source/x265.h Sun Nov 12 21:05:11 2017 +0100<br>
@@ -1750,20 +1750,20 @@<br>
* closed by the caller using fclose(). If csv-loglevel 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>
-FILE* x265_csvlog_open(const x265_param& param);<br>
+FILE* x265_csvlog_open(const x265_param *);<br>
<br>
/* Log frame statistics to the CSV file handle. csv-loglevel should have been non-zero<br>
* in the call to x265_csvlog_open() if this function is called. */<br>
-void x265_csvlog_frame(const x265_param& param, const x265_picture& pic);<br>
+void x265_csvlog_frame(const x265_param *, const x265_picture *);<br>
<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>
-void x265_csvlog_encode(x265_<wbr>encoder *encoder, const x265_stats& stats, int argc, char** argv);<br>
+void x265_csvlog_encode(x265_<wbr>encoder *encoder, const x265_stats *, 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>
-void x265_dither_image(x265_<wbr>picture& pic, int picWidth, int picHeight, int16_t *errorBuf, int bitDepth);<br>
+void x265_dither_image(x265_picture *, int picWidth, int picHeight, int16_t *errorBuf, int bitDepth);<br>
<br>
#define X265_MAJOR_VERSION 1<br>
<br>
@@ -1812,10 +1812,10 @@<br>
int (*encoder_ctu_info)(x265_<wbr>encoder*, int, x265_ctu_info_t**);<br>
int (*get_slicetype_poc_and_<wbr>scenecut)(x265_encoder*, int*, int*, int*);<br>
int (*get_ref_frame_list)(x265_<wbr>encoder*, x265_picyuv**, x265_picyuv**, int, int);<br>
- FILE* (*csvlog_open)(const x265_param&);<br>
- void (*csvlog_frame)(const x265_param&, const x265_picture&);<br>
- void (*csvlog_encode)(x265_encoder*<wbr>, const x265_stats&, int, char**);<br>
- void (*dither_image)(x265_picture&, int, int, int16_t*, int);<br>
+ FILE* (*csvlog_open)(const x265_param*);<br>
+ void (*csvlog_frame)(const x265_param*, const x265_picture*);<br>
+ void (*csvlog_encode)(x265_encoder*<wbr>, const x265_stats*, int, char**);<br>
+ void (*dither_image)(x265_picture*, int, int, int16_t*, int);<br>
/* add new pointers to the end, or increment X265_MAJOR_VERSION */<br>
} x265_api;<br>
<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>
</blockquote></div><br></div></div>