[x265] [PATCH] stats: average residual energy after motion prediction per frame
Divya Manivannan
divya at multicorewareinc.com
Thu Aug 20 07:16:32 CEST 2015
# HG changeset patch
# User Divya Manivannan <divya at multicorewareinc.com>
# Date 1440047769 -19800
# Thu Aug 20 10:46:09 2015 +0530
# Node ID cebd5c7b553457dcde3c26a16c6d4f58c7cfd71f
# Parent cc5ceb11f902094a9755af5a3295e639da620c10
stats: average residual energy after motion prediction per frame
diff -r cc5ceb11f902 -r cebd5c7b5534 source/CMakeLists.txt
--- a/source/CMakeLists.txt Wed Aug 19 16:46:00 2015 +0530
+++ b/source/CMakeLists.txt Thu Aug 20 10:46:09 2015 +0530
@@ -30,7 +30,7 @@
mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
# X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 71)
+set(X265_BUILD 72)
configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r cc5ceb11f902 -r cebd5c7b5534 source/common/framedata.h
--- a/source/common/framedata.h Wed Aug 19 16:46:00 2015 +0530
+++ b/source/common/framedata.h Thu Aug 20 10:46:09 2015 +0530
@@ -55,6 +55,7 @@
double avgLumaDistortion;
double avgChromaDistortion;
double avgPsyEnergy;
+ double avgResEnergy;
double percentIntraNxN;
double percentSkipCu[NUM_CU_DEPTH];
double percentMergeCu[NUM_CU_DEPTH];
@@ -67,6 +68,7 @@
uint64_t lumaDistortion;
uint64_t chromaDistortion;
uint64_t psyEnergy;
+ uint64_t resEnergy;
uint64_t cntSkipCu[NUM_CU_DEPTH];
uint64_t cntMergeCu[NUM_CU_DEPTH];
uint64_t cntInter[NUM_CU_DEPTH];
diff -r cc5ceb11f902 -r cebd5c7b5534 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Wed Aug 19 16:46:00 2015 +0530
+++ b/source/encoder/encoder.cpp Thu Aug 20 10:46:09 2015 +0530
@@ -1172,6 +1172,7 @@
frameStats->avgChromaDistortion = curFrame->m_encData->m_frameStats.avgChromaDistortion;
frameStats->avgLumaDistortion = curFrame->m_encData->m_frameStats.avgLumaDistortion;
frameStats->avgPsyEnergy = curFrame->m_encData->m_frameStats.avgPsyEnergy;
+ frameStats->avgResEnergy = curFrame->m_encData->m_frameStats.avgResEnergy;
frameStats->avgLumaLevel = curFrame->m_fencPic->m_avgLumaLevel;
frameStats->maxLumaLevel = curFrame->m_fencPic->m_maxLumaLevel;
for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)
diff -r cc5ceb11f902 -r cebd5c7b5534 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp Wed Aug 19 16:46:00 2015 +0530
+++ b/source/encoder/frameencoder.cpp Thu Aug 20 10:46:09 2015 +0530
@@ -592,6 +592,7 @@
m_frame->m_encData->m_frameStats.lumaDistortion += m_rows[i].rowStats.lumaDistortion;
m_frame->m_encData->m_frameStats.chromaDistortion += m_rows[i].rowStats.chromaDistortion;
m_frame->m_encData->m_frameStats.psyEnergy += m_rows[i].rowStats.psyEnergy;
+ m_frame->m_encData->m_frameStats.resEnergy += m_rows[i].rowStats.resEnergy;
for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)
{
@@ -606,6 +607,7 @@
m_frame->m_encData->m_frameStats.avgLumaDistortion = (double)(m_frame->m_encData->m_frameStats.lumaDistortion) / m_frame->m_encData->m_frameStats.totalCtu;
m_frame->m_encData->m_frameStats.avgChromaDistortion = (double)(m_frame->m_encData->m_frameStats.chromaDistortion) / m_frame->m_encData->m_frameStats.totalCtu;
m_frame->m_encData->m_frameStats.avgPsyEnergy = (double)(m_frame->m_encData->m_frameStats.psyEnergy) / m_frame->m_encData->m_frameStats.totalCtu;
+ m_frame->m_encData->m_frameStats.avgResEnergy = (double)(m_frame->m_encData->m_frameStats.resEnergy) / m_frame->m_encData->m_frameStats.totalCtu;
m_frame->m_encData->m_frameStats.percentIntraNxN = (double)(m_frame->m_encData->m_frameStats.cntIntraNxN * 100) / m_frame->m_encData->m_frameStats.totalCu;
for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)
{
@@ -975,6 +977,7 @@
curRow.rowStats.lumaDistortion += best.lumaDistortion;
curRow.rowStats.chromaDistortion += best.chromaDistortion;
curRow.rowStats.psyEnergy += best.psyEnergy;
+ curRow.rowStats.resEnergy += best.resEnergy;
curRow.rowStats.cntIntraNxN += frameLog.cntIntraNxN;
curRow.rowStats.totalCu += frameLog.totalCu;
for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)
diff -r cc5ceb11f902 -r cebd5c7b5534 source/encoder/search.cpp
--- a/source/encoder/search.cpp Wed Aug 19 16:46:00 2015 +0530
+++ b/source/encoder/search.cpp Thu Aug 20 10:46:09 2015 +0530
@@ -1196,6 +1196,8 @@
const Yuv* fencYuv = intraMode.fencYuv;
intraMode.psyEnergy = m_rdCost.psyCost(cuGeom.log2CUSize - 2, fencYuv->m_buf[0], fencYuv->m_size, intraMode.reconYuv.m_buf[0], intraMode.reconYuv.m_size);
}
+ intraMode.resEnergy = primitives.cu[cuGeom.log2CUSize - 2].sse_pp(intraMode.fencYuv->m_buf[0], intraMode.fencYuv->m_size, intraMode.predYuv.m_buf[0], intraMode.predYuv.m_size);
+
updateModeCost(intraMode);
checkDQP(intraMode, cuGeom);
}
@@ -1408,6 +1410,7 @@
const Yuv* fencYuv = intraMode.fencYuv;
intraMode.psyEnergy = m_rdCost.psyCost(cuGeom.log2CUSize - 2, fencYuv->m_buf[0], fencYuv->m_size, reconYuv->m_buf[0], reconYuv->m_size);
}
+ intraMode.resEnergy = primitives.cu[cuGeom.log2CUSize - 2].sse_pp(intraMode.fencYuv->m_buf[0], intraMode.fencYuv->m_size, intraMode.predYuv.m_buf[0], intraMode.predYuv.m_size);
m_entropyCoder.store(intraMode.contexts);
updateModeCost(intraMode);
@@ -2455,6 +2458,7 @@
CUData& cu = interMode.cu;
Yuv* reconYuv = &interMode.reconYuv;
const Yuv* fencYuv = interMode.fencYuv;
+ Yuv* predYuv = &interMode.predYuv;
X265_CHECK(!cu.isIntra(0), "intra CU not expected\n");
@@ -2488,6 +2492,7 @@
interMode.totalBits = interMode.mvBits;
if (m_rdCost.m_psyRd)
interMode.psyEnergy = m_rdCost.psyCost(part, fencYuv->m_buf[0], fencYuv->m_size, reconYuv->m_buf[0], reconYuv->m_size);
+ interMode.resEnergy = primitives.cu[part].sse_pp(fencYuv->m_buf[0], fencYuv->m_size, predYuv->m_buf[0], predYuv->m_size);
updateModeCost(interMode);
m_entropyCoder.store(interMode.contexts);
@@ -2600,6 +2605,7 @@
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));
if (m_rdCost.m_psyRd)
interMode.psyEnergy = m_rdCost.psyCost(sizeIdx, fencYuv->m_buf[0], fencYuv->m_size, reconYuv->m_buf[0], reconYuv->m_size);
+ interMode.resEnergy = primitives.cu[sizeIdx].sse_pp(fencYuv->m_buf[0], fencYuv->m_size, predYuv->m_buf[0], predYuv->m_size);
interMode.totalBits = bits;
interMode.lumaDistortion = bestLumaDist;
diff -r cc5ceb11f902 -r cebd5c7b5534 source/encoder/search.h
--- a/source/encoder/search.h Wed Aug 19 16:46:00 2015 +0530
+++ b/source/encoder/search.h Thu Aug 20 10:46:09 2015 +0530
@@ -109,6 +109,7 @@
uint64_t sa8dCost; // sum of partition sa8d distortion costs (sa8d(fenc, pred) + lambda * bits)
uint32_t sa8dBits; // signal bits used in sa8dCost calculation
uint32_t psyEnergy; // sum of partition psycho-visual energy difference
+ sse_ret_t resEnergy; // sum of partition residual energy after motion prediction
sse_ret_t lumaDistortion;
sse_ret_t chromaDistortion;
sse_ret_t distortion; // sum of partition SSE distortion
@@ -122,6 +123,7 @@
sa8dCost = 0;
sa8dBits = 0;
psyEnergy = 0;
+ resEnergy = 0;
lumaDistortion = 0;
chromaDistortion = 0;
distortion = 0;
@@ -138,10 +140,12 @@
sa8dBits = MAX_UINT / 2;
psyEnergy = MAX_UINT / 2;
#if X265_DEPTH <= 10
+ resEnergy = MAX_UINT / 2;
lumaDistortion = MAX_UINT / 2;
chromaDistortion = MAX_UINT / 2;
distortion = MAX_UINT / 2;
#else
+ resEnergy = UINT64_MAX / 2;
lumaDistortion = UINT64_MAX / 2;
chromaDistortion = UINT64_MAX / 2;
distortion = UINT64_MAX / 2;
@@ -158,6 +162,7 @@
sa8dCost >= UINT64_MAX / 2 ||
sa8dBits >= MAX_UINT / 2 ||
psyEnergy >= MAX_UINT / 2 ||
+ resEnergy >= MAX_UINT / 2 ||
lumaDistortion >= MAX_UINT / 2 ||
chromaDistortion >= MAX_UINT / 2 ||
distortion >= MAX_UINT / 2 ||
@@ -169,6 +174,7 @@
sa8dCost >= UINT64_MAX / 2 ||
sa8dBits >= MAX_UINT / 2 ||
psyEnergy >= MAX_UINT / 2 ||
+ resEnergy >= UINT64_MAX / 2 ||
lumaDistortion >= UINT64_MAX / 2 ||
chromaDistortion >= UINT64_MAX / 2 ||
distortion >= UINT64_MAX / 2 ||
@@ -186,6 +192,7 @@
sa8dCost += subMode.sa8dCost;
sa8dBits += subMode.sa8dBits;
psyEnergy += subMode.psyEnergy;
+ resEnergy += subMode.resEnergy;
lumaDistortion += subMode.lumaDistortion;
chromaDistortion += subMode.chromaDistortion;
distortion += subMode.distortion;
diff -r cc5ceb11f902 -r cebd5c7b5534 source/x265-extras.cpp
--- a/source/x265-extras.cpp Wed Aug 19 16:46:00 2015 +0530
+++ b/source/x265-extras.cpp Thu Aug 20 10:46:09 2015 +0530
@@ -107,7 +107,7 @@
fprintf(csvfp, ", Merge %dx%d", size, size);
size /= 2;
}
- fprintf(csvfp, ", Avg Luma Distortion, Avg Chroma Distortion, Avg psyEnergy, Avg Luma Level, Max Luma Level");
+ fprintf(csvfp, ", Avg Luma Distortion, Avg Chroma Distortion, Avg psyEnergy, Avg Luma Level, Max Luma Level, Avg Residual Energy");
}
fprintf(csvfp, "\n");
}
@@ -179,7 +179,7 @@
fprintf(csvfp, ", %5.2lf%%", frameStats->cuStats.percentSkipCu[depth]);
for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)
fprintf(csvfp, ", %5.2lf%%", frameStats->cuStats.percentMergeCu[depth]);
- fprintf(csvfp, ", %.2lf, %.2lf, %.2lf, %.2lf, %d", frameStats->avgLumaDistortion, frameStats->avgChromaDistortion, frameStats->avgPsyEnergy, frameStats->avgLumaLevel, frameStats->maxLumaLevel);
+ fprintf(csvfp, ", %.2lf, %.2lf, %.2lf, %.2lf, %d, %.2lf", frameStats->avgLumaDistortion, frameStats->avgChromaDistortion, frameStats->avgPsyEnergy, frameStats->avgLumaLevel, frameStats->maxLumaLevel, frameStats->avgResEnergy);
}
fprintf(csvfp, "\n");
fflush(stderr);
diff -r cc5ceb11f902 -r cebd5c7b5534 source/x265.h
--- a/source/x265.h Wed Aug 19 16:46:00 2015 +0530
+++ b/source/x265.h Thu Aug 20 10:46:09 2015 +0530
@@ -132,6 +132,7 @@
double avgLumaDistortion;
double avgChromaDistortion;
double avgPsyEnergy;
+ double avgResEnergy;
double avgLumaLevel;
uint64_t bits;
int encoderOrder;
More information about the x265-devel
mailing list