Newer
Older
bool valid = false;
run = 0;
while (idx < total)
xPos = m_scanOrder[idx].x;
yPos = m_scanOrder[idx].y;
runType.at(xPos, yPos) = PLT_RUN_COPY;
if (yPos == 0 && !cu.useRotation[compBegin])
{
return false;
}
if (xPos == 0 && cu.useRotation[compBegin])
{
return false;
}
if (!cu.useRotation[compBegin] && curPLTIdx.at(xPos, yPos) == curPLTIdx.at(xPos, yPos - 1))
valid = true;
}
else if (cu.useRotation[compBegin] && curPLTIdx.at(xPos, yPos) == curPLTIdx.at(xPos - 1, yPos))
valid = true;
}
else
{
break;
}
}
return valid;
Yung-Hsuan Chao (Jessie)
committed
}
bool IntraPrediction::calIndexRun(CodingStructure &cs, Partitioner& partitioner, uint32_t startPos, uint32_t total, uint32_t &run, ComponentID compBegin)
Yung-Hsuan Chao (Jessie)
committed
{
TransformUnit &tu = *cs.getTU(partitioner.chType);
PelBuf curPLTIdx = tu.getcurPLTIdx(compBegin);
PLTtypeBuf runType = tu.getrunType(compBegin);
run = 1;
uint32_t idx = startPos;
while (idx < total)
uint32_t xPos = m_scanOrder[idx].x;
uint32_t yPos = m_scanOrder[idx].y;
runType.at(xPos, yPos) = PLT_RUN_INDEX;
uint32_t xPrev = idx == 0 ? 0 : m_scanOrder[idx - 1].x;
uint32_t yPrev = idx == 0 ? 0 : m_scanOrder[idx - 1].y;
if (idx > startPos && curPLTIdx.at(xPos, yPos) == curPLTIdx.at(xPrev, yPrev))
{
break;
}
}
return true;
Yung-Hsuan Chao (Jessie)
committed
}
void IntraPrediction::reorderPLT(CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp)
Yung-Hsuan Chao (Jessie)
committed
{
CodingUnit &cu = *cs.getCU(partitioner.chType);
uint8_t reusePLTSizetmp = 0;
uint8_t pltSizetmp = 0;
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
Pel curPLTtmp[MAX_NUM_COMPONENT][MAXPLTSIZE];
bool curPLTpred[MAXPLTPREDSIZE];
for (int idx = 0; idx < MAXPLTPREDSIZE; idx++)
{
curPLTpred[idx] = false;
cu.reuseflag[compBegin][idx] = false;
}
for (int idx = 0; idx < MAXPLTSIZE; idx++)
{
curPLTpred[idx] = false;
}
for (int predidx = 0; predidx < cs.prevPLT.curPLTSize[compBegin]; predidx++)
{
bool match = false;
int curidx = 0;
for (curidx = 0; curidx < cu.curPLTSize[compBegin]; curidx++)
{
bool matchTmp = true;
for (int comp = compBegin; comp < (compBegin + numComp); comp++)
{
matchTmp = matchTmp && (cu.curPLT[comp][curidx] == cs.prevPLT.curPLT[comp][predidx]);
}
if (matchTmp)
{
match = true;
break;
}
}
if (match)
{
cu.reuseflag[compBegin][predidx] = true;
curPLTpred[curidx] = true;
for (int comp = compBegin; comp < (compBegin + numComp); comp++)
{
curPLTtmp[comp][reusePLTSizetmp] = cs.prevPLT.curPLT[comp][predidx];
}
reusePLTSizetmp++;
}
}
cu.reusePLTSize[compBegin] = reusePLTSizetmp;
for (int curidx = 0; curidx < cu.curPLTSize[compBegin]; curidx++)
{
if (!curPLTpred[curidx])
{
for (int comp = compBegin; comp < (compBegin + numComp); comp++)
{
curPLTtmp[comp][pltSizetmp] = cu.curPLT[comp][curidx];
}
}
assert(pltSizetmp == cu.curPLTSize[compBegin]);
for (int curidx = 0; curidx < cu.curPLTSize[compBegin]; curidx++)
{
for (int comp = compBegin; comp < (compBegin + numComp); comp++)
{
cu.curPLT[comp][curidx] = curPLTtmp[comp][curidx];
}
}
Yung-Hsuan Chao (Jessie)
committed
}