Commit 88ec22ab authored by Xiang Li's avatar Xiang Li
Browse files

Merge branch 'fix1452' into 'master'

Fix #1452: use "true" original for HDR metrics

See merge request jvet/VVCSoftware_VTM!2007
parents a45b614a d40f94ac
......@@ -329,6 +329,8 @@ const CPelUnitBuf Picture::getOrigBuf() const { return M_BUF
PelBuf Picture::getOrigBuf(const ComponentID compID) { return getBuf(compID, PIC_ORIGINAL); }
const CPelBuf Picture::getOrigBuf(const ComponentID compID) const { return getBuf(compID, PIC_ORIGINAL); }
PelBuf Picture::getTrueOrigBuf(const ComponentID compID) { return getBuf(compID, PIC_TRUE_ORIGINAL); }
const CPelBuf Picture::getTrueOrigBuf(const ComponentID compID) const { return getBuf(compID, PIC_TRUE_ORIGINAL); }
PelUnitBuf Picture::getTrueOrigBuf() { return M_BUFS(0, PIC_TRUE_ORIGINAL); }
const CPelUnitBuf Picture::getTrueOrigBuf() const { return M_BUFS(0, PIC_TRUE_ORIGINAL); }
PelBuf Picture::getTrueOrigBuf(const CompArea &blk) { return getBuf(blk, PIC_TRUE_ORIGINAL); }
......
......@@ -113,6 +113,8 @@ struct Picture : public UnitArea
const CPelUnitBuf getOrigBuf() const;
PelBuf getOrigBuf(const ComponentID compID);
const CPelBuf getOrigBuf(const ComponentID compID) const;
PelBuf getTrueOrigBuf(const ComponentID compID);
const CPelBuf getTrueOrigBuf(const ComponentID compID) const;
PelUnitBuf getTrueOrigBuf();
const CPelUnitBuf getTrueOrigBuf() const;
PelBuf getTrueOrigBuf(const CompArea &blk);
......
......@@ -4778,12 +4778,12 @@ void EncGOP::copyBuftoFrame( Picture* pcPic )
int cropOffsetRight = m_pcCfg->getCropOffsetRight();
int cropOffsetBottom = m_pcCfg->getCropOffsetBottom();
int height = pcPic->getOrigBuf(COMPONENT_Y).height - cropOffsetLeft + cropOffsetRight;
int width = pcPic->getOrigBuf(COMPONENT_Y).width - cropOffsetTop + cropOffsetBottom;
int height = pcPic->getTrueOrigBuf(COMPONENT_Y).height - cropOffsetLeft + cropOffsetRight;
int width = pcPic->getTrueOrigBuf(COMPONENT_Y).width - cropOffsetTop + cropOffsetBottom;
ChromaFormat chFmt = pcPic->chromaFormat;
Pel* pOrg = pcPic->getOrigBuf(COMPONENT_Y).buf;
Pel *pOrg = pcPic->getTrueOrigBuf(COMPONENT_Y).buf;
Pel* pRec = pcPic->getRecoBuf(COMPONENT_Y).buf;
uint16_t* yOrg = m_ppcFrameOrg[0]->m_ui16Comp[hdrtoolslib::Y_COMP];
......@@ -4807,7 +4807,7 @@ void EncGOP::copyBuftoFrame( Picture* pcPic )
{
for (int j = 0; j < width; j++)
{
yOrg[i*width + j] = static_cast<uint16_t>(pOrg[(i + cropOffsetTop) * pcPic->getOrigBuf(COMPONENT_Y).stride + j + cropOffsetLeft]);
yOrg[i * width + j] = static_cast<uint16_t>(pOrg[(i + cropOffsetTop) * pcPic->getTrueOrigBuf(COMPONENT_Y).stride + j + cropOffsetLeft]);
yRec[i*width + j] = static_cast<uint16_t>(pRec[(i + cropOffsetTop) * pcPic->getRecoBuf(COMPONENT_Y).stride + j + cropOffsetLeft]);
}
}
......@@ -4820,26 +4820,26 @@ void EncGOP::copyBuftoFrame( Picture* pcPic )
cropOffsetTop >>= 1;
}
pOrg = pcPic->getOrigBuf(COMPONENT_Cb).buf;
pOrg = pcPic->getTrueOrigBuf(COMPONENT_Cb).buf;
pRec = pcPic->getRecoBuf(COMPONENT_Cb).buf;
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
uOrg[i*width + j] = static_cast<uint16_t>(pOrg[(i + cropOffsetTop) * pcPic->getOrigBuf(COMPONENT_Cb).stride + j + cropOffsetLeft]);
uOrg[i * width + j] = static_cast<uint16_t>(pOrg[(i + cropOffsetTop) * pcPic->getTrueOrigBuf(COMPONENT_Cb).stride + j + cropOffsetLeft]);
uRec[i*width + j] = static_cast<uint16_t>(pRec[(i + cropOffsetTop) * pcPic->getRecoBuf(COMPONENT_Cb).stride + j + cropOffsetLeft]);
}
}
pOrg = pcPic->getOrigBuf(COMPONENT_Cr).buf;
pOrg = pcPic->getTrueOrigBuf(COMPONENT_Cr).buf;
pRec = pcPic->getRecoBuf(COMPONENT_Cr).buf;
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
vOrg[i*width + j] = static_cast<uint16_t>(pOrg[(i + cropOffsetTop) * pcPic->getOrigBuf(COMPONENT_Cr).stride + j + cropOffsetLeft]);
vOrg[i * width + j] = static_cast<uint16_t>(pOrg[(i + cropOffsetTop) * pcPic->getTrueOrigBuf(COMPONENT_Cr).stride + j + cropOffsetLeft]);
vRec[i*width + j] = static_cast<uint16_t>(pRec[(i + cropOffsetTop) * pcPic->getRecoBuf(COMPONENT_Cr).stride + j + cropOffsetLeft]);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment