[x265] [PATCH] analysis: fix bug in intra and inter information sharing using analysisdata file
gopu at multicorewareinc.com
gopu at multicorewareinc.com
Thu Nov 13 08:38:16 CET 2014
# HG changeset patch
# User Gopu Govindaswamy <gopu at multicorewareinc.com>
# Date 1415864212 -19800
# Thu Nov 13 13:06:52 2014 +0530
# Node ID 0693e0c041fbf0079f97ce35c50029fe130985b6
# Parent 2e30a7929ebd85c8ebede93cd0c41797bdf36ba0
analysis: fix bug in intra and inter information sharing using analysisdata file
1.fixed the bug output mismatch for inter sharing while running same cli with
save and load mode
2.fixed the bug output mismatch for intra information sharing while running same
cli with save and load mode
3.currently disabled forcing slicetype using analysis data file, this is causing
output non determinism with and without forcing slicetype,
diff -r 2e30a7929ebd -r 0693e0c041fb source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp Thu Nov 13 11:39:47 2014 +0530
+++ b/source/encoder/analysis.cpp Thu Nov 13 13:06:52 2014 +0530
@@ -148,7 +148,7 @@
else
{
if (m_param->analysisMode)
- m_interAnalysisData = m_frame->m_interData + (ctu.m_cuAddr * (CUGeom::MAX_GEOMS * NUM_SIZES));
+ m_interAnalysisData = m_frame->m_interData + (ctu.m_cuAddr * (CUGeom::MAX_GEOMS * NUM_SIZES * Mode::MAX_INTER_PARTS));
if (!m_param->rdLevel)
{
@@ -218,7 +218,7 @@
PartSize size = (PartSize)sharedPartSizes[zOrder];
Mode& mode = size == SIZE_2Nx2N ? md.pred[PRED_INTRA] : md.pred[PRED_INTRA_NxN];
mode.cu.initSubCU(parentCTU, cuGeom);
- checkIntra(mode, cuGeom, size, sharedModes);
+ checkIntra(mode, cuGeom, size, &sharedModes[zOrder]);
checkBestMode(mode, depth);
if (m_bTryLossless)
@@ -1454,10 +1454,10 @@
MotionData* bestME = interMode.bestME[part];
for (int32_t i = 0; i < numPredDir; i++)
{
- bestME[i].costZero = !!m_interAnalysisData->costZero[i];
bestME[i].mv.x = m_interAnalysisData->mvx[i];
bestME[i].mv.y = m_interAnalysisData->mvy[i];
bestME[i].ref = m_interAnalysisData->ref[i];
+ bestME[i].satdcost = m_interAnalysisData->satdCost[i];
}
m_interAnalysisData++;
}
@@ -1477,10 +1477,10 @@
MotionData* bestME = interMode.bestME[part];
for (int32_t i = 0; i < numPredDir; i++)
{
- m_interAnalysisData->costZero[i] = bestME[i].costZero;
m_interAnalysisData->mvx[i] = bestME[i].mv.x;
m_interAnalysisData->mvy[i] = bestME[i].mv.y;
m_interAnalysisData->ref[i] = bestME[i].ref;
+ m_interAnalysisData->satdCost[i] = bestME[i].satdcost;
}
m_interAnalysisData->zOrder = cuGeom.encodeIdx;
m_interAnalysisData->depth = cuGeom.depth;
@@ -1509,10 +1509,10 @@
MotionData* bestME = interMode.bestME[part];
for (int32_t i = 0; i < numPredDir; i++)
{
- bestME[i].costZero = !!m_interAnalysisData->costZero[i];
bestME[i].mv.x = m_interAnalysisData->mvx[i];
bestME[i].mv.y = m_interAnalysisData->mvy[i];
bestME[i].ref = m_interAnalysisData->ref[i];
+ bestME[i].satdcost = m_interAnalysisData->satdCost[i];
}
m_interAnalysisData++;
}
@@ -1528,10 +1528,10 @@
MotionData* bestME = interMode.bestME[part];
for (int32_t i = 0; i < numPredDir; i++)
{
- m_interAnalysisData->costZero[i] = bestME[i].costZero;
m_interAnalysisData->mvx[i] = bestME[i].mv.x;
m_interAnalysisData->mvy[i] = bestME[i].mv.y;
m_interAnalysisData->ref[i] = bestME[i].ref;
+ m_interAnalysisData->satdCost[i] = bestME[i].satdcost;
}
m_interAnalysisData->zOrder = cuGeom.encodeIdx;
m_interAnalysisData->depth = cuGeom.depth;
diff -r 2e30a7929ebd -r 0693e0c041fb source/encoder/search.cpp
--- a/source/encoder/search.cpp Thu Nov 13 11:39:47 2014 +0530
+++ b/source/encoder/search.cpp Thu Nov 13 13:06:52 2014 +0530
@@ -2032,21 +2032,18 @@
MV bmv(bestME[l].mv.x, bestME[l].mv.y);
int satdCost;
- if (bestME[l].costZero)
- satdCost = m_me.mvcost(bmv);
- else
- satdCost = bestME[l].cost;
+ satdCost = bestME[l].satdcost;
/* Get total cost of partition, but only include MV bit cost once */
bits += m_me.bitcost(bmv);
uint32_t cost = (satdCost - m_me.mvcost(bmv)) + m_rdCost.getCost(bits);
/* Refine MVP selection, updates: mvp, mvpIdx, bits, cost */
- checkBestMVP(interMode.amvpCand[l][ref], outmv, mvp, mvpIdx, bits, cost);
+ checkBestMVP(interMode.amvpCand[l][ref], bmv, mvp, mvpIdx, bits, cost);
if (cost < bestME[l].cost)
{
- bestME[l].mv = outmv;
+ bestME[l].mv = bmv;
bestME[l].mvp = mvp;
bestME[l].mvpIdx = mvpIdx;
bestME[l].ref = ref;
@@ -2155,6 +2152,7 @@
bestME[l].ref = ref;
bestME[l].cost = cost;
bestME[l].bits = bits;
+ bestME[l].satdcost = satdCost;
}
}
}
diff -r 2e30a7929ebd -r 0693e0c041fb source/encoder/search.h
--- a/source/encoder/search.h Thu Nov 13 11:39:47 2014 +0530
+++ b/source/encoder/search.h Thu Nov 13 13:06:52 2014 +0530
@@ -74,6 +74,7 @@
uint32_t cost;
int bits;
bool costZero;
+ uint32_t satdcost;
};
struct Mode
diff -r 2e30a7929ebd -r 0693e0c041fb source/x265.cpp
--- a/source/x265.cpp Thu Nov 13 11:39:47 2014 +0530
+++ b/source/x265.cpp Thu Nov 13 13:06:52 2014 +0530
@@ -883,12 +883,12 @@
return;\
}\
- int poc, width, height;
+ int poc, width, height, sliceType;
uint32_t numPart, numCU;
FREAD(&width, sizeof(int), 1, this->analysisFile);
FREAD(&height, sizeof(int), 1, this->analysisFile);
FREAD(&poc, sizeof(int), 1, this->analysisFile);
- FREAD(&pic->sliceType, sizeof(int), 1, this->analysisFile);
+ FREAD(&sliceType, sizeof(int), 1, this->analysisFile);
FREAD(&numCU, sizeof(int), 1, this->analysisFile);
FREAD(&numPart, sizeof(int), 1, this->analysisFile);
diff -r 2e30a7929ebd -r 0693e0c041fb source/x265.h
--- a/source/x265.h Thu Nov 13 11:39:47 2014 +0530
+++ b/source/x265.h Thu Nov 13 13:06:52 2014 +0530
@@ -93,7 +93,7 @@
{
uint32_t zOrder;
int ref[2];
- int costZero[2];
+ uint32_t satdCost[2];
int16_t mvx[2];
int16_t mvy[2];
uint32_t depth;
More information about the x265-devel
mailing list