Commit dfd26227 authored by Karsten Suehring's avatar Karsten Suehring

Merge branch 'L0231-Wraparound' into 'master'

JVET-L0231: wrap-around MC

See merge request !123
parents 3b48a289 9238b6b9
Pipeline #456 passed with stage
......@@ -275,6 +275,11 @@ void EncApp::xInitLibCfg()
m_cEncLib.setCPRFastMethod ( m_CPRFastMethod );
#endif
#if JVET_L0231_WRAPAROUND
m_cEncLib.setUseWrapAround ( m_wrapAround );
m_cEncLib.setWrapAroundOffset ( m_wrapAroundOffset );
#endif
// ADD_NEW_TOOL : (encoder app) add setting of tool enabling flags and associated parameters here
m_cEncLib.setMaxCUWidth ( m_uiCTUSize );
......
......@@ -879,6 +879,11 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
( "CPRFastMethod", m_CPRFastMethod, 6u, "Fast methods for CPR")
#endif
#if JVET_L0231_WRAPAROUND
("WrapAround", m_wrapAround, false, "Enable horizontal wrap-around motion compensation for inter prediction (0:off, 1:on) [default: off]")
("WrapAroundOffset", m_wrapAroundOffset, 0u, "Offset in luma samples used for computing the horizontal wrap-around position")
#endif
// ADD_NEW_TOOL : (encoder app) add parsing parameters here
("LCTUFast", m_useFastLCTU, false, "Fast methods for large CTU")
......@@ -1982,8 +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 ENABLE_SPLIT_PARALLELISM
xConfirmPara( m_numSplitThreads < 1, "Number of used threads cannot be smaller than 1" );
......@@ -3164,6 +3177,13 @@ void EncAppCfg::xPrintParameter()
}
#if JVET_L0293_CPR
msg(VERBOSE, "CPR:%d ", m_CPRMode);
#endif
#if JVET_L0231_WRAPAROUND
msg( VERBOSE, "WrapAround:%d ", m_wrapAround);
if( m_wrapAround )
{
msg( VERBOSE, "WrapAroundOffset:%d ", m_wrapAroundOffset );
}
#endif
// ADD_NEW_TOOL (add some output indicating the usage of tools)
......
......@@ -257,6 +257,11 @@ protected:
unsigned m_CPRFastMethod;
#endif
#if JVET_L0231_WRAPAROUND
bool m_wrapAround;
unsigned m_wrapAroundOffset;
#endif
// ADD_NEW_TOOL : (encoder app) add tool enabling flags and associated parameters here
unsigned m_uiMaxCUWidth; ///< max. CU width in pixel
......
......@@ -460,7 +460,11 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList&
mv[0] = pu.mv[eRefPicList];
}
if ( !pu.cu->affine )
clipMv(mv[0], pu.cu->lumaPos(), sps);
clipMv(mv[0], pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
sps);
for( uint32_t comp = COMPONENT_Y; comp < pcYuvPred.bufs.size() && comp <= m_maxCompIDToPred; comp++ )
......@@ -752,7 +756,11 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio
)
{
Mv mvTemp = _mv[0];
clipMv( mvTemp, pu.cu->lumaPos(), *pu.cs->sps );
clipMv( mvTemp, pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
*pu.cs->sps );
xPredInterBlk( compID, pu, refPic, mvTemp, dstPic, bi, clpRng
#if JVET_L0256_BIO
, false
......@@ -847,10 +855,25 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio
roundAffineMv(iMvScaleTmpHor, iMvScaleTmpVer, shift);
// clip and scale
iMvScaleTmpHor = std::min<int>(iHorMax, std::max<int>(iHorMin, iMvScaleTmpHor));
iMvScaleTmpVer = std::min<int>(iVerMax, std::max<int>(iVerMin, iMvScaleTmpVer));
#if JVET_L0231_WRAPAROUND
if (sps.getUseWrapAround())
{
m_storedMv[h / AFFINE_MIN_BLOCK_SIZE * MVBUFFER_SIZE + w / AFFINE_MIN_BLOCK_SIZE].set(iMvScaleTmpHor, iMvScaleTmpVer);
Mv tmpMv(iMvScaleTmpHor, iMvScaleTmpVer);
clipMv(tmpMv, Position(pu.Y().x + w, pu.Y().y + h), Size(blockWidth, blockHeight), sps);
iMvScaleTmpHor = tmpMv.getHor();
iMvScaleTmpVer = tmpMv.getVer();
}
else
{
#endif
iMvScaleTmpHor = std::min<int>(iHorMax, std::max<int>(iHorMin, iMvScaleTmpHor));
iMvScaleTmpVer = std::min<int>(iVerMax, std::max<int>(iVerMin, iMvScaleTmpVer));
m_storedMv[h / AFFINE_MIN_BLOCK_SIZE * MVBUFFER_SIZE + w / AFFINE_MIN_BLOCK_SIZE].set(iMvScaleTmpHor, iMvScaleTmpVer);
m_storedMv[h / AFFINE_MIN_BLOCK_SIZE * MVBUFFER_SIZE + w / AFFINE_MIN_BLOCK_SIZE].set(iMvScaleTmpHor, iMvScaleTmpVer);
#if JVET_L0231_WRAPAROUND
}
#endif
}
else
{
......@@ -860,6 +883,12 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio
m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE + 1)* MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE + 1)] +
Mv(2, 2));
curMv.set(curMv.getHor() >> 2, curMv.getVer() >> 2);
#if JVET_L0231_WRAPAROUND
if (sps.getUseWrapAround())
{
clipMv(curMv, Position(pu.Y().x + (w << iScaleX), pu.Y().y + (h << iScaleY)), Size(blockWidth << iScaleX, blockHeight << iScaleY), sps);
}
#endif
iMvScaleTmpHor = curMv.hor;
iMvScaleTmpVer = curMv.ver;
}
......@@ -869,8 +898,22 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio
roundAffineMv( iMvScaleTmpHor, iMvScaleTmpVer, shift );
// clip and scale
iMvScaleTmpHor = std::min<int>( iHorMax, std::max<int>( iHorMin, iMvScaleTmpHor ) );
iMvScaleTmpVer = std::min<int>( iVerMax, std::max<int>( iVerMin, iMvScaleTmpVer ) );
#if JVET_L0231_WRAPAROUND
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);
iMvScaleTmpHor = tmpMv.getHor();
iMvScaleTmpVer = tmpMv.getVer();
}
else
{
#endif
iMvScaleTmpHor = std::min<int>( iHorMax, std::max<int>( iHorMin, iMvScaleTmpHor ) );
iMvScaleTmpVer = std::min<int>( iVerMax, std::max<int>( iVerMin, iMvScaleTmpVer ) );
#if JVET_L0231_WRAPAROUND
}
#endif
#endif
// get the MV in high precision
int xFrac, yFrac, xInt, yInt;
......
......@@ -63,7 +63,11 @@ void roundAffineMv( int& mvx, int& mvy, int nShift )
mvy = mvy >= 0 ? (mvy + nOffset) >> nShift : -((-mvy + nOffset) >> nShift);
}
void clipMv( Mv& rcMv, const Position& pos, const SPS& sps )
void clipMv( Mv& rcMv, const Position& pos,
#if JVET_L0231_WRAPAROUND
const struct Size& size,
#endif
const SPS& sps )
{
#if !REMOVE_MV_ADAPT_PREC
int iMvShift = 2 + (rcMv.highPrec ? VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE : 0);
......@@ -80,6 +84,17 @@ void clipMv( Mv& rcMv, const Position& pos, const SPS& sps )
int iVerMax = ( sps.getPicHeightInLumaSamples() + iOffset - ( int ) pos.y - 1 ) << iMvShift;
int iVerMin = ( -( int ) sps.getMaxCUHeight() - iOffset - ( int ) pos.y + 1 ) << iMvShift;
#if JVET_L0231_WRAPAROUND
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;
rcMv.setHor( std::min( iHorMax, std::max( iHorMin, rcMv.getHor() ) ) );
rcMv.setVer( std::min( iVerMax, std::max( iVerMin, rcMv.getVer() ) ) );
return;
}
#endif
rcMv.setHor( std::min( iHorMax, std::max( iHorMin, rcMv.getHor() ) ) );
rcMv.setVer( std::min( iVerMax, std::max( iVerMin, rcMv.getVer() ) ) );
}
......
......@@ -287,7 +287,11 @@ namespace std
};
#endif
void roundMV( Mv& rcMv, unsigned imvShift );
void clipMv ( Mv& rcMv, const struct Position& pos, const class SPS& sps );
void clipMv ( Mv& rcMv, const struct Position& pos,
#if JVET_L0231_WRAPAROUND
const struct Size& size,
#endif
const class SPS& sps );
void roundAffineMv( int& mvx, int& mvy, int nShift );
......
......@@ -1004,15 +1004,35 @@ void Picture::extendPicBorder()
Pel* pi = piTxt;
// do left and right margins
for (int y = 0; y < p.height; y++)
#if JVET_L0231_WRAPAROUND
if (cs->sps->getUseWrapAround())
{
for (int x = 0; x < xmargin; x++ )
int xoffset = cs->sps->getWrapAroundOffset() >> getComponentScaleX( compID, cs->area.chromaFormat );
for (int y = 0; y < p.height; y++)
{
pi[ -xmargin + x ] = pi[0];
pi[ p.width + x ] = pi[p.width-1];
for (int x = 0; x < xmargin; x++ )
{
pi[ -xmargin + x ] = pi[ -xmargin + x + xoffset ];
pi[ p.width + x ] = pi[ p.width + x - xoffset ];
}
pi += p.stride;
}
pi += p.stride;
}
else
{
#endif
for (int y = 0; y < p.height; y++)
{
for (int x = 0; x < xmargin; x++ )
{
pi[ -xmargin + x ] = pi[0];
pi[ p.width + x ] = pi[p.width-1];
}
pi += p.stride;
}
#if JVET_L0231_WRAPAROUND
}
#endif
// pi is now the (0,height) (bottom left of image within bigger picture
pi -= (p.stride + xmargin);
......
......@@ -1889,6 +1889,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++)
{
......
......@@ -1091,6 +1091,11 @@ private:
bool m_useALF;
#if JVET_L0231_WRAPAROUND
bool m_useWrapAround;
unsigned m_wrapAroundOffset;
#endif
public:
SPS();
......@@ -1263,6 +1268,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
};
......
......@@ -50,6 +50,8 @@
#include <assert.h>
#include <cassert>
#define JVET_L0231_WRAPAROUND 1 // Wrap-around MC
#define TRAINED_CABAC_INIT_TABLES 1 // Trained values for VTM3
#define JVET_L0410_TC_TAB 1 // Change TC table for QP 51-63
......
......@@ -1156,6 +1156,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);
......
......@@ -239,6 +239,11 @@ protected:
unsigned m_CPRFastMethod;
#endif
#if JVET_L0231_WRAPAROUND
bool m_wrapAround;
unsigned m_wrapAroundOffset;
#endif
// ADD_NEW_TOOL : (encoder lib) add tool enabling flags and associated parameters here
bool m_useFastLCTU;
......@@ -732,6 +737,13 @@ public:
unsigned getCPRFastMethod () const { return m_CPRFastMethod; }
#endif
#if JVET_L0231_WRAPAROUND
void setUseWrapAround ( bool b ) { m_wrapAround = b; }
bool getUseWrapAround () const { return m_wrapAround; }
void setWrapAroundOffset ( unsigned u ) { m_wrapAroundOffset = u; }
unsigned getWrapAroundOffset () const { return m_wrapAroundOffset; }
#endif
// ADD_NEW_TOOL : (encoder lib) add access functions here
......
......@@ -893,6 +893,11 @@ void EncLib::xInitSPS(SPS &sps)
#if JVET_L0293_CPR
sps.getSpsNext().setCPRMode ( m_CPRMode );
#endif
#if JVET_L0231_WRAPAROUND
sps.setUseWrapAround ( m_wrapAround );
sps.setWrapAroundOffset ( m_wrapAroundOffset );
#endif
// ADD_NEW_TOOL : (encoder lib) set tool enabling flags and associated parameters here
int minCUSize = sps.getMaxCUWidth() >> sps.getLog2DiffMaxMinCodingBlockSize();
......
......@@ -1280,8 +1280,16 @@ void InterSearch::xSetIntraSearchRange(PredictionUnit& pu, int iRoiWidth, int iR
rcMvSrchRngLT <<= 2;
rcMvSrchRngRB <<= 2;
clipMv(rcMvSrchRngLT, pu.cu->lumaPos(), sps);
clipMv(rcMvSrchRngRB, pu.cu->lumaPos(), sps);
clipMv(rcMvSrchRngLT, pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
sps);
clipMv(rcMvSrchRngRB, pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
sps);
rcMvSrchRngLT >>= 2;
rcMvSrchRngRB >>= 2;
}
......@@ -2338,7 +2346,11 @@ Distortion InterSearch::xGetTemplateCost( const PredictionUnit& pu,
cMvCand.hor = cMvCand.hor << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
cMvCand.ver = cMvCand.ver << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
#endif
clipMv( cMvCand, pu.cu->lumaPos(), *pu.cs->sps );
clipMv( cMvCand, pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
*pu.cs->sps );
// prediction pattern
......@@ -2576,7 +2588,11 @@ void InterSearch::xSetSearchRange ( const PredictionUnit& pu,
cFPMvPred.hor = cFPMvPred.hor << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
cFPMvPred.ver = cFPMvPred.ver << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
#endif
clipMv( cFPMvPred, pu.cu->lumaPos(), *pu.cs->sps );
clipMv( cFPMvPred, pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
*pu.cs->sps );
#if !REMOVE_MV_ADAPT_PREC
Mv mvTL(cFPMvPred.getHor() - (iSrchRng << iMvShift), cFPMvPred.getVer() - (iSrchRng << iMvShift), cFPMvPred.highPrec);
......@@ -2586,8 +2602,16 @@ void InterSearch::xSetSearchRange ( const PredictionUnit& pu,
Mv mvBR(cFPMvPred.getHor() + (iSrchRng << iMvShift), cFPMvPred.getVer() + (iSrchRng << iMvShift));
#endif
clipMv( mvTL, pu.cu->lumaPos(), *pu.cs->sps );
clipMv( mvBR, pu.cu->lumaPos(), *pu.cs->sps );
clipMv( mvTL, pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
*pu.cs->sps );
clipMv( mvBR, pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
*pu.cs->sps );
mvTL.divideByPowerOf2( iMvShift );
mvBR.divideByPowerOf2( iMvShift );
......@@ -2737,7 +2761,11 @@ void InterSearch::xTZSearch( const PredictionUnit& pu,
rcMv.hor = rcMv.hor << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
rcMv.ver = rcMv.ver << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
#endif
clipMv( rcMv, pu.cu->lumaPos(), *pu.cs->sps );
clipMv( rcMv, pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
*pu.cs->sps );
#if REMOVE_MV_ADAPT_PREC
rcMv.hor = rcMv.hor >> VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
rcMv.ver = rcMv.ver >> VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
......@@ -2778,7 +2806,11 @@ void InterSearch::xTZSearch( const PredictionUnit& pu,
integerMv2Nx2NPred.hor = integerMv2Nx2NPred.hor << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
integerMv2Nx2NPred.ver = integerMv2Nx2NPred.ver << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
#endif
clipMv( integerMv2Nx2NPred, pu.cu->lumaPos(), *pu.cs->sps );
clipMv( integerMv2Nx2NPred, pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
*pu.cs->sps );
#if REMOVE_MV_ADAPT_PREC
integerMv2Nx2NPred.hor = integerMv2Nx2NPred.hor >> VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
integerMv2Nx2NPred.ver = integerMv2Nx2NPred.ver >> VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
......@@ -3015,7 +3047,11 @@ void InterSearch::xTZSearchSelective( const PredictionUnit& pu,
rcMv.hor = rcMv.hor << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
rcMv.ver = rcMv.ver << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
#endif
clipMv( rcMv, pu.cu->lumaPos(), *pu.cs->sps );
clipMv( rcMv, pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
*pu.cs->sps );
#if REMOVE_MV_ADAPT_PREC
rcMv.hor = rcMv.hor >> VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
rcMv.ver = rcMv.ver >> VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
......@@ -3050,7 +3086,11 @@ void InterSearch::xTZSearchSelective( const PredictionUnit& pu,
integerMv2Nx2NPred.hor = integerMv2Nx2NPred.hor << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
integerMv2Nx2NPred.ver = integerMv2Nx2NPred.ver << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
#endif
clipMv( integerMv2Nx2NPred, pu.cu->lumaPos(), *pu.cs->sps );
clipMv( integerMv2Nx2NPred, pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
*pu.cs->sps );
#if REMOVE_MV_ADAPT_PREC
integerMv2Nx2NPred.hor = integerMv2Nx2NPred.hor >> VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
integerMv2Nx2NPred.ver = integerMv2Nx2NPred.ver >> VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
......@@ -3201,7 +3241,11 @@ void InterSearch::xPatternSearchIntRefine(PredictionUnit& pu, IntTZSearchStruct&
cTempMV.hor = cTempMV.hor << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
cTempMV.ver = cTempMV.ver << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
#endif
clipMv(cTempMV, pu.cu->lumaPos(), sps);
clipMv(cTempMV, pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
sps);
#if REMOVE_MV_ADAPT_PREC
cTempMV.hor = cTempMV.hor >> VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
cTempMV.ver = cTempMV.ver >> VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
......@@ -3468,13 +3512,21 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu,
vy = mvScaleVer + dMvHorY * (pu.Y().x - mvInfo->x) + dMvVerY * (pu.Y().y - mvInfo->y);
roundAffineMv(vx, vy, shift);
mvTmp[0] = Mv(vx, vy);
clipMv(mvTmp[0], pu.cu->lumaPos(), *pu.cs->sps);
clipMv(mvTmp[0], pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
*pu.cs->sps);
mvTmp[0].roundMV2SignalPrecision();
vx = mvScaleHor + dMvHorX * (pu.Y().x + pu.Y().width - mvInfo->x) + dMvVerX * (pu.Y().y - mvInfo->y);
vy = mvScaleVer + dMvHorY * (pu.Y().x + pu.Y().width - mvInfo->x) + dMvVerY * (pu.Y().y - mvInfo->y);
roundAffineMv(vx, vy, shift);
mvTmp[1] = Mv(vx, vy);
clipMv(mvTmp[1], pu.cu->lumaPos(), *pu.cs->sps);
clipMv(mvTmp[1], pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
*pu.cs->sps);
mvTmp[1].roundMV2SignalPrecision();
#if REMOVE_MV_ADAPT_PREC
mvTmp[0].hor = mvTmp[0].hor >> VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
......@@ -4255,11 +4307,23 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu,
uint32_t uiBitsBest = 0;
// do motion compensation with origin mv
clipMv( acMvTemp[0], pu.cu->lumaPos(), *pu.cs->sps );
clipMv( acMvTemp[1], pu.cu->lumaPos(), *pu.cs->sps );
clipMv( acMvTemp[0], pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
*pu.cs->sps );
clipMv( acMvTemp[1], pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
*pu.cs->sps );
if ( pu.cu->affineType == AFFINEMODEL_6PARAM )
{
clipMv( acMvTemp[2], pu.cu->lumaPos(), *pu.cs->sps );
clipMv( acMvTemp[2], pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
*pu.cs->sps );
}
xPredAffineBlk( COMPONENT_Y, pu, refPic, acMvTemp, predBuf, false, pu.cs->slice->clpRng( COMPONENT_Y ) );
......@@ -4432,7 +4496,11 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu,
acMvTemp[i].hor = Clip3( -32768, 32767, acMvTemp[i].hor );
acMvTemp[i].ver = Clip3( -32768, 32767, acMvTemp[i].ver );
acMvTemp[i].roundMV2SignalPrecision();
clipMv(acMvTemp[i], pu.cu->lumaPos(), *pu.cs->sps);
clipMv(acMvTemp[i], pu.cu->lumaPos(),
#if JVET_L0231_WRAPAROUND
pu.cu->lumaSize(),
#endif
*pu.cs->sps);
}
xPredAffineBlk( COMPONENT_Y, pu, refPic, acMvTemp, predBuf, false, pu.cu->slice->clpRng( COMPONENT_Y ) );
......
......@@ -783,6 +783,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