[x265] [PATCH 3 of 3] analysis: Reduce data dump in analysis save mode for inter picture
sagar at multicorewareinc.com
sagar at multicorewareinc.com
Thu Jan 28 06:08:12 CET 2016
# HG changeset patch
# User Sagar Kotecha<sagar at multicorewareinc.com>
# Date 1453714190 -19800
# Mon Jan 25 14:59:50 2016 +0530
# Node ID 020efdd561f77237d1ebe42f96869b28573f96ae
# Parent 73dedfb8c0f69ce86207df0a754db84fd7aec4ab
analysis: Reduce data dump in analysis save mode for inter picture
diff -r 73dedfb8c0f6 -r 020efdd561f7 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp Mon Jan 25 14:59:15 2016 +0530
+++ b/source/encoder/analysis.cpp Mon Jan 25 14:59:50 2016 +0530
@@ -191,12 +191,6 @@
{
uint32_t zOrder = 0;
compressInterCU_rd5_6(ctu, cuGeom, zOrder, qp);
- if (m_param->analysisMode == X265_ANALYSIS_SAVE && m_frame->m_analysisData.interData)
- {
- CUData* bestCU = &m_modeDepth[0].bestMode->cu;
- memcpy(&m_reuseInterDataCTU->depth[ctu.m_cuAddr * numPartition], bestCU->m_cuDepth, sizeof(uint8_t) * numPartition);
- memcpy(&m_reuseInterDataCTU->modes[ctu.m_cuAddr * numPartition], bestCU->m_predMode, sizeof(uint8_t) * numPartition);
- }
}
}
diff -r 73dedfb8c0f6 -r 020efdd561f7 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Mon Jan 25 14:59:15 2016 +0530
+++ b/source/encoder/encoder.cpp Mon Jan 25 14:59:50 2016 +0530
@@ -1995,9 +1995,26 @@
else
{
+ uint8_t *tempBuf = NULL, *depthBuf = NULL, *modeBuf = NULL;
+
+ tempBuf = X265_MALLOC(uint8_t, depthBytes * 2);
+ X265_FREAD(tempBuf, sizeof(uint8_t), depthBytes * 2, m_analysisFile);
+
+ depthBuf = tempBuf;
+ modeBuf = tempBuf + depthBytes;
+
+ size_t count = 0;
+ for (uint32_t d = 0; d < depthBytes; d++)
+ {
+ int bytes = analysis->numPartitions >> (depthBuf[d] * 2);
+ memset(&((analysis_inter_data *)analysis->interData)->depth[count], depthBuf[d], bytes);
+ memset(&((analysis_inter_data *)analysis->interData)->modes[count], modeBuf[d], bytes);
+ count += bytes;
+ }
+
+ X265_FREE(tempBuf);
+
int numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2;
- X265_FREAD(((analysis_inter_data *)analysis->interData)->depth, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFile);
- X265_FREAD(((analysis_inter_data *)analysis->interData)->modes, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFile);
X265_FREAD(((analysis_inter_data *)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFile);
X265_FREAD(((analysis_inter_data *)analysis->interData)->bestMergeCand, sizeof(uint32_t), analysis->numCUsInFrame * CUGeom::MAX_GEOMS, m_analysisFile);
X265_FREAD(((analysis_inter_data *)analysis->interData)->mv, sizeof(MV), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFile);
@@ -2048,6 +2065,30 @@
memcpy(&intraDataCTU->modes[ctu->m_cuAddr * ctu->m_numPartitions], ctu->m_lumaIntraDir, sizeof(uint8_t)* ctu->m_numPartitions);
}
}
+ else
+ {
+ for (uint32_t cuAddr = 0; cuAddr < analysis->numCUsInFrame; cuAddr++)
+ {
+ uint8_t depth = 0;
+ uint8_t predMode = 0;
+
+ CUData* ctu = curEncData.getPicCTU(cuAddr);
+ analysis_inter_data* interDataCTU = (analysis_inter_data*)analysis->interData;
+
+ for (uint32_t absPartIdx = 0; absPartIdx < ctu->m_numPartitions; depthBytes++)
+ {
+ depth = ctu->m_cuDepth[absPartIdx];
+ interDataCTU->depth[depthBytes] = depth;
+
+ predMode = ctu->m_predMode[absPartIdx];
+ interDataCTU->modes[depthBytes] = predMode;
+
+ absPartIdx += ctu->m_numPartitions >> (depth * 2);
+ }
+ }
+
+ }
+
/* calculate frameRecordSize */
analysis->frameRecordSize = sizeof(analysis->frameRecordSize) + sizeof(depthBytes) + sizeof(analysis->poc) + sizeof(analysis->sliceType) +
@@ -2058,7 +2099,7 @@
{
int numDir = (analysis->sliceType == X265_TYPE_P) ? 1 : 2;
analysis->frameRecordSize += sizeof(int32_t) * analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir;
- analysis->frameRecordSize += sizeof(uint8_t) * analysis->numCUsInFrame * analysis->numPartitions * 2;
+ analysis->frameRecordSize += depthBytes * 2;
analysis->frameRecordSize += sizeof(uint32_t) * analysis->numCUsInFrame * CUGeom::MAX_GEOMS;
analysis->frameRecordSize += sizeof(MV) * analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir;
}
@@ -2081,8 +2122,8 @@
else
{
int numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2;
- X265_FWRITE(((analysis_inter_data*)analysis->interData)->depth, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFile);
- X265_FWRITE(((analysis_inter_data*)analysis->interData)->modes, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFile);
+ X265_FWRITE(((analysis_inter_data*)analysis->interData)->depth, sizeof(uint8_t), depthBytes, m_analysisFile);
+ X265_FWRITE(((analysis_inter_data*)analysis->interData)->modes, sizeof(uint8_t), depthBytes, m_analysisFile);
X265_FWRITE(((analysis_inter_data*)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFile);
X265_FWRITE(((analysis_inter_data*)analysis->interData)->bestMergeCand, sizeof(uint32_t), analysis->numCUsInFrame * CUGeom::MAX_GEOMS, m_analysisFile);
X265_FWRITE(((analysis_inter_data*)analysis->interData)->mv, sizeof(MV), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFile);
More information about the x265-devel
mailing list