...
 
Commits (166)
......@@ -87,7 +87,6 @@ TemporalSubsampleRatio : 8
#============ NEXT ====================
# General
LargeCTU : 1 # Large CTU
CTUSize : 128
LCTUFast : 1
QuadtreeTULog2MaxSize : 6
......@@ -99,7 +98,6 @@ MinQTNonISlice : 8
MaxBTDepth : 3
MaxBTDepthISliceL : 3
MaxBTDepthISliceC : 3
MTT : 1
MTS : 1
MTSIntraMaxCand : 3
......@@ -110,7 +108,7 @@ SubPuMvp : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
DepQuant : 1
IMV : 2
IMV : 1
ALF : 1
IBC : 0 # turned off in CTC
AllowDisFracMMVD : 1
......@@ -119,6 +117,7 @@ LumaReshapeEnable : 1 # luma reshaping. 0: disable 1:enable
# Fast tools
PBIntraFast : 1
ISPFast : 1
FastMrg : 1
AMaxBT : 1
......
......@@ -103,7 +103,6 @@ CrQpOffset : 1
#============ NEXT ====================
# General
LargeCTU : 1 # Large CTU
CTUSize : 128
LCTUFast : 1
QuadtreeTULog2MaxSize : 6
......@@ -115,7 +114,6 @@ MinQTNonISlice : 8
MaxBTDepth : 3
MaxBTDepthISliceL : 3
MaxBTDepthISliceC : 3
MTT : 1
MTS : 1
MTSIntraMaxCand : 3
......@@ -126,7 +124,7 @@ SubPuMvp : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
DepQuant : 1
IMV : 2
IMV : 1
ALF : 1
MHIntra : 1
IBC : 0 # turned off in CTC
......@@ -136,6 +134,7 @@ LumaReshapeEnable : 1 # luma reshaping. 0: disable 1:enable
# Fast tools
PBIntraFast : 1
ISPFast : 1
FastMrg : 1
AMaxBT : 1
......
......@@ -103,7 +103,6 @@ CrQpOffset : 1
#============ NEXT ====================
# General
LargeCTU : 1 # Large CTU
CTUSize : 128
LCTUFast : 1
QuadtreeTULog2MaxSize : 6
......@@ -115,7 +114,6 @@ MinQTNonISlice : 8
MaxBTDepth : 3
MaxBTDepthISliceL : 3
MaxBTDepthISliceC : 3
MTT : 1
MTS : 1
MTSIntraMaxCand : 3
......@@ -126,7 +124,7 @@ SubPuMvp : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
DepQuant : 1
IMV : 2
IMV : 1
ALF : 1
GBi : 1
GBiFast : 1
......@@ -139,6 +137,7 @@ LumaReshapeEnable : 1 # luma reshaping. 0: disable 1:enable
# Fast tools
PBIntraFast : 1
ISPFast : 1
FastMrg : 1
AMaxBT : 1
......
......@@ -117,7 +117,6 @@ CrQpOffset : 1
#============ NEXT ====================
# General
LargeCTU : 1 # Large CTU
CTUSize : 128
LCTUFast : 1
QuadtreeTULog2MaxSize : 6
......@@ -129,7 +128,6 @@ MinQTNonISlice : 8
MaxBTDepth : 3
MaxBTDepthISliceL : 3
MaxBTDepthISliceC : 3
MTT : 1
MTS : 1
MTSIntraMaxCand : 3
......@@ -140,7 +138,7 @@ SubPuMvp : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
DepQuant : 1
IMV : 2
IMV : 1
ALF : 1
GBi : 1
GBiFast : 1
......@@ -155,6 +153,7 @@ DMVR : 1
# Fast tools
PBIntraFast : 1
ISPFast : 1
FastMrg : 1
AMaxBT : 1
......
......@@ -312,6 +312,9 @@ class CMakeLauncher(object):
self._add_common_cmake_build_options(cmake_argv, params)
self._add_cmake_build_jobs_option(cmake_argv, params.cmk_generator_alias, params.cmk_build_jobs)
self._add_cmake_build_verbosity_option(cmake_argv, params.cmk_generator_alias, params.cmk_build_verbosity)
if params.cmk_generator_alias.startswith('vs'):
# msbuild option to disable node reuse -> jenkins build seems to idle at the end.
self._add_cmake_build_tool_options(cmake_argv, ['/nr:false'])
if cmake_argv_optional:
self._add_cmake_build_tool_options(cmake_argv, cmake_argv_optional)
retv = self.launch_cmake(cmake_argv)
......
......@@ -111,6 +111,9 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] )
"\t1: enable bit statistic\n"
"\t2: enable tool statistic\n"
"\t3: enable bit and tool statistic\n")
#endif
#if JVET_M0445_MCTS_DEC_CHECK
("MCTSCheck", m_mctsCheck, false, "If enabled, the decoder checks for violations of mc_exact_sample_value_match_flag in Temporal MCTS ")
#endif
;
......@@ -148,6 +151,9 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] )
}
#endif
#if JVET_M0445_MCTS_DEC_CHECK
g_mctsDecCheckEnabled = m_mctsCheck;
#endif
// Chroma output bit-depth
if( m_outputBitDepth[CHANNEL_TYPE_LUMA] != 0 && m_outputBitDepth[CHANNEL_TYPE_CHROMA] == 0 )
{
......@@ -230,6 +236,9 @@ DecAppCfg::DecAppCfg()
, m_bClipOutputVideoToRec709Range(false)
, m_packedYUVMode(false)
, m_statMode(0)
#if JVET_M0445_MCTS_DEC_CHECK
, m_mctsCheck(false)
#endif
{
for (uint32_t channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
{
......
......@@ -73,6 +73,9 @@ protected:
bool m_packedYUVMode; ///< If true, output 10-bit and 12-bit YUV data as 5-byte and 3-byte (respectively) packed YUV data
std::string m_cacheCfgFile; ///< Config file of cache model
int m_statMode; ///< Config statistic mode (0 - bit stat, 1 - tool stat, 3 - both)
#if JVET_M0445_MCTS_DEC_CHECK
bool m_mctsCheck;
#endif
public:
DecAppCfg();
......
......@@ -116,6 +116,9 @@ void EncApp::xInitLibCfg()
m_cEncLib.setIntraPeriod ( m_iIntraPeriod );
m_cEncLib.setDecodingRefreshType ( m_iDecodingRefreshType );
m_cEncLib.setGOPSize ( m_iGOPSize );
#if JCTVC_Y0038_PARAMS
m_cEncLib.setReWriteParamSets ( m_rewriteParamSets );
#endif
m_cEncLib.setGopList ( m_GOPList );
m_cEncLib.setExtraRPSs ( m_extraRPSs );
for(int i = 0; i < MAX_TLAYER; i++)
......@@ -215,20 +218,14 @@ void EncApp::xInitLibCfg()
m_cEncLib.setMinQTSizes ( m_uiMinQT );
m_cEncLib.setMaxBTDepth ( m_uiMaxBTDepth, m_uiMaxBTDepthI, m_uiMaxBTDepthIChroma );
m_cEncLib.setDualITree ( m_dualTree );
m_cEncLib.setLargeCTU ( m_LargeCTU );
m_cEncLib.setSubPuMvpMode ( m_SubPuMvpMode );
m_cEncLib.setAffine ( m_Affine );
m_cEncLib.setAffineType ( m_AffineType );
m_cEncLib.setBIO (m_BIO);
m_cEncLib.setDisableMotionCompression ( m_DisableMotionCompression );
m_cEncLib.setMTTMode ( m_MTT );
m_cEncLib.setUseLMChroma ( m_LMChroma );
#if JVET_M0142_CCLM_COLLOCATED_CHROMA
m_cEncLib.setCclmCollocatedChromaFlag ( m_cclmCollocatedChromaFlag );
#endif
#if ENABLE_WPP_PARALLELISM
m_cEncLib.setUseAltDQPCoding ( m_AltDQPCoding );
#endif
#if JVET_M0464_UNI_MTS
m_cEncLib.setIntraMTS ( m_MTS & 1 );
m_cEncLib.setIntraMTSMaxCand ( m_MTSIntraMaxCand );
......@@ -300,6 +297,9 @@ void EncApp::xInitLibCfg()
m_cEncLib.setQuadtreeTULog2MinSize ( m_quadtreeTULog2MinSize );
m_cEncLib.setQuadtreeTUMaxDepthInter ( m_uiQuadtreeTUMaxDepthInter );
m_cEncLib.setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra );
#if JVET_M0428_ENC_DB_OPT
m_cEncLib.setUseEncDbOpt(m_encDbOpt);
#endif
m_cEncLib.setUseFastLCTU ( m_useFastLCTU );
m_cEncLib.setFastInterSearchMode ( m_fastInterSearchMode );
m_cEncLib.setUseEarlyCU ( m_bUseEarlyCU );
......@@ -332,6 +332,9 @@ void EncApp::xInitLibCfg()
m_cEncLib.setUseBLambdaForNonKeyLowDelayPictures ( m_bUseBLambdaForNonKeyLowDelayPictures );
m_cEncLib.setPCMLog2MinSize ( m_uiPCMLog2MinSize);
m_cEncLib.setUsePCM ( m_usePCM );
#if JVET_M0102_INTRA_SUBPARTITIONS
m_cEncLib.setUseFastISP ( m_useFastISP );
#endif
// set internal bit-depth and constants
for (uint32_t channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
......@@ -432,6 +435,9 @@ void EncApp::xInitLibCfg()
m_cEncLib.setSOPDescriptionSEIEnabled ( m_SOPDescriptionSEIEnabled );
m_cEncLib.setScalableNestingSEIEnabled ( m_scalableNestingSEIEnabled );
m_cEncLib.setTMCTSSEIEnabled ( m_tmctsSEIEnabled );
#if JVET_M0445_MCTS
m_cEncLib.setMCTSEncConstraint ( m_MCTSEncConstraint);
#endif
m_cEncLib.setTimeCodeSEIEnabled ( m_timeCodeSEIEnabled );
m_cEncLib.setNumberOfTimeSets ( m_timeCodeSEINumTs );
for(int i = 0; i < m_timeCodeSEINumTs; i++)
......
This diff is collapsed.
......@@ -135,6 +135,9 @@ protected:
int m_iIntraPeriod; ///< period of I-slice (random access period)
int m_iDecodingRefreshType; ///< random access type
int m_iGOPSize; ///< GOP size of hierarchical structure
#if JCTVC_Y0038_PARAMS
bool m_rewriteParamSets; ///< Flag to enable rewriting of parameter sets at random access points
#endif
int m_extraRPSs; ///< extra RPSs added to handle CRA
GOPEntry m_GOPList[MAX_GOP]; ///< the coding structure entries from the config file
int m_numReorderPics[MAX_TLAYER]; ///< total number of reorder pictures
......@@ -150,6 +153,9 @@ protected:
bool m_rdpcmEnabledFlag[NUMBER_OF_RDPCM_SIGNALLING_MODES];///< control flags for residual DPCM
bool m_persistentRiceAdaptationEnabledFlag; ///< control flag for Golomb-Rice parameter adaptation over each slice
bool m_cabacBypassAlignmentEnabledFlag;
#if JVET_M0102_INTRA_SUBPARTITIONS
bool m_useFastISP; ///< flag for enabling fast methods for ISP
#endif
// coding quality
#if QP_SWITCHING_FOR_PARALLEL
......@@ -202,16 +208,10 @@ protected:
unsigned m_uiMaxBTDepthI;
unsigned m_uiMaxBTDepthIChroma;
bool m_dualTree;
bool m_LargeCTU;
int m_SubPuMvpMode;
bool m_Affine;
bool m_AffineType;
bool m_BIO;
bool m_DisableMotionCompression;
unsigned m_MTT;
#if ENABLE_WPP_PARALLELISM
bool m_AltDQPCoding;
#endif
int m_LMChroma;
#if JVET_M0142_CCLM_COLLOCATED_CHROMA
bool m_cclmCollocatedChromaFlag;
......@@ -276,6 +276,9 @@ protected:
uint32_t m_reshapeSignalType;
uint32_t m_intraCMD;
ReshapeCW m_reshapeCW;
#endif
#if JVET_M0428_ENC_DB_OPT
bool m_encDbOpt;
#endif
unsigned m_uiMaxCUWidth; ///< max. CU width in pixel
unsigned m_uiMaxCUHeight; ///< max. CU height in pixel
......@@ -462,6 +465,10 @@ protected:
uint32_t m_greenMetadataType;
uint32_t m_xsdMetricType;
#if JVET_M0445_MCTS
bool m_MCTSEncConstraint;
#endif
// weighted prediction
bool m_useWeightedPred; ///< Use of weighted prediction in P slices
bool m_useWeightedBiPred; ///< Use of bi-directional weighted prediction in B slices
......@@ -551,7 +558,7 @@ protected:
std::string m_decodeBitstreams[2]; ///< filename for decode bitstreams.
#if JVET_M0055_DEBUG_CTU
int m_debugCTU;
#endif
#endif
int m_switchPOC; ///< dbg poc.
int m_switchDQP; ///< switch DQP.
int m_fastForwardToPOC; ///< get to encoding the specified POC as soon as possible by skipping temporal layers irrelevant for the specified POC
......
......@@ -104,7 +104,13 @@ void AdaptiveLoopFilter::ALFProcess( CodingStructure& cs, AlfSliceParam& alfSlic
{
Area blk( xPos, yPos, width, height );
deriveClassification( m_classifier, tmpYuv.get( COMPONENT_Y ), blk );
m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, COMPONENT_Y, m_coeffFinal, m_clpRngs.comp[COMPONENT_Y]);
#if JVET_M0277_FIX_PCM_DISABLEFILTER
Area blkPCM(xPos, yPos, width, height);
resetPCMBlkClassInfo(cs, m_classifier, tmpYuv.get(COMPONENT_Y), blkPCM);
m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, COMPONENT_Y, m_coeffFinal, m_clpRngs.comp[COMPONENT_Y], cs );
#else
m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, COMPONENT_Y, m_coeffFinal, m_clpRngs.comp[COMPONENT_Y] );
#endif
}
for( int compIdx = 1; compIdx < MAX_NUM_COMPONENT; compIdx++ )
......@@ -117,7 +123,11 @@ void AdaptiveLoopFilter::ALFProcess( CodingStructure& cs, AlfSliceParam& alfSlic
{
Area blk( xPos >> chromaScaleX, yPos >> chromaScaleY, width >> chromaScaleX, height >> chromaScaleY );
#if JVET_M0277_FIX_PCM_DISABLEFILTER
m_filter5x5Blk( m_classifier, recYuv, tmpYuv, blk, compID, alfSliceParam.chromaCoeff, m_clpRngs.comp[compIdx], cs );
#else
m_filter5x5Blk( m_classifier, recYuv, tmpYuv, blk, compID, alfSliceParam.chromaCoeff, m_clpRngs.comp[compIdx] );
#endif
}
}
ctuIdx++;
......@@ -272,6 +282,57 @@ void AdaptiveLoopFilter::deriveClassification( AlfClassifier** classifier, const
}
}
}
#if JVET_M0277_FIX_PCM_DISABLEFILTER
void AdaptiveLoopFilter::resetPCMBlkClassInfo(CodingStructure & cs, AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blk)
{
if ( !cs.sps->getPCMFilterDisableFlag() )
{
return;
}
int height = blk.pos().y + blk.height;
int width = blk.pos().x + blk.width;
const int clsSizeY = 4;
const int clsSizeX = 4;
int classIdx = m_ALF_UNUSED_CLASSIDX;
int transposeIdx = m_ALF_UNUSED_TRANSPOSIDX;
for( int i = blk.pos().y; i < height; i += m_CLASSIFICATION_BLK_SIZE )
{
int nHeight = std::min(i + m_CLASSIFICATION_BLK_SIZE, height) - i;
for( int j = blk.pos().x; j < width; j += m_CLASSIFICATION_BLK_SIZE )
{
int nWidth = std::min(j + m_CLASSIFICATION_BLK_SIZE, width) - j;
int posX = j;
int posY = i;
for( int subi = 0; subi < nHeight; subi += clsSizeY )
{
for( int subj = 0; subj < nWidth; subj += clsSizeX )
{
int yOffset = subi + posY;
int xOffset = subj + posX;
Position pos(xOffset, yOffset);
const CodingUnit* cu = cs.getCU(pos, CH_L);
if ( cu->ipcm )
{
AlfClassifier *cl0 = classifier[yOffset] + xOffset;
AlfClassifier *cl1 = classifier[yOffset + 1] + xOffset;
AlfClassifier *cl2 = classifier[yOffset + 2] + xOffset;
AlfClassifier *cl3 = classifier[yOffset + 3] + xOffset;
cl0[0] = cl0[1] = cl0[2] = cl0[3] =
cl1[0] = cl1[1] = cl1[2] = cl1[3] =
cl2[0] = cl2[1] = cl2[2] = cl2[3] =
cl3[0] = cl3[1] = cl3[2] = cl3[3] = AlfClassifier(classIdx, transposeIdx);
}
}
}
}
}
}
#endif
void AdaptiveLoopFilter::deriveClassificationBlk( AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blk, const int shift )
{
......@@ -445,13 +506,23 @@ void AdaptiveLoopFilter::deriveClassificationBlk( AlfClassifier** classifier, in
}
template<AlfFilterType filtType>
#if JVET_M0277_FIX_PCM_DISABLEFILTER
void AdaptiveLoopFilter::filterBlk( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs )
#else
void AdaptiveLoopFilter::filterBlk( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng )
#endif
{
const bool bChroma = isChroma( compId );
if( bChroma )
{
CHECK( filtType != 0, "Chroma needs to have filtType == 0" );
}
#if JVET_M0277_FIX_PCM_DISABLEFILTER
const SPS* sps = cs.slice->getSPS();
bool isDualTree =CS::isDualITree(cs);
bool isPCMFilterDisabled = sps->getPCMFilterDisableFlag();
ChromaFormat nChromaFormat = sps->getChromaFormatIdc();
#endif
const CPelBuf srcLuma = recSrc.get( compId );
PelBuf dstLuma = recDst.get( compId );
......@@ -516,8 +587,26 @@ void AdaptiveLoopFilter::filterBlk( AlfClassifier** classifier, const PelUnitBuf
{
AlfClassifier& cl = pClass[j];
transposeIdx = cl.transposeIdx;
#if JVET_M0277_FIX_PCM_DISABLEFILTER
if( isPCMFilterDisabled && cl.classIdx== m_ALF_UNUSED_CLASSIDX && transposeIdx== m_ALF_UNUSED_TRANSPOSIDX )
{
continue;
}
#endif
coef = filterSet + cl.classIdx * MAX_NUM_ALF_LUMA_COEFF;
}
#if JVET_M0277_FIX_PCM_DISABLEFILTER
else if( isPCMFilterDisabled )
{
Position pos(i, j);
CodingUnit* cu = isDualTree ? cs.getCU( recalcPosition(nChromaFormat, CH_L, CH_C, pos), CH_C ): cs.getCU(pos, CH_L);
if ( cu->ipcm )
{
continue;
}
}
#endif
if( filtType == ALF_FILTER_7 )
{
......
......@@ -41,7 +41,9 @@
#include "CommonDef.h"
#include "Unit.h"
#if JVET_M0277_FIX_PCM_DISABLEFILTER
#include "UnitTools.h"
#endif
struct AlfClassifier
{
AlfClassifier() {}
......@@ -68,6 +70,10 @@ class AdaptiveLoopFilter
public:
static constexpr int m_NUM_BITS = 8;
static constexpr int m_CLASSIFICATION_BLK_SIZE = 32; //non-normative, local buffer size
#if JVET_M0277_FIX_PCM_DISABLEFILTER
static constexpr int m_ALF_UNUSED_CLASSIDX = 255;
static constexpr int m_ALF_UNUSED_TRANSPOSIDX = 255;
#endif
AdaptiveLoopFilter();
virtual ~AdaptiveLoopFilter() {}
......@@ -78,17 +84,28 @@ public:
void destroy();
static void deriveClassificationBlk( AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blk, const int shift );
void deriveClassification( AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blk );
#if JVET_M0277_FIX_PCM_DISABLEFILTER
void resetPCMBlkClassInfo(CodingStructure & cs, AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blk);
#endif
template<AlfFilterType filtType>
#if JVET_M0277_FIX_PCM_DISABLEFILTER
static void filterBlk( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs );
#else
static void filterBlk( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng );
#endif
inline static int getMaxGolombIdx( AlfFilterType filterType )
{
return filterType == ALF_FILTER_5 ? 2 : 3;
}
void( *m_deriveClassificationBlk )( AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blk, const int shift );
#if JVET_M0277_FIX_PCM_DISABLEFILTER
void( *m_filter5x5Blk )( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs );
void( *m_filter7x7Blk )( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs );
#else
void( *m_filter5x5Blk )( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng );
void( *m_filter7x7Blk )( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng );
#endif
#ifdef TARGET_SIMD_X86
void initAdaptiveLoopFilterX86();
......
......@@ -448,39 +448,18 @@ void AreaBuf<Pel>::scaleSignal(const int scale, const bool dir, const ClpRng& cl
{
sign = src[x] >= 0 ? 1 : -1;
absval = sign * src[x];
dst[x] = sign * ((absval * scale + (1 << (CSCALE_FP_PREC - 1))) >> CSCALE_FP_PREC);
int val = sign * ((absval * scale + (1 << (CSCALE_FP_PREC - 1))) >> CSCALE_FP_PREC);
if (sizeof(Pel) == 2) // avoid overflow when storing data
{
val = Clip3<int>(-32768, 32767, val);
}
dst[x] = (Pel)val;
}
dst += stride;
src += stride;
}
}
}
template<>
Pel AreaBuf <Pel> ::computeAvg() const
{
const Pel* src = buf;
#if !JVET_M0102_INTRA_SUBPARTITIONS
if (width == 1)
{
THROW("Blocks of width = 1 not supported");
}
else
{
#endif
int32_t acc = 0;
#define AVG_INC \
src += stride;
#define AVG_OP(ADDR) acc += src[ADDR]
SIZE_AWARE_PER_EL_OP(AVG_OP, AVG_INC);
#undef AVG_INC
#undef AVG_OP
return Pel((acc + (area() >> 1)) / area());
#if !JVET_M0102_INTRA_SUBPARTITIONS
}
#endif
}
#endif
template<>
......
......@@ -145,8 +145,9 @@ struct AreaBuf : public Size
#if JVET_M0427_INLOOP_RESHAPER
void rspSignal ( std::vector<Pel>& pLUT );
void scaleSignal ( const int scale, const bool dir , const ClpRng& clpRng);
T computeAvg ( ) const;
#endif
T computeAvg ( ) const;
T& at( const int &x, const int &y ) { return buf[y * stride + x]; }
const T& at( const int &x, const int &y ) const { return buf[y * stride + x]; }
......@@ -566,6 +567,7 @@ void AreaBuf<T>::extendBorderPel( unsigned margin )
::memcpy( p - ( y + 1 ) * s, p, sizeof( T ) * ( w + ( margin << 1 ) ) );
}
}
template<typename T>
T AreaBuf<T>::meanDiff( const AreaBuf<const T> &other ) const
{
......@@ -629,6 +631,33 @@ void AreaBuf<T>::transposedFrom( const AreaBuf<const T> &other )
}
}
template<typename T>
T AreaBuf <T> ::computeAvg() const
{
#if !JVET_M0102_INTRA_SUBPARTITIONS
if (width == 1)
{
THROW("Blocks of width = 1 not supported");
}
else
{
#endif
const T* src = buf;
#if ENABLE_QPA
int64_t acc = 0; // for picture-wise use in getGlaringColorQPOffset() and applyQPAdaptationChroma()
#else
int32_t acc = 0;
#endif
#define AVG_INC src += stride
#define AVG_OP(ADDR) acc += src[ADDR]
SIZE_AWARE_PER_EL_OP(AVG_OP, AVG_INC);
#undef AVG_INC
#undef AVG_OP
return T ((acc + (area() >> 1)) / area());
#if !JVET_M0102_INTRA_SUBPARTITIONS
}
#endif
}
#ifndef DONT_UNDEF_SIZE_AWARE_PER_EL_OP
#undef SIZE_AWARE_PER_EL_OP
......
......@@ -751,6 +751,11 @@ void CodingStructure::initSubStructure( CodingStructure& subStruct, const Channe
{
CHECK( this == &subStruct, "Trying to init self as sub-structure" );
#if JVET_M0428_ENC_DB_OPT
subStruct.useDbCost = false;
subStruct.costDbOffset = 0;
#endif
for( uint32_t i = 0; i < subStruct.area.blocks.size(); i++ )
{
CHECKD( subStruct.area.blocks[i].size() != subArea.blocks[i].size(), "Trying to init sub-structure of incompatible size" );
......@@ -852,7 +857,9 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C
fracBits += subStruct.fracBits;
dist += subStruct.dist;
cost += subStruct.cost;
#if JVET_M0428_ENC_DB_OPT
costDbOffset += subStruct.costDbOffset;
#endif
if( parent )
{
// allow this to be false at the top level
......@@ -916,7 +923,9 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C
fracBits += subStruct.fracBits;
dist += subStruct.dist;
cost += subStruct.cost;
#if JVET_M0428_ENC_DB_OPT
costDbOffset += subStruct.costDbOffset;
#endif
if( parent )
{
// allow this to be false at the top level
......@@ -978,7 +987,9 @@ void CodingStructure::copyStructure( const CodingStructure& other, const Channel
fracBits = other.fracBits;
dist = other.dist;
cost = other.cost;
#if JVET_M0428_ENC_DB_OPT
costDbOffset = other.costDbOffset;
#endif
CHECKD( area != other.area, "Incompatible sizes" );
const UnitArea dualITreeArea = CS::getArea( *this, this->area, chType );
......@@ -1110,6 +1121,10 @@ void CodingStructure::initStructData( const int &QP, const bool &_isLosses, cons
cost = MAX_DOUBLE;
#if JVET_M0102_INTRA_SUBPARTITIONS
lumaCost = MAX_DOUBLE;
#endif
#if JVET_M0428_ENC_DB_OPT
costDbOffset = 0;
useDbCost = false;
#endif
interHad = std::numeric_limits<Distortion>::max();
}
......
......@@ -179,6 +179,10 @@ public:
static_vector<double, NUM_ENC_FEATURES> features;
double cost;
#if JVET_M0428_ENC_DB_OPT
bool useDbCost;
double costDbOffset;
#endif
#if JVET_M0102_INTRA_SUBPARTITIONS
double lumaCost;
#endif
......
......@@ -53,9 +53,10 @@
#include "TypeDef.h"
#include "version.h"
// MS Visual Studio before 2014 does not support required C++11 features
#ifdef _MSC_VER
#if _MSC_VER <= 1500
inline int64_t abs (int64_t x) { return _abs64(x); };
#if _MSC_VER < 1900
#error "MS Visual Studio version not supported. Please upgrade to Visual Studio 2015 or higher (or use other compilers)"
#endif
#endif
......@@ -66,7 +67,14 @@ inline int64_t abs (int64_t x) { return _abs64(x); };
// Platform information
// ====================================================================================================================
#ifdef __GNUC__
#ifdef __clang__
#define NVM_COMPILEDBY "[clang %d.%d.%d]", __clang_major__, __clang_minor__, __clang_patchlevel__
#ifdef __IA64__
#define NVM_ONARCH "[on 64-bit] "
#else
#define NVM_ONARCH "[on 32-bit] "
#endif
#elif __GNUC__
#define NVM_COMPILEDBY "[GCC %d.%d.%d]", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__
#ifdef __IA64__
#define NVM_ONARCH "[on 64-bit] "
......
......@@ -349,11 +349,7 @@ unsigned DeriveCtx::CtxQtCbf( const ComponentID compID, const unsigned trDepth,
unsigned DeriveCtx::CtxInterDir( const PredictionUnit& pu )
{
if( pu.cs->sps->getSpsNext().getUseLargeCTU() )
{
return Clip3( 0, 3, 7 - ( ( g_aucLog2[pu.lumaSize().width] + g_aucLog2[pu.lumaSize().height] + 1 ) >> 1 ) ); // VG-ASYMM DONE
}
return pu.cu->qtDepth;
return Clip3( 0, 3, 7 - ( ( g_aucLog2[pu.lumaSize().width] + g_aucLog2[pu.lumaSize().height] + 1 ) >> 1 ) ); // VG-ASYMM DONE
}
unsigned DeriveCtx::CtxAffineFlag( const CodingUnit& cu )
......
This diff is collapsed.
......@@ -520,106 +520,4 @@ private:
class CtxStateBuf
{
public:
CtxStateBuf () : m_valid(false) {}
~CtxStateBuf() {}
inline void reset() { m_valid = false; }
inline bool getIfValid(Ctx &ctx) const
{
if (m_valid)
{
ctx.loadPStates(m_states);
return true;
}
return false;
}
inline void store(const Ctx &ctx)
{
ctx.savePStates(m_states);
m_valid = true;
}
private:
std::vector<uint16_t> m_states;
bool m_valid;
};
class CtxStateArray
{
public:
CtxStateArray () {}
~CtxStateArray() {}
inline void resetAll()
{
for (std::size_t k = 0; k < m_data.size(); k++)
{
m_data[k].reset();
}
}
inline void resize(std::size_t reqSize)
{
if (m_data.size() < reqSize)
{
m_data.resize(reqSize);
}
}
inline bool getIfValid(Ctx &ctx, unsigned id) const
{
if (id < m_data.size())
{
return m_data[id].getIfValid(ctx);
}
return false;
}
inline void store(const Ctx &ctx, unsigned id)
{
if (id >= m_data.size())
{
resize(id + 1);
}
m_data[id].store(ctx);
}
private:
std::vector<CtxStateBuf> m_data;
};
class CtxWSizeSet
{
public:
CtxWSizeSet() : m_valid(false), m_changes(false), m_coded(false), m_log2WinSizes() {}
bool isValid() const { return m_valid; }
const std::vector<uint8_t>& getWinSizeBuffer() const { return m_log2WinSizes; }
std::vector<uint8_t>& getWinSizeBuffer() { return m_log2WinSizes; }
int getMode() const { return ( !m_valid || !m_changes ? 0 : ( m_coded ? 2 : 1 ) ); }
void setInvalid() { m_valid = m_changes = m_coded = false; }
void setCoded() { m_coded = true; }
void setValidOnly() { m_valid = true; }
void setValid( uint8_t defSize )
{
m_valid = true;
m_changes = false;
for( std::size_t n = 0; n < m_log2WinSizes.size(); n++ )
{
if( m_log2WinSizes[n] && m_log2WinSizes[n] != defSize )
{
m_changes = true;
return;
}
}
}
private:
bool m_valid;
bool m_changes;
bool m_coded;
std::vector<uint8_t> m_log2WinSizes;
};
#endif
......@@ -1687,10 +1687,18 @@ namespace DQIntern
#if JVET_M0297_32PT_MTS_ZERO_OUT
int effWidth = tuPars.m_width, effHeight = tuPars.m_height;
bool zeroOut = false;
#if JVET_M0140_SBT
#if JVET_M0464_UNI_MTS
if( ( tu.mtsIdx > 1 || ( tu.cu->sbtInfo != 0 && tuPars.m_height <= 32 && tuPars.m_width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y )
#else
if( ( ( tu.cu->emtFlag && !tu.transformSkip[ compID ] ) || ( tu.cu->sbtInfo != 0 && tuPars.m_height <= 32 && tuPars.m_width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y )
#endif
#else
#if JVET_M0464_UNI_MTS
if( tu.mtsIdx > 1 && !tu.cu->transQuantBypass && compID == COMPONENT_Y )
#else
if( tu.cu->emtFlag && !tu.transformSkip[compID] && !tu.cu->transQuantBypass && compID == COMPONENT_Y )
#endif
#endif
{
effHeight = ( tuPars.m_height == 32 ) ? 16 : tuPars.m_height;
......
......@@ -39,6 +39,9 @@
#include "Buffer.h"
#include "UnitTools.h"
#if JVET_M0445_MCTS
#include "MCTS.h"
#endif
#include <memory.h>
#include <algorithm>
......@@ -439,12 +442,7 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList&
pu.cu->lumaSize(),
sps);
#if JVET_M0823_MMVD_ENCOPT
int numOfPass = (pu.mmvdMergeFlag && pu.mmvdEncOptMode) ? 1 : (std::min((int)pcYuvPred.bufs.size(), m_maxCompIDToPred + 1));
for (uint32_t comp = COMPONENT_Y; comp < numOfPass; comp++)
#else
for( uint32_t comp = COMPONENT_Y; comp < pcYuvPred.bufs.size() && comp <= m_maxCompIDToPred; comp++ )
#endif
{
const ComponentID compID = ComponentID( comp );
if (compID == COMPONENT_Y && !luma)
......@@ -516,7 +514,7 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred)
}
#endif
if (pu.cu->cs->sps->getSpsNext().getUseGBi() && bioApplied && pu.cu->GBiIdx != GBI_DEFAULT)
if (pu.cu->cs->sps->getUseGBi() && bioApplied && pu.cu->GBiIdx != GBI_DEFAULT)
{
bioApplied = false;
}
......@@ -1334,7 +1332,7 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu
)
{
// dual tree handling for IBC as the only ref
if (!luma || !chroma)
if ((!luma || !chroma) && eRefPicList == REF_PIC_LIST_0)
{
if (!luma && chroma)
{
......@@ -1452,10 +1450,27 @@ void InterPrediction::motionCompensation4Triangle( CodingUnit &cu, MergeCtx &tri
PU::spanMotionInfo( pu );
motionCompensation( pu, tmpTriangleBuf );
#if JVET_M0445_MCTS_DEC_CHECK
{
if( g_mctsDecCheckEnabled && !MCTSHelper::checkMvBufferForMCTSConstraint( pu, true ) )
{
printf( "DECODER_TRIANGLE_PU: pu motion vector across tile boundaries (%d,%d,%d,%d)\n", pu.lx(), pu.ly(), pu.lwidth(), pu.lheight() );
}
}
#endif
triangleMrgCtx.setMergeInfo( pu, candIdx1 );
PU::spanMotionInfo( pu );
motionCompensation( pu, predBuf );
#if JVET_M0445_MCTS_DEC_CHECK
{
if( g_mctsDecCheckEnabled && !MCTSHelper::checkMvBufferForMCTSConstraint( pu, true ) )
{
printf( "DECODER_TRIANGLE_PU: pu motion vector across tile boundaries (%d,%d,%d,%d)\n", pu.lx(), pu.ly(), pu.lwidth(), pu.lheight() );
}
}
#endif
#if JVET_M0328_KEEP_ONE_WEIGHT_GROUP
weightedTriangleBlk( pu, splitDir, MAX_NUM_CHANNEL_TYPE, predBuf, tmpTriangleBuf, predBuf );
#else
......
......@@ -325,11 +325,13 @@ void IntraPrediction::predIntraAng( const ComponentID compId, PelBuf &piPred, co
case(2):
case(DIA_IDX):
case(VDIA_IDX):
#if JVET_M0102_INTRA_SUBPARTITIONS
if (getWideAngle(useISP ? cuSize.width : iWidth, useISP ? cuSize.height : iHeight, uiDirMode) == static_cast<int>(uiDirMode)) // check if uiDirMode is not wide-angle
{
#if JVET_M0102_INTRA_SUBPARTITIONS
xPredIntraAng(CPelBuf(ptrSrc, srcStride, srcHStride), piPred, channelType, uiDirMode, clpRng, *pu.cs->sps, multiRefIdx, useFilteredPredSamples, useISP, cuSize );
#else
if (getWideAngle(iWidth, iHeight, uiDirMode) == static_cast<int>(uiDirMode)) // check if uiDirMode is not wide-angle
{
xPredIntraAng(CPelBuf(ptrSrc, srcStride, srcHStride), piPred, channelType, uiDirMode, clpRng, *pu.cs->sps
, multiRefIdx
, useFilteredPredSamples);
......@@ -618,8 +620,8 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch
// Set bitshifts and scale the angle parameter to block size
static const int angTable[32] = { 0, 1, 2, 3, 4, 6, 8, 10, 12, 14, 16, 18, 20, 23, 26, 29, 32, 35, 39, 45, 51, 57, 64, 73, 85, 102, 128, 171, 256, 341, 512, 1024 };
static const int invAngTable[32] = { 0, 8192, 4096, 2731, 2048, 1365, 1024, 819, 683, 585, 512, 455, 410, 356, 315, 282, 256, 234, 210, 182, 160, 144, 128, 112, 96, 80, 64, 48, 32, 24, 16, 8 }; // (256 * 32) / Angle
static const int angTable[32] = { 0, 1, 2, 3, 4, 6, 8, 10, 12, 14, 16, 18, 20, 23, 26, 29, 32, 35, 39, 45, 51, 57, 64, 73, 86, 102, 128, 171, 256, 341, 512, 1024 };
static const int invAngTable[32] = { 0, 8192, 4096, 2731, 2048, 1365, 1024, 819, 683, 585, 512, 455, 410, 356, 315, 282, 256, 234, 210, 182, 160, 144, 128, 112, 95, 80, 64, 48, 32, 24, 16, 8 }; // (256 * 32) / Angle
int invAngle = invAngTable[absAngMode];
int absAng = angTable [absAngMode];
......@@ -1639,7 +1641,7 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom
}
}
#if JVET_M0142_CCLM_COLLOCATED_CHROMA
else if( pu.cs->sps->getSpsNext().getCclmCollocatedChromaFlag() )
else if( pu.cs->sps->getCclmCollocatedChromaFlag() )
{
piSrc = pRecSrc0 - iRecStride2;
......@@ -1686,7 +1688,7 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom
for (int j = 0; j < uiCHeight + addedLeftBelow; j++)
{
#if JVET_M0142_CCLM_COLLOCATED_CHROMA
if( pu.cs->sps->getSpsNext().getCclmCollocatedChromaFlag() )
if( pu.cs->sps->getCclmCollocatedChromaFlag() )
{
if( j == 0 && !bAboveAvaillable )
{
......@@ -1722,7 +1724,7 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom
for( int i = 0; i < uiCWidth; i++ )
{
#if JVET_M0142_CCLM_COLLOCATED_CHROMA
if( pu.cs->sps->getSpsNext().getCclmCollocatedChromaFlag() )
if( pu.cs->sps->getCclmCollocatedChromaFlag() )
{
if( i == 0 && !bLeftAvaillable )
{
......
......@@ -126,8 +126,20 @@ void LoopFilter::create( const unsigned uiMaxCUDepth )
m_aapucBS [edgeDir].resize( numPartitions );
m_aapbEdgeFilter[edgeDir].resize( numPartitions );
}
#if JVET_M0428_ENC_DB_OPT
m_enc = false;
#endif
}
#if JVET_M0428_ENC_DB_OPT
void LoopFilter::initEncPicYuvBuffer(ChromaFormat chromaFormat, int lumaWidth, int lumaHeight)
{
const UnitArea picArea(chromaFormat, Area(0, 0, lumaWidth, lumaHeight));
m_encPicYuvBuffer.destroy();
m_encPicYuvBuffer.create(picArea);
}
#endif
void LoopFilter::destroy()
{
for( int edgeDir = 0; edgeDir < NUM_EDGE_DIR; edgeDir++ )
......@@ -135,6 +147,9 @@ void LoopFilter::destroy()
m_aapucBS [edgeDir].clear();
m_aapbEdgeFilter[edgeDir].clear();
}
#if JVET_M0428_ENC_DB_OPT
m_encPicYuvBuffer.destroy();
#endif
}
/**
......@@ -521,16 +536,13 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
const Slice& sliceQ = *cu.slice;
const Position& cuPosLuma = cu.lumaPos();
int shiftHor = cu.Y().valid() ? 0 : ::getComponentScaleX(COMPONENT_Cb, cu.firstPU->chromaFormat);
int shiftVer = cu.Y().valid() ? 0 : ::getComponentScaleY(COMPONENT_Cb, cu.firstPU->chromaFormat);
const Position& posQ = Position{ localPos.x >> shiftHor, localPos.y >> shiftVer };
const Position posP = ( edgeDir == EDGE_VER ) ? posQ.offset( -1, 0 ) : posQ.offset( 0, -1 );
const bool sameCU = posP.x >= cuPosLuma.x && posP.y >= cuPosLuma.y;
const CodingUnit& cuQ = cu;
const CodingUnit& cuP = sameCU ? cu : *cu.cs->getCU( posP, cu.chType );
const CodingUnit& cuP = *cu.cs->getCU( posP, cu.chType );
//-- Set BS for Intra MB : BS = 4 or 3
if( ( MODE_INTRA == cuP.predMode ) || ( MODE_INTRA == cuQ.predMode ) )
......@@ -542,8 +554,8 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
#endif
}
const TransformUnit& tuQ = posQ == cuQ.lumaPos() ? *cuQ.firstTU : *cuQ.cs->getTU(posQ, cuQ.chType);
const TransformUnit& tuP = posP == cuP.lumaPos() ? *cuP.firstTU : *cuP.cs->getTU(posP, cuP.chType);
const TransformUnit& tuQ = *cuQ.cs->getTU(posQ, cuQ.chType);
const TransformUnit& tuP = *cuP.cs->getTU(posP, cuP.chType);
const PreCalcValues& pcv = *cu.cs->pcv;
const unsigned rasterIdx = getRasterIdx( posQ, pcv );
#if JVET_M0908_CIIP_DB
......@@ -592,9 +604,19 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
return 1;
}
#endif
#if JVET_M0471_LONG_DEBLOCKING_FILTERS
if ( !cu.Y().valid() )
{
return tmpBs;
}
#endif
// and now the pred
const MotionInfo& miQ = cuQ.cs->getMotionInfo( posQ );
const MotionInfo& miP = cuP.cs->getMotionInfo( posP );
const Position& lumaPosQ = Position{ localPos.x, localPos.y };
const Position lumaPosP = ( edgeDir == EDGE_VER ) ? lumaPosQ.offset( -1, 0 ) : lumaPosQ.offset( 0, -1 );
const MotionInfo& miQ = cuQ.cs->getMotionInfo( lumaPosQ );
const MotionInfo& miP = cuP.cs->getMotionInfo( lumaPosP );
const Slice& sliceP = *cuP.slice;
if (sliceQ.isInterB() || sliceP.isInterB())
......@@ -696,7 +718,7 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
void LoopFilter::deriveLADFShift( const Pel* src, const int stride, int& shift, const DeblockEdgeDir edgeDir, const SPS sps )
{
uint32_t lumaLevel = 0;
shift = sps.getSpsNext().getLadfQpOffset(0);
shift = sps.getLadfQpOffset(0);
if (edgeDir == EDGE_VER)
{
......@@ -707,12 +729,12 @@ void LoopFilter::deriveLADFShift( const Pel* src, const int stride, int& shift,
lumaLevel = (src[0] + src[3] + src[-stride] + src[-stride + 3]) >> 2;
}
for ( int k = 1; k < sps.getSpsNext().getLadfNumIntervals(); k++ )
for ( int k = 1; k < sps.getLadfNumIntervals(); k++ )
{
const int th = sps.getSpsNext().getLadfIntervalLowerBound( k );
const int th = sps.getLadfIntervalLowerBound( k );
if ( lumaLevel > th )
{
shift = sps.getSpsNext().getLadfQpOffset( k );
shift = sps.getLadfQpOffset( k );
}
else
{
......@@ -731,7 +753,11 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge
const CompArea& lumaArea = cu.block(COMPONENT_Y);
const PreCalcValues& pcv = *cu.cs->pcv;
#if JVET_M0428_ENC_DB_OPT
PelBuf picYuvRec = m_enc ? m_encPicYuvBuffer.getBuf( lumaArea ) : cu.cs->getRecoBuf( lumaArea );
#else
PelBuf picYuvRec = cu.cs->getRecoBuf( lumaArea );
#endif
Pel *piSrc = picYuvRec.buf;
const int iStride = picYuvRec.stride;
Pel *piTmpSrc = piSrc;
......@@ -816,7 +842,7 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge
iQP = (cuP.qp + cuQ.qp + 1) >> 1;
#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
if ( sps.getSpsNext().getLadfEnabled() )
if ( sps.getLadfEnabled() )
{
int iShift = 0;
deriveLADFShift( piTmpSrc + iSrcStep * (iIdx*pelsInPart), iStride, iShift, edgeDir, sps );
......@@ -1003,9 +1029,13 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed
const PreCalcValues& pcv = *cu.cs->pcv;
unsigned rasterIdx = getRasterIdx( lumaPos, pcv );
#if JVET_M0428_ENC_DB_OPT
PelBuf picYuvRecCb = m_enc ? m_encPicYuvBuffer.getBuf(cu.block(COMPONENT_Cb)) : cu.cs->getRecoBuf(cu.block(COMPONENT_Cb));
PelBuf picYuvRecCr = m_enc ? m_encPicYuvBuffer.getBuf(cu.block(COMPONENT_Cr)) : cu.cs->getRecoBuf(cu.block(COMPONENT_Cr));
#else
PelBuf picYuvRecCb = cu.cs->getRecoBuf( cu.block(COMPONENT_Cb) );
PelBuf picYuvRecCr = cu.cs->getRecoBuf( cu.block(COMPONENT_Cr) );
#endif
Pel *piSrcCb = picYuvRecCb.buf;
Pel *piSrcCr = picYuvRecCr.buf;
const int iStride = picYuvRecCb.stride;
......
......@@ -58,10 +58,15 @@ private:
static_vector<char, MAX_NUM_PARTS_IN_CTU> m_aapucBS [NUM_EDGE_DIR]; ///< Bs for [Ver/Hor][Y/U/V][Blk_Idx]
static_vector<bool, MAX_NUM_PARTS_IN_CTU> m_aapbEdgeFilter[NUM_EDGE_DIR];
LFCUParam m_stLFCUParam; ///< status structure
#if JVET_M0428_ENC_DB_OPT
PelStorage m_encPicYuvBuffer;
bool m_enc;
#endif
private:
#if !JVET_M0428_ENC_DB_OPT
/// CU-level deblocking function
void xDeblockCU ( CodingUnit& cu, const DeblockEdgeDir edgeDir );
#endif
// set / get functions
void xSetLoopfilterParam ( const CodingUnit& cu );
......@@ -111,6 +116,14 @@ public:
LoopFilter();
~LoopFilter();
#if JVET_M0428_ENC_DB_OPT
/// CU-level deblocking function
void xDeblockCU(CodingUnit& cu, const DeblockEdgeDir edgeDir);
void initEncPicYuvBuffer(ChromaFormat chromaFormat, int lumaWidth, int lumaHeight);
PelStorage& getDbEncPicYuvBuffer() { return m_encPicYuvBuffer; }
void setEnc(bool b) { m_enc = b; }
#endif
void create ( const unsigned uiMaxCUDepth );
void destroy ();
......
This diff is collapsed.
/* The copyright in this software is being made available under the BSD
* License, included below. This software may be subject to other third party
* and contributor rights, including patent rights, and no such rights are
* granted under this license.
*
* Copyright (c) 2010-2019, ITU/ISO/IEC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
/** \file MCTS.h
\brief Motion Constrained Tile Sets class (header)
*/
#ifndef __MCTS__
#define __MCTS__
// Include files
#include "Unit.h"
// forward declaration
class Mv;
//! \ingroup CommonLib
//! \{
// ====================================================================================================================
// Class definition
// ====================================================================================================================
class MCTSInfo
{
private:
Area m_tileArea;
public:
MCTSInfo() :
m_tileArea( Area( 0, 0, 0, 0 ) )
{};
void init( CodingStructure* cs, int ctuAddr );
Area getTileArea() { return m_tileArea; }
const Area& getTileArea() const { return m_tileArea; }
Area getTileAreaSubPelRestricted( const PredictionUnit &pu );
Area getTileAreaIntPelRestricted( const PredictionUnit &pu );
};
namespace MCTSHelper {
Area getTileAreaRestricted ( const Area& tileArea, const int offLT, const int offRB );
void clipMvToArea ( Mv& rcMv, const struct Area& block, const struct Area& clipArea, const SPS& sps, int mvFracBits = MV_FRACTIONAL_BITS_INTERNAL );
Area getTileArea ( const CodingStructure* cs, const int ctuAddr );
bool checkMvForMCTSConstraint ( const PredictionUnit &pu, const Mv& mv );
bool checkMvBufferForMCTSConstraint( const PredictionUnit &pu, bool msgFlag = false );
}
//! \}
#endif // __MCTS__
......@@ -49,6 +49,9 @@
#if JVET_M0253_HASH_ME
#include "Hash.h"
#endif
#if JVET_M0445_MCTS
#include "MCTS.h"
#endif
#include <deque>
#if ENABLE_WPP_PARALLELISM || ENABLE_SPLIT_PARALLELISM
......@@ -286,6 +289,9 @@ public:
#if HEVC_TILES_WPP
TileMap* tileMap;
#endif
#if JVET_M0445_MCTS
MCTSInfo mctsInfo;
#endif
std::vector<AQpLayer*> aqlayer;
......@@ -314,6 +320,9 @@ public:
#if ENABLE_QPA
std::vector<double> m_uEnerHpCtu; ///< CTU-wise L2 or squared L1 norm of high-passed luma input
std::vector<Pel> m_iOffsetCtu; ///< CTU-wise DC offset (later QP index offset) of luma input
#if ENABLE_QPA_SUB_CTU
std::vector<int8_t> m_subCtuQP; ///< sub-CTU-wise adapted QPs for delta-QP depth of 1 or more
#endif
#endif
std::vector<SAOBlkParam> m_sao[2];
......
......@@ -676,6 +676,7 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID,
TCoeff *deltaU = m_deltaU;
#endif
memset(piDstCoeff, 0, sizeof(*piDstCoeff) * uiMaxNumCoeff);
memset( m_pdCostCoeff, 0, sizeof( double ) * uiMaxNumCoeff );
memset( m_pdCostSig, 0, sizeof( double ) * uiMaxNumCoeff );
#if HEVC_USE_SIGN_HIDING
......
......@@ -176,11 +176,6 @@ void RdCost::init()
m_motionLambda = 0;
m_iCostScale = 0;
#if JVET_M0427_INLOOP_RESHAPER
m_signalType = RESHAPE_SIGNAL_NULL;
m_chromaWeight = 1.0;
m_lumaBD = 10;
#endif
}
......@@ -2868,9 +2863,9 @@ Distortion RdCost::xGetHADs( const DistParam &rcDtParam )
#if WCG_EXT
#if JVET_M0427_INLOOP_RESHAPER
uint32_t RdCost::m_signalType;
double RdCost::m_chromaWeight;
int RdCost::m_lumaBD;
uint32_t RdCost::m_signalType = RESHAPE_SIGNAL_NULL;
double RdCost::m_chromaWeight = 1.0;
int RdCost::m_lumaBD = 10;
std::vector<double> RdCost::m_reshapeLumaLevelToWeightPLUT;
std::vector<double> RdCost::m_lumaLevelToWeightPLUT;
#else
......
......@@ -199,7 +199,7 @@ void Reshape::constructReshaper()
m_fwdLUT[i*pwlFwdBinLen] = Clip3((Pel)0, (Pel)((1 << m_lumaBD) - 1), (Pel)Y1);
int log2PwlFwdBinLen = g_aucLog2[pwlFwdBinLen];
int log2PwlFwdBinLen = floorLog2(pwlFwdBinLen);
int32_t scale = ((int32_t)(Y2 - Y1) * (1 << FP_PREC) + (1 << (log2PwlFwdBinLen - 1))) >> (log2PwlFwdBinLen);
for (int j = 1; j < pwlFwdBinLen; j++)
......
......@@ -51,6 +51,9 @@
#if ENABLE_TRACING
CDTrace *g_trace_ctx = NULL;
#endif
#if JVET_M0445_MCTS_DEC_CHECK
bool g_mctsDecCheckEnabled = false;
#endif
//! \ingroup CommonLib
......
......@@ -262,5 +262,9 @@ extern const uint8_t g_triangleCombination[TRIANGLE_MAX_NUM_CANDS][3];
extern const uint8_t g_triangleIdxBins[TRIANGLE_MAX_NUM_CANDS];
#endif
#if JVET_M0445_MCTS_DEC_CHECK
extern bool g_mctsDecCheckEnabled;
#endif
#endif //__TCOMROM__
......@@ -634,13 +634,17 @@ void SampleAdaptiveOffset::xPCMLFDisableProcess(CodingStructure& cs)
void SampleAdaptiveOffset::xPCMCURestoration(CodingStructure& cs, const UnitArea &ctuArea)
{
const SPS& sps = *cs.sps;
#if JVET_M0277_FIX_PCM_DISABLEFILTER
uint32_t numComponents = CS::isDualITree(cs) ? 1 : m_numberOfComponents;
#endif
for( auto &cu : cs.traverseCUs( ctuArea, CH_L ) )
{
// restore PCM samples
if( ( cu.ipcm && sps.getPCMFilterDisableFlag() ) || CU::isLosslessCoded( cu ) )
{
#if !JVET_M0277_FIX_PCM_DISABLEFILTER
const uint32_t numComponents = m_numberOfComponents;
#endif
for( uint32_t comp = 0; comp < numComponents; comp++ )
{
......@@ -648,6 +652,23 @@ void SampleAdaptiveOffset::xPCMCURestoration(CodingStructure& cs, const UnitArea
}
}
}
#if JVET_M0277_FIX_PCM_DISABLEFILTER
numComponents = m_numberOfComponents;
if (CS::isDualITree(cs) && numComponents)