...
 
Commits (123)
......@@ -98,6 +98,7 @@ MTS : 1
MTSIntraMaxCand : 3
MTSInterMaxCand : 4
SBT : 1
LFNST : 1
ISP : 1
Affine : 1
SubPuMvp : 1
......@@ -110,12 +111,15 @@ IBC : 0 # turned off in CTC
AllowDisFracMMVD : 1
AffineAmvr : 0
LumaReshapeEnable : 1 # luma reshaping. 0: disable 1:enable
MIP : 1
# Fast tools
PBIntraFast : 1
ISPFast : 1
FastMrg : 1
AMaxBT : 1
FastMIP : 1
FastLFNST : 1
# Encoder optimization tools
AffineAmvrEncOpt : 0
......
......@@ -127,12 +127,14 @@ IBC : 0 # turned off in CTC
AllowDisFracMMVD : 1
AffineAmvr : 0
LumaReshapeEnable : 1 # luma reshaping. 0: disable 1:enable
MIP : 1
# Fast tools
PBIntraFast : 1
ISPFast : 1
FastMrg : 1
AMaxBT : 1
FastMIP : 0
# Encoder optimization tools
AffineAmvrEncOpt : 0
......
......@@ -131,12 +131,14 @@ IBC : 0 # turned off in CTC
AllowDisFracMMVD : 1
AffineAmvr : 0
LumaReshapeEnable : 1 # luma reshaping. 0: disable 1:enable
MIP : 1
# Fast tools
PBIntraFast : 1
ISPFast : 1
FastMrg : 1
AMaxBT : 1
FastMIP : 0
# Encoder optimization tools
AffineAmvrEncOpt : 0
......
......@@ -128,6 +128,7 @@ MTS : 1
MTSIntraMaxCand : 3
MTSInterMaxCand : 4
SBT : 1
LFNST : 1
ISP : 1
MMVD : 1
Affine : 1
......@@ -146,6 +147,7 @@ IBC : 0 # turned off in CTC
AllowDisFracMMVD : 1
AffineAmvr : 1
LumaReshapeEnable : 1 # luma reshaping. 0: disable 1:enable
MIP : 1
DMVR : 1
SMVD : 1
......@@ -154,6 +156,8 @@ PBIntraFast : 1
ISPFast : 1
FastMrg : 1
AMaxBT : 1
FastMIP : 0
FastLFNST : 0
# Encoder optimization tools
AffineAmvrEncOpt : 1
......
......@@ -1229,6 +1229,12 @@ $}
Specifies the maximum number of merge candidates to use.
\\
\Option{MaxNumTriangleCand} &
%\ShortOption{\None} &
\Default{5} &
Specifies the maximum number of triangle merge candidates to use.
\\
\Option{DisableIntraInInter} &
%\ShortOption{\None} &
\Default{0} &
......@@ -1771,6 +1777,12 @@ Enables or disables the use of a deblocking across tile boundaries.
\begin{OptionTableNoShorthand}{Coding tools parameters}{tab:coding-tools}
\Option{MIP} &
%\ShortOption{\None} &
\Default{true} &
Enables or disables the use of matrix-based intra prediction (MIP).
\\
\Option{AMP} &
%\ShortOption{\None} &
\Default{true} &
......@@ -2022,6 +2034,24 @@ Enables optimization of non-linear filters for ALF on Chroma channels.
Enables or disables symmetric MVD mode.
\\
\Option{RDPCM} &
%\ShortOption{\None} &
\Default{false} &
Enables or disables RDPCM coding mode.
\\
\Option{LFNST} &
%\ShortOption{\None} &
\Default{false} &
Enables or disables the use of low frequency non-separable transform (LFNST).
\\
\Option{FastLFNST} &
%\ShortOption{\None} &
\Default{false} &
Enables or disables the fast encoding of low frequency non-separable transform (LFNST).
\\
\end{OptionTableNoShorthand}
%%
......
......@@ -248,6 +248,10 @@ void EncApp::xInitLibCfg()
m_cEncLib.setMinQTSizes ( m_uiMinQT );
m_cEncLib.setMaxBTDepth ( m_uiMaxBTDepth, m_uiMaxBTDepthI, m_uiMaxBTDepthIChroma );
m_cEncLib.setDualITree ( m_dualTree );
#if JVET_N0193_LFNST
m_cEncLib.setLFNST ( m_LFNST );
m_cEncLib.setUseFastLFNST ( m_useFastLFNST );
#endif
m_cEncLib.setSubPuMvpMode ( m_SubPuMvpMode );
m_cEncLib.setAffine ( m_Affine );
m_cEncLib.setAffineType ( m_AffineType );
......@@ -291,6 +295,9 @@ void EncApp::xInitLibCfg()
#endif
#if JVET_N0449_MMVD_SIMP
m_cEncLib.setMmvdDisNum (m_MmvdDisNum);
#endif
#if JVET_N0413_RDPCM
m_cEncLib.setRDPCM ( m_RdpcmMode );
#endif
m_cEncLib.setIBCMode ( m_IBCMode );
m_cEncLib.setIBCLocalSearchRangeX ( m_IBCLocalSearchRangeX );
......@@ -341,6 +348,10 @@ void EncApp::xInitLibCfg()
#if JVET_N0242_NON_LINEAR_ALF
m_cEncLib.setUseNonLinearAlfLuma ( m_useNonLinearAlfLuma );
m_cEncLib.setUseNonLinearAlfChroma ( m_useNonLinearAlfChroma );
#endif
#if JVET_N0217_MATRIX_INTRAPRED
m_cEncLib.setUseMIP ( m_MIP );
m_cEncLib.setUseFastMIP ( m_useFastMIP );
#endif
m_cEncLib.setCrossComponentPredictionEnabledFlag ( m_crossComponentPredictionEnabledFlag );
m_cEncLib.setUseReconBasedCrossCPredictionEstimate ( m_reconBasedCrossCPredictionEstimate );
......@@ -379,6 +390,9 @@ void EncApp::xInitLibCfg()
m_cEncLib.setPCMLog2MaxSize ( m_pcmLog2MaxSize);
m_cEncLib.setMaxNumMergeCand ( m_maxNumMergeCand );
m_cEncLib.setMaxNumAffineMergeCand ( m_maxNumAffineMergeCand );
#if JVET_N0400_SIGNAL_TRIANGLE_CAND_NUM
m_cEncLib.setMaxNumTriangleCand ( m_maxNumTriangleCand );
#endif
//====== Weighted Prediction ========
m_cEncLib.setUseWP ( m_useWeightedPred );
......
......@@ -838,6 +838,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("MaxBTDepthISliceL", m_uiMaxBTDepthI, 3u, "MaxBTDepthISliceL")
("MaxBTDepthISliceC", m_uiMaxBTDepthIChroma, 3u, "MaxBTDepthISliceC")
("DualITree", m_dualTree, false, "Use separate QTBT trees for intra slice luma and chroma channel types")
#if JVET_N0193_LFNST
( "LFNST", m_LFNST, false, "Enable LFNST (0:off, 1:on) [default: off]" )
( "FastLFNST", m_useFastLFNST, false, "Fast methods for LFNST" )
#endif
("SubPuMvp", m_SubPuMvpMode, 0, "Enable Sub-PU temporal motion vector prediction (0:off, 1:ATMVP, 2:STMVP, 3:ATMVP+STMVP) [default: off]")
#if JVET_N0127_MMVD_SPS_FLAG
("MMVD", m_MMVD, true, "Enable Merge mode with Motion Vector Difference (0:off, 1:on) [default: 1]")
......@@ -889,6 +893,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("DMVR", m_DMVR, false, "Decoder-side Motion Vector Refinement")
#if JVET_N0449_MMVD_SIMP
("MmvdDisNum", m_MmvdDisNum, 8, "Number of MMVD Distance Entries")
#endif
#if JVET_N0413_RDPCM
( "RDPCM", m_RdpcmMode, false, "RDPCM")
#endif
( "IBC", m_IBCMode, 0u, "IBCMode (0x1:enabled, 0x0:disabled) [default: disabled]")
( "IBCLocalSearchRangeX", m_IBCLocalSearchRangeX, 128u, "Search range of IBC local search in x direction")
......@@ -922,6 +929,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
#if JVET_N0242_NON_LINEAR_ALF
("UseNonLinearAlfLuma", m_useNonLinearAlfLuma, true, "Non-linear adaptive loop filters for Luma Channel")
("UseNonLinearAlfChroma", m_useNonLinearAlfChroma, true, "Non-linear adaptive loop filters for Chroma Channels")
#endif
#if JVET_N0217_MATRIX_INTRAPRED
("MIP", m_MIP, true, "Enable MIP (matrix-based intra prediction)")
("FastMIP", m_useFastMIP, false, "Fast encoder search for MIP (matrix-based intra prediction)")
#endif
// Unit definition parameters
("MaxCUWidth", m_uiMaxCUWidth, 64u)
......@@ -1115,6 +1126,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
#endif
("MaxNumMergeCand", m_maxNumMergeCand, 5u, "Maximum number of merge candidates")
("MaxNumAffineMergeCand", m_maxNumAffineMergeCand, 5u, "Maximum number of affine merge candidates")
#if JVET_N0400_SIGNAL_TRIANGLE_CAND_NUM
("MaxNumTriangleCand", m_maxNumTriangleCand, 5u, "Maximum number of triangle candidates")
#endif
/* Misc. */
("SEIDecodedPictureHash,-dph", tmpDecodedPictureHashSEIMappedType, 0, "Control generation of decode picture hash SEI messages\n"
"\t3: checksum\n"
......@@ -1748,6 +1762,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
CHECK( m_LadfNumIntervals != cfg_LadfQpOffset.values.size(), "size of LadfQpOffset must be equal to LadfNumIntervals");
CHECK( m_LadfNumIntervals - 1 != cfg_LadfIntervalLowerBound.values.size(), "size of LadfIntervalLowerBound must be equal to LadfNumIntervals - 1");
m_LadfQpOffset = cfg_LadfQpOffset.values;
m_LadfIntervalLowerBound[0] = 0;
for (int k = 1; k < m_LadfNumIntervals; k++)
{
m_LadfIntervalLowerBound[k] = cfg_LadfIntervalLowerBound.values[k - 1];
......@@ -2032,6 +2047,9 @@ bool EncAppCfg::xCheckParameter()
xConfirmPara(m_DMVR, "DMVR only allowed with NEXT profile");
#if JVET_N0449_MMVD_SIMP
xConfirmPara(m_MmvdDisNum, "Number of distance MMVD entry setting only allowed with NEXT profile");
#endif
#if JVET_N0413_RDPCM
xConfirmPara(m_RdpcmMode, "RDPCM only allowed with NEXT profile");
#endif
// ADD_NEW_TOOL : (parameter check) add a check for next tools here
}
......@@ -2349,6 +2367,11 @@ bool EncAppCfg::xCheckParameter()
#endif
xConfirmPara( m_maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater.");
xConfirmPara( m_maxNumMergeCand > MRG_MAX_NUM_CANDS, "MaxNumMergeCand must be no more than MRG_MAX_NUM_CANDS." );
#if JVET_N0400_SIGNAL_TRIANGLE_CAND_NUM
xConfirmPara( m_maxNumTriangleCand > TRIANGLE_MAX_NUM_UNI_CANDS, "MaxNumTriangleCand must be no more than TRIANGLE_MAX_NUM_UNI_CANDS." );
xConfirmPara( m_maxNumTriangleCand > m_maxNumMergeCand, "MaxNumTriangleCand must be no more than MaxNumMergeCand." );
xConfirmPara( 0 < m_maxNumTriangleCand && m_maxNumTriangleCand < 2, "MaxNumTriangleCand must be no less than 2 unless MaxNumTriangleCand is 0." );
#endif
xConfirmPara( m_maxNumAffineMergeCand < 1, "MaxNumAffineMergeCand must be 1 or greater." );
xConfirmPara( m_maxNumAffineMergeCand > AFFINE_MRG_MAX_NUM_CANDS, "MaxNumAffineMergeCand must be no more than AFFINE_MRG_MAX_NUM_CANDS." );
......@@ -3116,6 +3139,9 @@ void EncAppCfg::xPrintParameter()
msg( DETAILS, "Max Num Merge Candidates : %d\n", m_maxNumMergeCand );
msg( DETAILS, "Max Num Affine Merge Candidates : %d\n", m_maxNumAffineMergeCand );
#if JVET_N0400_SIGNAL_TRIANGLE_CAND_NUM
msg( DETAILS, "Max Num Triangle Merge Candidates : %d\n", m_maxNumTriangleCand );
#endif
msg( DETAILS, "\n");
msg( VERBOSE, "TOOL CFG: ");
......@@ -3186,6 +3212,9 @@ void EncAppCfg::xPrintParameter()
if( m_profile == Profile::NEXT )
{
msg( VERBOSE, "\nNEXT TOOL CFG: " );
#if JVET_N0193_LFNST
msg( VERBOSE, "LFNST:%d ", m_LFNST );
#endif
#if JVET_N0127_MMVD_SPS_FLAG
msg( VERBOSE, "MMVD:%d ", m_MMVD);
#endif
......@@ -3232,6 +3261,9 @@ void EncAppCfg::xPrintParameter()
msg(VERBOSE, "DMVR:%d ", m_DMVR);
#if JVET_N0449_MMVD_SIMP
msg(VERBOSE, "MmvdDisNum:%d ", m_MmvdDisNum);
#endif
#if JVET_N0413_RDPCM
msg(VERBOSE, "RDPCM:%d ", m_RdpcmMode );
#endif
}
msg(VERBOSE, "IBC:%d ", m_IBCMode);
......@@ -3265,6 +3297,9 @@ void EncAppCfg::xPrintParameter()
msg(VERBOSE, "(Sigal:%s ", m_reshapeSignalType==0? "SDR" : "HDR-PQ");
msg(VERBOSE, ") ");
}
#if JVET_N0217_MATRIX_INTRAPRED
msg(VERBOSE, "MIP:%d ", m_MIP);
#endif
msg(VERBOSE, "EncDbOpt:%d ", m_encDbOpt);
msg( VERBOSE, "\nFAST TOOL CFG: " );
msg( VERBOSE, "LCTUFast:%d ", m_useFastLCTU );
......@@ -3276,6 +3311,9 @@ void EncAppCfg::xPrintParameter()
if( m_ISP ) msg( VERBOSE, "ISPFast:%d ", m_useFastISP );
#else
msg( VERBOSE, "ISPFast:%d ", m_useFastISP );
#endif
#if JVET_N0193_LFNST
if( m_LFNST ) msg( VERBOSE, "FastLFNST:%d ", m_useFastLFNST );
#endif
msg( VERBOSE, "AMaxBT:%d ", m_useAMaxBT );
msg( VERBOSE, "E0023FastEnc:%d ", m_e0023FastEnc );
......@@ -3284,6 +3322,9 @@ void EncAppCfg::xPrintParameter()
msg( VERBOSE, "UseNonLinearALFLuma:%d ", m_useNonLinearAlfLuma );
msg( VERBOSE, "UseNonLinearALFChroma:%d ", m_useNonLinearAlfChroma );
#endif
#if JVET_N0217_MATRIX_INTRAPRED
if( m_MIP ) msg(VERBOSE, "FastMIP:%d ", m_useFastMIP);
#endif
msg( VERBOSE, "NumSplitThreads:%d ", m_numSplitThreads );
if( m_numSplitThreads > 1 )
......
......@@ -238,6 +238,10 @@ protected:
unsigned m_uiMaxBTDepthI;
unsigned m_uiMaxBTDepthIChroma;
bool m_dualTree;
#if JVET_N0193_LFNST
bool m_LFNST;
bool m_useFastLFNST;
#endif
int m_SubPuMvpMode;
bool m_Affine;
bool m_AffineType;
......@@ -275,6 +279,9 @@ protected:
#endif
#if JVET_N0449_MMVD_SIMP
int m_MmvdDisNum;
#endif
#if JVET_N0413_RDPCM
bool m_RdpcmMode;
#endif
unsigned m_IBCMode;
unsigned m_IBCLocalSearchRangeX;
......@@ -316,6 +323,10 @@ protected:
bool m_useNonLinearAlfLuma;
bool m_useNonLinearAlfChroma;
#endif
#if JVET_N0217_MATRIX_INTRAPRED
bool m_MIP;
bool m_useFastMIP;
#endif
int m_numSplitThreads;
......@@ -492,6 +503,9 @@ protected:
uint32_t m_log2ParallelMergeLevel; ///< Parallel merge estimation region
uint32_t m_maxNumMergeCand; ///< Max number of merge candidates
uint32_t m_maxNumAffineMergeCand; ///< Max number of affine merge candidates
#if JVET_N0400_SIGNAL_TRIANGLE_CAND_NUM
uint32_t m_maxNumTriangleCand;
#endif
int m_TMVPModeId;
bool m_depQuantEnabledFlag;
......
......@@ -129,7 +129,7 @@ uint32_t SEIRemovalApp::decode()
// just kick out all suffix SEIS
bWrite &= (( !m_discardSuffixSEIs || nalu.m_nalUnitType != NAL_UNIT_SUFFIX_SEI ) && ( !m_discardPrefixSEIs || nalu.m_nalUnitType != NAL_UNIT_PREFIX_SEI ));
bWrite &= unitCnt >= m_numNALUnitsToSkip;
bWrite &= m_numNALUnitsToWrite > 0 && unitCnt <= m_numNALUnitsToWrite;
bWrite &= m_numNALUnitsToWrite < 0 || unitCnt <= m_numNALUnitsToWrite;
if( bWrite )
{
......
This diff is collapsed.
This diff is collapsed.
......@@ -42,11 +42,6 @@
#include "Buffer.h"
#include "InterpolationFilter.h"
#if ENABLE_SIMD_OPT_BUFFER
#ifdef TARGET_SIMD_X86
#include "CommonDefX86.h"
template< typename T >
void addAvgCore( const T* src1, int src1Stride, const T* src2, int src2Stride, T* dest, int dstStride, int width, int height, int rshift, int offset, const ClpRng& clpRng )
{
......@@ -298,9 +293,6 @@ PelBufferOps::PelBufferOps()
PelBufferOps g_pelBufOP = PelBufferOps();
#endif
#endif
void copyBufferCore(Pel *src, int srcStride, Pel *dst, int dstStride, int width, int height)
{
int numBytes = width * sizeof(Pel);
......
......@@ -51,16 +51,15 @@
// AreaBuf struct
// ---------------------------------------------------------------------------
#if ENABLE_SIMD_OPT_BUFFER
#ifdef TARGET_SIMD_X86
struct PelBufferOps
{
PelBufferOps();
#if ENABLE_SIMD_OPT_BUFFER && defined(TARGET_SIMD_X86)
void initPelBufOpsX86();
template<X86_VEXT vext>
void _initPelBufOpsX86();
#endif
void ( *addAvg4 ) ( const Pel* src0, int src0Stride, const Pel* src1, int src1Stride, Pel *dst, int dstStride, int width, int height, int shift, int offset, const ClpRng& clpRng );
void ( *addAvg8 ) ( const Pel* src0, int src0Stride, const Pel* src1, int src1Stride, Pel *dst, int dstStride, int width, int height, int shift, int offset, const ClpRng& clpRng );
......@@ -84,10 +83,6 @@ struct PelBufferOps
extern PelBufferOps g_pelBufOP;
#endif
#endif
void paddingCore(Pel *ptr, int stride, int width, int height, int padSize);
void copyBufferCore(Pel *src, int srcStride, Pel *Dst, int dstStride, int width, int height);
......
......@@ -106,12 +106,6 @@ static inline uint64_t getTotalFracBits(const uint32_t width, const uint32_t hei
//Intra prediction ====================================================================================================
//======================================================================================================================
static inline bool filterIntraReferenceSamples (const ChannelType chType, const ChromaFormat chFmt, const bool intraReferenceSmoothingDisabled)
{
return (!intraReferenceSmoothingDisabled) && (isLuma(chType) || (chFmt == CHROMA_444));
}
//------------------------------------------------
static inline int getTransformShift(const int channelBitDepth, const Size size, const int maxLog2TrDynamicRange)
......
......@@ -91,6 +91,9 @@ enum CodingStatisticsType
STATS__CABAC_BITS__SAO,
STATS__CABAC_BITS__ALF,
STATS__CABAC_TRM_BITS,
#if JVET_N0193_LFNST
STATS__CABAC_BITS__LFNST,
#endif
STATS__CABAC_FIXED_BITS,
STATS__CABAC_PCM_ALIGN_BITS,
STATS__CABAC_PCM_CODE_BITS,
......@@ -110,9 +113,15 @@ enum CodingStatisticsType
STATS__CABAC_BITS__TRIANGLE_INDEX,
STATS__CABAC_BITS__MULTI_REF_LINE,
STATS__CABAC_BITS__SYMMVD_FLAG,
#if JVET_N0413_RDPCM
STATS__CABAC_BITS__BDPCM_MODE,
#endif
STATS__TOOL_TOTAL_FRAME,// This is a special case and is not included in the report.
STATS__TOOL_AFF,
STATS__TOOL_EMT,
#if JVET_N0193_LFNST
STATS__TOOL_LFNST,
#endif
STATS__TOOL_TOTAL,
STATS__NUM_STATS
};
......@@ -173,6 +182,9 @@ static inline const char* getName(CodingStatisticsType name)
"CABAC_BITS__SIGN_BIT",
"CABAC_BITS__ESCAPE_BITS",
"CABAC_BITS__SAO",
#if JVET_N0193_LFNST
"CABAC_BITS__LFNST",
#endif
"CABAC_BITS__ALF",
"CABAC_TRM_BITS",
"CABAC_FIXED_BITS",
......@@ -194,9 +206,15 @@ static inline const char* getName(CodingStatisticsType name)
"CABAC_BITS__TRIANGLE_INDEX",
"CABAC_BITS__MULTI_REF_LINE",
"CABAC_BITS__SYMMVD_FLAG",
#if JVET_N0413_RDPCM
"CABAC_BITS__BDPCM_MODE",
#endif
"TOOL_FRAME",
"TOOL_AFFINE",
"TOOL_EMT",
#if JVET_N0193_LFNST
"TOOL_LFNST",
#endif
"TOOL_TOTAL"
};
CHECK( STATS__NUM_STATS != sizeof( statNames ) / sizeof( char* ) || name >= STATS__NUM_STATS, "stats out of range" );
......
......@@ -286,7 +286,11 @@ TransformUnit* CodingStructure::getTU( const Position &pos, const ChannelType ef
}
else
{
#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES
while( !tus[idx - 1 + extraIdx]->blocks[getFirstComponentOfChannel( effChType )].contains( pos ) )
#else
while( pos != tus[idx - 1 + extraIdx]->blocks[getFirstComponentOfChannel( effChType )].pos() )
#endif
{
extraIdx++;
}
......@@ -772,7 +776,11 @@ void CodingStructure::initSubStructure( CodingStructure& subStruct, const Channe
subStruct.vps = vps;
#endif
subStruct.pps = pps;
#if JVET_N0415_CTB_ALF
memcpy(subStruct.apss, apss, sizeof(apss));
#else
subStruct.aps = aps;
#endif
subStruct.slice = slice;
subStruct.baseQP = baseQP;
subStruct.prevQP[_chType]
......@@ -1388,8 +1396,6 @@ const TransformUnit* CodingStructure::getTURestricted( const Position &pos, cons
IbcLumaCoverage CodingStructure::getIbcLumaCoverage(const CompArea& chromaArea) const
{
CHECK(chType != CHANNEL_TYPE_CHROMA, "Error");
const unsigned int unitAreaSubBlock = MIN_PU_SIZE * MIN_PU_SIZE;
CompArea lumaArea = CompArea(COMPONENT_Y, chromaArea.chromaFormat, chromaArea.lumaPos(), recalcSize(chromaArea.chromaFormat, CHANNEL_TYPE_CHROMA, CHANNEL_TYPE_LUMA, chromaArea.size()));
lumaArea = clipArea(lumaArea, picture->block(COMPONENT_Y));
......
......@@ -84,7 +84,6 @@ public:
Slice *slice;
UnitScale unitScale[MAX_NUM_COMPONENT];
ChannelType chType;
int baseQP;
int prevQP[MAX_NUM_CHANNEL_TYPE];
......@@ -95,7 +94,11 @@ public:
bool isLossless;
const SPS *sps;
const PPS *pps;
#if JVET_N0415_CTB_ALF
APS* apss[MAX_NUM_APS];
#else
APS * aps;
#endif
#if HEVC_VPS
const VPS *vps;
#endif
......@@ -258,6 +261,9 @@ public:
const CPelBuf getRecoBuf(const CompArea &blk) const;
PelUnitBuf getRecoBuf(const UnitArea &unit);
const CPelUnitBuf getRecoBuf(const UnitArea &unit) const;
#if JVET_N0415_CTB_ALF
PelUnitBuf& getRecoBufRef() { return m_reco; }
#endif
PelBuf getOrgResiBuf(const CompArea &blk);
const CPelBuf getOrgResiBuf(const CompArea &blk) const;
......@@ -310,8 +316,5 @@ private:
static inline uint32_t getNumberValidTBlocks(const PreCalcValues& pcv) { return (pcv.chrFormat==CHROMA_400) ? 1 : ( pcv.multiBlock422 ? MAX_NUM_TBLOCKS : MAX_NUM_COMPONENT ); }
inline unsigned toWSizeIdx( const CodingStructure* cs ) { return gp_sizeIdxInfo->idxFrom( cs->area.lwidth() ); }
inline unsigned toHSizeIdx( const CodingStructure* cs ) { return gp_sizeIdxInfo->idxFrom( cs->area.lheight() ); }
#endif
......@@ -259,6 +259,16 @@ public:
}
};
#if JVET_N0217_MATRIX_INTRAPRED
struct AvailableInfo
{
int maxPosTop;
int maxPosLeft;
AvailableInfo() : maxPosTop(0), maxPosLeft(0) {}
AvailableInfo(const int top, const int left) : maxPosTop(top), maxPosLeft(left) {}
};
#endif
#endif
......@@ -173,6 +173,18 @@ static const int MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1 = 1;
static const int MAXIMUM_INTRA_FILTERED_WIDTH = 16;
static const int MAXIMUM_INTRA_FILTERED_HEIGHT = 16;
#if JVET_N0217_MATRIX_INTRAPRED
static const int MIP_MAX_WIDTH = 64;
static const int MIP_MAX_HEIGHT = 64;
#endif
#if JVET_N0415_CTB_ALF
static const int ALF_FIXED_FILTER_NUM = 64;
static const int ALF_CTB_MAX_NUM_APS = 6;
static const int NUM_FIXED_FILTER_SETS = 16;
static const int NUM_TOTAL_FILTER_SETS = NUM_FIXED_FILTER_SETS + ALF_CTB_MAX_NUM_APS;
#endif
#if JVET_N0178_IMPLICIT_BDOF_SPLIT
static const int MAX_BDOF_APPLICATION_REGION = 16;
#endif
......@@ -212,6 +224,10 @@ static const int NUM_LUMA_MODE = 67; ///< Plan
static const int NUM_LMC_MODE = 1 + 2; ///< LMC + MDLM_T + MDLM_L
static const int NUM_INTRA_MODE = (NUM_LUMA_MODE + NUM_LMC_MODE);
#if JVET_N0193_LFNST
static const int NUM_EXT_LUMA_MODE = 28;
#endif
static const int NUM_DIR = (((NUM_LUMA_MODE - 3) >> 2) + 1);
static const int PLANAR_IDX = 0; ///< index for intra PLANAR mode
static const int DC_IDX = 1; ///< index for intra DC mode
......@@ -219,6 +235,9 @@ static const int HOR_IDX = (1 * (NUM_DIR - 1) + 2); ///< inde
static const int DIA_IDX = (2 * (NUM_DIR - 1) + 2); ///< index for intra DIAGONAL mode
static const int VER_IDX = (3 * (NUM_DIR - 1) + 2); ///< index for intra VERTICAL mode
static const int VDIA_IDX = (4 * (NUM_DIR - 1) + 2); ///< index for intra VDIAGONAL mode
#if JVET_N0413_RDPCM
static const int BDPCM_IDX = (5 * (NUM_DIR - 1) + 2); ///< index for intra VDIAGONAL mode
#endif
static const int NOMODE_IDX = MAX_UCHAR; ///< indicating uninitialized elements
static const int NUM_CHROMA_MODE = (5 + NUM_LMC_MODE); ///< total number of chroma modes
......@@ -233,9 +252,26 @@ static const uint32_t NUM_TRAFO_MODES_MTS = 6; ///<
static const uint32_t MTS_INTRA_MAX_CU_SIZE = 32; ///< Max Intra CU size applying EMT, supported values: 8, 16, 32, 64, 128
static const uint32_t MTS_INTER_MAX_CU_SIZE = 32; ///< Max Inter CU size applying EMT, supported values: 8, 16, 32, 64, 128
static const int NUM_MOST_PROBABLE_MODES = 6;
#if JVET_N0217_MATRIX_INTRAPRED
static const int NUM_MPM_MIP = 3; ///< number of most probable modes for MIP
#endif
static const int LM_SYMBOL_NUM = (1 + NUM_LMC_MODE);
#if JVET_N0217_MATRIX_INTRAPRED
static const int MAX_NUM_MIP_MODE = 35; ///< maximum number of MIP modes
static const int FAST_UDI_MAX_RDMODE_NUM = (NUM_LUMA_MODE + MAX_NUM_MIP_MODE); ///< maximum number of RD comparison in fast-UDI estimation loop
#else
static const int FAST_UDI_MAX_RDMODE_NUM = NUM_LUMA_MODE; ///< maximum number of RD comparison in fast-UDI estimation loop
#endif
#if JVET_N0193_LFNST
static const int MAX_LFNST_COEF_NUM = 16;
static const int LFNST_SIG_NZ_LUMA = 1;
static const int LFNST_SIG_NZ_CHROMA = 1;
static const int NUM_LFNST_NUM_PER_SET = 3;
#endif
static const int MDCS_ANGLE_LIMIT = 9; ///< 0 = Horizontal/vertical only, 1 = Horizontal/vertical +/- 1, 2 = Horizontal/vertical +/- 2 etc...
......@@ -327,6 +363,11 @@ static const int GBI_SIZE_CONSTRAINT = 256; ///< disa
static const int MAX_NUM_HMVP_CANDS = (MRG_MAX_NUM_CANDS-1); ///< maximum number of HMVP candidates to be stored and used in merge list
static const int MAX_NUM_HMVP_AVMPCANDS = 4; ///< maximum number of HMVP candidates to be used in AMVP list
#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION
static const int ALF_VB_POS_ABOVE_CTUROW_LUMA = 4;
static const int ALF_VB_POS_ABOVE_CTUROW_CHMA = 2;
#endif
#if W0038_DB_OPT
static const int MAX_ENCODER_DEBLOCKING_QUALITY_LAYERS = 8 ;
#endif
......@@ -341,6 +382,9 @@ static const int DMVR_SUBCU_WIDTH_LOG2 = 4;
static const int DMVR_SUBCU_HEIGHT_LOG2 = 4;
static const int MAX_NUM_SUBCU_DMVR = ((MAX_CU_SIZE * MAX_CU_SIZE) >> (DMVR_SUBCU_WIDTH_LOG2 + DMVR_SUBCU_HEIGHT_LOG2));
static const int DMVR_NUM_ITERATION = 2;
#if JVET_N0413_RDPCM
static const int BDPCM_MAX_CU_SIZE = 32; ///< maximum CU size for RDPCM mode
#endif
//QTBT high level parameters
//for I slice luma CTB configuration para.
......@@ -404,9 +448,17 @@ static const int MAX_LADF_INTERVALS = 5; /// max n
static const int NTAPS_BILINEAR = 2; ///< Number of taps for bilinear filter
static const int ATMVP_SUB_BLOCK_SIZE = 3; ///< sub-block size for ATMVP
#if JVET_N0400_SIGNAL_TRIANGLE_CAND_NUM
static const int TRIANGLE_MAX_NUM_UNI_CANDS = 6;
#else
static const int TRIANGLE_MAX_NUM_UNI_CANDS = 5;
#endif
static const int TRIANGLE_MAX_NUM_CANDS_MEM = 7;
#if JVET_N0400_SIGNAL_TRIANGLE_CAND_NUM
static const int TRIANGLE_MAX_NUM_CANDS = TRIANGLE_MAX_NUM_UNI_CANDS * (TRIANGLE_MAX_NUM_UNI_CANDS - 1) * 2;
#else
static const int TRIANGLE_MAX_NUM_CANDS = 40;
#endif
static const int TRIANGLE_MAX_NUM_SATD_CANDS = 3;
static const int TRIANGLE_MIN_SIZE = 8 * 8;
......@@ -425,6 +477,11 @@ static constexpr int MV_MANTISSA_BITCOUNT = 6;
static constexpr int MV_MANTISSA_UPPER_LIMIT = ((1 << (MV_MANTISSA_BITCOUNT - 1)) - 1);
static constexpr int MV_MANTISSA_LIMIT = (1 << (MV_MANTISSA_BITCOUNT - 1));
static constexpr int MV_EXPONENT_MASK = ((1 << MV_EXPONENT_BITCOUNT) - 1);
static constexpr int MV_BITS = 18;
static constexpr int MV_MAX = (1 << (MV_BITS - 1)) - 1;
static constexpr int MV_MIN = -(1 << (MV_BITS - 1));
static const int PIC_ANALYZE_CW_BINS = 32;
static const int PIC_CODE_CW_BINS = 16;
#if JVET_N0220_LMCS_SIMPLIFICATION
......
......@@ -42,7 +42,11 @@
#if HEVC_USE_SIGN_HIDING
#if JVET_N0413_RDPCM
CoeffCodingContext::CoeffCodingContext( const TransformUnit& tu, ComponentID component, bool signHide, bool bdpcm )
#else
CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID component, bool signHide)
#endif
#else
CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID component )
#endif
......@@ -88,7 +92,7 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp
, m_lastOffsetY (0)
, m_lastShiftX (0)
, m_lastShiftY (0)
, m_TrafoBypass (tu.cs->sps->getSpsRangeExtension().getTransformSkipContextEnabledFlag() && (tu.cu->transQuantBypass || tu.mtsIdx==1))
, m_TrafoBypass (tu.cs->sps->getSpsRangeExtension().getTransformSkipContextEnabledFlag() && (tu.cu->transQuantBypass || tu.mtsIdx==MTS_SKIP))
, m_scanPosLast (-1)
, m_subSetId (-1)
, m_subSetPos (-1)
......@@ -109,6 +113,9 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp
, m_tsGtxFlagCtxSet ( Ctx::TsGtxFlag )
#endif
, m_sigCoeffGroupFlag ()
#if JVET_N0413_RDPCM
, m_bdpcm (bdpcm)
#endif
{
// LOGTODO
unsigned log2sizeX = m_log2BlockWidth;
......@@ -158,8 +165,8 @@ void CoeffCodingContext::initSubblock( int SubsetId, bool sigGroupFlag )
unsigned sigLower = unsigned( ( CGPosY + 1 ) < m_heightInGroups ? m_sigCoeffGroupFlag[ m_subSetPos + m_widthInGroups ] : false );
m_sigGroupCtxId = Ctx::SigCoeffGroup[m_chType]( sigRight | sigLower );
#if JVET_N0280_RESIDUAL_CODING_TS
unsigned sigLeft = unsigned( int( CGPosX - 1 ) > 0 ? m_sigCoeffGroupFlag[m_subSetPos - 1 ] : false );
unsigned sigAbove = unsigned( int( CGPosY - 1 ) > 0 ? m_sigCoeffGroupFlag[m_subSetPos - m_widthInGroups] : false );
unsigned sigLeft = unsigned( CGPosX > 0 ? m_sigCoeffGroupFlag[m_subSetPos - 1 ] : false );
unsigned sigAbove = unsigned( CGPosY > 0 ? m_sigCoeffGroupFlag[m_subSetPos - m_widthInGroups] : false );
m_sigGroupCtxIdTS = Ctx::TsSigCoeffGroup( sigLeft + sigAbove );
#endif
}
......@@ -382,7 +389,9 @@ unsigned DeriveCtx::CtxIBCFlag(const CodingUnit& cu)
void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx )
{
CHECK( candIdx >= numValidMergeCand, "Merge candidate does not exist" );
#if JVET_N0324_REGULAR_MRG_FLAG
pu.regularMergeFlag = !(pu.mhIntraFlag || pu.cu->triangle);
#endif
pu.mergeFlag = true;
pu.mmvdMergeFlag = false;
pu.interDir = interDirNeighbours[candIdx];
......@@ -562,6 +571,9 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx)
pu.mmvdMergeFlag = true;
pu.mmvdMergeIdx = candIdx;
pu.mergeFlag = true;
#if JVET_N0324_REGULAR_MRG_FLAG
pu.regularMergeFlag = false;
#endif
pu.mergeIdx = candIdx;
pu.mergeType = MRG_TYPE_DEFAULT_N;
pu.mvd[REF_PIC_LIST_0] = Mv();
......@@ -586,3 +598,21 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx)
PU::restrictBiPredMergeCandsOne(pu);
}
#if JVET_N0217_MATRIX_INTRAPRED
unsigned DeriveCtx::CtxMipFlag( const CodingUnit& cu )
{
const CodingStructure *cs = cu.cs;
unsigned ctxId = 0;
const CodingUnit *cuLeft = cs->getCURestricted( cu.lumaPos().offset( -1, 0 ), cu, CH_L );
ctxId = (cuLeft && cuLeft->mipFlag) ? 1 : 0;
const CodingUnit *cuAbove = cs->getCURestricted( cu.lumaPos().offset( 0, -1 ), cu, CH_L );
ctxId += (cuAbove && cuAbove->mipFlag) ? 1 : 0;
ctxId = (cu.lwidth() > 2*cu.lheight() || cu.lheight() > 2*cu.lwidth()) ? 3 : ctxId;
return ctxId;
}
#endif
......@@ -52,7 +52,11 @@ struct CoeffCodingContext
{
public:
#if HEVC_USE_SIGN_HIDING
#if JVET_N0413_RDPCM
CoeffCodingContext( const TransformUnit& tu, ComponentID component, bool signHide, bool bdpcm = false );
#else
CoeffCodingContext( const TransformUnit& tu, ComponentID component, bool signHide);
#endif
#else
CoeffCodingContext( const TransformUnit& tu, ComponentID component );
#endif
......@@ -110,7 +114,9 @@ public:
#else
unsigned sigGroupCtxId () const { return m_sigGroupCtxId; }
#endif
#if JVET_N0413_RDPCM
bool bdpcm () const { return m_bdpcm; }
#endif
unsigned sigCtxIdAbs( int scanPos, const TCoeff* coeff, const int state )
{
const uint32_t posY = m_scan[scanPos].y;
......@@ -306,6 +312,9 @@ private:
int m_remainingContextBins;
#endif
std::bitset<MLS_GRP_NUM> m_sigCoeffGroupFlag;
#if JVET_N0413_RDPCM
const bool m_bdpcm;
#endif
};
......@@ -380,6 +389,9 @@ unsigned CtxTriangleFlag( const CodingUnit& cu );
#endif
unsigned CtxPredModeFlag( const CodingUnit& cu );
unsigned CtxIBCFlag(const CodingUnit& cu);
#if JVET_N0217_MATRIX_INTRAPRED
unsigned CtxMipFlag ( const CodingUnit& cu );
#endif
}
#endif // __CONTEXTMODELLING__
......@@ -245,7 +245,15 @@ const CtxSet ContextSetCfg::MergeFlag = ContextSetCfg::addCtxSet
{ 153, },
{ 5, },
});
#if JVET_N0324_REGULAR_MRG_FLAG
const CtxSet ContextSetCfg::RegularMergeFlag = ContextSetCfg::addCtxSet
({
{ 111, 111, },
{ 111, 111, },
{ 153, 153, },
{ 5, 5, },
});
#endif
const CtxSet ContextSetCfg::MergeIdx = ContextSetCfg::addCtxSet
({
{ 138, },
......@@ -329,6 +337,24 @@ const CtxSet ContextSetCfg::IntraChromaPredMode = ContextSetCfg::addCtxSet
{ 5, 8, 9,},
});
#if JVET_N0217_MATRIX_INTRAPRED
const CtxSet ContextSetCfg::MipFlag = ContextSetCfg::addCtxSet
({
{ 182, 183, 184, 153},
{ 182, 183, 184, 153},
{ 151, 197, 169, 153},
{ 9, 9, 9, 0},
});
const CtxSet ContextSetCfg::MipMode = ContextSetCfg::addCtxSet
({
{ 196, },
{ 196, },
{ 168, },
{ 8, }
});
#endif
const CtxSet ContextSetCfg::DeltaQP = ContextSetCfg::addCtxSet
({
{ 154, 154, 154,},
......@@ -401,6 +427,16 @@ const CtxSet ContextSetCfg::Mvd = ContextSetCfg::addCtxSet
{ 9, 5, },
});
#if JVET_N0413_RDPCM
const CtxSet ContextSetCfg::BDPCMMode = ContextSetCfg::addCtxSet
({
{ CNU, CNU, },
{ CNU, CNU, },
{ CNU, CNU, },
{ DWS, DWS, },
});
#endif
const CtxSet ContextSetCfg::QtRootCbf = ContextSetCfg::addCtxSet
({
{ 109, },
......@@ -411,6 +447,15 @@ const CtxSet ContextSetCfg::QtRootCbf = ContextSetCfg::addCtxSet
const CtxSet ContextSetCfg::QtCbf[] =
{
#if JVET_N0413_RDPCM
ContextSetCfg::addCtxSet
({
{ 141, 127, 139, 140, CNU },
{ 142, 127, 139, 140, CNU },
{ CNU, 111, 124, 111, CNU },
{ 1, 5, 9, 8, DWS },
}),
#else
ContextSetCfg::addCtxSet
({
{ 141, 127, 139, 140, },
......@@ -418,6 +463,7 @@ const CtxSet ContextSetCfg::QtCbf[] =
{ CNU, 111, 124, 111, },
{ 1, 5, 9, 8, },
}),
#endif
ContextSetCfg::addCtxSet
({
{ 163, 154, CNU, CNU, CNU, },
......@@ -641,6 +687,23 @@ const CtxSet ContextSetCfg::TransquantBypassFlag = ContextSetCfg::addCtxSet
{ DWS, }
});
#if JVET_N0193_LFNST
const CtxSet ContextSetCfg::LFNSTIdx = ContextSetCfg::addCtxSet
( {
#if JVET_N0105_LFNST_CTX_MODELLING
{ CNU, CNU, },
{ CNU, CNU, },
{ CNU, CNU, },
{ DWS, DWS, },
#else
{ CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, },
{ CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, },
{ CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, },
{ DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, },
#endif
} );
#endif
const CtxSet ContextSetCfg::RdpcmFlag = ContextSetCfg::addCtxSet
({
{ 139, 139,},
......@@ -755,6 +818,29 @@ const CtxSet ContextSetCfg::ctbAlfFlag =
} )
};
#if JVET_N0415_CTB_ALF
const CtxSet ContextSetCfg::AlfUseLatestFilt =
{
ContextSetCfg::addCtxSet
({
{ 154, }, // B
{ 154, }, // P
{ 185, }, // I
{ DWS, },
})
};
const CtxSet ContextSetCfg::AlfUseTemporalFilt =
{
ContextSetCfg::addCtxSet
({
{ 154, },
{ 154, },
{ 154, },
{ DWS, },
})
};
#endif
const CtxSet ContextSetCfg::MHIntraFlag = ContextSetCfg::addCtxSet
({
{ 225, },
......@@ -762,7 +848,7 @@ const CtxSet ContextSetCfg::MHIntraFlag = ContextSetCfg::addCtxSet
{ CNU, },
{ 1, },
});
#if !JVET_N0302_SIMPLFIED_CIIP
const CtxSet ContextSetCfg::MHIntraPredMode = ContextSetCfg::addCtxSet
({
{ 156, CNU, CNU, CNU, },
......@@ -770,7 +856,7 @@ const CtxSet ContextSetCfg::MHIntraPredMode = ContextSetCfg::addCtxSet
{ CNU, CNU, CNU, CNU, },
{ 9, DWS, DWS, DWS, },
});
#endif
const CtxSet ContextSetCfg::TriangleFlag = ContextSetCfg::addCtxSet
({
#if JVET_N600_AMVR_TPM_CTX_REDUCTION
......@@ -793,7 +879,6 @@ const CtxSet ContextSetCfg::TriangleIdx = ContextSetCfg::addCtxSet
{ CNU, },
{ DWS, },
});
// clang-format on
const CtxSet ContextSetCfg::IBCFlag = ContextSetCfg::addCtxSet
({
......@@ -862,13 +947,21 @@ const CtxSet ContextSetCfg::TsResidualSign =
{
ContextSetCfg::addCtxSet
({
#if JVET_N0413_RDPCM
{ CNU, CNU, },
{ CNU, CNU, },
{ CNU, CNU, },
{ DWS, DWS, },
#else
{ CNU, },
{ CNU, },
{ CNU, },
{ DWS, },
#endif
}),
};
#endif
// clang-format on
const unsigned ContextSetCfg::NumberOfContexts = (unsigned)ContextSetCfg::sm_InitTables[0].size();
......@@ -876,7 +969,9 @@ const unsigned ContextSetCfg::NumberOfContexts = (unsigned)ContextSetCfg::sm_Ini
// combined sets
const CtxSet ContextSetCfg::Sao = { ContextSetCfg::SaoMergeFlag, ContextSetCfg::SaoTypeIdx };
#if JVET_N0415_CTB_ALF
const CtxSet ContextSetCfg::Alf = { ContextSetCfg::ctbAlfFlag, ContextSetCfg::AlfUseLatestFilt, ContextSetCfg::AlfUseTemporalFilt };
#endif
template <class BinProbModel>
CtxStore<BinProbModel>::CtxStore()
......
......@@ -201,6 +201,9 @@ public:
static const CtxSet Split12Flag;
static const CtxSet SkipFlag;
static const CtxSet MergeFlag;
#if JVET_N0324_REGULAR_MRG_FLAG
static const CtxSet RegularMergeFlag;
#endif
static const CtxSet MergeIdx;
static const CtxSet PartSize;
static const CtxSet PredMode;
......@@ -210,6 +213,10 @@ public:
static const CtxSet IntraLumaPlanarFlag;
#endif
static const CtxSet IntraChromaPredMode;
#if JVET_N0217_MATRIX_INTRAPRED
static const CtxSet MipFlag;
static const CtxSet MipMode;
#endif
static const CtxSet DeltaQP;
static const CtxSet InterDir;
static const CtxSet RefPic;
......@@ -220,6 +227,9 @@ public:
static const CtxSet AffineType;
static const CtxSet AffMergeIdx;
static const CtxSet Mvd;
#if JVET_N0413_RDPCM
static const CtxSet BDPCMMode;
#endif
static const CtxSet QtRootCbf;
static const CtxSet QtCbf [3]; // [ channel ]
static const CtxSet SigCoeffGroup [4]; // [ ChannelType ]
......@@ -240,6 +250,9 @@ public:
static const CtxSet SaoTypeIdx;
static const CtxSet MTSIndex;
static const CtxSet TransquantBypassFlag;
#if JVET_N0193_LFNST
static const CtxSet LFNSTIdx;
#endif
static const CtxSet RdpcmFlag;
static const CtxSet RdpcmDir;
static const CtxSet SbtFlag;
......@@ -252,8 +265,15 @@ public:
static const CtxSet ImvFlag;
static const CtxSet GBiIdx;
static const CtxSet ctbAlfFlag;
#if JVET_N0415_CTB_ALF
static const CtxSet AlfUseLatestFilt;
static const CtxSet AlfUseTemporalFilt;
static const CtxSet Alf;
#endif
static const CtxSet MHIntraFlag;
#if !JVET_N0302_SIMPLFIED_CIIP
static const CtxSet MHIntraPredMode;
#endif
static const CtxSet TriangleFlag;
static const CtxSet TriangleIdx;
static const CtxSet SmvdFlag;
......
This diff is collapsed.
......@@ -109,6 +109,12 @@ TComHash::TComHash()
{
m_lookupTable = NULL;
tableHasContent = false;
#if JVET_N0247_HASH_IMPROVE
for (int i = 0; i < 5; i++)
{
hashPic[i] = NULL;
}
#endif
}
TComHash::~TComHash()
......@@ -120,7 +126,25 @@ TComHash::~TComHash()
m_lookupTable = NULL;
}
}
#if JVET_N0247_HASH_IMPROVE
void TComHash::create(int picWidth, int picHeight)
{
if (m_lookupTable)
{
clearAll();
}
if (!hashPic[0])
{
for (int k = 0; k < 5; k++)
{
hashPic[k] = new uint16_t[picWidth*picHeight];
}
}
if (m_lookupTable)
{
return;
}
#else
void TComHash::create()
{
if (m_lookupTable != NULL)
......@@ -128,6 +152,7 @@ void TComHash::create()
clearAll();
return;
}
#endif
int maxAddr = 1 << (m_CRCBits + m_blockSizeBits);
m_lookupTable = new std::vector<BlockHash>*[maxAddr];
memset(m_lookupTable, 0, sizeof(std::vector<BlockHash>*) * maxAddr);
......@@ -136,6 +161,16 @@ void TComHash::create()
void TComHash::clearAll()
{
#if JVET_N0247_HASH_IMPROVE
if (hashPic[0])
{
for (int k = 0; k < 5; k++)
{
delete[] hashPic[k];
hashPic[k] = NULL;
}
}
#endif
tableHasContent = false;
if (m_lookupTable == NULL)
{
......@@ -251,6 +286,7 @@ void TComHash::generateBlock2x2HashValue(const PelUnitBuf &curPicBuf, int picWid
delete[] p;
}
#if !JVET_N0247_HASH_IMPROVE
void TComHash::generateRectangleHashValue(int picWidth, int picHeight, int width, int height, uint32_t* srcPicBlockHash[2], uint32_t* dstPicBlockHash[2], bool* srcPicBlockSameInfo[3], bool* dstPicBlockSameInfo[3])
{
//at present, only support 1:2(2:1) retangle hash value
......@@ -328,6 +364,7 @@ void TComHash::generateRectangleHashValue(int picWidth, int picHeight, int width
delete[] p;
}
#endif
void TComHash::generateBlockHashValue(int picWidth, int picHeight, int width, int height, uint32_t* srcPicBlockHash[2], uint32_t* dstPicBlockHash[2], bool* srcPicBlockSameInfo[3], bool* dstPicBlockSameInfo[3])
{
......@@ -372,15 +409,21 @@ void TComHash::generateBlockHashValue(int picWidth, int picHeight, int width, in
if (width >= 4)
{
#if !JVET_N0247_HASH_IMPROVE
int widthMinus1 = width - 1;
int heightMinus1 = height - 1;
#endif
pos = 0;
for (int yPos = 0; yPos < yEnd; yPos++)
{
for (int xPos = 0; xPos < xEnd; xPos++)
{
#if JVET_N0247_HASH_IMPROVE
dstPicBlockSameInfo[2][pos] = (!dstPicBlockSameInfo[0][pos] && !dstPicBlockSameInfo[1][pos]);
#else
dstPicBlockSameInfo[2][pos] = (!dstPicBlockSameInfo[0][pos] && !dstPicBlockSameInfo[1][pos]) || (((xPos & widthMinus1) == 0) && ((yPos & heightMinus1) == 0));
#endif
pos++;
}
pos += width - 1;
......@@ -404,12 +447,18 @@ void TComHash::addToHashMapByRowWithPrecalData(uint32_t* picHash[2], bool* picIs
addValue <<= m_CRCBits;
int crcMask = 1 << m_CRCBits;
crcMask -= 1;
#if JVET_N0247_HASH_IMPROVE
int blockIdx = g_aucLog2[width] - 2;
#endif
for (int xPos = 0; xPos < xEnd; xPos++)
{
for (int yPos = 0; yPos < yEnd; yPos++)
{
int pos = yPos * picWidth + xPos;
#if JVET_N0247_HASH_IMPROVE
hashPic[blockIdx][pos] = (uint16_t)(srcHash[1][pos] & crcMask);
#endif
//valid data
if (srcIsAdded[pos])
{
......@@ -557,7 +606,38 @@ bool TComHash::isBlock2x2ColSameValue(unsigned char* p, bool includeAllComponent
return true;
}
#if JVET_N0247_HASH_IMPROVE
bool TComHash::isHorizontalPerfectLuma(const Pel* srcPel, int stride, int width, int height)
{
for (int i = 0; i < height; i++)
{
for (int j = 1; j < width; j++)
{
if (srcPel[j] != srcPel[0])
{
return false;
}
}
srcPel += stride;
}
return true;
}
bool TComHash::isVerticalPerfectLuma(const Pel* srcPel, int stride, int width, int height)
{
for (int i = 0; i < width; i++)
{
for (int j = 1; j < height; j++)
{
if (srcPel[j*stride + i] != srcPel[i])
{
return false;
}
}
}
return true;
}
#endif
bool TComHash::getBlockHashValue(const PelUnitBuf &curPicBuf, int width, int height, int xStart, int yStart, const BitDepths bitDepths, uint32_t& hashValue1, uint32_t& hashValue2)
{
int addValue = m_blockSizeToIndex[width][height];
......@@ -712,8 +792,10 @@ void TComHash::initBlockSizeToIndex()
m_blockSizeToIndex[32][32] = 2;
m_blockSizeToIndex[64][64] = 3;
m_blockSizeToIndex[4][4] = 4;
#if !JVET_N0247_HASH_IMPROVE
m_blockSizeToIndex[4][8] = 5;
m_blockSizeToIndex[8][4] = 6;
#endif
}
uint32_t TComHash::getCRCValue1(unsigned char* p, int length)
......
......@@ -91,7 +91,11 @@ struct TComHash
public:
TComHash();
~TComHash();
#if JVET_N0247_HASH_IMPROVE
void create(int picWidth, int picHeight);
#else
void create();
#endif
void clearAll();
void addToTable(uint32_t hashValue, const BlockHash& blockHash);
int count(uint32_t hashValue);
......@@ -102,11 +106,15 @@ public:
void generateBlock2x2HashValue(const PelUnitBuf &curPicBuf, int picWidth, int picHeight, const BitDepths bitDepths, uint32_t* picBlockHash[2], bool* picBlockSameInfo[3]);
void generateBlockHashValue(int picWidth, int picHeight, int width, int height, uint32_t* srcPicBlockHash[2], uint32_t* dstPicBlockHash[2], bool* srcPicBlockSameInfo[3], bool* dstPicBlockSameInfo[3]);
#if !JVET_N0247_HASH_IMPROVE
void generateRectangleHashValue(int picWidth, int picHeight, int width, int height, uint32_t* srcPicBlockHash[2], uint32_t* dstPicBlockHash[2], bool* srcPicBlockSameInfo[3], bool* dstPicBlockSameInfo[3]);
#endif
void addToHashMapByRowWithPrecalData(uint32_t* srcHash[2], bool* srcIsSame, int picWidth, int picHeight, int width, int height);
bool isInitial() { return tableHasContent; }
void setInitial() { tableHasContent = true; }
#if JVET_N0247_HASH_IMPROVE
uint16_t* getHashPic(int baseSize) const { return hashPic[g_aucLog2[baseSize] - 2]; }
#endif
public:
......@@ -117,10 +125,17 @@ public:
static bool isBlock2x2ColSameValue(unsigned char* p, bool includeAllComponent = true);
static bool getBlockHashValue(const PelUnitBuf &curPicBuf, int width, int height, int xStart, int yStart, const BitDepths bitDepths, uint32_t& hashValue1, uint32_t& hashValue2);
static void initBlockSizeToIndex();
#if JVET_N0247_HASH_IMPROVE
static bool isHorizontalPerfectLuma(const Pel* srcPel, int stride, int width, int height);
static bool isVerticalPerfectLuma(const Pel* srcPel, int stride, int width, int height);
#endif
private:
std::vector<BlockHash>** m_lookupTable;
bool tableHasContent;
#if JVET_N0247_HASH_IMPROVE
uint16_t* hashPic[5];//4x4 ~ 64x64
#endif
private:
static const int m_CRCBits = 16;
......
......@@ -310,7 +310,7 @@ bool IbcHashMap::ibcHashMatch(const Area& lumaArea, std::vector<Position>& cand,
if (lumaArea.width > MIN_PU_SIZE || lumaArea.height > MIN_PU_SIZE)
{
#if JVET_N0329_IBC_SEARCH_IMP
if (!cs.isDecomp(bottomRight, cs.chType) || bottomRight.x >= m_picWidth || bottomRight.y >= m_picHeight || topLeft.x < 0 || topLeft.y < 0)
if (!cs.isDecomp(bottomRight, CHANNEL_TYPE_LUMA) || bottomRight.x >= m_picWidth || bottomRight.y >= m_picHeight || topLeft.x < 0 || topLeft.y < 0)
#else
if (!cs.isDecomp(bottomRight, cs.chType) || bottomRight.x >= m_picWidth || bottomRight.y >= m_picHeight)
#endif
......@@ -334,7 +334,7 @@ bool IbcHashMap::ibcHashMatch(const Area& lumaArea, std::vector<Position>& cand,
{
#if JVET_N0329_IBC_SEARCH_IMP
CHECK(topLeft != *refBlockPos, "4x4 target block should not have offset!");
if (abs(topLeft.x - lumaArea.x) > searchRange4SmallBlk || abs(topLeft.y - lumaArea.y) > searchRange4SmallBlk || !cs.isDecomp(bottomRight, cs.chType))
if (abs(topLeft.x - lumaArea.x) > searchRange4SmallBlk || abs(topLeft.y - lumaArea.y) > searchRange4SmallBlk || !cs.isDecomp(bottomRight, CHANNEL_TYPE_LUMA))
#else
if (abs(refBlockPos->x - lumaArea.x) > searchRange4SmallBlk || abs(refBlockPos->y - lumaArea.y) > searchRange4SmallBlk || !cs.isDecomp(bottomRight, cs.chType))
#endif
......
......@@ -841,6 +841,7 @@ bool InterPrediction::isSubblockVectorSpreadOverLimit( int a, int b, int c, int
#endif
void InterPrediction::xPredAffineBlk( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv* _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng )
{
#if !JVET_N0196_SIX_TAP_FILTERS
if ( (pu.cu->affineType == AFFINEMODEL_6PARAM && _mv[0] == _mv[1] && _mv[0] == _mv[2])
|| (pu.cu->affineType == AFFINEMODEL_4PARAM && _mv[0] == _mv[1])
)
......@@ -855,6 +856,7 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio
);
return;
}
#endif
JVET_J0090_SET_REF_PICTURE( refPic, compID );
const ChromaFormat chFmt = pu.chromaFormat;
......
......@@ -294,9 +294,11 @@ void IntraPrediction::predIntraAng( const ComponentID compId, PelBuf &piPred, co
const ChannelType channelType = toChannelType( compID );
const int iWidth = piPred.width;
const int iHeight = piPred.height;
#if JVET_N0413_RDPCM
const uint32_t uiDirMode = isLuma( compId ) && pu.cu->bdpcmMode ? BDPCM_IDX : PU::getFinalIntraMode( pu, channelType );
#else
const uint32_t uiDirMode = PU::getFinalIntraMode( pu, channelType );
#endif
CHECK( g_aucLog2[iWidth] < 2 && pu.cs->pcv->noChroma2x2, "Size not allowed" );
CHECK( g_aucLog2[iWidth] > 7, "Size not allowed" );
......@@ -315,6 +317,9 @@ void IntraPrediction::predIntraAng( const ComponentID compId, PelBuf &piPred, co
{
case(PLANAR_IDX): xPredIntraPlanar(srcBuf, piPred); break;
case(DC_IDX): xPredIntraDc(srcBuf, piPred, channelType, false); break;
#if JVET_N0413_RDPCM
case(BDPCM_IDX): xPredIntraBDPCM(srcBuf, piPred, pu.cu->bdpcmMode, clpRng); break;
#endif
default: xPredIntraAng(srcBuf, piPred, channelType, clpRng); break;
}
......@@ -583,6 +588,12 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA
m_ipaParam.interpolationFlag = (m_ipaParam.isModeVer ? puSize.width : puSize.height) > 8 ? true : false ;
}
}
#if JVET_N0413_RDPCM
else if (isLuma( chType ) && pu.cu->bdpcmMode) // BDPCM
{
m_ipaParam.refFilterFlag = false;
}
#endif
else if (dirMode == PLANAR_IDX) // Planar intra prediction
{
m_ipaParam.refFilterFlag = puSize.width * puSize.height > 32 ? true : false;
......@@ -607,7 +618,11 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA
if (filterFlag)
{
const bool isRefFilter = isIntegerSlope(absAng);
#if JVET_N0435_WAIP_HARMONIZATION
m_ipaParam.refFilterFlag = isRefFilter && puSize.width * puSize.height > 32;
#else
m_ipaParam.refFilterFlag = isRefFilter;
#endif
m_ipaParam.interpolationFlag = !isRefFilter;