diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index 79058fb3821572e42078761872b60ab682b73831..268109f066e80a467df67eb567f2b404b4f9272b 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -592,11 +592,7 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred, Pe bool dmvrApplied = false; dmvrApplied = (pu.mvRefine) && PU::checkDMVRCondition(pu); -#if JVET_P0590_SCALING_WINDOW bool samePicSize = ( refIdx0 < 0 ? true : pu.cu->slice->getScalingRatio( REF_PIC_LIST_0, refIdx0 ) == SCALE_1X ) && ( refIdx1 < 0 ? true : pu.cu->slice->getScalingRatio( REF_PIC_LIST_1, refIdx1 ) == SCALE_1X ); -#else - bool samePicSize = PU::isRefPicSameSize( pu ); -#endif dmvrApplied = dmvrApplied && samePicSize; bioApplied = bioApplied && samePicSize; @@ -2742,7 +2738,6 @@ bool InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio, int offX = 1 << ( posShift - shiftHor - 1 ); int offY = 1 << ( posShift - shiftVer - 1 ); -#if JVET_P0590_SCALING_WINDOW const int64_t posX = ( ( blk.pos().x << ::getComponentScaleX( compID, chFmt ) ) - pps.getScalingWindow().getWindowLeftOffset() ) >> ::getComponentScaleX( compID, chFmt ); const int64_t posY = ( ( blk.pos().y << ::getComponentScaleY( compID, chFmt ) ) - pps.getScalingWindow().getWindowTopOffset() ) >> ::getComponentScaleY( compID, chFmt ); @@ -2762,22 +2757,6 @@ bool InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio, y0Int = ( ( posY << ( 4 + ::getComponentScaleY( compID, chFmt ) ) ) + mv.getVer() ) * (int64_t)scalingRatio.second; y0Int = SIGN( y0Int ) * ( ( llabs( y0Int ) + ( (long long)1 << ( 7 + ::getComponentScaleY( compID, chFmt ) ) ) ) >> ( 8 + ::getComponentScaleY( compID, chFmt ) ) ) + ( refPic->getScalingWindow().getWindowTopOffset() << ( ( posShift - ::getComponentScaleY( compID, chFmt ) ) ) ); #endif -#elif JVET_P0592_CHROMA_PHASE - int addX = isLuma( compID ) ? 0 : int( 1 - refPic->cs->sps->getHorCollocatedChromaFlag() ) * 8 * ( scalingRatio.first - SCALE_1X.first ); - int addY = isLuma( compID ) ? 0 : int( 1 - refPic->cs->sps->getVerCollocatedChromaFlag() ) * 8 * ( scalingRatio.second - SCALE_1X.second ); - - x0Int = ( ( blk.pos().x << ( 4 + ::getComponentScaleX( compID, chFmt ) ) ) + mv.getHor() )* (int64_t)scalingRatio.first + addX; - x0Int = SIGN( x0Int ) * ( ( llabs( x0Int ) + ( (long long)1 << ( 7 + ::getComponentScaleX( compID, chFmt ) ) ) ) >> ( 8 + ::getComponentScaleX( compID, chFmt ) ) ); - - y0Int = ( ( blk.pos().y << ( 4 + ::getComponentScaleY( compID, chFmt ) ) ) + mv.getVer() )* (int64_t)scalingRatio.second + addY; - y0Int = SIGN( y0Int ) * ( ( llabs( y0Int ) + ( (long long)1 << ( 7 + ::getComponentScaleY( compID, chFmt ) ) ) ) >> ( 8 + ::getComponentScaleY( compID, chFmt ) ) ); -#else - x0Int = ( ( blk.pos().x << ( 4 + ::getComponentScaleX( compID, chFmt ) ) ) + mv.getHor() )* (int64_t)scalingRatio.first; - x0Int = SIGN( x0Int ) * ( ( llabs( x0Int ) + ( (long long)1 << ( 7 + ::getComponentScaleX( compID, chFmt ) ) ) ) >> ( 8 + ::getComponentScaleX( compID, chFmt ) ) ); - - y0Int = ( ( blk.pos().y << ( 4 + ::getComponentScaleY( compID, chFmt ) ) ) + mv.getVer() )* (int64_t)scalingRatio.second; - y0Int = SIGN( y0Int ) * ( ( llabs( y0Int ) + ( (long long)1 << ( 7 + ::getComponentScaleY( compID, chFmt ) ) ) ) >> ( 8 + ::getComponentScaleY( compID, chFmt ) ) ); -#endif const int extSize = isLuma( compID ) ? 1 : 2; int vFilterSize = isLuma( compID ) ? NTAPS_LUMA : NTAPS_CHROMA; diff --git a/source/Lib/CommonLib/Picture.cpp b/source/Lib/CommonLib/Picture.cpp index 9b9fc871379639cdca40761e22d0c232cdc74260..1948a4c650d4fefd320cd4bed2c8cbbd045767f3 100644 --- a/source/Lib/CommonLib/Picture.cpp +++ b/source/Lib/CommonLib/Picture.cpp @@ -360,9 +360,7 @@ void Picture::finalInit( const VPS* vps, const SPS& sps, const PPS& pps, PicHead cs->scalinglistAps = scalingListAps; cs->pcv = pps.pcv; m_conformanceWindow = pps.getConformanceWindow(); -#if JVET_P0590_SCALING_WINDOW m_scalingWindow = pps.getScalingWindow(); -#endif if (m_spliceIdx == NULL) { @@ -594,7 +592,6 @@ const TFilterCoeff DownsamplingFilterSRC[8][16][12] = } }; -#if JVET_P0590_SCALING_WINDOW #if JVET_P0592_CHROMA_PHASE void Picture::sampleRateConv( const std::pair<int, int> scalingRatio, const std::pair<int, int> compScale, const CPelBuf& beforeScale, const int beforeScaleLeftOffset, const int beforeScaleTopOffset, @@ -729,140 +726,7 @@ void Picture::sampleRateConv( const std::pair<int, int> scalingRatio, delete[] buf; } -#else -#if JVET_P0592_CHROMA_PHASE -void Picture::sampleRateConv( const std::pair<int, int> scalingRatio, const std::pair<int, int> compScale, - const Pel* orgSrc, SizeType orgWidth, SizeType orgHeight, SizeType orgStride, - Pel* scaledSrc, SizeType scaledWidth, SizeType scaledHeight, - SizeType paddedWidth, SizeType paddedHeight, SizeType scaledStride, - const int bitDepth, const bool useLumaFilter, const bool downsampling, - const bool horCollocatedPositionFlag, const bool verCollocatedPositionFlag ) -#else -void Picture::sampleRateConv( const Pel* orgSrc, SizeType orgWidth, SizeType orgHeight, SizeType orgStride, Pel* scaledSrc, SizeType scaledWidth, SizeType scaledHeight, SizeType paddedWidth, SizeType paddedHeight, SizeType scaledStride, const int bitDepth, const bool useLumaFilter, const bool downsampling ) -#endif -{ - if( orgWidth == scaledWidth && orgHeight == scaledHeight ) - { - for( int j = 0; j < orgHeight; j++ ) - { - memcpy( scaledSrc + j * scaledStride, orgSrc + j * orgStride, sizeof( Pel ) * orgWidth ); - } - - return; - } - - const TFilterCoeff* filterHor = useLumaFilter ? &InterpolationFilter::m_lumaFilter[0][0] : &InterpolationFilter::m_chromaFilter[0][0]; - const TFilterCoeff* filterVer = useLumaFilter ? &InterpolationFilter::m_lumaFilter[0][0] : &InterpolationFilter::m_chromaFilter[0][0]; - const int numFracPositions = useLumaFilter ? 15 : 31; - const int numFracShift = useLumaFilter ? 4 : 5; - -#if JVET_P0592_CHROMA_PHASE - const int posShift = SCALE_RATIO_BITS - numFracShift; - int addX = ( 1 << ( posShift - 1 ) ) + ( ( int( 1 - horCollocatedPositionFlag ) * 8 * ( scalingRatio.first - SCALE_1X.first ) + ( 1 << ( 3 + compScale.first ) ) ) >> ( 4 + compScale.first ) ); - int addY = ( 1 << ( posShift - 1 ) ) + ( ( int( 1 - verCollocatedPositionFlag ) * 8 * ( scalingRatio.second - SCALE_1X.second ) + ( 1 << ( 3 + compScale.second ) ) ) >> ( 4 + compScale.second ) ); -#endif - - if( downsampling ) - { - int verFilter = 0; - int horFilter = 0; - - if( 4 * orgHeight > 15 * scaledHeight ) verFilter = 7; - else if( 7 * orgHeight > 20 * scaledHeight ) verFilter = 6; - else if( 2 * orgHeight > 5 * scaledHeight ) verFilter = 5; - else if( 1 * orgHeight > 2 * scaledHeight ) verFilter = 4; - else if( 3 * orgHeight > 5 * scaledHeight ) verFilter = 3; - else if( 4 * orgHeight > 5 * scaledHeight ) verFilter = 2; - else if( 19 * orgHeight > 20 * scaledHeight ) verFilter = 1; - - if( 4 * orgWidth > 15 * scaledWidth ) horFilter = 7; - else if( 7 * orgWidth > 20 * scaledWidth ) horFilter = 6; - else if( 2 * orgWidth > 5 * scaledWidth ) horFilter = 5; - else if( 1 * orgWidth > 2 * scaledWidth ) horFilter = 4; - else if( 3 * orgWidth > 5 * scaledWidth ) horFilter = 3; - else if( 4 * orgWidth > 5 * scaledWidth ) horFilter = 2; - else if( 19 * orgWidth > 20 * scaledWidth ) horFilter = 1; - - filterHor = &DownsamplingFilterSRC[horFilter][0][0]; - filterVer = &DownsamplingFilterSRC[verFilter][0][0]; - } - - const int filerLength = downsampling ? 12 : ( useLumaFilter ? NTAPS_LUMA : NTAPS_CHROMA ); - const int log2Norm = downsampling ? 14 : 12; - - int *buf = new int[orgHeight * paddedWidth]; - int maxVal = ( 1 << bitDepth ) - 1; - - CHECK( bitDepth > 17, "Overflow may happen!" ); - - for( int i = 0; i < paddedWidth; i++ ) - { - const Pel* org = orgSrc; -#if JVET_P0592_CHROMA_PHASE - int refPos = ( i * scalingRatio.first + addX ) >> posShift; - int integer = refPos >> numFracShift; - int frac = refPos & numFracPositions; -#else - int integer = ( i * orgWidth ) / scaledWidth; - int frac = ( ( i * orgWidth << numFracShift ) / scaledWidth ) & numFracPositions; -#endif - - int* tmp = buf + i; - - for( int j = 0; j < orgHeight; j++ ) - { - int sum = 0; - const TFilterCoeff* f = filterHor + frac * filerLength; - - for( int k = 0; k < filerLength; k++ ) - { - int xInt = std::min<int>( std::max( 0, integer + k - filerLength / 2 + 1 ), orgWidth - 1 ); - sum += f[k] * org[xInt]; // postpone horizontal filtering gain removal after vertical filtering - } - *tmp = sum; - - tmp += paddedWidth; - org += orgStride; - } - } - - Pel* dst = scaledSrc; - - for( int j = 0; j < paddedHeight; j++ ) - { -#if JVET_P0592_CHROMA_PHASE - int refPos = ( j * scalingRatio.second + addY ) >> posShift; - int integer = refPos >> numFracShift; - int frac = refPos & numFracPositions; -#else - int integer = ( j * orgHeight ) / scaledHeight; - int frac = ( ( j * orgHeight << numFracShift ) / scaledHeight ) & numFracPositions; -#endif - - for( int i = 0; i < paddedWidth; i++ ) - { - int sum = 0; - int* tmp = buf + i; - const TFilterCoeff* f = filterVer + frac * filerLength; - - for( int k = 0; k < filerLength; k++ ) - { - int yInt = std::min<int>( std::max( 0, integer + k - filerLength / 2 + 1 ), orgHeight - 1 ); - sum += f[k] * tmp[yInt*paddedWidth]; - } - - dst[i] = std::min<int>( std::max( 0, ( sum + ( 1 << ( log2Norm - 1 ) ) ) >> log2Norm ), maxVal ); - } - - dst += scaledStride; - } - - delete[] buf; -} -#endif - -#if JVET_P0590_SCALING_WINDOW void Picture::rescalePicture( const std::pair<int, int> scalingRatio, const CPelUnitBuf& beforeScaling, const Window& scalingWindowBefore, const PelUnitBuf& afterScaling, const Window& scalingWindowAfter, @@ -893,47 +757,6 @@ void Picture::rescalePicture( const std::pair<int, int> scalingRatio, #endif } } -#elif JVET_P0592_CHROMA_PHASE -void Picture::rescalePicture( const std::pair<int, int> scalingRatio, - const CPelUnitBuf& beforeScaling, const Window& confBefore, - const PelUnitBuf& afterScaling, const Window& confAfter, - const ChromaFormat chromaFormatIDC, const BitDepths& bitDepths, const bool useLumaFilter, const bool downsampling, - const bool horCollocatedChromaFlag, const bool verCollocatedChromaFlag ) -{ - for( int comp = 0; comp < ::getNumberValidComponents( chromaFormatIDC ); comp++ ) - { - ComponentID compID = ComponentID( comp ); - const CPelBuf& beforeScale = beforeScaling.get( compID ); - const PelBuf& afterScale = afterScaling.get( compID ); - int widthBefore = beforeScale.width - ( ( ( confBefore.getWindowLeftOffset() + confBefore.getWindowRightOffset() ) * SPS::getWinUnitX( chromaFormatIDC ) ) >> getChannelTypeScaleX( (ChannelType)( comp > 0 ), chromaFormatIDC ) ); - int heightBefore = beforeScale.height - ( ( ( confBefore.getWindowTopOffset() + confBefore.getWindowBottomOffset() ) * SPS::getWinUnitY( chromaFormatIDC ) ) >> getChannelTypeScaleY( (ChannelType)( comp > 0 ), chromaFormatIDC ) ); - int widthAfter = afterScale.width - ( ( ( confAfter.getWindowLeftOffset() + confAfter.getWindowRightOffset() ) * SPS::getWinUnitX( chromaFormatIDC ) ) >> getChannelTypeScaleX( (ChannelType)( comp > 0 ), chromaFormatIDC ) ); - int heightAfter = afterScale.height - ( ( ( confAfter.getWindowTopOffset() + confAfter.getWindowBottomOffset() ) * SPS::getWinUnitY( chromaFormatIDC ) ) >> getChannelTypeScaleY( (ChannelType)( comp > 0 ), chromaFormatIDC ) ); - - sampleRateConv( scalingRatio, std::pair<int, int>( ::getComponentScaleX( compID, chromaFormatIDC ), ::getComponentScaleY( compID, chromaFormatIDC ) ), - beforeScale.buf, widthBefore, heightBefore, beforeScale.stride, - afterScale.buf, widthAfter, heightAfter, afterScale.width, afterScale.height, afterScale.stride, - bitDepths.recon[comp], downsampling || useLumaFilter ? true : isLuma( compID ), downsampling, - isLuma( compID ) ? 1 : horCollocatedChromaFlag, isLuma( compID ) ? 1 : verCollocatedChromaFlag ); - } -} -#else -void Picture::rescalePicture( const CPelUnitBuf& beforeScaling, const Window& confBefore, const PelUnitBuf& afterScaling, const Window& confAfter, const ChromaFormat chromaFormatIDC, const BitDepths& bitDepths, const bool useLumaFilter, const bool downsampling ) -{ - for( int comp = 0; comp < ::getNumberValidComponents( chromaFormatIDC ); comp++ ) - { - ComponentID compID = ComponentID( comp ); - const CPelBuf& beforeScale = beforeScaling.get( compID ); - const PelBuf& afterScale = afterScaling.get( compID ); - int widthBefore = beforeScale.width - (((confBefore.getWindowLeftOffset() + confBefore.getWindowRightOffset()) * SPS::getWinUnitX(chromaFormatIDC)) >> getChannelTypeScaleX((ChannelType)(comp > 0), chromaFormatIDC)); - int heightBefore = beforeScale.height - (((confBefore.getWindowTopOffset() + confBefore.getWindowBottomOffset()) * SPS::getWinUnitY(chromaFormatIDC)) >> getChannelTypeScaleY((ChannelType)(comp > 0), chromaFormatIDC)); - int widthAfter = afterScale.width - (((confAfter.getWindowLeftOffset() + confAfter.getWindowRightOffset()) * SPS::getWinUnitX(chromaFormatIDC)) >> getChannelTypeScaleX((ChannelType)(comp > 0), chromaFormatIDC)); - int heightAfter = afterScale.height - (((confAfter.getWindowTopOffset() + confAfter.getWindowBottomOffset()) * SPS::getWinUnitY(chromaFormatIDC)) >> getChannelTypeScaleY((ChannelType)(comp > 0), chromaFormatIDC)); - - Picture::sampleRateConv( beforeScale.buf, widthBefore, heightBefore, beforeScale.stride, afterScale.buf, widthAfter, heightAfter, afterScale.width, afterScale.height, afterScale.stride, bitDepths.recon[comp], downsampling || useLumaFilter ? true : isLuma(compID), downsampling ); - } -} -#endif void Picture::extendPicBorder() { diff --git a/source/Lib/CommonLib/Picture.h b/source/Lib/CommonLib/Picture.h index e3ffefb5d950b9e4321c783b9d0f7d6882bc48da..e17339716ef9ccc32ad5e6b1d7fe4e2097a8e2dd 100644 --- a/source/Lib/CommonLib/Picture.h +++ b/source/Lib/CommonLib/Picture.h @@ -155,7 +155,6 @@ struct Picture : public UnitArea void setSpliceIdx(uint32_t idx, int poc) { m_spliceIdx[idx] = poc; } void createSpliceIdx(int nums); bool getSpliceFull(); -#if JVET_P0590_SCALING_WINDOW #if JVET_P0592_CHROMA_PHASE static void sampleRateConv( const std::pair<int, int> scalingRatio, const std::pair<int, int> compScale, const CPelBuf& beforeScale, const int beforeScaleLeftOffset, const int beforeScaleTopOffset, @@ -178,29 +177,10 @@ struct Picture : public UnitArea #else const ChromaFormat chromaFormatIDC, const BitDepths& bitDepths, const bool useLumaFilter, const bool downsampling = false ); #endif -#elif JVET_P0592_CHROMA_PHASE - static void sampleRateConv( const std::pair<int, int> scalingRatio, const std::pair<int, int> compScale, - const Pel* orgSrc, SizeType orgWidth, SizeType orgHeight, SizeType orgStride, - Pel* scaledSrc, SizeType scaledWidth, SizeType scaledHeight, - SizeType paddedWidth, SizeType paddedHeight, SizeType scaledStride, - const int bitDepth, const bool useLumaFilter, const bool downsampling, - const bool horCollocatedPositionFlag, const bool verCollocatedPositionFlag ); - - static void rescalePicture( const std::pair<int, int> scalingRatio, - const CPelUnitBuf& beforeScaling, const Window& confBefore, - const PelUnitBuf& afterScaling, const Window& confAfter, - const ChromaFormat chromaFormatIDC, const BitDepths& bitDepths, const bool useLumaFilter, const bool downsampling, - const bool horCollocatedChromaFlag, const bool verCollocatedChromaFlag ); -#else - static void sampleRateConv( const Pel* orgSrc, SizeType orgWidth, SizeType orgHeight, SizeType orgStride, Pel* scaledSrc, SizeType scaledWidth, SizeType scaledHeight, SizeType paddedWidth, SizeType paddedHeight, SizeType scaledStride, const int bitDepth, const bool useLumaFilter, const bool downsampling = false ); - static void rescalePicture(const CPelUnitBuf& beforeScaling, const Window& confBefore, const PelUnitBuf& afterScaling, const Window& confAfter, const ChromaFormat chromaFormatIDC, const BitDepths& bitDepths, const bool useLumaFilter, const bool downsampling = false); -#endif private: Window m_conformanceWindow; -#if JVET_P0590_SCALING_WINDOW Window m_scalingWindow; -#endif public: bool m_bIsBorderExtended; @@ -248,10 +228,8 @@ public: uint32_t getPicHeightInLumaSamples() const { return getRecoBuf( COMPONENT_Y ).height; } Window& getConformanceWindow() { return m_conformanceWindow; } const Window& getConformanceWindow() const { return m_conformanceWindow; } -#if JVET_P0590_SCALING_WINDOW Window& getScalingWindow() { return m_scalingWindow; } const Window& getScalingWindow() const { return m_scalingWindow; } -#endif void allocateNewSlice(); Slice *swapSliceObject(Slice * p, uint32_t i); diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index c1a915755832ddff3a27b1eb16f86ac83ddaf640..fb4cdaa53e478a6e013b6cc51ed84486d9bd7849 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -1829,9 +1829,7 @@ SPS::SPS() , m_MIP ( false ) , m_GDREnabledFlag ( true ) , m_SubLayerCbpParametersPresentFlag ( true ) -#if JVET_P0590_SCALING_WINDOW , m_rprEnabledFlag ( false ) -#endif { for(int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) @@ -3191,11 +3189,7 @@ void Slice::scaleRefPicList( Picture *scaledRefPic[ ], PicHeader *picHeader, APS m_scalingRatio[refList][rIdx] = std::pair<int, int>( xScale, yScale ); #if JVET_P0206_TMVP_flags -#if JVET_P0590_SCALING_WINDOW if( m_scalingRatio[refList][rIdx] == SCALE_1X && pps->getPicWidthInLumaSamples() == m_apcRefPicList[refList][rIdx]->getPicWidthInLumaSamples() && pps->getPicHeightInLumaSamples() == m_apcRefPicList[refList][rIdx]->getPicHeightInLumaSamples() ) -#else - if( m_scalingRatio[refList][rIdx] == SCALE_1X ) -#endif { refPicIsSameRes = true; } @@ -3256,7 +3250,6 @@ void Slice::scaleRefPicList( Picture *scaledRefPic[ ], PicHeader *picHeader, APS // rescale the reference picture const bool downsampling = m_apcRefPicList[refList][rIdx]->getRecoBuf().Y().width >= scaledRefPic[j]->getRecoBuf().Y().width && m_apcRefPicList[refList][rIdx]->getRecoBuf().Y().height >= scaledRefPic[j]->getRecoBuf().Y().height; -#if JVET_P0590_SCALING_WINDOW #if JVET_P0592_CHROMA_PHASE Picture::rescalePicture( m_scalingRatio[refList][rIdx], m_apcRefPicList[refList][rIdx]->getRecoBuf(), m_apcRefPicList[refList][rIdx]->slices[0]->getPPS()->getScalingWindow(), @@ -3265,15 +3258,6 @@ void Slice::scaleRefPicList( Picture *scaledRefPic[ ], PicHeader *picHeader, APS sps->getHorCollocatedChromaFlag(), sps->getVerCollocatedChromaFlag() ); #else Picture::rescalePicture( m_scalingRatio[refList][rIdx], m_apcRefPicList[refList][rIdx]->getRecoBuf(), m_apcRefPicList[refList][rIdx]->slices[0]->getPPS()->getScalingWindow(), scaledRefPic[j]->getRecoBuf(), pps->getScalingWindow(), sps->getChromaFormatIdc(), sps->getBitDepths(), true, downsampling ); -#endif -#elif JVET_P0592_CHROMA_PHASE - Picture::rescalePicture( m_scalingRatio[refList][rIdx], m_apcRefPicList[refList][rIdx]->getRecoBuf(), - m_apcRefPicList[refList][rIdx]->slices[0]->getPPS()->getConformanceWindow(), - scaledRefPic[j]->getRecoBuf(), pps->getConformanceWindow(), - sps->getChromaFormatIdc(), sps->getBitDepths(), true, downsampling, - sps->getHorCollocatedChromaFlag(), sps->getVerCollocatedChromaFlag() ); -#else - Picture::rescalePicture( m_apcRefPicList[refList][rIdx]->getRecoBuf(), m_apcRefPicList[refList][rIdx]->slices[0]->getPPS()->getConformanceWindow(), scaledRefPic[j]->getRecoBuf(), pps->getConformanceWindow(), sps->getChromaFormatIdc(), sps->getBitDepths(), true, downsampling ); #endif scaledRefPic[j]->extendPicBorder(); diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 9fe624b154344143076afff008f0e6db5d39686e..d799a73657c42d4aa9eb28a1c2ab73f95c85de3b 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -1139,9 +1139,7 @@ private: bool m_GDREnabledFlag; bool m_SubLayerCbpParametersPresentFlag; -#if JVET_P0590_SCALING_WINDOW bool m_rprEnabledFlag; -#endif bool m_interLayerPresentFlag; public: @@ -1461,10 +1459,8 @@ public: void setSubLayerParametersPresentFlag(bool flag) { m_SubLayerCbpParametersPresentFlag = flag; } bool getSubLayerParametersPresentFlag() const { return m_SubLayerCbpParametersPresentFlag; } -#if JVET_P0590_SCALING_WINDOW bool getRprEnabledFlag() const { return m_rprEnabledFlag; } void setRprEnabledFlag( bool flag ) { m_rprEnabledFlag = flag; } -#endif bool getInterLayerPresentFlag() const { return m_interLayerPresentFlag; } void setInterLayerPresentFlag( bool b ) { m_interLayerPresentFlag = b; } @@ -1597,9 +1593,7 @@ private: uint32_t m_picWidthInLumaSamples; uint32_t m_picHeightInLumaSamples; Window m_conformanceWindow; -#if JVET_P0590_SCALING_WINDOW Window m_scalingWindow; -#endif PPSRExt m_ppsRangeExtension; @@ -1831,11 +1825,9 @@ public: const Window& getConformanceWindow() const { return m_conformanceWindow; } void setConformanceWindow( Window& conformanceWindow ) { m_conformanceWindow = conformanceWindow; } -#if JVET_P0590_SCALING_WINDOW Window& getScalingWindow() { return m_scalingWindow; } const Window& getScalingWindow() const { return m_scalingWindow; } void setScalingWindow( Window& scalingWindow ) { m_scalingWindow = scalingWindow; } -#endif }; class APS diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index f83804584547a68c82ad8462a3f4e4909b7007ad..7a872e17dd143583bd480d3b6605ef8e97d4bd95 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -81,7 +81,6 @@ -#define JVET_P0590_SCALING_WINDOW 1 // JVET-P0590: scaling window for RPR #define JVET_P0592_CHROMA_PHASE 1 // JVET-P0592: chroma phase for RPR #define JVET_P0803_COMBINED_MIP_CLEANUP 1 // JVET-P0803: Several MIP cleanups diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index ccb2d8d3b7af1aaf7ffa3c0562c54d0a900e1702..65aaa9ef26b6fcf3f027c628f23887bb46b472ba 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -102,7 +102,6 @@ void CS::setRefinedMotionField(CodingStructure &cs) bool CU::getRprScaling( const SPS* sps, const PPS* curPPS, Picture* refPic, int& xScale, int& yScale ) { -#if JVET_P0590_SCALING_WINDOW const Window& curScalingWindow = curPPS->getScalingWindow(); int curPicWidth = curPPS->getPicWidthInLumaSamples() - curScalingWindow.getWindowLeftOffset() - curScalingWindow.getWindowRightOffset(); int curPicHeight = curPPS->getPicHeightInLumaSamples() - curScalingWindow.getWindowTopOffset() - curScalingWindow.getWindowBottomOffset(); @@ -110,14 +109,6 @@ bool CU::getRprScaling( const SPS* sps, const PPS* curPPS, Picture* refPic, int& const Window& refScalingWindow = refPic->getScalingWindow(); int refPicWidth = refPic->getPicWidthInLumaSamples() - refScalingWindow.getWindowLeftOffset() - refScalingWindow.getWindowRightOffset(); int refPicHeight = refPic->getPicHeightInLumaSamples() - refScalingWindow.getWindowTopOffset() - refScalingWindow.getWindowBottomOffset(); -#else - const Window& curConfWindow = curPPS->getConformanceWindow(); - int curPicWidth = curPPS->getPicWidthInLumaSamples() - (curConfWindow.getWindowLeftOffset() + curConfWindow.getWindowRightOffset()) * SPS::getWinUnitX(sps->getChromaFormatIdc()); - int curPicHeight = curPPS->getPicHeightInLumaSamples() - (curConfWindow.getWindowTopOffset() + curConfWindow.getWindowBottomOffset()) * SPS::getWinUnitY(sps->getChromaFormatIdc()); - const Window& refConfWindow = refPic->getConformanceWindow(); - int refPicWidth = refPic->getPicWidthInLumaSamples() - (refConfWindow.getWindowLeftOffset() + refConfWindow.getWindowRightOffset()) * SPS::getWinUnitX(sps->getChromaFormatIdc()); - int refPicHeight = refPic->getPicHeightInLumaSamples() - (refConfWindow.getWindowTopOffset() + refConfWindow.getWindowBottomOffset()) * SPS::getWinUnitY(sps->getChromaFormatIdc()); -#endif xScale = ( ( refPicWidth << SCALE_RATIO_BITS ) + ( curPicWidth >> 1 ) ) / curPicWidth; yScale = ( ( refPicHeight << SCALE_RATIO_BITS ) + ( curPicHeight >> 1 ) ) / curPicHeight; diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index c74f346d76246b450d6be72c5825b08a261793ba..0f45ee269b88e18bd4d7958da53b3ec03008f96d 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -1147,7 +1147,6 @@ void DecLib::xActivateParameterSets( const int layerId ) CHECK( ( pps->getPicWidthInLumaSamples() % ( std::max( 8, int( sps->getMaxCUWidth() >> ( sps->getMaxCodingDepth() - 1 ) ) ) ) ) != 0, "Coded frame width must be a multiple of Max(8, the minimum unit size)" ); CHECK( ( pps->getPicHeightInLumaSamples() % ( std::max( 8, int( sps->getMaxCUHeight() >> ( sps->getMaxCodingDepth() - 1 ) ) ) ) ) != 0, "Coded frame height must be a multiple of Max(8, the minimum unit size)" ); -#if JVET_P0590_SCALING_WINDOW if( !sps->getRprEnabledFlag() ) // subpics_present_flag is equal to 1 condition shall be added { CHECK( pps->getPicWidthInLumaSamples() != sps->getMaxPicWidthInLumaSamples(), "When subpics_present_flag is equal to 1 or ref_pic_resampling_enabled_flag equal to 0, the value of pic_width_in_luma_samples shall be equal to pic_width_max_in_luma_samples." ); @@ -1155,7 +1154,6 @@ void DecLib::xActivateParameterSets( const int layerId ) } CHECK( !sps->getRprEnabledFlag() && pps->getScalingWindow().getWindowEnabledFlag(), "When ref_pic_resampling_enabled_flag is equal to 0, the value of scaling_window_flag shall be equal to 0." ); -#endif if( sps->getCTUSize() + 2 * ( 1 << sps->getLog2MinCodingBlockSize() ) > pps->getPicWidthInLumaSamples() ) { diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 7c5f0091059ff949797e2ae34b01e0990eb35709..6e7fcc5747029a30591b54f051fd469c7a4aff8f 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -436,7 +436,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode ); } -#if JVET_P0590_SCALING_WINDOW READ_FLAG( uiCode, "scaling_window_flag" ); if( uiCode != 0 ) { @@ -446,7 +445,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana READ_UVLC( uiCode, "scaling_win_top_offset" ); scalingWindow.setWindowTopOffset( uiCode ); READ_UVLC( uiCode, "scaling_win_bottom_offset" ); scalingWindow.setWindowBottomOffset( uiCode ); } -#endif READ_FLAG( uiCode, "output_flag_present_flag" ); pcPPS->setOutputFlagPresentFlag( uiCode==1 ); @@ -1074,9 +1072,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setSeparateColourPlaneFlag( uiCode != 0 ); } -#if JVET_P0590_SCALING_WINDOW READ_FLAG( uiCode, "ref_pic_resampling_enabled_flag" ); pcSPS->setRprEnabledFlag( uiCode ); -#endif READ_UVLC( uiCode, "pic_width_max_in_luma_samples" ); pcSPS->setMaxPicWidthInLumaSamples( uiCode ); READ_UVLC( uiCode, "pic_height_max_in_luma_samples" ); pcSPS->setMaxPicHeightInLumaSamples( uiCode ); diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index e258082405600c3f548bbb490fa8f7c9197eb075..ec58b1c98ff8a4408017299e8a345376bbd7db38 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -3893,7 +3893,6 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni const CPelBuf& upscaledOrg = sps.getUseLmcs() ? pcPic->M_BUFS( 0, PIC_TRUE_ORIGINAL_INPUT).get( COMPONENT_Y ) : pcPic->M_BUFS( 0, PIC_ORIGINAL_INPUT).get( COMPONENT_Y ); upscaledRec.create( pic.chromaFormat, Area( Position(), upscaledOrg ) ); -#if JVET_P0590_SCALING_WINDOW int xScale, yScale; // it is assumed that full resolution picture PPS has ppsId 0 const PPS* pps = m_pcEncLib->getPPS(0); @@ -3904,19 +3903,6 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni Picture::rescalePicture( scalingRatio, picC, pcPic->getScalingWindow(), upscaledRec, pps->getScalingWindow(), format, sps.getBitDepths(), false, false, sps.getHorCollocatedChromaFlag(), sps.getVerCollocatedChromaFlag() ); #else Picture::rescalePicture( scalingRatio, picC, pcPic->getScalingWindow(), upscaledRec, pps->getScalingWindow(), format, sps.getBitDepths(), false ); -#endif -#elif JVET_P0592_CHROMA_PHASE - int xScale, yScale; - // it is assumed that full resolution picture PPS has ppsId 0 - const PPS* pps = m_pcEncLib->getPPS( 0 ); - CU::getRprScaling( &sps, pps, pcPic, xScale, yScale ); - std::pair<int, int> scalingRatio = std::pair<int, int>( xScale, yScale ); - - Picture::rescalePicture( scalingRatio, picC, pcPic->getConformanceWindow(), upscaledRec, m_pcEncLib->getConformanceWindow(), format, sps.getBitDepths(), false, false, sps.getHorCollocatedChromaFlag(), sps.getVerCollocatedChromaFlag() ); -#else - // the input source picture has a conformance window derived at encoder - Window& conformanceWindow = m_pcEncLib->getConformanceWindow(); - Picture::rescalePicture( picC, pcPic->cs->pps->getConformanceWindow(), upscaledRec, conformanceWindow, format, sps.getBitDepths(), false ); #endif } @@ -3929,7 +3915,6 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni CHECK(!( p.width == o.width), "Unspecified error"); CHECK(!( p.height == o.height), "Unspecified error"); -#if JVET_P0590_SCALING_WINDOW int padX = m_pcEncLib->getPad( 0 ); int padY = m_pcEncLib->getPad( 1 ); @@ -3944,10 +3929,6 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni const uint32_t width = p.width - ( padX >> ::getComponentScaleX( compID, format ) ); const uint32_t height = p.height - ( padY >> ( !!bPicIsField + ::getComponentScaleY( compID, format ) ) ); -#else - const uint32_t width = p.width - (m_pcEncLib->getPad(0) >> ::getComponentScaleX(compID, format)); - const uint32_t height = p.height - (m_pcEncLib->getPad(1) >> (!!bPicIsField+::getComponentScaleY(compID,format))); -#endif // create new buffers with correct dimensions const CPelBuf recPB(p.bufAt(0, 0), p.stride, width, height); @@ -3976,7 +3957,6 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni { const CPelBuf& upscaledOrg = sps.getUseLmcs() ? pcPic->M_BUFS( 0, PIC_TRUE_ORIGINAL_INPUT ).get( compID ) : pcPic->M_BUFS( 0, PIC_ORIGINAL_INPUT ).get( compID ); -#if JVET_P0590_SCALING_WINDOW const uint32_t upscaledWidth = upscaledOrg.width - ( m_pcEncLib->getPad( 0 ) >> ::getComponentScaleX( compID, format ) ); const uint32_t upscaledHeight = upscaledOrg.height - ( m_pcEncLib->getPad( 1 ) >> ( !!bPicIsField + ::getComponentScaleY( compID, format ) ) ); @@ -3991,15 +3971,6 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni #endif upscaledPSNR[comp] = upscaledSSD ? 10.0 * log10( (double)maxval * maxval * upscaledWidth * upscaledHeight / (double)upscaledSSD ) : 999.99; -#else -#if ENABLE_QPA - const uint64_t upscaledSSD = xFindDistortionPlane( upscaledRec.get( compID ), upscaledOrg, useWPSNR ? bitDepth : 0, ::getComponentScaleX( compID, format ), ::getComponentScaleY( compID, format ) ); -#else - const uint64_t scaledSSD = xFindDistortionPlane( upscaledRec.get( compID ), upscaledOrg, 0 ); -#endif - - upscaledPSNR[comp] = upscaledSSD ? 10.0 * log10( (double)maxval * maxval * upscaledOrg.width * upscaledOrg.height / (double)upscaledSSD ) : 999.99; -#endif } } diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 3fab7f8d8767a6bc2f45f530f6af24b868cd0283..7df1893dd8bcb2798f65aa9ee192ec642d60a89c 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -263,22 +263,13 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) if( m_rprEnabled ) { PPS &pps = *( m_ppsMap.allocatePS( ENC_PPS_ID_RPR ) ); -#if JVET_P0590_SCALING_WINDOW Window& inputScalingWindow = pps0.getScalingWindow(); int scaledWidth = int( ( pps0.getPicWidthInLumaSamples() - inputScalingWindow.getWindowLeftOffset() - inputScalingWindow.getWindowRightOffset() ) / m_scalingRatioHor ); -#else - Window& inputConfWindow = pps0.getConformanceWindow(); - int scaledWidth = int((pps0.getPicWidthInLumaSamples() - (inputConfWindow.getWindowLeftOffset() + inputConfWindow.getWindowRightOffset()) * SPS::getWinUnitX(sps0.getChromaFormatIdc())) / m_scalingRatioHor); -#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; -#if JVET_P0590_SCALING_WINDOW int scaledHeight = int( ( pps0.getPicHeightInLumaSamples() - inputScalingWindow.getWindowTopOffset() - inputScalingWindow.getWindowBottomOffset() ) / m_scalingRatioVer ); -#else - int scaledHeight = int((pps0.getPicHeightInLumaSamples() - (inputConfWindow.getWindowTopOffset() + inputConfWindow.getWindowBottomOffset()) * SPS::getWinUnitY(sps0.getChromaFormatIdc())) / m_scalingRatioVer); -#endif temp = scaledHeight / minSizeUnit; int height = ( scaledHeight - ( temp * minSizeUnit) > 0 ? temp + 1 : temp ) * minSizeUnit; @@ -289,11 +280,9 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) conformanceWindow.setWindow( 0, ( width - scaledWidth ) / SPS::getWinUnitX( sps0.getChromaFormatIdc() ), 0, ( height - scaledHeight ) / SPS::getWinUnitY( sps0.getChromaFormatIdc() ) ); pps.setConformanceWindow( conformanceWindow ); -#if JVET_P0590_SCALING_WINDOW Window scalingWindow; scalingWindow.setWindow( 0, width - scaledWidth, 0, height - scaledHeight ); pps.setScalingWindow( scalingWindow ); -#endif // disable picture partitioning for scaled RPR pictures (slice/tile config only provided for the original resolution) m_noPicPartitionFlag = true; @@ -636,7 +625,6 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu const ChromaFormat chromaFormatIDC = pSPS->getChromaFormatIdc(); const PPS *refPPS = m_ppsMap.getPS( 0 ); -#if JVET_P0590_SCALING_WINDOW const Window& curScalingWindow = pPPS->getScalingWindow(); int curPicWidth = pPPS->getPicWidthInLumaSamples() - curScalingWindow.getWindowLeftOffset() - curScalingWindow.getWindowRightOffset(); int curPicHeight = pPPS->getPicHeightInLumaSamples() - curScalingWindow.getWindowTopOffset() - curScalingWindow.getWindowBottomOffset(); @@ -657,27 +645,6 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu #else Picture::rescalePicture( scalingRatio, *pcPicYuvOrg, refPPS->getScalingWindow(), pcPicCurr->getOrigBuf(), pPPS->getScalingWindow(), chromaFormatIDC, pSPS->getBitDepths(), true, true ); Picture::rescalePicture( scalingRatio, *cPicYuvTrueOrg, refPPS->getScalingWindow(), pcPicCurr->getTrueOrigBuf(), pPPS->getScalingWindow(), chromaFormatIDC, pSPS->getBitDepths(), true, true ); -#endif -#elif JVET_P0592_CHROMA_PHASE - const Window& curWindow = pPPS->getConformanceWindow(); - int curPicWidth = pPPS->getPicWidthInLumaSamples() - ( curWindow.getWindowLeftOffset() + curWindow.getWindowRightOffset() ) * SPS::getWinUnitX( chromaFormatIDC ); - int curPicHeight = pPPS->getPicHeightInLumaSamples() - ( curWindow.getWindowTopOffset() + curWindow.getWindowBottomOffset() ) * SPS::getWinUnitY( chromaFormatIDC ); - - const Window& refWindow = refPPS->getConformanceWindow(); - int refPicWidth = refPPS->getPicWidthInLumaSamples() - ( refWindow.getWindowLeftOffset() + refWindow.getWindowRightOffset() ) * SPS::getWinUnitX( chromaFormatIDC ); - int refPicHeight = refPPS->getPicHeightInLumaSamples() - ( refWindow.getWindowTopOffset() + refWindow.getWindowBottomOffset() ) * SPS::getWinUnitY( chromaFormatIDC ); - - int xScale = ( ( refPicWidth << SCALE_RATIO_BITS ) + ( curPicWidth >> 1 ) ) / curPicWidth; - int yScale = ( ( refPicHeight << SCALE_RATIO_BITS ) + ( curPicHeight >> 1 ) ) / curPicHeight; - std::pair<int, int> scalingRatio = std::pair<int, int>( xScale, yScale ); - - Picture::rescalePicture( scalingRatio, *pcPicYuvOrg, refPPS->getConformanceWindow(), pcPicCurr->getOrigBuf(), pPPS->getConformanceWindow(), chromaFormatIDC, pSPS->getBitDepths(), true, true, - pSPS->getHorCollocatedChromaFlag(), pSPS->getVerCollocatedChromaFlag() ); - Picture::rescalePicture( scalingRatio, *cPicYuvTrueOrg, refPPS->getConformanceWindow(), pcPicCurr->getTrueOrigBuf(), pPPS->getConformanceWindow(), chromaFormatIDC, pSPS->getBitDepths(), true, true, - pSPS->getHorCollocatedChromaFlag(), pSPS->getVerCollocatedChromaFlag() ); -#else - Picture::rescalePicture( *pcPicYuvOrg, refPPS->getConformanceWindow(), pcPicCurr->getOrigBuf(), pPPS->getConformanceWindow(), chromaFormatIDC, pSPS->getBitDepths(), true, true ); - Picture::rescalePicture( *cPicYuvTrueOrg, refPPS->getConformanceWindow(), pcPicCurr->getTrueOrigBuf(), pPPS->getConformanceWindow(), chromaFormatIDC, pSPS->getBitDepths(), true, true ); #endif } else diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index e7ecf33be77cdef52f7bdd339b0b7cbb38b21175..7fd8109b01cc3c141fdc7ef3cc13125a7fde030a 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -267,7 +267,6 @@ void HLSWriter::codePPS( const PPS* pcPPS, const SPS* pcSPS ) WRITE_UVLC( conf.getWindowTopOffset(), "conf_win_top_offset" ); WRITE_UVLC( conf.getWindowBottomOffset(), "conf_win_bottom_offset" ); } -#if JVET_P0590_SCALING_WINDOW Window scalingWindow = pcPPS->getScalingWindow(); WRITE_FLAG( scalingWindow.getWindowEnabledFlag(), "scaling_window_flag" ); @@ -278,7 +277,6 @@ void HLSWriter::codePPS( const PPS* pcPPS, const SPS* pcSPS ) WRITE_UVLC( scalingWindow.getWindowTopOffset(), "scaling_win_top_offset" ); WRITE_UVLC( scalingWindow.getWindowBottomOffset(), "scaling_win_bottom_offset" ); } -#endif WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0, "output_flag_present_flag" ); WRITE_FLAG(pcPPS->getSubPicIdSignallingPresentFlag(), "pps_subpic_id_signalling_present_flag"); @@ -718,9 +716,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( 0, "separate_colour_plane_flag"); } -#if JVET_P0590_SCALING_WINDOW WRITE_FLAG( pcSPS->getRprEnabledFlag(), "ref_pic_resampling_enabled_flag" ); -#endif WRITE_UVLC( pcSPS->getMaxPicWidthInLumaSamples(), "pic_width_max_in_luma_samples" ); WRITE_UVLC( pcSPS->getMaxPicHeightInLumaSamples(), "pic_height_max_in_luma_samples" ); diff --git a/source/Lib/Utilities/VideoIOYuv.cpp b/source/Lib/Utilities/VideoIOYuv.cpp index d9f29c22248cd694daa2cbaec5629e1dc71b27be..4a793114c679a2eda8cb307f1707f84f0140760c 100644 --- a/source/Lib/Utilities/VideoIOYuv.cpp +++ b/source/Lib/Utilities/VideoIOYuv.cpp @@ -1224,7 +1224,6 @@ bool VideoIOYuv::writeUpscaledPicture( const SPS& sps, const PPS& pps, const CPe ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc(); bool ret = false; -#if JVET_P0590_SCALING_WINDOW static Window confFullResolution; static Window afterScaleWindowFullResolution; @@ -1234,7 +1233,6 @@ bool VideoIOYuv::writeUpscaledPicture( const SPS& sps, const PPS& pps, const CPe afterScaleWindowFullResolution = pps.getScalingWindow(); afterScaleWindowFullResolution = pps.getConformanceWindow(); } -#endif if( outputChoice && ( sps.getMaxPicWidthInLumaSamples() != pic.get( COMPONENT_Y ).width || sps.getMaxPicHeightInLumaSamples() != pic.get( COMPONENT_Y ).height ) ) { @@ -1243,7 +1241,6 @@ bool VideoIOYuv::writeUpscaledPicture( const SPS& sps, const PPS& pps, const CPe PelStorage upscaledPic; upscaledPic.create( chromaFormatIDC, Area( Position(), Size( sps.getMaxPicWidthInLumaSamples(), sps.getMaxPicHeightInLumaSamples() ) ) ); -#if JVET_P0590_SCALING_WINDOW int curPicWidth = sps.getMaxPicWidthInLumaSamples() - afterScaleWindowFullResolution.getWindowLeftOffset() - afterScaleWindowFullResolution.getWindowRightOffset(); int curPicHeight = sps.getMaxPicHeightInLumaSamples() - afterScaleWindowFullResolution.getWindowTopOffset() - afterScaleWindowFullResolution.getWindowBottomOffset(); @@ -1268,34 +1265,6 @@ bool VideoIOYuv::writeUpscaledPicture( const SPS& sps, const PPS& pps, const CPe confFullResolution.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ), confFullResolution.getWindowBottomOffset() * SPS::getWinUnitY( chromaFormatIDC ), NUM_CHROMA_FORMAT, bClipToRec709 ); -#else - const Window conf; - -#if JVET_P0592_CHROMA_PHASE - int curPicWidth = sps.getMaxPicWidthInLumaSamples() - ( conf.getWindowLeftOffset() + conf.getWindowRightOffset() ) * SPS::getWinUnitX( chromaFormatIDC ); - int curPicHeight = sps.getMaxPicHeightInLumaSamples() - ( conf.getWindowTopOffset() + conf.getWindowBottomOffset() ) * SPS::getWinUnitY( chromaFormatIDC ); - - const Window& beforeScalingWindow = pps.getConformanceWindow(); - int refPicWidth = pps.getPicWidthInLumaSamples() - ( beforeScalingWindow.getWindowLeftOffset() + beforeScalingWindow.getWindowRightOffset() ) * SPS::getWinUnitX( chromaFormatIDC ); - int refPicHeight = pps.getPicHeightInLumaSamples() - ( beforeScalingWindow.getWindowTopOffset() + beforeScalingWindow.getWindowBottomOffset() ) * SPS::getWinUnitY( chromaFormatIDC ); - - int xScale = ( ( refPicWidth << SCALE_RATIO_BITS ) + ( curPicWidth >> 1 ) ) / curPicWidth; - int yScale = ( ( refPicHeight << SCALE_RATIO_BITS ) + ( curPicHeight >> 1 ) ) / curPicHeight; - - Picture::rescalePicture( std::pair<int, int>( xScale, yScale ), pic, pps.getConformanceWindow(), upscaledPic, conf, chromaFormatIDC, sps.getBitDepths(), false, false, sps.getHorCollocatedChromaFlag(), sps.getVerCollocatedChromaFlag() ); -#else - Picture::rescalePicture( pic, pps.getConformanceWindow(), upscaledPic, conf, chromaFormatIDC, sps.getBitDepths(), false ); -#endif - - ret = write( sps.getMaxPicWidthInLumaSamples(), sps.getMaxPicHeightInLumaSamples(), upscaledPic, - ipCSC, - bPackedYUVOutputMode, - conf.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ), - conf.getWindowRightOffset() * SPS::getWinUnitX( chromaFormatIDC ), - conf.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ), - conf.getWindowBottomOffset() * SPS::getWinUnitY( chromaFormatIDC ), - NUM_CHROMA_FORMAT, bClipToRec709 ); -#endif } else {