Commit 9238b6b9 authored by Philippe Hanhart's avatar Philippe Hanhart

Moved SPS parameters from SPSNext to SPS

parent d476397b
......@@ -1964,9 +1964,6 @@ bool EncAppCfg::xCheckParameter()
#endif
#if JVET_L0124_L0208_TRIANGLE
xConfirmPara( m_Triangle, "Triangle is only allowed with NEXT profile" );
#endif
#if JVET_L0231_WRAPAROUND
xConfirmPara( m_wrapAround, "Horizontal wrap-around motion compensation for inter prediction is only allowed with NEXT profile" );
#endif
// ADD_NEW_TOOL : (parameter check) add a check for next tools here
}
......@@ -1990,16 +1987,16 @@ bool EncAppCfg::xCheckParameter()
#if !REMOVE_MV_ADAPT_PREC
xConfirmPara(m_Affine && !m_highPrecisionMv, "Affine is not yet implemented for HighPrecMv off.");
#endif
}
#if JVET_L0231_WRAPAROUND
if( m_wrapAround )
{
xConfirmPara(m_wrapAroundOffset == 0, "Wrap-around offset must be greater than 0");
xConfirmPara(m_wrapAroundOffset > m_iSourceWidth, "Wrap-around offset must not be greater than the source picture width");
xConfirmPara(m_wrapAroundOffset % SPS::getWinUnitX(m_chromaFormatIDC) != 0, "Wrap-around offset must be an integer multiple of the specified chroma subsampling");
}
#endif
if( m_wrapAround )
{
xConfirmPara( m_wrapAroundOffset == 0, "Wrap-around offset must be greater than 0" );
xConfirmPara( m_wrapAroundOffset > m_iSourceWidth, "Wrap-around offset must not be greater than the source picture width" );
xConfirmPara( m_wrapAroundOffset % SPS::getWinUnitX(m_chromaFormatIDC) != 0, "Wrap-around offset must be an integer multiple of the specified chroma subsampling" );
}
#endif
#if ENABLE_SPLIT_PARALLELISM
xConfirmPara( m_numSplitThreads < 1, "Number of used threads cannot be smaller than 1" );
......
......@@ -831,7 +831,7 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio
// clip and scale
#if JVET_L0231_WRAPAROUND
if (sps.getSpsNext().getUseWrapAround())
if (sps.getUseWrapAround())
{
m_storedMv[h / AFFINE_MIN_BLOCK_SIZE * MVBUFFER_SIZE + w / AFFINE_MIN_BLOCK_SIZE].set(iMvScaleTmpHor, iMvScaleTmpVer);
Mv tmpMv(iMvScaleTmpHor, iMvScaleTmpVer);
......@@ -859,7 +859,7 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio
Mv(2, 2));
curMv.set(curMv.getHor() >> 2, curMv.getVer() >> 2);
#if JVET_L0231_WRAPAROUND
if (sps.getSpsNext().getUseWrapAround())
if (sps.getUseWrapAround())
{
clipMv(curMv, Position(pu.Y().x + (w << iScaleX), pu.Y().y + (h << iScaleY)), Size(blockWidth << iScaleX, blockHeight << iScaleY), sps);
}
......@@ -874,7 +874,7 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio
// clip and scale
#if JVET_L0231_WRAPAROUND
if (sps.getSpsNext().getUseWrapAround())
if (sps.getUseWrapAround())
{
Mv tmpMv(iMvScaleTmpHor, iMvScaleTmpVer);
clipMv(tmpMv, Position(pu.Y().x + (w << iScaleX), pu.Y().y + (h << iScaleY)), Size(blockWidth << iScaleX, blockHeight << iScaleY), sps);
......
......@@ -85,7 +85,7 @@ void clipMv( Mv& rcMv, const Position& pos,
int iVerMin = ( -( int ) sps.getMaxCUHeight() - iOffset - ( int ) pos.y + 1 ) << iMvShift;
#if JVET_L0231_WRAPAROUND
if( sps.getSpsNext().getUseWrapAround() )
if( sps.getUseWrapAround() )
{
int iHorMax = ( sps.getPicWidthInLumaSamples() + sps.getMaxCUWidth() - size.width + iOffset - ( int ) pos.x - 1 ) << iMvShift;
int iHorMin = ( -( int ) sps.getMaxCUWidth() - iOffset - ( int ) pos.x + 1 ) << iMvShift;
......
......@@ -1005,9 +1005,9 @@ void Picture::extendPicBorder()
Pel* pi = piTxt;
// do left and right margins
#if JVET_L0231_WRAPAROUND
if (cs->sps->getSpsNext().getUseWrapAround())
if (cs->sps->getUseWrapAround())
{
int xoffset = cs->sps->getSpsNext().getWrapAroundOffset() >> getComponentScaleX( compID, cs->area.chromaFormat );
int xoffset = cs->sps->getWrapAroundOffset() >> getComponentScaleX( compID, cs->area.chromaFormat );
for (int y = 0; y < p.height; y++)
{
for (int x = 0; x < xmargin; x++ )
......
......@@ -1829,10 +1829,6 @@ SPSNext::SPSNext( SPS& sps )
, m_compositeRefEnabled ( false )
#if JVET_L0293_CPR
, m_CPRMode ( 0 )
#endif
#if JVET_L0231_WRAPAROUND
, m_wrapAround ( false )
, m_wrapAroundOffset ( 0 )
#endif
// ADD_NEW_TOOL : (sps extension) add tool enabling flags here (with "false" as default values)
{
......@@ -1878,6 +1874,10 @@ SPS::SPS()
, m_vuiParametersPresentFlag (false)
, m_vuiParameters ()
, m_spsNextExtension (*this)
#if JVET_L0231_WRAPAROUND
, m_useWrapAround (false)
, m_wrapAroundOffset ( 0)
#endif
{
for(int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
{
......
......@@ -868,11 +868,6 @@ private:
unsigned m_CPRMode;
#endif
#if JVET_L0231_WRAPAROUND
bool m_wrapAround;
unsigned m_wrapAroundOffset;
#endif
// ADD_NEW_TOOL : (sps extension) add tool enabling flags and associated parameters here
public:
......@@ -994,12 +989,6 @@ public:
#if JVET_L0293_CPR
void setCPRMode (unsigned CPRMode) { m_CPRMode = CPRMode; }
unsigned getCPRMode () const { return m_CPRMode; }
#endif
#if JVET_L0231_WRAPAROUND
void setUseWrapAround ( bool b ) { m_wrapAround = b; }
bool getUseWrapAround () const { return m_wrapAround; }
void setWrapAroundOffset ( unsigned offset ) { m_wrapAroundOffset = offset; }
unsigned getWrapAroundOffset () const { return m_wrapAroundOffset; }
#endif
// ADD_NEW_TOOL : (sps extension) add access functions for tool enabling flags and associated parameters here
......@@ -1086,6 +1075,11 @@ private:
bool m_useALF;
#if JVET_L0231_WRAPAROUND
bool m_useWrapAround;
unsigned m_wrapAroundOffset;
#endif
public:
SPS();
......@@ -1220,6 +1214,13 @@ public:
bool getUseALF() const { return m_useALF; }
void setUseALF( bool b ) { m_useALF = b; }
#if JVET_L0231_WRAPAROUND
void setUseWrapAround(bool b) { m_useWrapAround = b; }
bool getUseWrapAround() const { return m_useWrapAround; }
void setWrapAroundOffset(unsigned offset) { m_wrapAroundOffset = offset; }
unsigned getWrapAroundOffset() const { return m_wrapAroundOffset; }
#endif
};
......
......@@ -930,14 +930,6 @@ void HLSyntaxReader::parseSPSNext( SPSNext& spsNext, const bool usePCM )
}
}
#endif
#if JVET_L0231_WRAPAROUND
READ_FLAG( symbol, "ref_wraparound_enabled_flag" ); spsNext.setUseWrapAround( symbol != 0 );
if( spsNext.getUseWrapAround() )
{
READ_UVLC( symbol, "ref_wraparound_offset" ); spsNext.setWrapAroundOffset( symbol );
}
#endif
// ADD_NEW_TOOL : (sps extension parser) read tool enabling flags and associated parameters here
}
......@@ -1085,6 +1077,14 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
READ_FLAG( uiCode, "pcm_loop_filter_disable_flag" ); pcSPS->setPCMFilterDisableFlag ( uiCode ? true : false );
}
#if JVET_L0231_WRAPAROUND
READ_FLAG(uiCode, "ref_wraparound_enabled_flag"); pcSPS->setUseWrapAround( uiCode ? true : false );
if (pcSPS->getUseWrapAround())
{
READ_UVLC(uiCode, "ref_wraparound_offset"); pcSPS->setWrapAroundOffset( uiCode );
}
#endif
READ_UVLC( uiCode, "num_short_term_ref_pic_sets" );
CHECK(uiCode > 64, "Invalid code");
pcSPS->createRPSList(uiCode);
......
......@@ -884,8 +884,8 @@ void EncLib::xInitSPS(SPS &sps)
#endif
#if JVET_L0231_WRAPAROUND
sps.getSpsNext().setUseWrapAround ( m_wrapAround );
sps.getSpsNext().setWrapAroundOffset ( m_wrapAroundOffset );
sps.setUseWrapAround ( m_wrapAround );
sps.setWrapAroundOffset ( m_wrapAroundOffset );
#endif
// ADD_NEW_TOOL : (encoder lib) set tool enabling flags and associated parameters here
......
......@@ -640,14 +640,6 @@ void HLSWriter::codeSPSNext( const SPSNext& spsNext, const bool usePCM )
}
}
#endif
#if JVET_L0231_WRAPAROUND
WRITE_FLAG( spsNext.getUseWrapAround() ? 1 : 0, "ref_wraparound_enabled_flag" );
if( spsNext.getUseWrapAround() )
{
WRITE_UVLC( spsNext.getWrapAroundOffset(), "ref_wraparound_offset" );
}
#endif
// ADD_NEW_TOOL : (sps extension writer) write tool enabling flags and associated parameters here
}
......@@ -740,6 +732,14 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
WRITE_FLAG( pcSPS->getPCMFilterDisableFlag()?1 : 0, "pcm_loop_filter_disable_flag");
}
#if JVET_L0231_WRAPAROUND
WRITE_FLAG( pcSPS->getUseWrapAround() ? 1 : 0, "ref_wraparound_enabled_flag" );
if( pcSPS->getUseWrapAround() )
{
WRITE_UVLC( pcSPS->getWrapAroundOffset(), "ref_wraparound_offset" );
}
#endif
CHECK( pcSPS->getMaxTLayers() == 0, "Maximum number of T-layers is '0'" );
const RPSList* rpsList = pcSPS->getRPSList();
......
Markdown is supported
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