[x265] [PATCH x265] csv: Bypass luma calculatations when --max-cll is OFF or when csv-log-level < 2
Ashok Kumar Mishra
ashok at multicorewareinc.com
Thu Feb 1 15:34:50 CET 2018
On Thu, Feb 1, 2018 at 5:59 PM, <bhavna at multicorewareinc.com> wrote:
> # HG changeset patch
> # User Bhavna Hariharan <bhavna at multicorewareinc.com>
> # Date 1517408059 -19800
> # Wed Jan 31 19:44:19 2018 +0530
> # Node ID 4345744c5e23e925ed658837359d5502b5ff94a7
> # Parent 79c5e3bfeb59041be822f7a4a21b95548ddccd07
> csv: Bypass luma calculatations when --max-cll is OFF or when
> csv-log-level < 2
>
> The maxFall and maxCll values are calculated from the min, max and average
> luma
> values. The luma values were being calculated even when --max-cll is
> disabled.
> This patch bypasses the luma calculations when --max-cll is OFF or
> when csv-log-level < 2
>
> diff -r 79c5e3bfeb59 -r 4345744c5e23 source/common/picyuv.cpp
> --- a/source/common/picyuv.cpp Tue Jan 30 15:57:08 2018 +0530
> +++ b/source/common/picyuv.cpp Wed Jan 31 19:44:19 2018 +0530
> @@ -358,17 +358,21 @@
> pixel *uPic = m_picOrg[1];
> pixel *vPic = m_picOrg[2];
>
> - for (int r = 0; r < height; r++)
> +
> + if (param.csvLogLevel >= 2 || param.maxCLL || param.maxFALL)
> {
> - for (int c = 0; c < width; c++)
> + for (int r = 0; r < height; r++)
> {
> - m_maxLumaLevel = X265_MAX(yPic[c], m_maxLumaLevel);
> - m_minLumaLevel = X265_MIN(yPic[c], m_minLumaLevel);
> - lumaSum += yPic[c];
> + for (int c = 0; c < width; c++)
> + {
> + m_maxLumaLevel = X265_MAX(yPic[c], m_maxLumaLevel);
> + m_minLumaLevel = X265_MIN(yPic[c], m_minLumaLevel);
> + lumaSum += yPic[c];
> + }
> + yPic += m_stride;
> }
> - yPic += m_stride;
> + m_avgLumaLevel = (double)lumaSum / (m_picHeight * m_picWidth);
> }
> - m_avgLumaLevel = (double)lumaSum / (m_picHeight * m_picWidth);
>
> if (param.csvLogLevel >= 2)
> {
> diff -r 79c5e3bfeb59 -r 4345744c5e23 source/encoder/api.cpp
> --- a/source/encoder/api.cpp Tue Jan 30 15:57:08 2018 +0530
> +++ b/source/encoder/api.cpp Wed Jan 31 19:44:19 2018 +0530
> @@ -67,8 +67,7 @@
> "Y PSNR, U PSNR, V PSNR, Global PSNR, SSIM, SSIM (dB), "
> "I count, I ave-QP, I kbps, I-PSNR Y, I-PSNR U, I-PSNR V, I-SSIM
> (dB), "
> "P count, P ave-QP, P kbps, P-PSNR Y, P-PSNR U, P-PSNR V, P-SSIM
> (dB), "
> - "B count, B ave-QP, B kbps, B-PSNR Y, B-PSNR U, B-PSNR V, B-SSIM
> (dB), "
> - "MaxCLL, MaxFALL, Version\n";
> + "B count, B ave-QP, B kbps, B-PSNR Y, B-PSNR U, B-PSNR V, B-SSIM
> (dB), ";
>
> x265_encoder *x265_encoder_open(x265_param *p)
> {
> @@ -757,7 +756,12 @@
> fprintf(csvfp, "\n");
> }
> else
> + {
> fputs(summaryCSVHeader, csvfp);
> + if (param->csvLogLevel >= 2 || param->maxCLL ||
> param->maxFALL)
> + fputs("MaxCLL, MaxFALL,", csvfp);
> + fputs(" Version\n", csvfp);
> + }
> }
> return csvfp;
> }
> @@ -881,6 +885,9 @@
> // adding summary to a per-frame csv log file, so it needs a
> summary header
> fprintf(p->csvfpt, "\nSummary\n");
> fputs(summaryCSVHeader, p->csvfpt);
> + if (p->csvLogLevel >= 2 || p->maxCLL || p->maxFALL)
> + fputs("MaxCLL, MaxFALL,", p->csvfpt);
> + fputs(" Version\n",p->csvfpt);
> }
>
> // CLI arguments or other
> @@ -974,7 +981,9 @@
> else
> fprintf(p->csvfpt, " -, -, -, -, -, -, -,");
>
> - fprintf(p->csvfpt, " %-6u, %-6u, %s\n", stats->maxCLL,
> stats->maxFALL, api->version_str);
> + if (p->csvLogLevel >= 2 || p->maxCLL || p->maxFALL)
> + fprintf(p->csvfpt, " %-6u, %-6u,", stats->maxCLL,
> stats->maxFALL);
> + fprintf(p->csvfpt, " %s\n", api->version_str);
> }
>
> }
> diff -r 79c5e3bfeb59 -r 4345744c5e23 source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp Tue Jan 30 15:57:08 2018 +0530
> +++ b/source/encoder/encoder.cpp Wed Jan 31 19:44:19 2018 +0530
> @@ -1984,8 +1984,11 @@
> stats->statsB.psnrV = m_analyzeB.m_psnrSumV /
> (double)m_analyzeB.m_numPics;
> stats->statsB.ssim = x265_ssim2dB(m_analyzeB.m_globalSsim /
> (double)m_analyzeB.m_numPics);
>
> - stats->maxCLL = m_analyzeAll.m_maxCLL;
> - stats->maxFALL = (uint16_t)(m_analyzeAll.m_maxFALL /
> m_analyzeAll.m_numPics);
> + if (m_param->csvLogLevel >= 2 || m_param->maxCLL ||
> m_param->maxFALL)
> + {
> + stats->maxCLL = m_analyzeAll.m_maxCLL;
> + stats->maxFALL = (uint16_t)(m_analyzeAll.m_maxFALL /
> m_analyzeAll.m_numPics);
> + }
> }
>
> /* If new statistics are added to x265_stats, we must check here
> whether the
> @@ -2060,8 +2063,11 @@
> m_analyzeB.addSsim(ssim);
> }
>
> - m_analyzeAll.m_maxFALL += curFrame->m_fencPic->m_avgLumaLevel;
> - m_analyzeAll.m_maxCLL = X265_MAX(m_analyzeAll.m_maxCLL,
> curFrame->m_fencPic->m_maxLumaLevel);
> + if (m_param->csvLogLevel >= 2 || m_param->maxCLL || m_param->maxFALL)
> + {
> + m_analyzeAll.m_maxFALL += curFrame->m_fencPic->m_avgLumaLevel;
> + m_analyzeAll.m_maxCLL = X265_MAX(m_analyzeAll.m_maxCLL,
> curFrame->m_fencPic->m_maxLumaLevel);
> + }
>
> char c = (slice->isIntra() ? (curFrame->m_lowres.sliceType ==
> X265_TYPE_IDR ? 'I' : 'i') : slice->isInterP() ? 'P' : 'B');
> int poc = slice->m_poc;
> @@ -2104,10 +2110,6 @@
>
> #define ELAPSED_MSEC(start, end) (((double)(end) - (start)) / 1000)
>
> - frameStats->maxLumaLevel = curFrame->m_fencPic->m_maxLumaLevel;
> - frameStats->minLumaLevel = curFrame->m_fencPic->m_minLumaLevel;
> - frameStats->avgLumaLevel = curFrame->m_fencPic->m_avgLumaLevel;
> -
> if (m_param->csvLogLevel >= 2)
> {
> frameStats->decideWaitTime = ELAPSED_MSEC(0, curEncoder->m_
> slicetypeWaitTime);
> @@ -2128,6 +2130,10 @@
> frameStats->avgPsyEnergy = curFrame->m_encData->m_
> frameStats.avgPsyEnergy;
> frameStats->avgResEnergy = curFrame->m_encData->m_
> frameStats.avgResEnergy;
>
> + frameStats->maxLumaLevel = curFrame->m_fencPic->m_
> maxLumaLevel;
> + frameStats->minLumaLevel = curFrame->m_fencPic->m_
> minLumaLevel;
> + frameStats->avgLumaLevel = curFrame->m_fencPic->m_
> avgLumaLevel;
> +
> frameStats->maxChromaULevel = curFrame->m_fencPic->m_
> maxChromaULevel;
> frameStats->minChromaULevel = curFrame->m_fencPic->m_
> minChromaULevel;
> frameStats->avgChromaULevel = curFrame->m_fencPic->m_
> avgChromaULevel;
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
>
Thanks. Pushed to default.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20180201/1c11a50d/attachment-0001.html>
More information about the x265-devel
mailing list