Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ecm/ECM
  • seregin/ECM
  • XiangLi/ECM
  • ksuehring/ECM
  • Morris/ecm-7-0
  • leizhao/ECM
  • Dongcheol/ecm
  • ghaznavi/ECM
  • junyanhuo/ECM
  • Morris/jvet-ad-0202
  • Yasugi/jvet-ad-0105-aspect-1
  • jonatan/ECM
  • kevin625/ECM
  • astola/ECM
  • Yasugi/jvet-ae-0055
  • ghaznavi/jvet-ae-0100-bvgcccm
  • yyu2021/ECM
  • moonmo.koo/ECM
  • ihtseng/ECM
  • ghaznavi/bugfix-for-jvet-ae-0100-bvgcccm
  • FANZHEMING/jvet-af-0101
  • ghaznavi/jvet-ah-0076-obic
  • NicolasHorst/ecm
  • ghaznavi/harmonizing-dimd-based-transform-selection-functions
  • bordesp/ECM
  • pohan-lin/ECM
  • daizhenyu/ECM
  • qinhongdong/ECM-MasterBranch
  • jvet-ahg-gcc/ECM
  • renan.utida/ECM-AhG15
  • mosenabdoli/ecm-14-0-timd-merge
  • FANZHEMING/jvet-aj-0079
  • lxw/ECM
  • mosenabdoli/ecm-resolve-aj0096-aj0061
  • mosenabdoli/ecm-resolve-aj-0096-aj-0061
  • yanning/ECM
  • ghaznavi/jvet-aj-0146-and-obic-interaction
  • frankplow/ECM
  • moonmo.koo/ecm-15-ahg-7
  • moonmo.koo/ecm-15-ahg-7-fix
  • ivash/ecm-master-branch
  • moonmo.koo/ecm-test
  • pgarus/ecm-ak
  • Myungoh/jvet-ak-0059-test-1-2-c
  • Myungoh/ecm-test-1-2-c
  • Myungoh/mdip-encoder-fix
  • Myungoh/fix-mdip-2
  • Myungoh/mdip-control-for-ahg-7-tests
