<div dir="ltr">Thanks. resEnergy and lumaDistortion should be in uint64_t for main12. Eventhough both are in uint64_t, it will fail in main12 because sse function returns integer data type. So, I will fix the sse function in the follow up patch.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 6, 2015 at 9:42 PM, Steve Borho <span dir="ltr"><<a href="mailto:steve@borho.org" target="_blank">steve@borho.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 08/06, Divya Manivannan wrote:<br>
> # HG changeset patch<br>
> # User Divya Manivannan <<a href="mailto:divya@multicorewareinc.com">divya@multicorewareinc.com</a>><br>
> # Date 1438844729 -19800<br>
> #      Thu Aug 06 12:35:29 2015 +0530<br>
> # Node ID 1ef3394a866a79dc9735ed61fe37f4a8c55b7a64<br>
> # Parent  377a996a8d74110f838ff2e3cef1c42781d6d730<br>
> stats: average residual energy after motion prediction per frame<br>
><br>
> diff -r 377a996a8d74 -r 1ef3394a866a source/CMakeLists.txt<br>
> --- a/source/CMakeLists.txt   Wed Aug 05 15:09:14 2015 +0530<br>
> +++ b/source/CMakeLists.txt   Thu Aug 06 12:35:29 2015 +0530<br>
> @@ -30,7 +30,7 @@<br>
>  mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)<br>
><br>
>  # X265_BUILD must be incremented each time the public API is changed<br>
> -set(X265_BUILD 68)<br>
> +set(X265_BUILD 69)<br>
>  configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265.def.in" rel="noreferrer" target="_blank">x265.def.in</a>"<br>
>                 "${PROJECT_BINARY_DIR}/x265.def")<br>
>  configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265_config.h.in" rel="noreferrer" target="_blank">x265_config.h.in</a>"<br>
> diff -r 377a996a8d74 -r 1ef3394a866a source/common/framedata.h<br>
> --- a/source/common/framedata.h       Wed Aug 05 15:09:14 2015 +0530<br>
> +++ b/source/common/framedata.h       Thu Aug 06 12:35:29 2015 +0530<br>
> @@ -55,6 +55,7 @@<br>
>      double      avgLumaDistortion;<br>
>      double      avgChromaDistortion;<br>
>      double      avgPsyEnergy;<br>
> +    double      avgResEnergy;<br>
>      double      avgLumaLevel;<br>
>      double      lumaLevel;<br>
>      double      percentIntraNxN;<br>
> @@ -69,6 +70,7 @@<br>
>      uint64_t    lumaDistortion;<br>
>      uint64_t    chromaDistortion;<br>
>      uint64_t    psyEnergy;<br>
> +    uint64_t    resEnergy;<br>
>      uint64_t    cntSkipCu[NUM_CU_DEPTH];<br>
>      uint64_t    cntMergeCu[NUM_CU_DEPTH];<br>
>      uint64_t    cntInter[NUM_CU_DEPTH];<br>
> diff -r 377a996a8d74 -r 1ef3394a866a source/encoder/encoder.cpp<br>
> --- a/source/encoder/encoder.cpp      Wed Aug 05 15:09:14 2015 +0530<br>
> +++ b/source/encoder/encoder.cpp      Thu Aug 06 12:35:29 2015 +0530<br>
> @@ -1168,6 +1168,7 @@<br>
>          frameStats->avgChromaDistortion     = curFrame->m_encData->m_frameStats.avgChromaDistortion;<br>
>          frameStats->avgLumaDistortion       = curFrame->m_encData->m_frameStats.avgLumaDistortion;<br>
>          frameStats->avgPsyEnergy            = curFrame->m_encData->m_frameStats.avgPsyEnergy;<br>
> +        frameStats->avgResEnergy            = curFrame->m_encData->m_frameStats.avgResEnergy;<br>
>          frameStats->avgLumaLevel            = curFrame->m_encData->m_frameStats.avgLumaLevel;<br>
>          frameStats->maxLumaLevel            = curFrame->m_encData->m_frameStats.maxLumaLevel;<br>
>          for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
> diff -r 377a996a8d74 -r 1ef3394a866a source/encoder/frameencoder.cpp<br>
> --- a/source/encoder/frameencoder.cpp Wed Aug 05 15:09:14 2015 +0530<br>
> +++ b/source/encoder/frameencoder.cpp Thu Aug 06 12:35:29 2015 +0530<br>
> @@ -591,6 +591,7 @@<br>
>          m_frame->m_encData->m_frameStats.lumaDistortion   += m_rows[i].rowStats.lumaDistortion;<br>
>          m_frame->m_encData->m_frameStats.chromaDistortion += m_rows[i].rowStats.chromaDistortion;<br>
>          m_frame->m_encData->m_frameStats.psyEnergy        += m_rows[i].rowStats.psyEnergy;<br>
> +        m_frame->m_encData->m_frameStats.resEnergy        += m_rows[i].rowStats.resEnergy;<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>
> @@ -608,6 +609,7 @@<br>
>      m_frame->m_encData->m_frameStats.avgLumaDistortion   = (double)(m_frame->m_encData->m_frameStats.lumaDistortion / m_frame->m_encData->m_frameStats.totalCtu);<br>
>      m_frame->m_encData->m_frameStats.avgChromaDistortion = (double)(m_frame->m_encData->m_frameStats.chromaDistortion / m_frame->m_encData->m_frameStats.totalCtu);<br>
>      m_frame->m_encData->m_frameStats.avgPsyEnergy        = (double)(m_frame->m_encData->m_frameStats.psyEnergy / m_frame->m_encData->m_frameStats.totalCtu);<br>
> +    m_frame->m_encData->m_frameStats.avgResEnergy        = (double)(m_frame->m_encData->m_frameStats.resEnergy / m_frame->m_encData->m_frameStats.totalCtu);<br>
>      m_frame->m_encData->m_frameStats.avgLumaLevel        = (double)(m_frame->m_encData->m_frameStats.lumaLevel / m_frame->m_encData->m_frameStats.totalCtu);<br>
>      m_frame->m_encData->m_frameStats.percentIntraNxN     = (double)(m_frame->m_encData->m_frameStats.cntIntraNxN * 100) / m_frame->m_encData->m_frameStats.totalCu;<br>
>      for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
> @@ -977,6 +979,7 @@<br>
>          curRow.rowStats.lumaDistortion   += best.lumaDistortion;<br>
>          curRow.rowStats.chromaDistortion += best.chromaDistortion;<br>
>          curRow.rowStats.psyEnergy        += best.psyEnergy;<br>
> +        curRow.rowStats.resEnergy        += best.resEnergy;<br>
>          curRow.rowStats.cntIntraNxN      += frameLog.cntIntraNxN;<br>
>          curRow.rowStats.totalCu          += frameLog.totalCu;<br>
>          for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
> diff -r 377a996a8d74 -r 1ef3394a866a source/encoder/search.cpp<br>
> --- a/source/encoder/search.cpp       Wed Aug 05 15:09:14 2015 +0530<br>
> +++ b/source/encoder/search.cpp       Thu Aug 06 12:35:29 2015 +0530<br>
> @@ -1190,6 +1190,8 @@<br>
>          const Yuv* fencYuv = intraMode.fencYuv;<br>
>          intraMode.psyEnergy = m_rdCost.psyCost(cuGeom.log2CUSize - 2, fencYuv->m_buf[0], fencYuv->m_size, intraMode.reconYuv.m_buf[0], intraMode.reconYuv.m_size);<br>
>      }<br>
> +    intraMode.resEnergy = <a href="http://primitives.cu" rel="noreferrer" target="_blank">primitives.cu</a>[cuGeom.log2CUSize - 2].sse_pp(intraMode.fencYuv->m_buf[0], intraMode.fencYuv->m_size, intraMode.predYuv.m_buf[0], intraMode.predYuv.m_size);<br>
> +<br>
>      updateModeCost(intraMode);<br>
>      checkDQP(intraMode, cuGeom);<br>
>  }<br>
> @@ -1402,6 +1404,7 @@<br>
>          const Yuv* fencYuv = intraMode.fencYuv;<br>
>          intraMode.psyEnergy = m_rdCost.psyCost(cuGeom.log2CUSize - 2, fencYuv->m_buf[0], fencYuv->m_size, reconYuv->m_buf[0], reconYuv->m_size);<br>
>      }<br>
> +    intraMode.resEnergy = <a href="http://primitives.cu" rel="noreferrer" target="_blank">primitives.cu</a>[cuGeom.log2CUSize - 2].sse_pp(intraMode.fencYuv->m_buf[0], intraMode.fencYuv->m_size, intraMode.predYuv.m_buf[0], intraMode.predYuv.m_size);<br>
><br>
>      m_entropyCoder.store(intraMode.contexts);<br>
>      updateModeCost(intraMode);<br>
> @@ -2447,6 +2450,7 @@<br>
>      CUData& cu = interMode.cu;<br>
>      Yuv* reconYuv = &interMode.reconYuv;<br>
>      const Yuv* fencYuv = interMode.fencYuv;<br>
> +    Yuv* predYuv = &interMode.predYuv;<br>
><br>
>      X265_CHECK(!cu.isIntra(0), "intra CU not expected\n");<br>
><br>
> @@ -2480,6 +2484,7 @@<br>
>      interMode.totalBits = interMode.mvBits;<br>
>      if (m_rdCost.m_psyRd)<br>
>          interMode.psyEnergy = m_rdCost.psyCost(part, fencYuv->m_buf[0], fencYuv->m_size, reconYuv->m_buf[0], reconYuv->m_size);<br>
> +    interMode.resEnergy = <a href="http://primitives.cu" rel="noreferrer" target="_blank">primitives.cu</a>[part].sse_pp(fencYuv->m_buf[0], fencYuv->m_size, predYuv->m_buf[0], predYuv->m_size);<br>
><br>
>      updateModeCost(interMode);<br>
>      m_entropyCoder.store(interMode.contexts);<br>
> @@ -2592,6 +2597,7 @@<br>
>      bestChromaDist += m_rdCost.scaleChromaDist(2, primitives.chroma[m_csp].cu[sizeIdx].sse_pp(fencYuv->m_buf[2], fencYuv->m_csize, reconYuv->m_buf[2], reconYuv->m_csize));<br>
>      if (m_rdCost.m_psyRd)<br>
>          interMode.psyEnergy = m_rdCost.psyCost(sizeIdx, fencYuv->m_buf[0], fencYuv->m_size, reconYuv->m_buf[0], reconYuv->m_size);<br>
> +    interMode.resEnergy = <a href="http://primitives.cu" rel="noreferrer" target="_blank">primitives.cu</a>[sizeIdx].sse_pp(fencYuv->m_buf[0], fencYuv->m_size, predYuv->m_buf[0], predYuv->m_size);<br>
><br>
>      interMode.totalBits = bits;<br>
>      interMode.lumaDistortion = bestLumaDist;<br>
> diff -r 377a996a8d74 -r 1ef3394a866a source/encoder/search.h<br>
> --- a/source/encoder/search.h Wed Aug 05 15:09:14 2015 +0530<br>
> +++ b/source/encoder/search.h Thu Aug 06 12:35:29 2015 +0530<br>
> @@ -109,6 +109,7 @@<br>
>      uint64_t   sa8dCost;   // sum of partition sa8d distortion costs   (sa8d(fenc, pred) + lambda * bits)<br>
>      uint32_t   sa8dBits;   // signal bits used in sa8dCost calculation<br>
>      uint32_t   psyEnergy;  // sum of partition psycho-visual energy difference<br>
> +    uint64_t   resEnergy;  // sum of partition residual energy after motion prediction<br>
>      uint32_t   lumaDistortion;<br>
<br>
</div></div>resEnergy uses the same primitive as lumaDistortion (one uses predYuv,<br>
the other uses reconYuv), so why does resEnergy need to be uint64_t?<br>
<div><div class="h5"><br>
>      uint32_t   chromaDistortion;<br>
>      uint32_t   distortion; // sum of partition SSE distortion<br>
> @@ -122,6 +123,7 @@<br>
>          sa8dCost = 0;<br>
>          sa8dBits = 0;<br>
>          psyEnergy = 0;<br>
> +        resEnergy = 0;<br>
>          lumaDistortion = 0;<br>
>          chromaDistortion = 0;<br>
>          distortion = 0;<br>
> @@ -137,6 +139,7 @@<br>
>          sa8dCost = UINT64_MAX / 2;<br>
>          sa8dBits = MAX_UINT / 2;<br>
>          psyEnergy = MAX_UINT / 2;<br>
> +        resEnergy = UINT64_MAX / 2;<br>
>          lumaDistortion = MAX_UINT / 2;<br>
>          chromaDistortion = MAX_UINT / 2;<br>
>          distortion = MAX_UINT / 2;<br>
> @@ -151,6 +154,7 @@<br>
>                   sa8dCost >= UINT64_MAX / 2 ||<br>
>                   sa8dBits >= MAX_UINT / 2 ||<br>
>                   psyEnergy >= MAX_UINT / 2 ||<br>
> +                 resEnergy >= UINT64_MAX / 2 ||<br>
>                   lumaDistortion >= MAX_UINT / 2 ||<br>
>                   chromaDistortion >= MAX_UINT / 2 ||<br>
>                   distortion >= MAX_UINT / 2 ||<br>
> @@ -167,6 +171,7 @@<br>
>          sa8dCost += subMode.sa8dCost;<br>
>          sa8dBits += subMode.sa8dBits;<br>
>          psyEnergy += subMode.psyEnergy;<br>
> +        resEnergy += subMode.resEnergy;<br>
>          lumaDistortion += subMode.lumaDistortion;<br>
>          chromaDistortion += subMode.chromaDistortion;<br>
>          distortion += subMode.distortion;<br>
> diff -r 377a996a8d74 -r 1ef3394a866a source/x265-extras.cpp<br>
> --- a/source/x265-extras.cpp  Wed Aug 05 15:09:14 2015 +0530<br>
> +++ b/source/x265-extras.cpp  Thu Aug 06 12:35:29 2015 +0530<br>
> @@ -107,7 +107,7 @@<br>
>                          fprintf(csvfp, ", Merge %dx%d", size, size);<br>
>                          size /= 2;<br>
>                      }<br>
> -                    fprintf(csvfp, ", Avg Luma Distortion, Avg Chroma Distortion, Avg psyEnergy, Avg Luma Level, Max Luma Level");<br>
> +                    fprintf(csvfp, ", Avg Luma Distortion, Avg Chroma Distortion, Avg psyEnergy, Avg Luma Level, Max Luma Level, Avg Residual Energy");<br>
>                  }<br>
>                  fprintf(csvfp, "\n");<br>
>              }<br>
> @@ -179,7 +179,7 @@<br>
>              fprintf(csvfp, ", %5.2lf%%", frameStats->cuStats.percentSkipCu[depth]);<br>
>          for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
>              fprintf(csvfp, ", %5.2lf%%", frameStats->cuStats.percentMergeCu[depth]);<br>
> -        fprintf(csvfp, ", %.2lf, %.2lf, %.2lf, %.2lf, %d", frameStats->avgLumaDistortion, frameStats->avgChromaDistortion, frameStats->avgPsyEnergy, frameStats->avgLumaLevel, frameStats->maxLumaLevel);<br>
> +        fprintf(csvfp, ", %.2lf, %.2lf, %.2lf, %.2lf, %d, %.2lf", frameStats->avgLumaDistortion, frameStats->avgChromaDistortion, frameStats->avgPsyEnergy, frameStats->avgLumaLevel, frameStats->maxLumaLevel, frameStats->avgResEnergy);<br>
>      }<br>
>      fprintf(csvfp, "\n");<br>
>      fflush(stderr);<br>
> diff -r 377a996a8d74 -r 1ef3394a866a source/x265.h<br>
> --- a/source/x265.h   Wed Aug 05 15:09:14 2015 +0530<br>
> +++ b/source/x265.h   Thu Aug 06 12:35:29 2015 +0530<br>
> @@ -132,6 +132,7 @@<br>
>      double           avgLumaDistortion;<br>
>      double           avgChromaDistortion;<br>
>      double           avgPsyEnergy;<br>
> +    double           avgResEnergy;<br>
>      double           avgLumaLevel;<br>
>      uint64_t         bits;<br>
>      int              encoderOrder;<br>
</div></div>> _______________________________________________<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>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Steve Borho<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>
</font></span></blockquote></div><br></div>