Skip to content
Snippets Groups Projects
Commit 5fbb5377 authored by Xiang Li's avatar Xiang Li
Browse files

Merge branch 'o1109-improvement' into 'master'

Fix #380: JVET-O1109 improvement

See merge request jvet/VVCSoftware_VTM!729
parents d5a8be14 b74c4adb
No related branches found
No related tags found
No related merge requests found
...@@ -155,6 +155,8 @@ int Reshape::calculateChromaAdjVpduNei(TransformUnit &tu, const CompArea &areaY ...@@ -155,6 +155,8 @@ int Reshape::calculateChromaAdjVpduNei(TransformUnit &tu, const CompArea &areaY
int xPos = areaY.lumaPos().x; int xPos = areaY.lumaPos().x;
int yPos = areaY.lumaPos().y; int yPos = areaY.lumaPos().y;
int ctuSize = cs.sps->getCTUSize(); int ctuSize = cs.sps->getCTUSize();
int numNeighbor = std::min(64, ctuSize);
int numNeighborLog = g_aucLog2[numNeighbor];
if (ctuSize == 128) if (ctuSize == 128)
{ {
xPos = xPos / 64 * 64; xPos = xPos / 64 * 64;
...@@ -175,10 +177,19 @@ int Reshape::calculateChromaAdjVpduNei(TransformUnit &tu, const CompArea &areaY ...@@ -175,10 +177,19 @@ int Reshape::calculateChromaAdjVpduNei(TransformUnit &tu, const CompArea &areaY
setVPDULoc(xPos, yPos); setVPDULoc(xPos, yPos);
Position topLeft(xPos, yPos); Position topLeft(xPos, yPos);
CodingUnit *topLeftLuma; CodingUnit *topLeftLuma;
const CodingUnit *cuAbove, *cuLeft;
if (CS::isDualITree(cs) && cs.slice->getSliceType() == I_SLICE) if (CS::isDualITree(cs) && cs.slice->getSliceType() == I_SLICE)
{
topLeftLuma = tu.cs->picture->cs->getCU(topLeft, CHANNEL_TYPE_LUMA); topLeftLuma = tu.cs->picture->cs->getCU(topLeft, CHANNEL_TYPE_LUMA);
cuAbove = cs.picture->cs->getCURestricted(topLeftLuma->lumaPos().offset(0, -1), *topLeftLuma, CHANNEL_TYPE_LUMA);
cuLeft = cs.picture->cs->getCURestricted(topLeftLuma->lumaPos().offset(-1, 0), *topLeftLuma, CHANNEL_TYPE_LUMA);
}
else else
{
topLeftLuma = cs.getCU(topLeft, CHANNEL_TYPE_LUMA); topLeftLuma = cs.getCU(topLeft, CHANNEL_TYPE_LUMA);
cuAbove = cs.getCURestricted(topLeftLuma->lumaPos().offset(0, -1), *topLeftLuma, CHANNEL_TYPE_LUMA);
cuLeft = cs.getCURestricted(topLeftLuma->lumaPos().offset(-1, 0), *topLeftLuma, CHANNEL_TYPE_LUMA);
}
xPos = topLeftLuma->lumaPos().x; xPos = topLeftLuma->lumaPos().x;
yPos = topLeftLuma->lumaPos().y; yPos = topLeftLuma->lumaPos().y;
...@@ -195,31 +206,31 @@ int Reshape::calculateChromaAdjVpduNei(TransformUnit &tu, const CompArea &areaY ...@@ -195,31 +206,31 @@ int Reshape::calculateChromaAdjVpduNei(TransformUnit &tu, const CompArea &areaY
const Pel valueDC = 1 << (tu.cs->sps->getBitDepth(CHANNEL_TYPE_LUMA) - 1); const Pel valueDC = 1 << (tu.cs->sps->getBitDepth(CHANNEL_TYPE_LUMA) - 1);
int32_t recLuma = 0; int32_t recLuma = 0;
int pelnum = 0; int pelnum = 0;
if (xPos > 0) if (cuLeft != nullptr)
{ {
for (int i = 0; i < NEIG_NUM; i++) for (int i = 0; i < numNeighbor; i++)
{ {
int k = (yPos + i) >= picH ? (picH - yPos - 1) : i; int k = (yPos + i) >= picH ? (picH - yPos - 1) : i;
recLuma += recSrc0[-1 + k * strideY]; recLuma += recSrc0[-1 + k * strideY];
pelnum++; pelnum++;
} }
} }
if (yPos > 0) if (cuAbove != nullptr)
{ {
for (int i = 0; i < NEIG_NUM; i++) for (int i = 0; i < numNeighbor; i++)
{ {
int k = (xPos + i) >= picW ? (picW - xPos - 1) : i; int k = (xPos + i) >= picW ? (picW - xPos - 1) : i;
recLuma += recSrc0[-strideY + k]; recLuma += recSrc0[-strideY + k];
pelnum++; pelnum++;
} }
} }
if (pelnum == NEIG_NUM) if (pelnum == numNeighbor)
{ {
lumaValue = ClipPel((recLuma + (1 << (NEIG_NUM_LOG - 1))) >> NEIG_NUM_LOG, tu.cs->slice->clpRng(COMPONENT_Y)); lumaValue = ClipPel((recLuma + (1 << (numNeighborLog - 1))) >> numNeighborLog, tu.cs->slice->clpRng(COMPONENT_Y));
} }
else if (pelnum == (NEIG_NUM << 1)) else if (pelnum == (numNeighbor << 1))
{ {
lumaValue = ClipPel((recLuma + (1 << NEIG_NUM_LOG)) >> (NEIG_NUM_LOG + 1), tu.cs->slice->clpRng(COMPONENT_Y)); lumaValue = ClipPel((recLuma + (1 << numNeighborLog)) >> (numNeighborLog + 1), tu.cs->slice->clpRng(COMPONENT_Y));
} }
else else
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment