diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp index 1ca5a23410ee1203295f7707023a240b5287bf8b..914b19f7cfb706e4a5fd939985cbfb63b297541f 100644 --- a/source/App/DecoderApp/DecApp.cpp +++ b/source/App/DecoderApp/DecApp.cpp @@ -472,7 +472,7 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) #else const Window &conf = pcPic->cs->sps->getConformanceWindow(); #endif -#if JVET_O1164_RPR +#if JVET_O1164_RPR m_cVideoIOYuvReconFile.write( pcPic->cs->sps->getMaxPicWidthInLumaSamples(), pcPic->cs->sps->getMaxPicHeightInLumaSamples(), pcPic->getRecoBuf(), #else m_cVideoIOYuvReconFile.write( pcPic->getRecoBuf(), @@ -616,7 +616,7 @@ void DecApp::xFlushOutput( PicList* pcListPic ) #else const Window &conf = pcPic->cs->sps->getConformanceWindow(); #endif -#if JVET_O1164_RPR +#if JVET_O1164_RPR m_cVideoIOYuvReconFile.write( pcPic->cs->sps->getMaxPicWidthInLumaSamples(), pcPic->cs->sps->getMaxPicHeightInLumaSamples(), pcPic->getRecoBuf(), #else m_cVideoIOYuvReconFile.write( pcPic->getRecoBuf(), diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index cacb7863258d1223424a350d7e1a90941d960721..e90148d9a3630034d06cd2106cac0bd4f84640ad 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -55,6 +55,7 @@ #define JVET_O1164_PS 1 #define RPR_BUFFER 1 // lossless #define RPR_CTC_PRINT 1 +#define RPR_CONF_WINDOW 1 #endif #define JVET_O0119_BASE_PALETTE_444 1 // JVET-O0119: Palette mode in HEVC and palette mode signaling in JVET-N0258. Only enabled for YUV444. diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index 477862d8ad810e41d78da050bd62c49e88a52e82..e2aa8ac775de6c5ec458ebfcc13fa5693a3c8ff7 100755 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -107,10 +107,20 @@ void CS::setRefinedMotionField(CodingStructure &cs) #if JVET_O1164_RPR bool CU::getRprScaling( const SPS* sps, const PPS* curPPS, const PPS* refPPS, int& xScale, int& yScale ) { + +#if RPR_CONF_WINDOW + const Window& curConfWindow = curPPS->getConformanceWindow(); + int curPicWidth = curPPS->getPicWidthInLumaSamples() - (curConfWindow.getWindowLeftOffset() + curConfWindow.getWindowRightOffset()) * SPS::getWinUnitY(sps->getChromaFormatIdc()); + int curPicHeight = curPPS->getPicHeightInLumaSamples() - (curConfWindow.getWindowTopOffset() + curConfWindow.getWindowBottomOffset()) * SPS::getWinUnitY(sps->getChromaFormatIdc()); + const Window& refConfWindow = refPPS->getConformanceWindow(); + int refPicWidth = refPPS->getPicWidthInLumaSamples() - (refConfWindow.getWindowLeftOffset() + refConfWindow.getWindowRightOffset()) * SPS::getWinUnitY(sps->getChromaFormatIdc()); + int refPicHeight = refPPS->getPicHeightInLumaSamples() - (refConfWindow.getWindowTopOffset() + refConfWindow.getWindowBottomOffset()) * SPS::getWinUnitY(sps->getChromaFormatIdc()); +#else int curPicWidth = curPPS->getPicWidthInLumaSamples(); int curPicHeight = curPPS->getPicHeightInLumaSamples(); int refPicWidth = refPPS->getPicWidthInLumaSamples(); int refPicHeight = refPPS->getPicHeightInLumaSamples(); +#endif xScale = ( ( refPicWidth << 14 ) + ( curPicWidth >> 1 ) ) / curPicWidth; yScale = ( ( refPicHeight << 14 ) + ( curPicHeight >> 1 ) ) / curPicHeight; diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 96b562cc6496e145aec321eb7c767dff86d82188..e00df6e3dd821dbff1b34809cce32330b88d837a 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -292,13 +292,23 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) if( m_rprEnabled ) { PPS &pps = *( m_ppsMap.allocatePS( 3 ) ); - int scaledWidth = int( pps0.getPicWidthInLumaSamples() / m_scalingRatio ); - int temp = scaledWidth >> 3; - int width = ( scaledWidth - ( temp << 3 ) > 0 ? temp + 1 : temp ) << 3; +#if RPR_CONF_WINDOW + Window& inputConfWindow = pps0.getConformanceWindow(); + int scaledWidth = int((pps0.getPicWidthInLumaSamples() - (inputConfWindow.getWindowLeftOffset() + inputConfWindow.getWindowRightOffset()) * SPS::getWinUnitX(sps0.getChromaFormatIdc())) / m_scalingRatio); +#else + int scaledWidth = int(pps0.getPicWidthInLumaSamples() / m_scalingRatio); +#endif + int minSizeUnit = std::max(8, (int)(sps0.getMaxCUHeight() >> (sps0.getMaxCodingDepth() - 1))); + int temp = scaledWidth / minSizeUnit; + int width = ( scaledWidth - ( temp * minSizeUnit) > 0 ? temp + 1 : temp ) * minSizeUnit; - int scaledHeight = int( pps0.getPicHeightInLumaSamples() / m_scalingRatio ); - temp = scaledHeight >> 3; - int height = ( scaledHeight - ( temp << 3 ) > 0 ? temp + 1 : temp ) << 3; +#if RPR_CONF_WINDOW + int scaledHeight = int((pps0.getPicHeightInLumaSamples() - (inputConfWindow.getWindowTopOffset() + inputConfWindow.getWindowBottomOffset()) * SPS::getWinUnitY(sps0.getChromaFormatIdc())) / m_scalingRatio); +#else + int scaledHeight = int(pps0.getPicHeightInLumaSamples() / m_scalingRatio); +#endif + temp = scaledHeight / minSizeUnit; + int height = ( scaledHeight - ( temp * minSizeUnit) > 0 ? temp + 1 : temp ) * minSizeUnit; pps.setPicWidthInLumaSamples( width ); pps.setPicHeightInLumaSamples( height );