48 results
Show changes
Commits on Source (130)
Showing
with 3326 additions and 76 deletions
......@@ -153,6 +153,7 @@ BIO : 1
CIIP : 1
Geo : 1
GeoShapeAdapt : 1
GeoBlendIntra : 1
IBC : 1
AllowDisFracMMVD : 1
AffineAmvr : 1
......
......@@ -16,4 +16,14 @@ EnableTMnoninterTools : 0
# offgroup4
DIMD : 0
CCCM : 0
EIP : 0
\ No newline at end of file
EIP : 0
# offgroup5
IntraMTSMaxSize: 32
MTSExt: 0
LFNSTExt: 0
NSPT: 0
AlfFixedFilter: 0
PDP: 0
IntraNN: 0
IntraMTSMaxSize: 32
MTSExt: 0
LFNSTExt: 0
NSPT: 0
AlfFixedFilter: 0
PDP: 0
IntraNN: 0
......@@ -449,6 +449,10 @@ void EncApp::xInitLibCfg()
m_cEncLib.setNoEipConstraintFlag(m_noEipConstraintFlag);
CHECK(m_noEipConstraintFlag && m_eip, "EIP shall be deactivated when m_noTmrlConstraintFlag is equal to 1");
#endif
#if JVET_AK0118_BF_FOR_INTRA_PRED
m_cEncLib.setNoIntraPredBfConstraintFlag(m_noIntraPredBfConstraintFlag);
CHECK(m_noIntraPredBfConstraintFlag && m_intraPredBf, "Intra Pred Bf shall be deactivated when m_noIntraPredBfConstraintFlag is equal to 1");
#endif
#if ENABLE_OBMC
m_cEncLib.setNoObmcConstraintFlag(m_noObmcConstraintFlag);
CHECK(m_noObmcConstraintFlag && m_OBMC, "OBMC shall be deactivated when m_noObmcConstraintFlag is equal to 1");
......@@ -601,6 +605,9 @@ void EncApp::xInitLibCfg()
#if JVET_AG0058_EIP
m_cEncLib.setNoEipConstraintFlag(false);
#endif
#if JVET_AK0118_BF_FOR_INTRA_PRED
m_cEncLib.setNoIntraPredBfConstraintFlag(false);
#endif
#if ENABLE_OBMC
m_cEncLib.setNoObmcConstraintFlag(false);
#endif
......@@ -810,6 +817,9 @@ void EncApp::xInitLibCfg()
m_cEncLib.setLog2SignPredArea (m_log2SignPredArea);
#endif
#endif
#if AHG7_MTS_TOOLOFF_CFG
m_cEncLib.setMTSExt (m_MTSExt);
#endif
#if JVET_AH0103_LOW_DELAY_LFNST_NSPT
m_cEncLib.setIntraLFNSTISlice ( m_intraLFNSTISlice );
m_cEncLib.setIntraLFNSTPBSlice ( m_intraLFNSTPBSlice );
......@@ -824,6 +834,10 @@ void EncApp::xInitLibCfg()
#if JVET_AI0050_SBT_LFNST
m_cEncLib.setUseSBTLFNST ( m_useSbtLFNST );
#endif
#if AHG7_LN_TOOLOFF_CFG
m_cEncLib.setNSPT ( m_NSPT );
m_cEncLib.setLFNSTExt ( m_LFNSTExt );
#endif
#if JVET_AH0103_LOW_DELAY_LFNST_NSPT
m_cEncLib.setUseFastInterLFNST ( m_useFastInterLFNST );
#endif
......@@ -941,6 +955,9 @@ void EncApp::xInitLibCfg()
#if JVET_AA0133_INTER_MTS_OPT
m_cEncLib.setInterMTSMaxSize(m_interMTSMaxSize);
#endif
#if AHG7_MTS_TOOLOFF_CFG
m_cEncLib.setIntraMTSMaxSize(m_intraMTSMaxSize);
#endif
#if ENABLE_DIMD
m_cEncLib.setUseDimd ( m_dimd );
#endif
......@@ -966,9 +983,15 @@ void EncApp::xInitLibCfg()
#if JVET_AG0058_EIP
m_cEncLib.setUseEip ( m_eip );
#endif
#if JVET_AK0118_BF_FOR_INTRA_PRED
m_cEncLib.setUseIntraPredBf ( m_intraPredBf );
#endif
#if JVET_AD0085_MPM_SORTING
m_cEncLib.setUseMpmSorting ( m_mpmSorting );
#endif
#if JVET_AK0059_MDIP
m_cEncLib.setUseMdip ( m_mdip );
#endif
#if JVET_AH0136_CHROMA_REORDERING
m_cEncLib.setUseChromaReordering (m_chromaReordering);
#endif
......@@ -994,6 +1017,9 @@ void EncApp::xInitLibCfg()
#endif
#if JVET_AJ0107_GPM_SHAPE_ADAPT
m_cEncLib.setUseGeoShapeAdapt ( m_Geo ? m_geoShapeAdapt : false);
#endif
#if JVET_AK0101_REGRESSION_GPM_INTRA
m_cEncLib.setUseGeoBlendIntra ( m_Geo ? m_geoBlendIntra : false);
#endif
m_cEncLib.setUseHashME ( m_HashME );
......@@ -1277,6 +1303,10 @@ void EncApp::xInitLibCfg()
#endif
#if JVET_AJ0188_CODING_INFO_CLASSIFICATION
m_cEncLib.setAlfLumaFixedFilterAdjust ( m_alfLumaFixedFilterAdjust );
#endif
#if JVET_AK0121_LOOPFILTER_OFFSET_REFINEMENT
m_cEncLib.setInloopOffsetRefineFlag ( m_inloopOffsetRefineFlag );
m_cEncLib.setInloopOffsetRefineFunc ( m_inloopOffsetRefineFunc );
#endif
m_cEncLib.setTestSAODisableAtPictureLevel ( m_bTestSAODisableAtPictureLevel );
m_cEncLib.setSaoEncodingRate ( m_saoEncodingRate );
......@@ -1287,6 +1317,10 @@ void EncApp::xInitLibCfg()
m_cEncLib.setSaoGreedyMergeEnc ( m_saoGreedyMergeEnc);
m_cEncLib.setIntraSmoothingDisabledFlag (!m_enableIntraReferenceSmoothing );
#if JVET_AK0085_TM_BOUNDARY_PADDING
m_cEncLib.setTMBP ( m_templateMatchingBoundaryPrediction );
#endif
m_cEncLib.setDecodedPictureHashSEIType ( m_decodedPictureHashSEIType );
#if JVET_R0294_SUBPIC_HASH
m_cEncLib.setSubpicDecodedPictureHashType ( m_subpicDecodedPictureHashType );
......@@ -1513,6 +1547,9 @@ void EncApp::xInitLibCfg()
m_cEncLib.setForceSingleSplitThread ( m_forceSplitSequential );
#endif
m_cEncLib.setUseALF ( m_alf );
#if FIXFILTER_CFG
m_cEncLib.setUseAlfFixedFilter ( m_alfFixedFilter );
#endif
m_cEncLib.setUseCCALF ( m_ccalf );
m_cEncLib.setCCALFQpThreshold ( m_ccalfQpThreshold );
m_cEncLib.setLmcs ( m_lmcsEnabled );
......
......@@ -941,6 +941,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
#if JVET_AG0058_EIP
("NoEipConstraintFlag", m_noEipConstraintFlag, false, "Indicate that EIP is deactivated")
#endif
#if JVET_AK0118_BF_FOR_INTRA_PRED
("NoIntraPredBfConstraintFlag", m_noIntraPredBfConstraintFlag, false, "Indicate that Intra Pred Bf is deactivated")
#endif
#if ENABLE_OBMC
("NoObmcConstraintFlag", m_noObmcConstraintFlag, false, "Indicate that OBMC is deactivated")
#endif
......@@ -1046,6 +1049,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
#endif
#if JVET_AI0050_SBT_LFNST
("SbtLFNST", m_useSbtLFNST, true, "SBT-LFNST (0:off, 1:on) [default: on]")
#endif
#if AHG7_LN_TOOLOFF_CFG
( "NSPT", m_NSPT, true, "Enable NSPT (0:off, 1:on) [default: on]" )
( "LFNSTExt", m_LFNSTExt, true, "Enable LFNST extension (0:off, 1:on) [default: on]" )
#endif
("SbTMVP", m_sbTmvpEnableFlag, false, "Enable Subblock Temporal Motion Vector Prediction (0: off, 1: on) [default: off]")
("MMVD", m_MMVD, true, "Enable Merge mode with Motion Vector Difference (0:off, 1:on) [default: 1]")
......@@ -1141,7 +1148,11 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("MTSInterMaxCand", m_MTSInterMaxCand, 4, "Number of additional candidates to test in encoder search for MTS in inter slices\n")
("MTSImplicit", m_MTSImplicit, 0, "Enable implicit MTS (when explicit MTS is off)\n")
( "SBT", m_SBT, false, "Enable Sub-Block Transform for inter blocks\n" )
#if JVET_AJ0260_SBT_CORNER_MODE
( "SBTFast64WidthTh", m_SBTFast64WidthTh, 0, "Picture width threshold for testing size-64 SBT in RDO (now for HD and above sequences)\n")
#else
( "SBTFast64WidthTh", m_SBTFast64WidthTh, 1920, "Picture width threshold for testing size-64 SBT in RDO (now for HD and above sequences)\n")
#endif
( "ISP", m_ISP, false, "Enable Intra Sub-Partitions\n" )
("SMVD", m_SMVD, false, "Enable Symmetric MVD\n")
("CompositeLTReference", m_compositeRefEnabled, false, "Enable Composite Long Term Reference Frame")
......@@ -1156,6 +1167,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
#if JVET_AA0133_INTER_MTS_OPT
("InterMTSMaxSize", m_interMTSMaxSize, 32, "InterMTSMaxSize")
#endif
#if AHG7_MTS_TOOLOFF_CFG
("IntraMTSMaxSize", m_intraMTSMaxSize, 128, "InterMTSMaxSize")
("MTSExt", m_MTSExt, true, "Enable extended MTS (0: 0ff, 1: on)")
#endif
#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL
("EnableTMnoninterTools", m_tmNoninterToolsEnableFlag, (bool) JVET_AE0174_NONINTER_TM_TOOLS_CONTROL, "Enable non-inter based template matching (0:off, 1:on) \n")
#endif
......@@ -1180,9 +1195,15 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
#if JVET_AG0058_EIP
("EIP", m_eip, true, "Enable extrapolation filter-based intra prediction\n")
#endif
#if JVET_AK0118_BF_FOR_INTRA_PRED
("IntraPredBf", m_intraPredBf, true, "Enable intra prediction bilateral filtering\n")
#endif
#if JVET_AD0085_MPM_SORTING
( "MPMSorting", m_mpmSorting, true, "Enable template-based intra MPM list construction\n" )
#endif
#if JVET_AK0059_MDIP
( "MDIP", m_mdip, true, "Enable MDIP and excluding intra modes\n" )
#endif
#if JVET_AH0136_CHROMA_REORDERING
("ChromaReordering", m_chromaReordering, true, "Enable template-based intra chroma list reordering\n")
#endif
......@@ -1208,6 +1229,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
#endif
#if JVET_AI0082_GPM_WITH_INTER_IBC
("GeoInterIbc", m_geoInterIbc, false, "GPM with inter and IBC (0:off, 1:on) [default: off]" )
#endif
#if JVET_AK0101_REGRESSION_GPM_INTRA
("GeoBlendIntra", m_geoBlendIntra, false, "Regression-based GPM with intra and inter (0:off, 1:on) [default: off]" )
#endif
("HashME", m_HashME, false, "Enable hash motion estimation (0:off, 1:on)")
......@@ -1585,6 +1609,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
#endif
#if JVET_AJ0188_CODING_INFO_CLASSIFICATION
("AlfLumaFixedFilterAdjust", m_alfLumaFixedFilterAdjust, true, "Alf Luma Fixed Filter Adjustment" )
#endif
#if JVET_AK0121_LOOPFILTER_OFFSET_REFINEMENT
("InloopOffsetRefineFlag", m_inloopOffsetRefineFlag, true, "Inloop Filter Offset Refinement Flag" )
("InloopOffsetRefineFunc", m_inloopOffsetRefineFunc, true, "Inloop Filter Offset Refinement Func" )
#endif
("TestSAODisableAtPictureLevel", m_bTestSAODisableAtPictureLevel, false, "Enables the testing of disabling SAO at the picture level after having analysed all blocks")
("SaoEncodingRate", m_saoEncodingRate, 0.75, "When >0 SAO early picture termination is enabled for luma and chroma")
......@@ -1614,6 +1642,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("Log2ParallelMergeLevel", m_log2ParallelMergeLevel, 2u, "Parallel merge estimation region")
("WaveFrontSynchro", m_entropyCodingSyncEnabledFlag, false, "0: entropy coding sync disabled; 1 entropy coding sync enabled")
("EntryPointsPresent", m_entryPointPresentFlag, true, "0: entry points is not present; 1 entry points may be present in slice header")
#if JVET_AK0085_TM_BOUNDARY_PADDING
("TMBP", m_templateMatchingBoundaryPrediction, true, "Enables Template Matching-based Reference Picture Boundary Padding")
#endif
("ScalingList", m_useScalingListId, SCALING_LIST_OFF, "0/off: no scaling list, 1/default: default scaling lists, 2/file: scaling lists specified in ScalingListFile")
("ScalingListFile", m_scalingListFileName, string(""), "Scaling list file name. Use an empty string to produce help.")
("DisableScalingMatrixForLFNST", m_disableScalingMatrixForLfnstBlks, true, "Disable scaling matrices, when enabled, for LFNST-coded blocks")
......@@ -1903,6 +1934,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("DebugCTU", m_debugCTU, -1, "If DebugBitstream is present, load frames up to this POC from this bitstream. Starting with DebugPOC-frame at CTUline containin debug CTU.")
("EnsureWppBitEqual", m_ensureWppBitEqual, false, "Ensure the results are equal to results with WPP-style parallelism, even if WPP is off")
( "ALF", m_alf, true, "Adaptive Loop Filter\n" )
#if FIXFILTER_CFG
( "AlfFixedFilter", m_alfFixedFilter, true, "Fixed Filters for Adaptive Loop Filter\n" )
#endif
( "CCALF", m_ccalf, true, "Cross-component Adaptive Loop Filter" )
( "CCALFQpTh", m_ccalfQpThreshold, 37, "QP threshold above which encoder reduces CCALF usage")
#if JVET_Q0114_ASPECT5_GCI_FLAG
......@@ -3591,6 +3625,14 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
}
#endif
#if AHG7_LN_TOOLOFF_CFG
if( !m_interLFNST )
{
m_useInterMTSS = false;
m_useSbtLFNST = false;
}
#endif
#if JVET_AJ0237_INTERNAL_12BIT
if ((m_internalBitDepth[CHANNEL_TYPE_LUMA] > 10) && m_CCSAO && (m_iQP >= 37) && (m_sourceWidth * m_sourceHeight > 1920 * 1080))
{
......@@ -4183,6 +4225,13 @@ bool EncAppCfg::xCheckParameter()
m_mpmSorting = false;
}
#endif
#if JVET_AK0059_MDIP
if(m_mdip)
{
msg(WARNING, "MDIP is forcefully disabled since the enable flag of non-inter-TM tools is set off. \n");
m_mdip = false;
}
#endif
#if JVET_AH0136_CHROMA_REORDERING
if (m_chromaReordering)
{
......@@ -4345,6 +4394,13 @@ bool EncAppCfg::xCheckParameter()
msg(WARNING, "Subblock TM is forcefully disabled since enable flag of TM tools is set off. \n");
m_useSbTmvpTM = false;
}
#endif
#if JVET_AK0085_TM_BOUNDARY_PADDING
if( m_templateMatchingBoundaryPrediction )
{
msg( WARNING, "TM boundary padding is forcefully disabled since enable flag of TM tools is set off. \n" );
m_templateMatchingBoundaryPrediction = false;
}
#endif
}
#endif
......@@ -5678,6 +5734,10 @@ void EncAppCfg::xPrintParameter()
#endif
#if JVET_AI0050_SBT_LFNST
msg( VERBOSE, "SbtLFNST:%d ", m_useSbtLFNST );
#endif
#if AHG7_LN_TOOLOFF_CFG
msg( VERBOSE, "NSPT:%d ", m_NSPT );
msg( VERBOSE, "LFNSTExt:%d ", m_LFNSTExt );
#endif
msg( VERBOSE, "MMVD:%d ", m_MMVD);
msg( VERBOSE, "Affine:%d ", m_Affine );
......@@ -5700,6 +5760,13 @@ void EncAppCfg::xPrintParameter()
msg( VERBOSE, "HorCollocatedChroma:%d ", m_horCollocatedChromaFlag );
msg( VERBOSE, "VerCollocatedChroma:%d ", m_verCollocatedChromaFlag );
msg( VERBOSE, "MTS: %1d(intra) %1d(inter) ", m_MTS & 1, ( m_MTS >> 1 ) & 1 );
#if AHG7_MTS_TOOLOFF_CFG
msg(VERBOSE, "MTSExt: %d ", m_MTSExt);
if (m_MTS & 1)
{
msg(VERBOSE, "IntraMTSMaxSize: %d ", m_intraMTSMaxSize);
}
#endif
#if JVET_AA0133_INTER_MTS_OPT
if ((m_MTS >> 1) & 1)
{
......@@ -5728,6 +5795,9 @@ void EncAppCfg::xPrintParameter()
#endif
#if JVET_AI0082_GPM_WITH_INTER_IBC
msg( VERBOSE, "GeoInterIbc:%d ", m_geoInterIbc );
#endif
#if JVET_AK0101_REGRESSION_GPM_INTRA
msg( VERBOSE, "GeoBlendIntra:%d ", m_geoBlendIntra );
#endif
m_allowDisFracMMVD = m_MMVD ? m_allowDisFracMMVD : false;
if ( m_MMVD )
......@@ -5933,6 +6003,9 @@ void EncAppCfg::xPrintParameter()
#if JVET_AD0085_MPM_SORTING && !JVET_AE0174_NONINTER_TM_TOOLS_CONTROL
msg(VERBOSE, "MPMSorting:%d ", m_mpmSorting);
#endif
#if JVET_AK0059_MDIP && !JVET_AE0174_NONINTER_TM_TOOLS_CONTROL
msg(VERBOSE, "MDIP:%d ", m_mdip);
#endif
#if JVET_AH0136_CHROMA_REORDERING && !JVET_AE0174_NONINTER_TM_TOOLS_CONTROL
msg(VERBOSE, "ChromaReordering:%d ", m_chromaReordering);
#endif
......@@ -5992,6 +6065,9 @@ void EncAppCfg::xPrintParameter()
#if JVET_AD0085_MPM_SORTING
msg(VERBOSE, "MPMsorting:%d ", m_mpmSorting);
#endif
#if JVET_AK0059_MDIP
msg(VERBOSE, "MDIP:%d ", m_mdip);
#endif
#if JVET_AH0136_CHROMA_REORDERING
msg(VERBOSE, "ChromaReordering:%d ", m_chromaReordering);
#endif
......
......@@ -217,6 +217,9 @@ protected:
#if JVET_AG0058_EIP
bool m_noEipConstraintFlag;
#endif
#if JVET_AK0118_BF_FOR_INTRA_PRED
bool m_noIntraPredBfConstraintFlag;
#endif
#if ENABLE_OBMC
bool m_noObmcConstraintFlag;
#endif
......@@ -387,6 +390,9 @@ protected:
unsigned m_uiMaxMTTHierarchyDepthIChroma;
unsigned m_uiMaxBT[3];
unsigned m_uiMaxTT[3];
#if AHG7_MTS_TOOLOFF_CFG
bool m_MTSExt;
#endif
#if JVET_Y0152_TT_ENC_SPEEDUP
int m_ttFastSkip;
double m_ttFastSkipThr;
......@@ -411,6 +417,10 @@ protected:
#endif
#if JVET_AI0050_SBT_LFNST
bool m_useSbtLFNST;
#endif
#if AHG7_LN_TOOLOFF_CFG
bool m_NSPT;
bool m_LFNSTExt;
#endif
bool m_sbTmvpEnableFlag;
bool m_Affine;
......@@ -505,6 +515,9 @@ protected:
#if JVET_AA0133_INTER_MTS_OPT
int m_interMTSMaxSize;
#endif
#if AHG7_MTS_TOOLOFF_CFG
int m_intraMTSMaxSize;
#endif
#if ENABLE_DIMD
bool m_dimd;
#endif
......@@ -529,9 +542,15 @@ protected:
#if JVET_AG0058_EIP
bool m_eip;
#endif
#if JVET_AK0118_BF_FOR_INTRA_PRED
bool m_intraPredBf;
#endif
#if JVET_AD0085_MPM_SORTING
bool m_mpmSorting;
#endif
#if JVET_AK0059_MDIP
bool m_mdip;
#endif
#if JVET_AH0136_CHROMA_REORDERING
bool m_chromaReordering;
#endif
......@@ -557,6 +576,9 @@ protected:
#endif
#if JVET_AI0082_GPM_WITH_INTER_IBC
bool m_geoInterIbc;
#endif
#if JVET_AK0101_REGRESSION_GPM_INTRA
bool m_geoBlendIntra;
#endif
bool m_HashME;
bool m_allowDisFracMMVD;
......@@ -773,6 +795,10 @@ protected:
#endif
#if JVET_AJ0188_CODING_INFO_CLASSIFICATION
bool m_alfLumaFixedFilterAdjust;
#endif
#if JVET_AK0121_LOOPFILTER_OFFSET_REFINEMENT
bool m_inloopOffsetRefineFlag;
bool m_inloopOffsetRefineFunc;
#endif
bool m_bTestSAODisableAtPictureLevel;
double m_saoEncodingRate; ///< When >0 SAO early picture termination is enabled for luma and chroma
......@@ -805,6 +831,9 @@ protected:
bool m_DeblockingFilterMetric; ///< blockiness metric in encoder
#endif
bool m_enableIntraReferenceSmoothing; ///< flag for enabling(default)/disabling intra reference smoothing/filtering
#if JVET_AK0085_TM_BOUNDARY_PADDING
bool m_templateMatchingBoundaryPrediction;
#endif
// coding tools (encoder-only parameters)
bool m_bUseASR; ///< flag for using adaptive motion search range
......@@ -1087,6 +1116,9 @@ protected:
bool m_forceDecodeBitstream1;
bool m_alf; ///< Adaptive Loop Filter
#if FIXFILTER_CFG
bool m_alfFixedFilter;
#endif
bool m_ccalf;
int m_ccalfQpThreshold;
......
......@@ -100,6 +100,9 @@ public:
#endif
}
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
static bool isCoeffRestricted(short coeff, bool luma);
#endif
#if JVET_AA0095_ALF_LONGER_FILTER
void mirroredPaddingForAlf(CodingStructure& cs, const PelUnitBuf& src, int paddingSize, bool enableLuma, bool enableChroma);
#endif
......@@ -116,6 +119,11 @@ public:
#if JVET_AJ0188_CODING_INFO_CLASSIFICATION
PelUnitBuf callCodingInfoBuf( CodingStructure &cs ) { return m_tempBufCodingInfo; }
#endif
#if JVET_AK0121_LOOPFILTER_OFFSET_REFINEMENT
PelUnitBuf callRecAfterSaoBuf() { return m_tempBufSAO; }
PelUnitBuf callRecBeforeAlfBuf() { return m_tempBuf; }
PelUnitBuf callRecBeforeDbfBuf(){ return m_tempBufBeforeDb; }
#endif
static constexpr int AlfNumClippingValues[MAX_NUM_CHANNEL_TYPE] = { 4, 4 };
static constexpr int MaxAlfNumClippingValues = 4;
......@@ -134,13 +142,26 @@ public:
static constexpr int m_ALF_UNUSED_CLASSIDX = 255;
static constexpr int m_ALF_UNUSED_TRANSPOSIDX = 255;
#if JVET_AK0123_ALF_COEFF_RESTRICTION
static constexpr int m_SCALE_BITS_NUM = 4;
static constexpr int m_SCALE_FACTOR[1 << m_SCALE_BITS_NUM] = {16, 17, 18, 19, 21, 23, 25, 27, 29, 15, 14, 13, 12, 11, 10, 9,};
static constexpr int m_SCALE_SHIFT = 4;
#endif
AdaptiveLoopFilter();
virtual ~AdaptiveLoopFilter() {}
void reconstructCoeffAPSs(CodingStructure& cs, bool luma, bool chroma, bool isRdo);
void reconstructCoeff(AlfParam& alfParam, ChannelType channel, const bool isRdo, const bool isRedo = false);
void ALFProcess(CodingStructure& cs);
#if FIXFILTER_CFG
void create(const int picWidth, const int picHeight, const ChromaFormat format, const int maxCUWidth, const int maxCUHeight, const int maxCUDepth, const int inputBitDepth[MAX_NUM_CHANNEL_TYPE], bool useFixedFilter = true);
#else
void create( const int picWidth, const int picHeight, const ChromaFormat format, const int maxCUWidth, const int maxCUHeight, const int maxCUDepth, const int inputBitDepth[MAX_NUM_CHANNEL_TYPE] );
#endif
void destroy();
#if JVET_AK0065_TALF
void TAlfProcess(CodingStructure &cs);
#endif
#if RPR_ENABLE
Size getAlfSize() { return Size(m_tempBuf.get(COMPONENT_Y).width, m_tempBuf.get(COMPONENT_Y).height); }
#endif
......@@ -241,7 +262,11 @@ public:
#if JVET_AD0222_ADDITONAL_ALF_FIXFILTER
void paddingGaussResultsPic(Pel*** gaussPic, const int storeIdx);
void paddingGaussResultsCtu(Pel*** gaussPic, Pel*** gaussCtu, const int storeIdx, const Area &blkDst);
void deriveGaussResultsCtuBoundary(Pel*** gaussPic, const CPelBuf &srcLuma, const Area &blkDst, CodingStructure& cs, const ClpRng &clpRng, const Pel clippingValues[4], uint8_t* ctuEnableFlagLuma, uint8_t* ctuEnableOnlineLuma, int ctuIdx, const int filterSetIdx, const int storeIdx );
void deriveGaussResultsCtuBoundary(Pel*** gaussPic, const CPelBuf &srcLuma, const Area &blkDst, CodingStructure& cs, const ClpRng &clpRng, const Pel clippingValues[4], uint8_t* ctuEnableFlagLuma, uint8_t* ctuEnableOnlineLuma, int ctuIdx, const int filterSetIdx, const int storeIdx
#if JVET_AJ0188_CODING_INFO_CLASSIFICATION && FIXFILTER_CFG
, const CPelBuf& srcCodingInfo, const CPelBuf& srcResi, const bool useFixedFilter
#endif
);
void deriveGaussResultsBlk( Pel*** gaussPic, const CPelBuf &srcLuma, const Area &blkDst, const Area &blk, CodingStructure& cs, const ClpRng &clpRng, const Pel clippingValues[4], int filterSetIdx, const int storeIdx);
void deriveGaussResults(const CPelBuf& srcLumaDb, const Area& blkDst, const Area& blk, CodingStructure &cs, const int filterSetIdx, const int storeIdx );
......@@ -263,7 +288,25 @@ public:
static void calcAlfLumaCodingInfoBlk( CodingStructure& cs, AlfClassifier** classifier, const Area &blkDst, const Area &blkSrc, const CPelBuf& srcLuma, int subBlkSize, int classifierIdx, int bitDepth, const CPelBuf& srcLumaResi, uint32_t **buffer, const CPelBuf& srcCodingInfo );
void( *m_calcAlfLumaCodingInfoBlk )( CodingStructure& cs, AlfClassifier** classifier, const Area &blkDst, const Area &blkSrc, const CPelBuf& srcLuma, int subBlkSize, int classifierIdx, int bitDepth, const CPelBuf& srcLumaResi, uint32_t **buffer, const CPelBuf& srcCodingInfo );
#endif
#if JVET_AK0121_LOOPFILTER_OFFSET_REFINEMENT
void calcOffsetRefinement(CodingStructure& cs, PelUnitBuf& src0, PelUnitBuf& src1, PelUnitBuf& dst, int stageIdx, int refineIdx);
void copyOffsetRefinement(CodingStructure& cs, PelUnitBuf& src, PelUnitBuf& dst );
void copyOffsetRefinementBlk(CodingStructure& cs, PelUnitBuf& src, PelUnitBuf& dst, const Area& blk );
static void calcOffsetRefinementBlk(CodingStructure& cs, PelUnitBuf& src0, PelUnitBuf& src1, PelUnitBuf& dst, PelUnitBuf& srcCodingInfo, int stageIdx, const Area& blk, int refineIdx, PelUnitBuf& codingInfo);
void ( *m_calcOffsetRefinementBlk )(CodingStructure& cs, PelUnitBuf& src0, PelUnitBuf& src1, PelUnitBuf& dst, PelUnitBuf& srcCodingInfo, int stageIdx, const Area& blk, int refineIdx, PelUnitBuf& codingInfo);
#endif
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
void paddingLaplacianResultsPic(Pel ***laplacianPic, const int storeIdx);
void paddingLaplacianResultsCtu(Pel ***laplacianPic, Pel ***laplacianCtu, const int storeIdx, const Area &blkDst);
void deriveLaplacianResultsCtuBoundary(Pel*** laplacianPic, const CPelBuf &srcLuma, const Area &blkDst, CodingStructure& cs, const ClpRng &clpRng, const Pel clippingValues[4], uint8_t* ctuEnableFlagLuma, uint8_t* ctuEnableOnlineLuma, int ctuIdx, const int filterSetIdx, const int storeIdx, const CPelBuf &srcCodingInfo);
void deriveLaplacianResultsBlk( Pel*** laplacianPic, const CPelBuf &srcLuma, const Area &blkDst, const Area &blk, CodingStructure& cs, const ClpRng &clpRng, const Pel clippingValues[4], int filterSetIdx, const int storeIdx, const CPelBuf &srcCodingInfo );
void deriveLaplacianResults(const CPelBuf& srcLuma, const Area& blkDst, const Area& blk, CodingStructure &cs, const int filterSetIdx, const int storeIdx, const CPelBuf &srcCodingInfo);
static void laplacianFiltering(CodingStructure &cs, Pel ***laplacianPic, const CPelBuf &srcLuma, const Area &blkDst, const Area &blk, const ClpRng &clpRng, const Pel clippingValues[4], int filterSetIdx, int storeIdx, const CPelBuf &srcCodingInfo);
void(*m_laplacianFiltering) (CodingStructure &cs, Pel ***laplacianPic, const CPelBuf &srcLuma, const Area &blkDst, const Area &blk, const ClpRng &clpRng, const Pel clippingValues[4], int filterSetIdx, int storeIdx, const CPelBuf &srcCodingInfo);
static void localGaussianFiltering(CodingStructure &cs, const Pel* srcPtrGauss, int strideSrc, int i , int j, const ClpRng &clpRng, const Pel clippingValues[4], Pel gaussOutput[], int gaussOutputLoc);
#endif
int assignAct(int avg_varPrec, int shift, int noAct);
static void calcClass(AlfClassifier **classifier, const Area &blkDst, const Area &cu, int dirWindSize, int classDir, int noDir, int noAct, int bitDepth, int subBlkSize, int mappingDir[NUM_DIR_FIX][NUM_DIR_FIX], uint32_t **laplacian[NUM_DIRECTIONS]);
static void deriveClassificationLaplacianBig(const Area &curBlk, uint32_t **laplacian[NUM_DIRECTIONS]);
......@@ -273,7 +316,11 @@ public:
static void deriveClassificationLaplacian(const CPelBuf &srcLuma, const Area &blkDst, const Area &blk, uint32_t **laplacian[NUM_DIRECTIONS]);
#endif
#if JVET_X0071_ALF_BAND_CLASSIFIER
void deriveClassificationAndFixFilterResultsBlk( AlfClassifier ***classifier, Pel ***fixedFilterResults, const CPelBuf &srcLuma,
void deriveClassificationAndFixFilterResultsBlk( AlfClassifier ***classifier, Pel ***fixedFilterResults,
#if FIXFILTER_CFG
bool useFixedFilter,
#endif
const CPelBuf &srcLuma,
#if JVET_AC0162_ALF_RESIDUAL_SAMPLES_INPUT
const bool bResiFixed, Pel ***fixedFilterResiResults, const CPelBuf &srcResiLuma,
#endif
......@@ -329,6 +376,9 @@ public:
#endif
#if JVET_X0071_ALF_BAND_CLASSIFIER
void deriveClassification( AlfClassifier*** classifier, const CPelBuf& srcLuma,
#if FIXFILTER_CFG
bool useFixedFilter,
#endif
#if JVET_AC0162_ALF_RESIDUAL_SAMPLES_INPUT
const bool bResiFixed, const CPelBuf &srcResiLuma,
#endif
......@@ -446,8 +496,14 @@ public:
#if JVET_AD0222_ADDITONAL_ALF_FIXFILTER
, Pel*** gaussPic, Pel*** gaussCtu
#endif
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
, Pel*** laplacianPic, Pel*** laplacianCtu
#endif
#if JVET_AG0158_ALF_LUMA_COEFF_PRECISION
, char coeffBits
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
, const char* scaleIdxSet
#endif
);
#else
......@@ -471,8 +527,14 @@ public:
#if JVET_AD0222_ADDITONAL_ALF_FIXFILTER
, Pel*** gaussPic, Pel*** gaussCtu
#endif
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
, Pel*** laplacianPic, Pel*** laplacianCtu
#endif
#if JVET_AG0158_ALF_LUMA_COEFF_PRECISION
, char coeffBits
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
, const char* scaleIdxSet
#endif
);
void (*m_filter7x7Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const PelUnitBuf &resi, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, Pel ***fixedFilterResiResults, int fixedFilterSetIdx
......@@ -482,8 +544,14 @@ public:
#if JVET_AD0222_ADDITONAL_ALF_FIXFILTER
, Pel*** gaussPic, Pel*** gaussCtu
#endif
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
, Pel*** laplacianPic, Pel*** laplacianCtu
#endif
#if JVET_AG0158_ALF_LUMA_COEFF_PRECISION
, char coeffBits
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
, const char* scaleIdxSet
#endif
);
void alfFiltering(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const PelUnitBuf &resi, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, AlfFilterType filterType, Pel ***fixedFilterResults, Pel ***fixedFilterResiResults, int fixedFilterSetIdx
......@@ -493,8 +561,14 @@ public:
#if JVET_AD0222_ADDITONAL_ALF_FIXFILTER
, Pel*** gaussPic, Pel*** gaussCtu
#endif
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
, Pel*** laplacianPic, Pel*** laplacianCtu
#endif
#if JVET_AG0158_ALF_LUMA_COEFF_PRECISION
, char coeffBits
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
, const char* scaleIdxSet
#endif
);
#if JVET_AI0084_ALF_RESIDUALS_SCALING
......@@ -517,8 +591,14 @@ public:
#if JVET_AD0222_ADDITONAL_ALF_FIXFILTER
, Pel*** gaussPic, Pel*** gaussCtu
#endif
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
, Pel*** laplacianPic, Pel*** laplacianCtu
#endif
#if JVET_AG0158_ALF_LUMA_COEFF_PRECISION
, char coeffBits
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
, const char* scaleIdxSet
#endif
);
void (*m_filter9x9BlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const PelUnitBuf &resi, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, Pel ***fixedFilterResiResults, int fixedFilterSetIdx
......@@ -528,8 +608,14 @@ public:
#if JVET_AD0222_ADDITONAL_ALF_FIXFILTER
, Pel*** gaussPic, Pel*** gaussCtu
#endif
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
, Pel*** laplacianPic, Pel*** laplacianCtu
#endif
#if JVET_AG0158_ALF_LUMA_COEFF_PRECISION
, char coeffBits
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
, const char* scaleIdxSet
#endif
);
void (*m_filterBlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const PelUnitBuf &resi, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, Pel ***fixedFilterResiResults, int fixedFilterSetIdx
......@@ -539,8 +625,14 @@ public:
#if JVET_AD0222_ADDITONAL_ALF_FIXFILTER
, Pel*** gaussPic, Pel*** gaussCtu
#endif
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
, Pel*** laplacianPic, Pel*** laplacianCtu
#endif
#if JVET_AG0158_ALF_LUMA_COEFF_PRECISION
, char coeffBits
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
, const char* scaleIdxSet
#endif
);
void (*m_filter9x9BlkExtDb)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const PelUnitBuf &resi, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, Pel ***fixedFilterResiResults, int fixedFilterSetIdx
......@@ -550,8 +642,14 @@ public:
#if JVET_AD0222_ADDITONAL_ALF_FIXFILTER
, Pel*** gaussPic, Pel*** gaussCtu
#endif
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
, Pel*** laplacianPic, Pel*** laplacianCtu
#endif
#if JVET_AG0158_ALF_LUMA_COEFF_PRECISION
, char coeffBits
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
, const char* scaleIdxSet
#endif
);
#if JVET_AA0095_ALF_LONGER_FILTER
......@@ -562,8 +660,14 @@ public:
#if JVET_AD0222_ADDITONAL_ALF_FIXFILTER
, Pel*** gaussPic, Pel*** gaussCtu
#endif
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
, Pel*** laplacianPic, Pel*** laplacianCtu
#endif
#if JVET_AG0158_ALF_LUMA_COEFF_PRECISION
, char coeffBits
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
, const char* scaleIdxSet
#endif
);
void (*m_filter13x13BlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const PelUnitBuf &resi, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, Pel ***fixedFilterResiResults, int fixedFilterSetIdx
......@@ -573,8 +677,14 @@ public:
#if JVET_AD0222_ADDITONAL_ALF_FIXFILTER
, Pel*** gaussPic, Pel*** gaussCtu
#endif
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
, Pel*** laplacianPic, Pel*** laplacianCtu
#endif
#if JVET_AG0158_ALF_LUMA_COEFF_PRECISION
, char coeffBits
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
, const char* scaleIdxSet
#endif
);
#endif
......@@ -585,10 +695,69 @@ public:
#if JVET_AD0222_ADDITONAL_ALF_FIXFILTER
, Pel*** gaussPic, Pel*** gaussCtu
#endif
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
, Pel*** laplacianPic, Pel*** laplacianCtu
#endif
#if JVET_AG0158_ALF_LUMA_COEFF_PRECISION
, char coeffBits
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
, const char* scaleIdxSet
#endif
);
#if FIXFILTER_CFG
void (*m_filter13x13BlkDbResiDirect)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const PelUnitBuf &resi, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, Pel ***fixedFilterResiResults, int fixedFilterSetIdx
#if JVET_AB0184_ALF_MORE_FIXED_FILTER_OUTPUT_TAPS
, Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
#endif
#if JVET_AD0222_ADDITONAL_ALF_FIXFILTER
, Pel*** gaussPic, Pel*** gaussCtu
#endif
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
, Pel ***laplacianPic, Pel ***laplacianCtu
#endif
#if JVET_AG0158_ALF_LUMA_COEFF_PRECISION
, char coeffBits
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
, const char* scaleIdxSet
#endif
);
void (*m_filter13x13BlkDbResi)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const PelUnitBuf &resi, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, Pel ***fixedFilterResiResults, int fixedFilterSetIdx
#if JVET_AB0184_ALF_MORE_FIXED_FILTER_OUTPUT_TAPS
, Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
#endif
#if JVET_AD0222_ADDITONAL_ALF_FIXFILTER
, Pel*** gaussPic, Pel*** gaussCtu
#endif
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
, Pel ***laplacianPic, Pel ***laplacianCtu
#endif
#if JVET_AG0158_ALF_LUMA_COEFF_PRECISION
, char coeffBits
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
, const char* scaleIdxSet
#endif
);
void (*m_filter9x9BlkNoFix)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const PelUnitBuf &resi, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, Pel ***fixedFilterResiResults, int fixedFilterSetIdx
#if JVET_AB0184_ALF_MORE_FIXED_FILTER_OUTPUT_TAPS
, Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
#endif
#if JVET_AD0222_ADDITONAL_ALF_FIXFILTER
, Pel*** gaussPic, Pel*** gaussCtu
#endif
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
, Pel ***laplacianPic, Pel ***laplacianCtu
#endif
#if JVET_AG0158_ALF_LUMA_COEFF_PRECISION
, char coeffBits
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
, const char* scaleIdxSet
#endif
);
#endif
void (*m_filter13x13BlkExtDbResi)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const PelUnitBuf &resi, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, Pel ***fixedFilterResiResults, int fixedFilterSetIdx
#if JVET_AB0184_ALF_MORE_FIXED_FILTER_OUTPUT_TAPS
, Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
......@@ -596,8 +765,14 @@ public:
#if JVET_AD0222_ADDITONAL_ALF_FIXFILTER
, Pel*** gaussPic, Pel*** gaussCtu
#endif
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
, Pel*** laplacianPic, Pel*** laplacianCtu
#endif
#if JVET_AG0158_ALF_LUMA_COEFF_PRECISION
, char coeffBits
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
, const char* scaleIdxSet
#endif
);
#else
......@@ -797,6 +972,37 @@ public:
CcAlfFilterParam &getCcAlfFilterParam() { return m_ccAlfFilterParam; }
uint8_t* getCcAlfControlIdc(const ComponentID compID) { return m_ccAlfFilterControl[compID-1]; }
# if JVET_AK0065_TALF
TAlfCtbParam* m_tAlfCtbControl;
std::vector<refComb> m_refCombs;
TAlfCtbParam* getTAlfControl () { return m_tAlfCtbControl; }
void getRefPics(const CodingStructure &cs);
bool getMotionOffset(const CodingStructure &cs, const Position pos, MvField* mvField, const int mode, const int shapeIdx);
static void setBiInput(Pel input[4][NUM_TALF_COEFF + 1][TALF_SBB_SIZE][TALF_SBB_SIZE], const CodingStructure& cs
, const ComponentID compId, const CPelBuf& recBuf, const Pel clipMax[4][MAX_NUM_ALF_LUMA_COEFF]
, const Pel clipMin[4][MAX_NUM_ALF_LUMA_COEFF], const Position curPos, const int shapeIdx, const int picWidth
, const int picHeight, const int mode, std::vector<refComb>& refCombs, MvField* mvField, const int numOfClips);
static void setUniInput(Pel input[4][NUM_TALF_COEFF + 1][TALF_SBB_SIZE][TALF_SBB_SIZE], const CodingStructure& cs
, const ComponentID compId, const CPelBuf& recBuf, const Pel clipMax[4][MAX_NUM_ALF_LUMA_COEFF]
, const Pel clipMin[4][MAX_NUM_ALF_LUMA_COEFF], const Position curPos, const int shapeIdx, const int picWidth
, const int picHeight, const int mode, std::vector<refComb>& refCombs, MvField* mvField, const int numOfClips);
static void filterBatchTAlf(Pel inputBatch[NUM_TALF_COEFF + 1][TALF_SBB_SIZE][TALF_SBB_SIZE], const int *filterCoeff
, const Position pos, PelBuf &dstBuf, PelBuf &recBuf, const int numCoeff, const int offset, const int shift
, const ClpRng& clpRng);
static int groupSumTAlf(Pel* a, Pel* b);
void filterBlkTAlf(CodingStructure &cs, const ComponentID compId, PelBuf &recBuf0, PelBuf &recBuf1, const UnitArea& ctu
, TAlfCtbParam& ctbControl, std::vector<TAlfFilterParam>& params, const TAlfControl talfControl);
void applyTAlfFilter(CodingStructure &cs, const ComponentID compId, PelUnitBuf &recAfterALF, PelUnitBuf &recBeforeALF
, std::vector<TAlfFilterParam>& params, TAlfCtbParam* tAlfControl, const TAlfControl talfControl);
void (*m_setTAlfInput[2])(Pel input[4][NUM_TALF_COEFF + 1][TALF_SBB_SIZE][TALF_SBB_SIZE], const CodingStructure& cs
, const ComponentID compId, const CPelBuf& recBuf, const Pel clipMax[4][MAX_NUM_ALF_LUMA_COEFF]
, const Pel clipMin[4][MAX_NUM_ALF_LUMA_COEFF], const Position curPos, const int shapeIdx, const int picWidth
, const int picHeight, const int mode, std::vector<refComb>& refCombs, MvField* mvField, const int numOfClips);
int (*m_groupSumTAlf)(Pel *a, Pel *b);
void (*m_filterBatchTAlf)(Pel inputBatch[NUM_TALF_COEFF + 1][TALF_SBB_SIZE][TALF_SBB_SIZE], const int *filterCoeff
, const Position pos, PelBuf &dstBuf, PelBuf &recBuf, const int numCoeff, const int offset, const int shift
, const ClpRng& clpRng);
#endif
#ifdef TARGET_SIMD_X86
void initAdaptiveLoopFilterX86();
template <X86_VEXT vext>
......@@ -818,6 +1024,9 @@ protected:
#endif
bool m_created = false;
short m_chromaCoeffFinal[MAX_NUM_ALF_ALTERNATIVES_CHROMA][MAX_NUM_ALF_CHROMA_COEFF];
#if JVET_AK0123_ALF_COEFF_RESTRICTION
char m_chromaScaleIdxFinal[MAX_NUM_ALF_ALTERNATIVES_LUMA][1];
#endif
AlfParam* m_alfParamChroma;
Pel m_alfClippingValues[MAX_NUM_CHANNEL_TYPE][MaxAlfNumClippingValues];
std::vector<AlfFilterShape> m_filterShapesCcAlf;
......@@ -860,6 +1069,10 @@ protected:
short m_clippApsLuma[ALF_CTB_MAX_NUM_APS][MAX_NUM_ALF_ALTERNATIVES_LUMA][MAX_NUM_ALF_LUMA_COEFF * MAX_NUM_ALF_CLASSES];
#endif
short m_coeffFinal[MAX_NUM_ALF_ALTERNATIVES_LUMA][MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF];
#if JVET_AK0123_ALF_COEFF_RESTRICTION
char m_scaleIdxApsLuma[ALF_CTB_MAX_NUM_APS][MAX_NUM_ALF_ALTERNATIVES_LUMA][MAX_NUM_ALF_CLASSES];
char m_scaleIdxFinal[MAX_NUM_ALF_ALTERNATIVES_LUMA][MAX_NUM_ALF_CLASSES];
#endif
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT
Pel m_clippFinal[MAX_NUM_ALF_ALTERNATIVES_LUMA][MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF];
#else
......@@ -900,6 +1113,10 @@ protected:
#if JVET_AD0222_ADDITONAL_ALF_FIXFILTER
Pel*** m_gaussPic;
Pel*** m_gaussCtu;
#endif
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
Pel*** m_laplacianPic;
Pel*** m_laplacianCtu;
#endif
const int usedWindowIdx[NUM_CLASSIFIER] = { 1, 5 };
int m_mappingDir[NUM_DIR_FIX][NUM_DIR_FIX];
......@@ -930,7 +1147,7 @@ protected:
PelStorage m_tempBufSAO;
PelStorage m_tempBufSAO2;
#endif
#if JVET_AJ0188_CODING_INFO_CLASSIFICATION
#if JVET_AJ0188_CODING_INFO_CLASSIFICATION || JVET_AK0091_LAPLACIAN_INFO_IN_ALF
PelStorage m_tempBufCodingInfo;
PelStorage m_tempBufCodingInfo2;
#endif
......@@ -963,6 +1180,157 @@ protected:
std::vector<int> m_scaleCorrChroma;
std::vector<int> m_idxCorrPrev[ALF_CTB_MAX_NUM_APS][MAX_NUM_ALF_ALTERNATIVES_LUMA];
#endif
#if ENABLE_SIMD_OPT_ALF_CHOLESKY
public:
#if JVET_AF0177_ALF_COV_FLOAT
using cholesky_float_t = float;
#else
using cholesky_float_t = double;
#endif
using cholesky_matrix = cholesky_float_t[MAX_NUM_ALF_LUMA_COEFF][MAX_NUM_ALF_LUMA_COEFF];
static constexpr cholesky_float_t cholesky_reg_sqr = cholesky_float_t(0.0000001);
static int(*m_fastCholeskyDec)(cholesky_matrix inpMatr, cholesky_matrix outMatr, int numEq);
static int fastCholeskyDec(cholesky_matrix inpMatr, cholesky_matrix outMatr, int numEq);
#endif
};
#if JVET_AK0123_ALF_COEFF_RESTRICTION
class ALFCoeffRestriction
{
public:
struct InputParam
{
int8_t bitWidth;
int8_t mantissa;
InputParam(int8_t bitWidth, int8_t mantissa) : bitWidth(bitWidth), mantissa(mantissa)
{
}
bool operator<(const InputParam& right) const
{
if (bitWidth != right.bitWidth)
{
return bitWidth < right.bitWidth;
}
return mantissa < right.mantissa;
}
};
struct Param
{
int16_t minValue, maxValue;
std::vector<int16_t> idxToCoeff;
std::vector<int16_t> coeffToIdx;
};
private:
static std::map<InputParam, Param> m_cache;
InputParam m_inputParam;
Param* m_param;
void build();
public:
ALFCoeffRestriction(int bitWidth, int mantissa);
void init();
const InputParam& getInputParam() { return m_inputParam; }
const Param& getParam() { return *m_param; }
};
class HuffmanForALF
{
public:
struct InputParam
{
bool isLuma;
int8_t bitWidth;
int8_t mantissa;
int8_t coeffGroup;
InputParam(bool isLuma, int8_t bitWidth, int8_t mantissa, int8_t coeffGroup) : isLuma(isLuma), bitWidth(bitWidth), mantissa(mantissa), coeffGroup(coeffGroup)
{
}
bool operator<(const InputParam& right) const
{
if (isLuma != right.isLuma)
{
return isLuma < right.isLuma;
}
if (bitWidth != right.bitWidth)
{
return bitWidth < right.bitWidth;
}
if (mantissa != right.mantissa)
{
return mantissa < right.mantissa;
}
return coeffGroup < right.coeffGroup;
}
};
struct Node
{
int16_t coeffIdx;
Node* zero;
Node* one;
};
struct Param
{
Node* root;
std::vector<std::pair<uint32_t, int8_t>> codeTableAndLength;
Param() : root(nullptr)
{
}
void dfsDelete(Node* node)
{
if (node)
{
dfsDelete(node->zero);
dfsDelete(node->one);
delete node;
}
}
~Param()
{
dfsDelete(root);
}
};
private:
static std::map<InputParam, std::vector<int>> m_stats;
static std::map<InputParam, Param> m_cache;
InputParam m_inputParam;
ALFCoeffRestriction m_coeff;
Param* m_param;
void build();
void buildHuffmanTree();
void buildCodeTable();
void buildCodeTable(Node* node, uint32_t code, int level);
public:
HuffmanForALF(bool isLuma, int bitWidth, int mantissa, int coeffGroup);
void init();
const InputParam& getInputParam() { return m_inputParam; }
const Param& getParam() { return *m_param; }
void setGroup(int coeffGroup);
bool encodeCoeff(int16_t coeff, uint32_t& symbol, int& length);
bool decodeBit(int8_t bit, Node*& node);
int16_t getCoeff(Node* node);
};
#endif
#endif
......@@ -74,6 +74,13 @@ enum AlfFilterType
#if JVET_AC0162_ALF_RESIDUAL_SAMPLES_INPUT
ALF_FILTER_13_EXT_DB_RESI_DIRECT,
ALF_FILTER_13_EXT_DB_RESI,
#if FIXFILTER_CFG
ALF_FILTER_13_DB_RESI_DIRECT,
ALF_FILTER_13_DB_RESI,
#endif
#endif
#if FIXFILTER_CFG
ALF_FILTER_9_NO_FIX,
#endif
#endif
ALF_NUM_OF_FILTER_TYPES
......@@ -91,10 +98,26 @@ static const int size_ALF_FILTER_13_EXT_DB = -6;
#if JVET_AC0162_ALF_RESIDUAL_SAMPLES_INPUT
static const int size_ALF_FILTER_13_EXT_DB_RESI_DIRECT = -7;
static const int size_ALF_FILTER_13_EXT_DB_RESI = -8;
#if FIXFILTER_CFG
static const int size_ALF_FILTER_13_DB_RESI_DIRECT = -9;
static const int size_ALF_FILTER_13_DB_RESI = -10;
#endif
#endif
#if FIXFILTER_CFG
static const int size_ALF_FILTER_9_NO_FIX = -11;
#endif
#if JVET_AK0065_TALF
static const int size_TALF = -100;
#endif
const int alfTypeToSize[ALF_NUM_OF_FILTER_TYPES] = { 5, 7, size_CC_ALF, 9, size_ALF_FILTER_9_EXT, size_ALF_FILTER_EXT, size_ALF_FILTER_13_EXT, size_ALF_FILTER_9_EXT_DB, size_ALF_FILTER_13_EXT_DB
#if JVET_AC0162_ALF_RESIDUAL_SAMPLES_INPUT
,size_ALF_FILTER_13_EXT_DB_RESI_DIRECT, size_ALF_FILTER_13_EXT_DB_RESI
#if FIXFILTER_CFG
,size_ALF_FILTER_13_DB_RESI_DIRECT, size_ALF_FILTER_13_DB_RESI
#endif
#endif
#if FIXFILTER_CFG
, size_ALF_FILTER_9_NO_FIX
#endif
};
#elif JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
......@@ -213,6 +236,37 @@ struct AlfFilterShape
offset0 = ALF_ORDER;
#endif
}
#if FIXFILTER_CFG
else if( size == size_ALF_FILTER_9_NO_FIX )
{
filterLength = 9;
filterSize = 9 * 9 / 2 + 1 ;
pattern = {
0,
1, 2, 3,
4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 19, 18, 17, 16,
15, 14, 13, 12, 11, 10, 9,
8, 7, 6, 5, 4,
3, 2, 1,
0
};
weights = {
2,
2, 2, 2,
2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 1, 1
};
filterType = ALF_FILTER_9_NO_FIX;
numCoeff = 21;
numOrder = 1;
indexSecOrder = 20;
offset0 = 0;
}
#endif
else if( size == size_ALF_FILTER_9_EXT )
{
size = 9;
......@@ -446,8 +500,13 @@ struct AlfFilterShape
{
size = 13;
#if JVET_AD0222_ALF_LONG_FIXFILTER && JVET_AD0222_ADDITONAL_ALF_FIXFILTER
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
numCoeff = 11 + EXT_LENGTH + NUM_DB + NUM_FIXED_BASED_COEFF_NEW - 1 + NUM_RESI + 1 + 1 + NUM_LAPLACIAN_FILTERED_COEFF;
filterSize = 11 + EXT_LENGTH + NUM_DB + NUM_FIXED_BASED_COEFF_NEW - 1 + NUM_RESI + 1 + 1 + NUM_LAPLACIAN_FILTERED_COEFF;
#else
numCoeff = 11 + EXT_LENGTH + NUM_DB + NUM_FIXED_BASED_COEFF_NEW - 1 + NUM_RESI + 1 + 1;
filterSize = 11 + EXT_LENGTH + NUM_DB + NUM_FIXED_BASED_COEFF_NEW - 1 + NUM_RESI + 1 + 1;
#endif
#elif JVET_AD0222_ALF_LONG_FIXFILTER
numCoeff = 11 + EXT_LENGTH + NUM_DB + NUM_FIXED_BASED_COEFF_NEW - 1 + NUM_RESI + 1;
filterSize = 11 + EXT_LENGTH + NUM_DB + NUM_FIXED_BASED_COEFF_NEW - 1 + NUM_RESI + 1;
......@@ -477,7 +536,11 @@ struct AlfFilterShape
};
numOrder = 2;
#if JVET_AD0222_ALF_LONG_FIXFILTER && JVET_AD0222_ADDITONAL_ALF_FIXFILTER
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
indexSecOrder = 8 + NUM_DB + NUM_FIXED_BASED_COEFF_NEW - 1 + NUM_RESI + NUM_LAPLACIAN_FILTERED_COEFF - NUM_LAPLACIAN_FILTERED_SOURCE;
#else
indexSecOrder = 8 + NUM_DB + NUM_FIXED_BASED_COEFF_NEW - 1 + NUM_RESI;
#endif
#elif JVET_AD0222_ALF_LONG_FIXFILTER
indexSecOrder = 8 + NUM_DB + NUM_FIXED_BASED_COEFF_NEW - 1 + NUM_RESI;
#elif JVET_AD0222_ADDITONAL_ALF_FIXFILTER
......@@ -487,6 +550,98 @@ struct AlfFilterShape
#endif
offset0 = 0;
}
#if FIXFILTER_CFG
else if (size == size_ALF_FILTER_13_DB_RESI_DIRECT)
{
size = 13;
#if JVET_AD0222_ALF_LONG_FIXFILTER && JVET_AD0222_ADDITONAL_ALF_FIXFILTER
numCoeff = 11 + NUM_DB + NUM_RESI + NUM_GAUSS_FILTERED_COEFF;
filterSize = 11 + NUM_DB + NUM_RESI + NUM_GAUSS_FILTERED_COEFF;
#elif JVET_AD0222_ALF_LONG_FIXFILTER
numCoeff = 11 + NUM_DB + NUM_RESI;
filterSize = 11 + NUM_DB + NUM_RESI;
#elif JVET_AD0222_ADDITONAL_ALF_FIXFILTER
numCoeff = 21 + NUM_DB + NUM_RESI + NUM_GAUSS_FILTERED_COEFF;
filterSize = 21 + NUM_DB + NUM_RESI + NUM_GAUSS_FILTERED_COEFF;
#else
numCoeff = 21 + NUM_DB;
filterSize = 21 + NUM_DB;
#endif
filterLength = 13;
filterType = ALF_FILTER_13_DB_RESI_DIRECT;
pattern = {
0,
1,
2,
3,
4, 5, 6, 7, 8,
9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, 14,
13, 12, 11, 10, 9,
8, 7, 6, 5, 4,
3,
2,
1,
0
};
numOrder = 2;
#if JVET_AD0222_ALF_LONG_FIXFILTER && JVET_AD0222_ADDITONAL_ALF_FIXFILTER
indexSecOrder = 8 + NUM_DB + NUM_RESI + NUM_GAUSS_FILTERED_COEFF - NUM_GAUSS_FILTERED_SOURCE;
#elif JVET_AD0222_ALF_LONG_FIXFILTER
indexSecOrder = 8 + NUM_DB + NUM_RESI;
#elif JVET_AD0222_ADDITONAL_ALF_FIXFILTER
indexSecOrder = 18 + NUM_DB + NUM_RESI + NUM_GAUSS_FILTERED_COEFF - NUM_GAUSS_FILTERED_SOURCE;
#else
indexSecOrder = 18 + NUM_DB + NUM_RESI;
#endif
offset0 = 0;
}
else if (size == size_ALF_FILTER_13_DB_RESI)
{
size = 13;
#if JVET_AD0222_ALF_LONG_FIXFILTER && JVET_AD0222_ADDITONAL_ALF_FIXFILTER
numCoeff = 11 + NUM_DB + NUM_RESI + 1;
filterSize = 11 + NUM_DB + NUM_RESI + 1;
#elif JVET_AD0222_ALF_LONG_FIXFILTER
numCoeff = 11 + NUM_DB + NUM_RESI + 1;
filterSize = 11 + NUM_DB + NUM_RESI + 1;
#elif JVET_AD0222_ADDITONAL_ALF_FIXFILTER
numCoeff = 21 + NUM_DB + NUM_RESI + 1 + 1;
filterSize = 21 + NUM_DB + NUM_RESI + 1 + 1;
#else
numCoeff = 21 + NUM_DB + NUM_RESI + 1;
filterSize = 21 + NUM_DB + NUM_RESI + 1;
#endif
filterLength = 13;
filterType = ALF_FILTER_13_DB_RESI;
pattern = {
0,
1,
2,
3,
4, 5, 6, 7, 8,
9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, 14,
13, 12, 11, 10, 9,
8, 7, 6, 5, 4,
3,
2,
1,
0
};
numOrder = 2;
#if JVET_AD0222_ALF_LONG_FIXFILTER && JVET_AD0222_ADDITONAL_ALF_FIXFILTER
indexSecOrder = 8 + NUM_DB + NUM_RESI;
#elif JVET_AD0222_ALF_LONG_FIXFILTER
indexSecOrder = 8 + NUM_DB + NUM_RESI;
#elif JVET_AD0222_ADDITONAL_ALF_FIXFILTER
indexSecOrder = 18 + NUM_DB + NUM_RESI;
#else
indexSecOrder = 18 + NUM_DB + NUM_RESI;
#endif
offset0 = 0;
}
#endif
#endif
#endif
else if( size == size_CC_ALF )
......@@ -503,6 +658,12 @@ struct AlfFilterShape
#endif
filterType = CC_ALF;
}
#if JVET_AK0065_TALF
else if (size <= size_TALF)
{
numCoeff = abs(size - size_TALF);
}
#endif
else
{
filterType = ALF_NUM_OF_FILTER_TYPES;
......@@ -698,6 +859,9 @@ struct AlfParam
#endif
#if JVET_AG0158_ALF_LUMA_COEFF_PRECISION
char coeffBits[MAX_NUM_ALF_ALTERNATIVES_LUMA];
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
char coeffMantissa[MAX_NUM_ALF_ALTERNATIVES_LUMA];
#endif
AlfFilterType filterType[MAX_NUM_CHANNEL_TYPE];
bool nonLinearFlag[MAX_NUM_CHANNEL_TYPE][32]; // alf_[luma/chroma]_clip_flag
......@@ -732,6 +896,10 @@ struct AlfParam
bool alfLumaCoeffDeltaFlag; // alf_luma_coeff_delta_flag
std::vector<AlfFilterShape>* filterShapes;
bool newFilterFlag[MAX_NUM_CHANNEL_TYPE];
#if JVET_AK0123_ALF_COEFF_RESTRICTION
char lumaScaleIdx[MAX_NUM_ALF_ALTERNATIVES_LUMA][MAX_NUM_ALF_CLASSES];
char chromaScaleIdx[MAX_NUM_ALF_ALTERNATIVES_CHROMA][1];
#endif
AlfParam()
{
......@@ -747,6 +915,9 @@ struct AlfParam
#endif
#if JVET_AG0158_ALF_LUMA_COEFF_PRECISION
std::memset( coeffBits, 0, sizeof( coeffBits ) );
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
std::memset(coeffMantissa, 0, sizeof(coeffMantissa));
#endif
std::memset( lumaCoeff, 0, sizeof( lumaCoeff ) );
std::memset( lumaClipp, 0, sizeof( lumaClipp ) );
......@@ -767,6 +938,10 @@ struct AlfParam
#endif
alfLumaCoeffDeltaFlag = false;
memset(newFilterFlag, 0, sizeof(newFilterFlag));
#if JVET_AK0123_ALF_COEFF_RESTRICTION
std::memset(lumaScaleIdx, 0, sizeof(lumaScaleIdx));
std::memset(chromaScaleIdx, 0, sizeof(chromaScaleIdx));
#endif
}
const AlfParam& operator = ( const AlfParam& src )
......@@ -778,6 +953,9 @@ struct AlfParam
#endif
#if JVET_AG0158_ALF_LUMA_COEFF_PRECISION
std::memcpy( coeffBits, src.coeffBits, sizeof( coeffBits ) );
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
std::memcpy(coeffMantissa, src.coeffMantissa, sizeof(coeffMantissa));
#endif
std::memcpy( lumaCoeff, src.lumaCoeff, sizeof( lumaCoeff ) );
std::memcpy( lumaClipp, src.lumaClipp, sizeof( lumaClipp ) );
......@@ -796,6 +974,10 @@ struct AlfParam
alfLumaCoeffDeltaFlag = src.alfLumaCoeffDeltaFlag;
filterShapes = src.filterShapes;
std::memcpy(newFilterFlag, src.newFilterFlag, sizeof(newFilterFlag));
#if JVET_AK0123_ALF_COEFF_RESTRICTION
std::memcpy(lumaScaleIdx, src.lumaScaleIdx, sizeof(lumaScaleIdx));
std::memcpy(chromaScaleIdx, src.chromaScaleIdx, sizeof(chromaScaleIdx));
#endif
return *this;
}
......@@ -826,6 +1008,12 @@ struct AlfParam
return false;
}
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
if (memcmp(coeffMantissa, other.coeffMantissa, sizeof(coeffMantissa)))
{
return false;
}
#endif
#endif
if( memcmp( lumaCoeff, other.lumaCoeff, sizeof( lumaCoeff ) ) )
{
......@@ -878,6 +1066,16 @@ struct AlfParam
{
return false;
}
#if JVET_AK0123_ALF_COEFF_RESTRICTION
if (memcmp(lumaScaleIdx, other.lumaScaleIdx, sizeof(lumaScaleIdx)))
{
return false;
}
if (memcmp(chromaScaleIdx, other.chromaScaleIdx, sizeof(chromaScaleIdx)))
{
return false;
}
#endif
return true;
}
......@@ -1063,6 +1261,17 @@ struct CcSaoPrvParam
};
#endif
#endif
#if JVET_AK0065_TALF
const Position templateShape0[NUM_TALF_COEFF] = {
Position( 0, 0), Position( 1, 0), Position( 0, 1), Position( 1, 1), Position(-1, 1), Position( 2, 0), Position( 0, 2),
Position(-2, 1), Position( 2, 1), Position(-1, 2), Position( 1, 2), Position( 3, 0), Position( 0, 3)
};
const Position templateShape1[NUM_TALF_COEFF] = {
Position( 0, 0), Position( 1, 0), Position( 0, 1), Position( 1, 1), Position(-1, 1), Position( 2, 0), Position( 0, 2),
Position( 3, 0), Position( 0, 3), Position( 4, 0), Position( 0, 4), Position( 5, 0), Position( 0, 5)
};
#endif
//! \}
#endif // end of #ifndef __ALFPARAMETERS__
......@@ -97,7 +97,11 @@ void BilateralFilter::destroy()
{
}
#if JVET_V0094_BILATERAL_FILTER
const char* BilateralFilter::getFilterLutParameters(int16_t* block, const int stride, const int width, const int height, const PredMode predMode, const int32_t qp, int& bfac)
const char* BilateralFilter::getFilterLutParameters(int16_t* block, const int stride, const int width, const int height, const PredMode predMode, const int32_t qp, int& bfac
#if JVET_AK0118_BF_FOR_INTRA_PRED
, int& madValue
#endif
)
{
#if JVET_AF0112_BIF_DYNAMIC_SCALING
int w = floorLog2(width);
......@@ -113,6 +117,9 @@ const char* BilateralFilter::getFilterLutParameters(int16_t* block, const int st
w = std::min(w, 7);
h = std::min(h, 7);
mad = std::min(mad >> 4, 15);
#if JVET_AK0118_BF_FOR_INTRA_PRED
madValue = mad;
#endif
bfac = m_tuSizeFactor[predMode == MODE_INTER][w * 8 + h];
if (bfac) // BIF is not applied if tuSizeFactor[(w, h)] = 0
......@@ -198,7 +205,11 @@ inline void bifApplyLut(int diff, int& res, int cutBitsNum, int bitsRound, int b
}
#if JVET_AJ0237_INTERNAL_12BIT
void BilateralFilter::blockBilateralFilterDiamond5x5(uint32_t uiWidth, uint32_t uiHeight, int16_t block[], int16_t blkFilt[], const ClpRng& clpRng, Pel* recPtr, int recStride, int iWidthExtSIMD, int bfac, int bifRoundAdd, int bifRoundShift, bool isRDO, const char* lutRowPtr, bool noClip, int cutBitsNum, int bdShift)
void BilateralFilter::blockBilateralFilterDiamond5x5(uint32_t uiWidth, uint32_t uiHeight, int16_t block[], int16_t blkFilt[], const ClpRng& clpRng, Pel* recPtr, int recStride, int iWidthExtSIMD, int bfac, int bifRoundAdd, int bifRoundShift, bool isRDO, const char* lutRowPtr, bool noClip, int cutBitsNum, int bdShift
#if JVET_AK0118_BF_FOR_INTRA_PRED
, bool isIntraPredBf
#endif
)
#else
void BilateralFilter::blockBilateralFilterDiamond5x5( uint32_t uiWidth, uint32_t uiHeight, int16_t block[], int16_t blkFilt[], const ClpRng& clpRng, Pel* recPtr, int recStride, int iWidthExtSIMD, int bfac, int bifRoundAdd, int bifRoundShift, bool isRDO, const char* lutRowPtr, bool noClip, int cutBitsNum)
#endif
......@@ -379,6 +390,23 @@ void BilateralFilter::blockBilateralFilterDiamond5x5( uint32_t uiWidth, uint32_t
#endif
}
}
#if JVET_AK0118_BF_FOR_INTRA_PRED
if( isIntraPredBf )
{
Pel* srcPtr = block + pad * padwidth + pad;
Pel* dstPtr = blkFilt + pad * padwidth + pad;
for(int yy = 0; yy < uiHeight; yy++)
{
for(int xx = 0; xx < uiWidth; xx++)
{
dstPtr[xx] = noClip ? dstPtr[xx] + srcPtr[xx] : ClipPel( dstPtr[xx] + srcPtr[xx], clpRng);
}
srcPtr += padwidth;
dstPtr += padwidth;
}
return;
}
#endif
// Copy back
Pel* tempBlockPtr = blkFilt + pad * padwidth + pad;
......@@ -481,6 +509,10 @@ void BilateralFilter::bilateralFilterRDOdiamond5x5(const ComponentID compID, Pel
memset(tempblock, 0, iWidthExtSIMD*uiHeightExt * sizeof(Pel));
Pel *tempBlockPtr = tempblock + NUMBER_PADDED_SAMPLES* iWidthExtSIMD + NUMBER_PADDED_SAMPLES;
#if JVET_AK0118_BF_FOR_INTRA_PRED
int lumaMadValue = 0;
bool isIntraPredBf = false;
#endif
//// Clip and move block to temporary block
if( useReco )
......@@ -655,7 +687,11 @@ void BilateralFilter::bilateralFilterRDOdiamond5x5(const ComponentID compID, Pel
if (isLuma(compID))
{
lutRowPtr = getFilterLutParameters(tempblock + iWidthExtSIMD * 2 + 2, iWidthExtSIMD, uiWidth, uiHeight, currTU.cu->predMode, qp + currTU.cs->pps->getBIFQPOffset(), bfac);
lutRowPtr = getFilterLutParameters(tempblock + iWidthExtSIMD * 2 + 2, iWidthExtSIMD, uiWidth, uiHeight, currTU.cu->predMode, qp + currTU.cs->pps->getBIFQPOffset(), bfac
#if JVET_AK0118_BF_FOR_INTRA_PRED
, lumaMadValue
#endif
);
}
else
{
......@@ -679,7 +715,11 @@ void BilateralFilter::bilateralFilterRDOdiamond5x5(const ComponentID compID, Pel
}
#if JVET_AJ0237_INTERNAL_12BIT
int bdShift = std::max(0, internalBitDepth - 10);
m_bilateralFilterDiamond5x5(uiWidth, uiHeight, tempblock, tempblockFiltered, clpRng, piReco, uiRecStride, iWidthExtSIMD, bfac, bifRoundAdd, bifRoundShift, true, lutRowPtr, false, cutBitsNum, bdShift);
m_bilateralFilterDiamond5x5(uiWidth, uiHeight, tempblock, tempblockFiltered, clpRng, piReco, uiRecStride, iWidthExtSIMD, bfac, bifRoundAdd, bifRoundShift, true, lutRowPtr, false, cutBitsNum, bdShift
#if JVET_AK0118_BF_FOR_INTRA_PRED
, isIntraPredBf
#endif
);
#else
m_bilateralFilterDiamond5x5(uiWidth, uiHeight, tempblock, tempblockFiltered, clpRng, piReco, uiRecStride, iWidthExtSIMD, bfac, bifRoundAdd, bifRoundShift, true, lutRowPtr, false, cutBitsNum);
#endif
......@@ -712,6 +752,10 @@ void BilateralFilter::bilateralFilterDiamond5x5( const ComponentID compID, const
#if JVET_AJ0237_INTERNAL_12BIT
int bdShift = std::max(0, internalBitDepth - 10);
#endif
#if JVET_AK0118_BF_FOR_INTRA_PRED
int lumaMadValue = 0;
bool isIntraPredBf = false;
#endif
#if JVET_Z0105_LOOP_FILTER_VIRTUAL_BOUNDARY
const int scaleX = getChannelTypeScaleX( toChannelType( compID ), currTU.cu->cs->pcv->chrFormat );
const int scaleY = getChannelTypeScaleY( toChannelType( compID ), currTU.cu->cs->pcv->chrFormat );
......@@ -971,7 +1015,11 @@ void BilateralFilter::bilateralFilterDiamond5x5( const ComponentID compID, const
int cutBitsNum = 3;
if (isLuma(compID))
{
lutRowPtr = getFilterLutParameters(tempblock + iWidthExtSIMD * 2 + 2, iWidthExtSIMD, uiWidth, uiHeight, currTU.cu->predMode, qp + currTU.cs->pps->getBIFQPOffset(), bfac);
lutRowPtr = getFilterLutParameters(tempblock + iWidthExtSIMD * 2 + 2, iWidthExtSIMD, uiWidth, uiHeight, currTU.cu->predMode, qp + currTU.cs->pps->getBIFQPOffset(), bfac
#if JVET_AK0118_BF_FOR_INTRA_PRED
, lumaMadValue
#endif
);
}
else
{
......@@ -996,7 +1044,11 @@ void BilateralFilter::bilateralFilterDiamond5x5( const ComponentID compID, const
int bifRoundShift = BIF_ROUND_SHIFT - currTU.cs->pps->getBIFStrength();
#if JVET_AJ0237_INTERNAL_12BIT
m_bilateralFilterDiamond5x5(uiWidth, uiHeight, tempblock, tempblockFiltered, clpRng, recPtr, recStride, iWidthExtSIMD, bfac, bifRoundAdd, bifRoundShift, false, lutRowPtr, false, cutBitsNum, bdShift);
m_bilateralFilterDiamond5x5(uiWidth, uiHeight, tempblock, tempblockFiltered, clpRng, recPtr, recStride, iWidthExtSIMD, bfac, bifRoundAdd, bifRoundShift, false, lutRowPtr, false, cutBitsNum, bdShift
#if JVET_AK0118_BF_FOR_INTRA_PRED
, isIntraPredBf
#endif
);
#else
m_bilateralFilterDiamond5x5(uiWidth, uiHeight, tempblock, tempblockFiltered, clpRng, recPtr, recStride, iWidthExtSIMD, bfac, bifRoundAdd, bifRoundShift, false, lutRowPtr, false, cutBitsNum);
#endif
......@@ -1242,7 +1294,11 @@ void BilateralFilter::bilateralFilterDiamond5x5( const ComponentID compID, const
if (isLuma(compID))
{
lutRowPtr = getFilterLutParameters(tempblock + iWidthExtSIMD * 2 + 2, iWidthExtSIMD, uiWidth, uiHeight, currTU.cu->predMode, qp + currTU.cs->pps->getBIFQPOffset(), bfac);
lutRowPtr = getFilterLutParameters(tempblock + iWidthExtSIMD * 2 + 2, iWidthExtSIMD, uiWidth, uiHeight, currTU.cu->predMode, qp + currTU.cs->pps->getBIFQPOffset(), bfac
#if JVET_AK0118_BF_FOR_INTRA_PRED
, lumaMadValue
#endif
);
}
else
{
......@@ -1266,7 +1322,11 @@ void BilateralFilter::bilateralFilterDiamond5x5( const ComponentID compID, const
int bifRoundAdd = BIF_ROUND_ADD >> currTU.cs->pps->getBIFStrength();
int bifRoundShift = BIF_ROUND_SHIFT - currTU.cs->pps->getBIFStrength();
#if JVET_AJ0237_INTERNAL_12BIT
m_bilateralFilterDiamond5x5(uiWidth, uiHeight, tempblock, tempblockFiltered, clpRng, recPtr, recStride, iWidthExtSIMD, bfac, bifRoundAdd, bifRoundShift, false, lutRowPtr, noClip, cutBitsNum, bdShift);
m_bilateralFilterDiamond5x5(uiWidth, uiHeight, tempblock, tempblockFiltered, clpRng, recPtr, recStride, iWidthExtSIMD, bfac, bifRoundAdd, bifRoundShift, false, lutRowPtr, noClip, cutBitsNum, bdShift
#if JVET_AK0118_BF_FOR_INTRA_PRED
, isIntraPredBf
#endif
);
#else
m_bilateralFilterDiamond5x5(uiWidth, uiHeight, tempblock, tempblockFiltered, clpRng, recPtr, recStride, iWidthExtSIMD, bfac, bifRoundAdd, bifRoundShift, false, lutRowPtr, noClip, cutBitsNum);
#endif
......
......@@ -58,7 +58,11 @@ public:
#endif
class BilateralFilter
{
#if JVET_AK0118_BF_FOR_INTRA_PRED
public:
#else
private:
#endif
// 128x128 is the max TU size, 4 is the padding for the considered neighborhood, 16 is the AVX buffer size.
// (128 + 4 + 16) * (128 + 4) = 19536.
Pel tempblockSIMD[19536];
......@@ -68,8 +72,16 @@ private:
Pel* tempblockFiltered = (Pel*)tempblockFilteredSIMD;
#if JVET_AJ0237_INTERNAL_12BIT
void (*m_bilateralFilterDiamond5x5)(uint32_t uiWidth, uint32_t uiHeight, int16_t block[], int16_t blkFilt[], const ClpRng& clpRng, Pel* recPtr, int recStride, int iWidthExtSIMD, int bfac, int bifRoundAdd, int bifRoundShift, bool isRDO, const char* lutRowPtr, bool noClip, int cutBitsNum, int bdShift);
static void blockBilateralFilterDiamond5x5(uint32_t uiWidth, uint32_t uiHeight, int16_t block[], int16_t blkFilt[], const ClpRng& clpRng, Pel* recPtr, int recStride, int iWidthExtSIMD, int bfac, int bifRoundAdd, int bifRoundShift, bool isRDO, const char* lutRowPtr, bool noClip, int cutBitsNum, int bdShift);
void (*m_bilateralFilterDiamond5x5)(uint32_t uiWidth, uint32_t uiHeight, int16_t block[], int16_t blkFilt[], const ClpRng& clpRng, Pel* recPtr, int recStride, int iWidthExtSIMD, int bfac, int bifRoundAdd, int bifRoundShift, bool isRDO, const char* lutRowPtr, bool noClip, int cutBitsNum, int bdShift
#if JVET_AK0118_BF_FOR_INTRA_PRED
, bool isIntraPredBf
#endif
);
static void blockBilateralFilterDiamond5x5(uint32_t uiWidth, uint32_t uiHeight, int16_t block[], int16_t blkFilt[], const ClpRng& clpRng, Pel* recPtr, int recStride, int iWidthExtSIMD, int bfac, int bifRoundAdd, int bifRoundShift, bool isRDO, const char* lutRowPtr, bool noClip, int cutBitsNum, int bdShift
#if JVET_AK0118_BF_FOR_INTRA_PRED
, bool isIntraPredBf
#endif
);
#else
void (*m_bilateralFilterDiamond5x5)(uint32_t uiWidth, uint32_t uiHeight, int16_t block[], int16_t blkFilt[], const ClpRng& clpRng, Pel* recPtr, int recStride, int iWidthExtSIMD, int bfac, int bifRoundAdd, int bifRoundShift, bool isRDO, const char* lutRowPtr, bool noClip, int cutBitsNum);
static void blockBilateralFilterDiamond5x5(uint32_t uiWidth, uint32_t uiHeight, int16_t block[], int16_t blkFilt[], const ClpRng& clpRng, Pel* recPtr, int recStride, int iWidthExtSIMD, int bfac, int bifRoundAdd, int bifRoundShift, bool isRDO, const char* lutRowPtr, bool noClip, int cutBitsNum);
......@@ -231,6 +243,9 @@ public:
#if JVET_AJ0237_INTERNAL_12BIT
void setInternalBitDepth(int bdDepth) { internalBitDepth = bdDepth; }
#endif
#if JVET_AK0118_BF_FOR_INTRA_PRED
int getInternalBitDepth() { return internalBitDepth; }
#endif
#if JVET_V0094_BILATERAL_FILTER
void bilateralFilterRDOdiamond5x5(const ComponentID compID, PelBuf& resiBuf, const CPelBuf& predBuf, PelBuf& recoBuf, int32_t qp, const CPelBuf& recIPredBuf, const ClpRng& clpRng, TransformUnit & currTU, bool useReco, bool doReshape = false, std::vector<Pel>* pLUT = nullptr);
void bilateralFilterPicRDOperCTU(const ComponentID compID, CodingStructure& cs, PelUnitBuf& src,BIFCabacEst* bifCABACEstimator);
......@@ -241,7 +256,11 @@ public:
#endif
);
const char* getFilterLutParameters(int16_t* block, const int stride, const int width, const int height, const PredMode predMode, const int qp, int& bfac);
const char* getFilterLutParameters(int16_t* block, const int stride, const int width, const int height, const PredMode predMode, const int qp, int& bfac
#if JVET_AK0118_BF_FOR_INTRA_PRED
, int& madValue
#endif
);
void clipNotBilaterallyFilteredBlocks(const ComponentID compID, const CPelUnitBuf& src, PelUnitBuf& rec, const ClpRng& clpRng, TransformUnit & currTU);
#endif
......@@ -257,7 +276,11 @@ public:
#ifdef TARGET_SIMD_X86
#if JVET_AJ0237_INTERNAL_12BIT
template<X86_VEXT vext>
static void simdFilterDiamond5x5(uint32_t uiWidth, uint32_t uiHeight, int16_t block[], int16_t blkFilt[], const ClpRng& clpRng, Pel* recPtr, int recStride, int iWidthExtSIMD, int bfac, int bifRoundAdd, int bifRoundShift, bool isRDO, const char* lutRowPtr, bool noClip, int cutBitsNum, int bdShift);
static void simdFilterDiamond5x5(uint32_t uiWidth, uint32_t uiHeight, int16_t block[], int16_t blkFilt[], const ClpRng& clpRng, Pel* recPtr, int recStride, int iWidthExtSIMD, int bfac, int bifRoundAdd, int bifRoundShift, bool isRDO, const char* lutRowPtr, bool noClip, int cutBitsNum, int bdShift
#if JVET_AK0118_BF_FOR_INTRA_PRED
, bool isIntraPredBf
#endif
);
#else
template<X86_VEXT vext>
static void simdFilterDiamond5x5(uint32_t uiWidth, uint32_t uiHeight, int16_t block[], int16_t blkFilt[], const ClpRng& clpRng, Pel* recPtr, int recStride, int iWidthExtSIMD, int bfac, int bifRoundAdd, int bifRoundShift, bool isRDO, const char* lutRowPtr, bool noClip, int cutBitsNum);
......
......@@ -374,9 +374,10 @@ void calcBIOParameterCoreHighPrecision(const Pel* srcY0Tmp, const Pel* srcY1Tmp,
gX += bioParamOffset;
gY += bioParamOffset;
#endif
int shift4 = 4;
const int shift4 = 4;
dI += bioParamOffset;
int32_t temp=0, tempGX=0, tempGY=0;
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
......@@ -396,6 +397,7 @@ void calcBIOParameterCoreHighPrecision(const Pel* srcY0Tmp, const Pel* srcY1Tmp,
#endif
}
srcY0Tmp += src0Stride;
srcY1Tmp += src1Stride;
gradX0 += widthG;
......@@ -467,6 +469,7 @@ void calcBIOParamSum4CoreHighPrecision(int32_t* s1, int32_t* s2, int32_t* s3, in
*sumS6 -= w * gY[x]*meanDiff;
#endif
}
s1 += widthG;
s2 += widthG;
s3 += widthG;
......@@ -493,8 +496,9 @@ void calcBIOParameterCore(const Pel* srcY0Tmp, const Pel* srcY1Tmp, Pel* gradX0,
absGX += bioParamOffset; absGY += bioParamOffset;
dIX += bioParamOffset; dIY += bioParamOffset;
signGyGx += bioParamOffset;
int shift4 = 4;
int shift5 = 1;
const int shift4 = 4;
const int shift5 = 1;
if (dI)
{
dI += bioParamOffset;
......@@ -542,6 +546,7 @@ void calcBIOParameterCore(const Pel* srcY0Tmp, const Pel* srcY1Tmp, Pel* gradX0,
dIY[x] = (tmpGY < 0 ? -tmpDI : (tmpGY == 0 ? 0 : tmpDI));
signGyGx[x] = (tmpGY < 0 ? -tmpGX : (tmpGY == 0 ? 0 : tmpGX));
}
srcY0Tmp += src0Stride;
srcY1Tmp += src1Stride;
gradX0 += widthG;
......@@ -588,12 +593,14 @@ void calcBIOParamSum5Core(Pel* absGX, Pel* absGY, Pel* dIX, Pel* dIY, Pel* signG
sumSignGyGx[sampleIdx] += signGyGx[xx];
#endif
}
absGX += widthG;
absGY += widthG;
dIX += widthG;
dIY += widthG;
signGyGx += widthG;
}
sumDIX[sampleIdx] <<= 2;
sumDIY[sampleIdx] <<= 2;
#if JVET_AE0091_ITERATIVE_BDOF
......@@ -607,6 +614,7 @@ void calcBIOParamSum5Core(Pel* absGX, Pel* absGY, Pel* dIX, Pel* dIY, Pel* signG
dIY += (1 - 5 * widthG);
signGyGx += (1 - 5 * widthG);
}
absGX += (widthG - width);
absGY += (widthG - width);
dIX += (widthG - width);
......@@ -616,7 +624,11 @@ void calcBIOParamSum5Core(Pel* absGX, Pel* absGY, Pel* dIX, Pel* dIY, Pel* signG
}
#if JVET_AI0046_HIGH_PRECISION_BDOF_SAMPLE
void calcBIOParamSum5NOSIMCore(int32_t* absGX, int32_t* absGY, int32_t* dIX, int32_t* dIY, int32_t* signGyGx, const int widthG, const int width, const int height, int* sumAbsGX, int* sumAbsGY, int* sumDIX, int* sumDIY, int* sumSignGyGx ,Pel* dI, Pel* gX, Pel* gY)
void calcBIOParamSum5NOSIMCore(int32_t* absGX, int32_t* absGY, int32_t* dIX, int32_t* dIY, int32_t* signGyGx, const int widthG, const int width, const int height, int* sumAbsGX, int* sumAbsGY, int* sumDIX, int* sumDIY, int* sumSignGyGx ,Pel* dI
#if JVET_AG0067_DMVR_EXTENSIONS
, Pel* gX, Pel* gY
#endif
)
{
for (int y = 0; y < height; y++)
{
......@@ -628,12 +640,15 @@ void calcBIOParamSum5NOSIMCore(int32_t* absGX, int32_t* absGY, int32_t* dIX, int
sumDIX[sampleIdx] = 0;
sumDIY[sampleIdx] = 0;
sumSignGyGx[sampleIdx] = 0;
#if JVET_AG0067_DMVR_EXTENSIONS
int meanDiff = 0;
int absmeanDiff = 0;
int sX0 = 0, sX1 = 0;
#endif
int w = 1, a = 1, b = 2, c = 4, d = 4, e = 8, f = 16;
int weight[5][5] = {{a, b, c, b, a}, {b, d, e, d, b}, {c, e, f, e, c}, {b, d, e, d, b}, {a, b, c, b, a}};
int regVxVy = 2528; // = ((1 << 11) * 100)/81. 100 is summation of the new weights, 81 was the summation of the old weights
const int regVxVy = 2528; // = ((1 << 11) * 100)/81. 100 is summation of the new weights, 81 was the summation of the old weights
for (int yy = 0; yy < 5; yy++)
{
for (int xx = 0; xx < 5; xx++)
......@@ -643,11 +658,13 @@ void calcBIOParamSum5NOSIMCore(int32_t* absGX, int32_t* absGY, int32_t* dIX, int
sumAbsGY[sampleIdx] += w * absGY[xx];
sumDIX[sampleIdx] += w * dIX[xx];
sumDIY[sampleIdx] += w * dIY[xx];
sumSignGyGx[sampleIdx] += w * signGyGx[xx];
#if JVET_AG0067_DMVR_EXTENSIONS
meanDiff += dI[xx];
absmeanDiff += abs(dI[xx]);
sX0 -= w * gX[xx];
sX1 -= w * gY[xx];
sumSignGyGx[sampleIdx] += w * signGyGx[xx];
#endif
}
absGX += widthG;
absGY += widthG;
......@@ -655,12 +672,17 @@ void calcBIOParamSum5NOSIMCore(int32_t* absGX, int32_t* absGY, int32_t* dIX, int
dIY += widthG;
signGyGx += widthG;
dI += widthG;
#if JVET_AG0067_DMVR_EXTENSIONS
gX += widthG;
gY += widthG;
#endif
}
#if JVET_AG0067_DMVR_EXTENSIONS
meanDiff = (absmeanDiff > 2 * abs(meanDiff)) ? 0 : (meanDiff + 32) >> 6;
sumDIX[sampleIdx] += sX0*meanDiff;
sumDIY[sampleIdx] += sX1*meanDiff;
#endif
sumDIX[sampleIdx] += (sumDIX[sampleIdx] + 2) >> 2;
sumDIY[sampleIdx] += (sumDIY[sampleIdx] + 2) >> 2;
sumAbsGX[sampleIdx] += regVxVy;
......@@ -671,17 +693,21 @@ void calcBIOParamSum5NOSIMCore(int32_t* absGX, int32_t* absGY, int32_t* dIX, int
dIY += (1 - 5 * widthG);
signGyGx += (1 - 5 * widthG);
dI += (1 - 5 * widthG);
#if JVET_AG0067_DMVR_EXTENSIONS
gX += (1 - 5 * widthG);
gY += (1 - 5 * widthG);
#endif
}
absGX += (widthG - width);
absGY += (widthG - width);
dIX += (widthG - width);
dIY += (widthG - width);
signGyGx += (widthG - width);
dI += (widthG - width);
#if JVET_AG0067_DMVR_EXTENSIONS
gX += (widthG - width);
gY += (widthG - width);
dI += (widthG - width);
#endif
}
}
#endif
......@@ -697,6 +723,7 @@ void calcBIOParamSum4Core(Pel* absGX, Pel* absGY, Pel* dIX, Pel* dIY, Pel* signG
*sumDIY += dIY[x];
*sumSignGyGx += signGyGx[x];
}
absGX += widthG;
absGY += widthG;
dIX += widthG;
......@@ -759,6 +786,7 @@ void addBIOAvgNCore(const Pel* src0, int src0Stride, const Pel* src1, int src1St
dst[x] = ClipPel(rightShift((src0[x] + src1[x] + b + offset), shift), clpRng);
}
}
pMcMask0 += mcStride;
pMcMask1 += mcStride;
tmpx += width;
......@@ -794,6 +822,7 @@ void addBIOAvgNCore(const Pel* src0, int src0Stride, const Pel* src1, int src1St
#endif
#endif
}
tmpx += width;
tmpy += width;
dst += dstStride;
......@@ -817,6 +846,7 @@ void addBIOAvgNCore(const Pel* src0, int src0Stride, const Pel* src1, int src1St
dst[x] = ClipPel((int16_t)rightShift((src0[x] + src1[x] + b + offset), shift), clpRng);
#endif
}
tmpx += width; tmpy += width;
dst += dstStride; src0 += src0Stride; src1 += src1Stride;
gradX0 += gradStride; gradX1 += gradStride; gradY0 += gradStride; gradY1 += gradStride;
......@@ -828,12 +858,14 @@ void addBIOAvgNCore(const Pel* src0, int src0Stride, const Pel* src1, int src1St
void calAbsSumCore(const Pel* diff, int stride, int width, int height, int* absSum)
{
*absSum = 0;
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
*absSum += ::abs(diff[x]);
}
diff += stride;
}
}
......@@ -845,7 +877,7 @@ void gradFilterCore(Pel* pSrc, int srcStride, int width, int height, int gradStr
Pel* srcTmp = pSrc + srcStride + 1;
Pel* gradXTmp = gradX + gradStride + 1;
Pel* gradYTmp = gradY + gradStride + 1;
int shift1 = 6;
const int shift1 = 6;
#if MULTI_PASS_DMVR || SAMPLE_BASED_BDOF
for (int y = 0; y < (height - 2); y++)
......@@ -860,6 +892,7 @@ void gradFilterCore(Pel* pSrc, int srcStride, int width, int height, int gradStr
gradYTmp[x] = ( srcTmp[x + srcStride] >> shift1 ) - ( srcTmp[x - srcStride] >> shift1 );
gradXTmp[x] = ( srcTmp[x + 1] >> shift1 ) - ( srcTmp[x - 1] >> shift1 );
}
gradXTmp += gradStride;
gradYTmp += gradStride;
srcTmp += srcStride;
......@@ -893,8 +926,8 @@ void gradFilterCore(Pel* pSrc, int srcStride, int width, int height, int gradStr
void calcBIOSumsCore(const Pel* srcY0Tmp, const Pel* srcY1Tmp, Pel* gradX0, Pel* gradX1, Pel* gradY0, Pel* gradY1, int xu, int yu, const int src0Stride, const int src1Stride, const int widthG, const int bitDepth, int* sumAbsGX, int* sumAbsGY, int* sumDIX, int* sumDIY, int* sumSignGyGx)
{
int shift4 = 4;
int shift5 = 1;
const int shift4 = 4;
const int shift5 = 1;
for (int y = 0; y < 6; y++)
{
......@@ -910,6 +943,7 @@ void calcBIOSumsCore(const Pel* srcY0Tmp, const Pel* srcY1Tmp, Pel* gradX0, Pel*
*sumSignGyGx += (tmpGY < 0 ? -tmpGX : (tmpGY == 0 ? 0 : tmpGX));
}
srcY1Tmp += src1Stride;
srcY0Tmp += src0Stride;
gradX0 += widthG;
......@@ -945,6 +979,7 @@ void calcBlkGradientCore(int sx, int sy, int *arraysGx2, int *arraysGxGy
sGxdI += GxdI[x];
sGydI += GydI[x];
}
Gx2 += width;
Gy2 += width;
GxGy += width;
......
......@@ -110,8 +110,16 @@ struct PelBufferOps
void(*calAbsSum) (const Pel* diff, int stride, int width, int height, int* absDiff);
void(*calcBIOParamSum5) (Pel* absGX, Pel* absGY, Pel* dIX, Pel* dIY, Pel* signGyGx, const int widthG, const int width, const int height, int* sumAbsGX, int* sumAbsGY, int* sumDIX, int* sumDIY, int* sumSignGyGx);
#if JVET_AI0046_HIGH_PRECISION_BDOF_SAMPLE
void(*calcBIOParamSum5NOSIM4) (int32_t* absGX, int32_t* absGY, int32_t* dIX, int32_t* dIY, int32_t* signGyGx, const int widthG, const int width, const int height, int* sumAbsGX, int* sumAbsGY, int* sumDIX, int* sumDIY, int* sumSignGyGx ,Pel* dI, Pel* gX, Pel* gY);
void(*calcBIOParamSum5NOSIM8) (int32_t* absGX, int32_t* absGY, int32_t* dIX, int32_t* dIY, int32_t* signGyGx, const int widthG, const int width, const int height, int* sumAbsGX, int* sumAbsGY, int* sumDIX, int* sumDIY, int* sumSignGyGx, Pel* dI, Pel* gX, Pel* gY);
void(*calcBIOParamSum5NOSIM4) (int32_t* absGX, int32_t* absGY, int32_t* dIX, int32_t* dIY, int32_t* signGyGx, const int widthG, const int width, const int height, int* sumAbsGX, int* sumAbsGY, int* sumDIX, int* sumDIY, int* sumSignGyGx ,Pel* dI
#if JVET_AG0067_DMVR_EXTENSIONS
, Pel* gX, Pel* gY
#endif
);
void(*calcBIOParamSum5NOSIM8) (int32_t* absGX, int32_t* absGY, int32_t* dIX, int32_t* dIY, int32_t* signGyGx, const int widthG, const int width, const int height, int* sumAbsGX, int* sumAbsGY, int* sumDIX, int* sumDIY, int* sumSignGyGx, Pel* dI
#if JVET_AG0067_DMVR_EXTENSIONS
, Pel* gX, Pel* gY
#endif
);
#endif
void(*calcBIOParamSum4) (Pel* absGX, Pel* absGY, Pel* dIX, Pel* dIY, Pel* signGyGx, int width, int height, const int widthG, int* sumAbsGX, int* sumAbsGY, int* sumDIX, int* sumDIY, int* sumSignGyGx);
#if JVET_Z0136_OOB
......
......@@ -2478,6 +2478,9 @@ void CodingStructure::initSubStructure( CodingStructure& subStruct, const Channe
memcpy(subStruct.alfApss, alfApss, sizeof(alfApss));
#if JVET_AK0065_TALF
memcpy(subStruct.talfApss, talfApss, sizeof(talfApss));
#endif
subStruct.lmcsAps = lmcsAps;
subStruct.scalinglistAps = scalinglistAps;
......
......@@ -97,6 +97,9 @@ public:
const SPS *sps;
const PPS *pps;
PicHeader *picHeader;
#if JVET_AK0065_TALF
APS* talfApss[ALF_CTB_MAX_NUM_APS];
#endif
APS* alfApss[ALF_CTB_MAX_NUM_APS];
APS * lmcsAps;
APS * scalinglistAps;
......
......@@ -643,7 +643,9 @@ struct EipModelCandidate
#else
int eipDimdMode = PLANAR_IDX;
#endif
#if JVET_AK0217_INTRA_MTSS || JVET_AK0187_IMPLICIT_MTS_LUT_EXTENSION
int eipDimdMode2nd = -1;
#endif
inline bool isTheSameParams(const EipModelCandidate& p) const
{
if (filterShape != p.filterShape)
......@@ -746,4 +748,158 @@ struct AltLMInterUnit
}
};
#endif
#if JVET_AK0065_TALF
struct TAlfControl
{
bool enabledFlag;
std::vector<int> apsIds;
int mode;
bool newFilters;
void reset()
{
enabledFlag = false;
apsIds.clear();
mode = 0;
newFilters = false;
}
TAlfControl()
{
reset();
}
};
struct refComb
{
RefPicList rplId;
int refId;
int poc;
int absPocDiff;
refComb(const RefPicList _rplId, const int _refId, const int _poc, const int _absPocDiff)
{
rplId = _rplId;
refId = _refId;
poc = _poc;
absPocDiff = _absPocDiff;
}
bool operator==(const refComb &other) const
{
return poc == other.poc;
}
};
struct TAlfFilterParam
{
bool newFlag;
uint8_t filterCount;
int shapeIdx;
int shift[MAX_NUM_TALF_FILTERS];
int clipFlag[MAX_NUM_TALF_FILTERS];
int coeff[MAX_NUM_TALF_FILTERS][MAX_NUM_ALF_LUMA_COEFF];
int clipIdx[MAX_NUM_TALF_FILTERS][MAX_NUM_ALF_LUMA_COEFF];
TAlfFilterParam()
{
reset();
}
void reset()
{
newFlag = false;
filterCount = 0;
shapeIdx = 0;
std::memset( shift, 0, sizeof( shift ) );
std::memset( clipFlag, 0, sizeof( clipFlag ) );
std::memset( coeff, 0, sizeof( coeff ) );
std::memset( clipIdx, 0, sizeof( clipIdx ) );
}
const TAlfFilterParam& operator = ( const TAlfFilterParam& src )
{
newFlag = src.newFlag;
filterCount = src.filterCount;
shapeIdx = src.shapeIdx;
std::memcpy( shift, src.shift, sizeof( shift ) );
std::memcpy( clipFlag, src.clipFlag, sizeof( clipFlag ) );
std::memcpy( coeff, src.coeff, sizeof( coeff ) );
std::memcpy( clipIdx, src.clipIdx, sizeof( clipIdx ) );
return *this;
}
bool operator!=(const TAlfFilterParam &other)
{
if (filterCount != other.filterCount || shapeIdx != other.shapeIdx)
{
return true;
}
for (int fIdx = 0; fIdx < filterCount; fIdx++)
{
if (shift[fIdx] != other.shift[fIdx] || clipFlag[fIdx] != other.clipFlag[fIdx])
{
return true;
}
for (int cIdx = 0; cIdx < NUM_TALF_COEFF; cIdx++)
{
if (coeff[fIdx][cIdx] != other.coeff[fIdx][cIdx])
{
return true;
}
if (coeff[fIdx][cIdx] && clipIdx[fIdx][cIdx] != other.clipIdx[fIdx][cIdx])
{
return true;
}
}
}
return false;
}
};
struct TAlfCtbParam
{
bool enabledFlag;
uint8_t setIdx;
uint8_t filterIdx;
void reset()
{
enabledFlag = false;
setIdx = 0;
filterIdx = 0;
}
TAlfCtbParam()
{
reset();
}
const TAlfCtbParam& operator = ( const TAlfCtbParam& src )
{
enabledFlag = src.enabledFlag;
setIdx = src.setIdx;
filterIdx = src.filterIdx;
return *this;
}
};
struct TAlfPosInfo
{
int refIdx;
RefPicList refPicList;
Position offset;
TAlfPosInfo()
{
refIdx = -1;
refPicList = NUM_REF_PIC_LIST_01;
offset = Position();
}
TAlfPosInfo(const int _refIdx, const int _refPicList, const int _offsetX, const int _offsetY)
{
refIdx = _refIdx;
refPicList = RefPicList(_refPicList);
offset.x = _offsetX;
offset.y = _offsetY;
}
};
#endif
#endif
......@@ -120,6 +120,11 @@
#define NSIGCTX 6
#define NGTXCTX 7
#endif
#if JVET_AK0095_ENHANCED_AFFINE_CANDIDATE
static const int AFFINE_TMVP_MAX_NUM = 20;
static const int AFFINE_TMVP_FINAL_MAX_NUM = 6;
static const int CONSTRUCTED_CANDIDATE_MAX_NUM = 5;
#endif
#if JVET_AF0163_TM_SUBBLOCK_REFINEMENT
#if JVET_AH0119_SUBBLOCK_TM
static const double REFINE_THRESHOLD_AFFINE_MERGE = 0.80;
......@@ -169,6 +174,11 @@ static const int32_t BIF_ROUND_ADD = 32;
static const int32_t BIF_ROUND_SHIFT = 6;
#endif
#if JVET_AK0097_LAST_POS_SIGNALING
static const uint32_t SECONDARY_PREFIX_START_SIZE = 8;
static const uint32_t ID_SUFFIX_CTX_START_SIZE = 16;
#endif
// ====================================================================================================================
// Common constants
// ====================================================================================================================
......@@ -476,6 +486,11 @@ static const int NUM_GAUSS_FILTERED_COEFF = 5;
static const int NUM_GAUSS_FILTERED_SOURCE = 1;
static const int ALF_PADDING_SIZE_GAUSS_RESULTS = 2;
#endif
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
static const int NUM_LAPLACIAN_FILTERED_COEFF = 5;
static const int NUM_LAPLACIAN_FILTERED_SOURCE = 1;
static const int ALF_PADDING_SIZE_LAPLACIAN_RESULTS = 2;
#endif
#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
static const int NUM_DB = 3;
static const int NUM_DB_SAMPLE = 5;
......@@ -488,7 +503,11 @@ static const int NUM_DB_PAD = 1;
#if JVET_AC0162_ALF_RESIDUAL_SAMPLES_INPUT
#if JVET_AD0222_ALF_LONG_FIXFILTER && JVET_AD0222_ADDITONAL_ALF_FIXFILTER
#if JVET_AK0091_LAPLACIAN_INFO_IN_ALF
static const int MAX_NUM_ALF_LUMA_COEFF = 11 + EXT_LENGTH + NUM_DB + NUM_FIXED_BASED_COEFF_NEW + NUM_RESI + 1 + NUM_GAUSS_FILTERED_COEFF + NUM_LAPLACIAN_FILTERED_COEFF;
#else
static const int MAX_NUM_ALF_LUMA_COEFF = 11 + EXT_LENGTH + NUM_DB + NUM_FIXED_BASED_COEFF_NEW + NUM_RESI + 1 + NUM_GAUSS_FILTERED_COEFF;
#endif
#elif JVET_AD0222_ALF_LONG_FIXFILTER
static const int MAX_NUM_ALF_LUMA_COEFF = 11 + EXT_LENGTH + NUM_DB + NUM_FIXED_BASED_COEFF_NEW + NUM_RESI + 1;
#elif JVET_AD0222_ADDITONAL_ALF_FIXFILTER
......@@ -599,6 +618,14 @@ 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_AK0065_TALF
static const int MAX_NUM_TALF_FILTERS = 8;
static const int MAX_TALF_FILTER_SHAPE = 2;
static const int NUM_TALF_COEFF = 13;
static const int TALF_SCALE_BIT = 6;
static const int TALF_SBB_SIZE = 4;
static const int NUM_TALF_REUSE_CANDS = 3;
#endif
#if JVET_Z0139_HIST_AFF
static const int MAX_NUM_AFFHMVP_ENTRIES_ONELIST = 5;
static const int MAX_NUM_AFFHMVP_ENTRIES = MAX_NUM_AFFHMVP_ENTRIES_ONELIST * 2;
......@@ -657,6 +684,12 @@ static const int DIMD_FUSION_NUM = 6;
#endif
#endif
#if JVET_AK0059_MDIP
static const int MDIP_NUM = 1;
static const int EXCLUDING_MODE_NUM = 20;
static const int REMOVAL_NUM = 32;
#endif
#if JVET_Y0116_EXTENDED_MRL_LIST
static const int MAX_REF_LINE_IDX = 13; //highest refLine offset in the list
static const int MRL_NUM_REF_LINES = 6; //number of candidates in the array
......@@ -751,6 +784,9 @@ static const int TIMDSAD_IDX = 241; ///< inde
static const int TIMD_NUM_MODES_SORTED = 15;
static const int TIMDDIFF_MAX_TEMP_SIZE = 8;
#endif
#if JVET_AK0059_MDIP
static const int MDIP_IDX = 300; ///< index for MDIP mode
#endif
static const int DIMD_MAX_TEMP_SIZE = 4;
static const int EXT_HOR_IDX = 34;
static const int EXT_DIA_IDX = 66;
......@@ -860,20 +896,20 @@ static const int DM_CHROMA_IDX = NUM_INTRA_MODE; ///< chro
#endif
#if JVET_Z0131_IBC_BVD_BINARIZATION
static const int BVD_CODING_GOLOMB_ORDER = 1;
static const int NUM_HOR_BVD_CTX = 5;
static const int NUM_VER_BVD_CTX = 5;
static const int HOR_BVD_CTX_OFFSET = 0;
static const int BVD_CODING_GOLOMB_ORDER = 1;
static const int NUM_HOR_BVD_CTX = 5;
static const int NUM_VER_BVD_CTX = 5;
static const int HOR_BVD_CTX_OFFSET = 0;
static const int BVD_IBC_MAX_PREFIX = 16;
static const int VER_BVD_CTX_OFFSET = 6;
static const int VER_BVD_CTX_OFFSET = 6;
#endif
#if JVET_AD0140_MVD_PREDICTION
static const int MVD_CODING_GOLOMB_ORDER = 1;
static const int MVD_CODING_GOLOMB_ORDER = 1;
#endif
#if JVET_AJ0249_NEURAL_NETWORK_BASED
static const int PNN_IDX = 220;
static const int NUM_INDICES_REP = 2;
static const int PNN_IDX = 220;
static const int NUM_INDICES_REP = 2;
#endif
#if JVET_W0119_LFNST_EXTENSION
......@@ -889,46 +925,52 @@ static const uint32_t L8H_ZO = 32;
#endif
#if JVET_Y0142_ADAPT_INTRA_MTS
static const uint32_t MTS_TH_COEFF[2] = { 6, 32};
static const uint32_t MTS_NCANDS[3] = { 1, 4, 6};
static const uint32_t NUM_TRAFO_MODES_MTS = 8;
static const uint32_t MTS_TH_COEFF[2] = { 6, 32};
static const uint32_t MTS_NCANDS[3] = { 1, 4, 6};
static const uint32_t NUM_TRAFO_MODES_MTS = 8;
#else
static const uint32_t NUM_TRAFO_MODES_MTS = 6; ///< Max Intra CU size applying EMT, supported values: 8, 16, 32, 64, 128
static const uint32_t NUM_TRAFO_MODES_MTS = 6; ///< Max Intra CU size applying EMT, supported values: 8, 16, 32, 64, 128
#endif
#if TU_256
static const uint32_t MTS_INTRA_MAX_CU_SIZE = 256; ///< Max Intra CU size applying EMT, supported values: 8, 16, 32, 64, 128
static const uint32_t MTS_INTER_MAX_CU_SIZE = 256; ///< Max Inter CU size applying EMT, supported values: 8, 16, 32, 64, 128
static const uint32_t MTS_INTRA_MAX_CU_SIZE = 256; ///< Max Intra CU size applying EMT, supported values: 8, 16, 32, 64, 128
static const uint32_t MTS_INTER_MAX_CU_SIZE = 256; ///< Max Inter CU size applying EMT, supported values: 8, 16, 32, 64, 128
#else
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 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
#endif
#if JVET_AK0061_PDP_MPM
static const int MPM_SORT_TEMPLATE_SIZE = 1;
static const int NUM_PDP_MODES = 6;
static const int MPM_SORT_TEMPLATE_SIZE = 1;
static const int NUM_PDP_MODES = 6;
#endif
#if SECONDARY_MPM
static const int NUM_PRIMARY_MOST_PROBABLE_MODES = 6;
static const int NUM_SECONDARY_MOST_PROBABLE_MODES = 16;
static const int NUM_PRIMARY_MOST_PROBABLE_MODES = 6;
static const int NUM_SECONDARY_MOST_PROBABLE_MODES = 16;
static const int NUM_MOST_PROBABLE_MODES = NUM_PRIMARY_MOST_PROBABLE_MODES + NUM_SECONDARY_MOST_PROBABLE_MODES;
#if SECONDARY_MPM
#if JVET_AK0059_MDIP
static const int NUM_NON_MPM_MODES = NUM_LUMA_MODE - NUM_MOST_PROBABLE_MODES - MDIP_NUM - EXCLUDING_MODE_NUM;
#else
static const int NUM_NON_MPM_MODES = NUM_LUMA_MODE - NUM_MOST_PROBABLE_MODES;
#endif
#else
static const int NUM_MOST_PROBABLE_MODES = 6;
static const int NUM_MOST_PROBABLE_MODES = 6;
#endif
static const int LM_SYMBOL_NUM = (1 + NUM_LMC_MODE);
static const int MAX_NUM_MIP_MODE = 32; ///< maximum number of MIP pred. modes
#if JVET_AB0155_SGPM
#if JVET_AJ0112_REGRESSION_SGPM
static const int RSGPM_CAND_NUM = 4;
static const int SGPM_CAND_NUM = 16;
static const int RSGPM_CAND_NUM = 4;
static const int SGPM_CAND_NUM = 16;
static const int SGPM_NUM = RSGPM_CAND_NUM + SGPM_CAND_NUM;
#else
static const int SGPM_NUM = 16;
static const int SGPM_NUM = 16;
#endif
static const int FAST_UDI_MAX_RDMODE_NUM = (NUM_LUMA_MODE + MAX_NUM_MIP_MODE + SGPM_NUM); ///< maximum number of RD comparison in fast-UDI estimation loop
#if JVET_AK0222_SGPM_DIMD_LFNST
static const int SGPM_VIPM_TH = 2;
static const int MAX_SGPM_VIPM_SIZE = 256;
#endif
#else
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
......@@ -949,6 +991,13 @@ static const int NUM_LFNST_NUM_PER_SET = 4;
static const int NUM_LFNST_NUM_PER_SET = 3;
#endif
#if JVET_AK0217_INTRA_MTSS
static const int MIN_MTSS_SIZE = 128;
static const int MIN_SGPM_MTSS_SIZE = 256;
static const int MTSS_LIST_SIZE = 3;
static const int MTSS_CAND_NUM[2] = { 1, 3 };
#endif
#if JVET_AJ0175_NSPT_FOR_NONREG_MODES
static const int NUM_NSPT_BLOCK_TYPES = 3; ///< 0:Regular 1:Mixed 2:Inter/ITMP
static const int NUM_NSPT_CLUSTERS_4x4 = 245;
......@@ -1624,6 +1673,9 @@ static const int GEO_NUM_INTRA_RDO_BUFFER = 23;
#if JVET_AG0112_REGRESSION_BASED_GPM_BLENDING
static const int GEO_BLEND_MAX_NUM_CANDS = ((GEO_MAX_NUM_UNI_CANDS + 1) >> 1) * ((GEO_MAX_NUM_UNI_CANDS + 1) >> 1) / 2;
static const int GEO_NUM_RDO_BUFFER = GEO_MAX_NUM_UNI_CANDS + 67 + 1 + 1;
#if JVET_AK0101_REGRESSION_GPM_INTRA
static const int GEO_BLEND_MAX_NUM_INTRA_CANDS = 6;
#endif
#else
#if JVET_AC0112_IBC_CIIP || JVET_AC0112_IBC_GPM
static const int GEO_NUM_RDO_BUFFER = GEO_MAX_NUM_UNI_CANDS + 67;
......@@ -1730,6 +1782,52 @@ static const int GPM_BLENDING_SIZE_THRESHOLD = 32;
#endif
#if ENABLE_OBMC
static const unsigned int defaultWeight[2][4] = { {27, 16, 6, 0}, {27, 0, 0, 0} };
#if JVET_AK0212_GPM_OBMC_MODIFICATION
static const int16_t currWeights[2][2][2][2][16] =
{
{
{
{ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, },
{ 128, 122, 112, 101, 128, 122, 112, 101, 128, 122, 112, 101, 128, 122, 112, 101, }, },
{ { 128, 128, 128, 128, 122, 122, 122, 122, 112, 112, 112, 112, 101, 101, 101, 101, },
{ 128, 122, 112, 101, 122, 116, 106, 95, 112, 106, 96, 85, 101, 95, 85, 74, }, },
},
{
{ { 101, 112, 122, 128, 101, 112, 122, 128, 101, 112, 122, 128, 101, 112, 122, 128, },
{ 101, 106, 106, 101, 101, 106, 106, 101, 101, 106, 106, 101, 101, 106, 106, 101, }, },
{ { 101, 112, 122, 128, 95, 106, 116, 122, 85, 96, 106, 112, 74, 85, 95, 101, },
{ 101, 106, 106, 101, 95, 100, 100, 95, 85, 90, 90, 85, 74, 79, 79, 74, }, },
},
},
{
{
{ { 101, 101, 101, 101, 112, 112, 112, 112, 122, 122, 122, 122, 128, 128, 128, 128, },
{ 101, 95, 85, 74, 112, 106, 96, 85, 122, 116, 106, 95, 128, 122, 112, 101, }, },
{ { 101, 101, 101, 101, 106, 106, 106, 106, 106, 106, 106, 106, 101, 101, 101, 101, },
{ 101, 95, 85, 74, 106, 100, 90, 79, 106, 100, 90, 79, 101, 95, 85, 74, }, },
},
{
{ { 74, 85, 95, 101, 85, 96, 106, 112, 95, 106, 116, 122, 101, 112, 122, 128, },
{ 74, 79, 79, 74, 85, 90, 90, 85, 95, 100, 100, 95, 101, 106, 106, 101, }, },
{ { 74, 85, 95, 101, 79, 90, 100, 106, 79, 90, 100, 106, 74, 85, 95, 101, },
{ 74, 79, 79, 74, 79, 84, 84, 79, 79, 84, 84, 79, 74, 79, 79, 74, }, },
},
},
};
static const int16_t neigWeights[5][16] =
{
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, // unavailable
{ 27, 27, 27, 27, 16, 16, 16, 16, 6, 6, 6, 6, 0, 0, 0, 0, }, // above
{ 27, 16, 6, 0, 27, 16, 6, 0, 27, 16, 6, 0, 27, 16, 6, 0, }, // left
{ 0, 0, 0, 0, 6, 6, 6, 6, 16, 16, 16, 16, 27, 27, 27, 27, }, // below
{ 0, 6, 16, 27, 0, 6, 16, 27, 0, 6, 16, 27, 0, 6, 16, 27, }, // right
};
static const int16_t weightsChroma[2] = { 0 , 27 };
#endif
#endif
#if JVET_X0141_CIIP_TIMD_TM
......@@ -2451,4 +2549,48 @@ static const int SGPM_NUM_BVS = 6; // maximum BVs to be considered into the list
static const int SGPM_BV_START_IDX = NUM_LUMA_MODE;
#endif
#if JVET_AK0185_TMVP_SELECTION
static const int COLLECT_REF_FIRST = 4;
static const int COLLECT_POS_FIRST = 8;
static const int COLLECT_TMVP_REF = 1;
static const int COLLECT_TMVP_POS = 2;
static const int COLLECT_TMVP_BOTH = (COLLECT_TMVP_REF | COLLECT_TMVP_POS);
#endif
#if JVET_AK0123_ALF_COEFF_RESTRICTION
// Parameters for Simulated Annealing (SA)
static const int ALF_SA_SOLUTION_POOL_SIZE_MIN = 3; // the number of (best known) solutions used as starting points
static const int ALF_SA_SOLUTION_POOL_SIZE_MAX = 8;
static const int ALF_SA_RUNS_COUNT = 100; // how many times the full SA-process (from a start point until it converges) is tried
static const int ALF_SA_NON_IMPROVES_PER_PARAMETER_TO_STOP = 8; // ALF_SA_NON_IMPROVES_PER_PARAMETER_TO_STOP * parametersNumber is the number of non-improving iterations that has to happen before SA run is stopped
static const int ALF_SA_CHANGES_PER_ITERATION = 3; // the maximal number of changed parameters in one iteration
#endif
#if JVET_AK0085_TM_BOUNDARY_PADDING
// define search area
static const int TMP_MIN_NUM_STEPS = 2; // 0 equals stdpad, minimum size of triangle
static const int TMP_MAX_NUM_STEPS = 12; // Limit the maximum number of steps executed, maximum size of triangle
static const int TMP_NUM_AVG_CANDS = 4; // Limit the number of averaged candidates
static const float TMP_ACS_FACTOR = 1.5; // adaptive candidate selection factor (needs to be <= 1)
// template size and target block size definition
static const int TMP_TEMPLATE_WIDTH = 16;
static const int TMP_TEMPLATE_HEIGHT = 3;
static const int TMP_TW_MINUS_TBW_BY_TWO = 2; // defines how much smaller the target block is than the template on each side
static const int TMP_PADSIZE = 16; // padding size for TM padding
static const int TMP_EARLY_TERMINATION_THRESHOLD = 128; // threshold for early termination
enum BoundaryDirection
{
BD_TOP,
BD_RIGHT,
BD_BOTTOM,
BD_LEFT,
NUM_BD_DIRECTIONS
};
#endif
#endif // end of #ifndef __COMMONDEF__
......@@ -2094,6 +2094,7 @@ void MergeCtx::setGeoMmvdMergeInfo(PredictionUnit& pu, int mergeIdx, int mmvdIdx
#if JVET_AG0276_NLIC
pu.cu->altLMFlag = altLMFlag[mergeIdx];
pu.cu->altLMParaUnit = altLMParaNeighbours[mergeIdx];
#if JVET_AH0314_LIC_INHERITANCE_FOR_MRG
bool initializeAltLM = !pu.cu->altLMFlag
&& !pu.cu->geoFlag;
......@@ -3193,6 +3194,9 @@ void AltLMAffineMergeCtx::initAltLMAffMergeCtx(int idx)
#if JVET_AD0193_ADAPTIVE_OBMC_CONTROL
obmcFlags[idx] = true;
#endif
#if JVET_AK0095_ENHANCED_AFFINE_CANDIDATE
m_isConstructed[idx] = false;
#endif
}
void AltLMAffineMergeCtx::init()
......
......@@ -978,6 +978,9 @@ public:
for (unsigned i = 0; i < AFFINE_MRG_MAX_NUM_CANDS_ALL; i++)
{
affineType[i] = AFFINEMODEL_4PARAM;
#if JVET_AK0095_ENHANCED_AFFINE_CANDIDATE
m_isConstructed[i] = false;
#endif
}
}
~AffineMergeCtx() {}
......@@ -1013,6 +1016,9 @@ public:
MergeCtx *mrgCtx;
MergeType mergeType[AFFINE_MRG_MAX_NUM_CANDS_ALL];
#if JVET_AK0095_ENHANCED_AFFINE_CANDIDATE
bool m_isConstructed[AFFINE_MRG_MAX_NUM_CANDS_ALL];
#endif
#if JVET_AC0185_ENHANCED_TEMPORAL_MOTION_DERIVATION
int colIdx[AFFINE_MRG_MAX_NUM_CANDS_ALL];
#endif
......@@ -1188,6 +1194,9 @@ public:
bool obmcFlags[ALT_AFF_MRG_MAX_NUM_CANDS];
#endif
int numValidMergeCand;
#if JVET_AK0095_ENHANCED_AFFINE_CANDIDATE
bool m_isConstructed[ALT_AFF_MRG_MAX_NUM_CANDS];
#endif
bool xCheckSameAffMotion(const PredictionUnit& pu, int cnt);
void initAltLMAffMergeCtx(int idx);
......
......@@ -543,6 +543,12 @@ public:
#if JVET_AJ0249_NEURAL_NETWORK_BASED
static const CtxSet PnnLuminanceFlag;
#endif
#if JVET_AK0097_LAST_POS_SIGNALING
static const CtxSet lastXSecondaryPrefix;
static const CtxSet lastYSecondaryPrefix;
static const CtxSet lastXSuffix[3];
static const CtxSet lastYSuffix[3];
#endif
#if JVET_V0130_INTRA_TMP
static const CtxSet TmpFlag;
#if JVET_AD0086_ENHANCED_INTRA_TMP
......@@ -574,6 +580,9 @@ public:
#if JVET_AJ0274_REGRESSION_GPM_TM
static const CtxSet GeoBlendTMFlag;
#endif
#if JVET_AK0101_REGRESSION_GPM_INTRA
static const CtxSet GeoBlendIntraFlag;
#endif
#endif
#if JVET_W0097_GPM_MMVD_TM
static const CtxSet GeoMmvdFlag;
......@@ -716,6 +725,9 @@ public:
static const CtxSet TransformSkipFlag;
static const CtxSet MTSIdx;
static const CtxSet LFNSTIdx;
#if AHG7_LN_TOOLOFF_CFG
static const CtxSet VvcLFNSTIdx;
#endif
#if JVET_AG0061_INTER_LFNST_NSPT
static const CtxSet InterLFNSTIdx;
#endif
......@@ -752,6 +764,9 @@ public:
static const CtxSet TimdFlagSad;
#endif
#endif
#if JVET_AK0059_MDIP
static const CtxSet MdipFlag;
#endif
#if JVET_AB0155_SGPM
static const CtxSet SgpmFlag;
#endif
......@@ -826,6 +841,9 @@ public:
#endif
#if JVET_AH0066_JVET_AH0202_CCP_MERGE_LUMACBF0
static const CtxSet InterCcpMergeZeroRootCbfIdc;
#endif
#if JVET_AK0065_TALF
static const CtxSet TAlfFilterControlFlag;
#endif
static const unsigned NumberOfContexts;
......