<div dir="ltr">Min, Kavitha's patch moved maxLumaLevel into copyFromPicture, which is the right place for this, since maxLumaLevel is calculated from input pic.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 13, 2015 at 8:52 AM, Min Chen <span dir="ltr"><<a href="mailto:chenm003@163.com" target="_blank">chenm003@163.com</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 Min Chen <<a href="mailto:chenm003@163.com">chenm003@163.com</a>><br>
# Date 1439426801 25200<br>
# Node ID 128db3baec386bacf0fd102c7e99ecf82c165657<br>
# Parent caf9562dc947f93e8ee237574575e9b67d494fc8<br>
Statistics maxLumaLevel in Frame Level<br>
---<br>
source/common/framedata.h | 1 -<br>
source/encoder/encoder.cpp | 20 +++++++++++++++++++-<br>
source/encoder/frameencoder.cpp | 8 --------<br>
3 files changed, 19 insertions(+), 10 deletions(-)<br>
<br>
diff -r caf9562dc947 -r 128db3baec38 source/common/framedata.h<br>
--- a/source/common/framedata.h Wed Aug 12 17:15:13 2015 -0700<br>
+++ b/source/common/framedata.h Wed Aug 12 17:46:41 2015 -0700<br>
@@ -75,7 +75,6 @@<br>
uint64_t cntIntra[NUM_CU_DEPTH];<br>
uint64_t cuInterDistribution[NUM_CU_DEPTH][INTER_MODES];<br>
uint64_t cuIntraDistribution[NUM_CU_DEPTH][INTRA_MODES];<br>
- uint16_t maxLumaLevel;<br>
<br>
FrameStats()<br>
{<br>
diff -r caf9562dc947 -r 128db3baec38 source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp Wed Aug 12 17:15:13 2015 -0700<br>
+++ b/source/encoder/encoder.cpp Wed Aug 12 17:46:41 2015 -0700<br>
@@ -1164,7 +1164,25 @@<br>
frameStats->avgLumaDistortion = curFrame->m_encData->m_frameStats.avgLumaDistortion;<br>
frameStats->avgPsyEnergy = curFrame->m_encData->m_frameStats.avgPsyEnergy;<br>
frameStats->avgLumaLevel = curFrame->m_encData->m_frameStats.avgLumaLevel;<br>
- frameStats->maxLumaLevel = curFrame->m_encData->m_frameStats.maxLumaLevel;<br>
+<br>
+ // Statistics Maximum LumaLevel for (csvlog_level >= 2)<br>
+ {<br>
+ const pixel *pix = curFrame->m_fencPic->m_picOrg[0];<br>
+ const intptr_t stride = curFrame->m_fencPic->m_stride;<br>
+<br>
+ pixel maxLumaLevel = 0;<br>
+ for(uint32_t y = 0; y < curFrame->m_fencPic->m_picHeight; y++)<br>
+ {<br>
+ for(uint32_t x = 0; x < curFrame->m_fencPic->m_picWidth; x++)<br>
+ {<br>
+ if (pix[x] > maxLumaLevel)<br>
+ maxLumaLevel = pix[x];<br>
+ }<br>
+ pix += stride;<br>
+ }<br>
+ frameStats->maxLumaLevel = maxLumaLevel;<br>
+ }<br>
+<br>
for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
{<br>
frameStats->cuStats.percentSkipCu[depth] = curFrame->m_encData->m_frameStats.percentSkipCu[depth];<br>
diff -r caf9562dc947 -r 128db3baec38 source/encoder/frameencoder.cpp<br>
--- a/source/encoder/frameencoder.cpp Wed Aug 12 17:15:13 2015 -0700<br>
+++ b/source/encoder/frameencoder.cpp Wed Aug 12 17:46:41 2015 -0700<br>
@@ -594,8 +594,6 @@<br>
m_frame->m_encData->m_frameStats.psyEnergy += m_rows[i].rowStats.psyEnergy;<br>
m_frame->m_encData->m_frameStats.lumaLevel += m_rows[i].rowStats.lumaLevel;<br>
<br>
- if (m_rows[i].rowStats.maxLumaLevel > m_frame->m_encData->m_frameStats.maxLumaLevel)<br>
- m_frame->m_encData->m_frameStats.maxLumaLevel = m_rows[i].rowStats.maxLumaLevel;<br>
for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
{<br>
m_frame->m_encData->m_frameStats.cntSkipCu[depth] += m_rows[i].rowStats.cntSkipCu[depth];<br>
@@ -995,12 +993,6 @@<br>
static const pixel dummy_zero[MAX_CU_SIZE] = {0};<br>
uint32_t ctuLumaLevel = primitives.pu[best.fencYuv->m_part].sad(best.fencYuv->m_buf[0], best.fencYuv->m_size, dummy_zero, 0);<br>
uint32_t ctuNoOfPixels = best.fencYuv->m_size * best.fencYuv->m_size;<br>
- for (uint32_t i = 0; i < ctuNoOfPixels; i++)<br>
- {<br>
- pixel p = best.fencYuv->m_buf[0][i];<br>
- if (p > curRow.rowStats.maxLumaLevel)<br>
- curRow.rowStats.maxLumaLevel = p;<br>
- }<br>
curRow.rowStats.lumaLevel += (double)(ctuLumaLevel) / ctuNoOfPixels;<br>
<br>
curEncData.m_cuStat[cuAddr].totalBits = best.totalBits;<br>
<br>
_______________________________________________<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/listinfo/x265-devel</a><br>
</blockquote></div><br></div>