diff --git a/source/Lib/CommonLib/Picture.cpp b/source/Lib/CommonLib/Picture.cpp index 7c9c0c7af68bfac0f40466dea4c1fd8c1bd058a6..df80b30d9b7cd428cbf617f9bb418e03f6241b39 100644 --- a/source/Lib/CommonLib/Picture.cpp +++ b/source/Lib/CommonLib/Picture.cpp @@ -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); } diff --git a/source/Lib/CommonLib/Picture.h b/source/Lib/CommonLib/Picture.h index b86547d6ab4b3bbf0e59d619916c62b452c1059f..5506da1b432b19d77e07b84c793eea9f63957e74 100644 --- a/source/Lib/CommonLib/Picture.h +++ b/source/Lib/CommonLib/Picture.h @@ -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); diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 53275f96d4f57da45d9e144b10bc44741ffb5c2f..75e23bdbb98db29a880f724a601d50b83a51b1e8 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -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]); } }