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
  • 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
  • wangguiqi/ECM
48 results
Show changes
Commits on Source (215)
Showing
with 3654 additions and 126 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
IBC: 3
HashME: 1
BDPCM: 1
TemporalFilter: 0
IntraTMP: 1
FastIntraTMP: 0
SGPMnoBlend: 1
PLT: 1
RRIBC: 1
TMIBC: 1
IBCFastMethod: 6
IBCMerge: 1
IBCMBVDAdaptive: 1
IBCHashSearch: 1
IBCCIIP: 1
IBCGPM: 1
BvpCluster: 1
IBCBiPred: 0
IBCNonAdjCand: 1
IBCFilter: 1
ItmpLicExtension: 1
IBC: 3
HashME: 1
BDPCM: 1
TemporalFilter: 0
IntraTMP: 1
FastIntraTMP: 0
SGPMnoBlend: 1
PLT: 1
RRIBC: 1
TMIBC: 1
IBCFastMethod: 6
IBCMerge: 1
IBCMBVDAdaptive: 1
IBCHashSearch: 1
IBCCIIP: 1
IBCGPM: 1
BvpCluster: 1
IBCBiPred: 0
IBCNonAdjCand: 1
IBCFilter: 1
ItmpLicExtension: 1
InterSliceSeparateTree: 0
GeoInterIbc: 1
GeoInterIbc: 1
IntraToolControlMode: 2
MaxMTTHierarchyDepthByTidOverrideByQP: 22 322222
IBC: 3
HashME: 1
BDPCM: 1
TemporalFilter: 0
IntraTMP: 1
FastIntraTMP: 0
SGPMnoBlend: 1
PLT: 1
RRIBC: 1
TMIBC: 1
IBCFastMethod: 6
IBCMerge: 1
IBCMBVDAdaptive: 1
IBCHashSearch: 1
IBCCIIP: 1
IBCGPM: 1
BvpCluster: 1
IBCBiPred: 0
IBCNonAdjCand: 1
IBCFilter: 1
ItmpLicExtension: 1
IBC: 3
HashME: 1
BDPCM: 1
TemporalFilter: 0
IntraTMP: 1
FastIntraTMP: 0
SGPMnoBlend: 1
PLT: 1
RRIBC: 1
TMIBC: 1
IBCFastMethod: 6
IBCMerge: 1
IBCMBVDAdaptive: 1
IBCHashSearch: 1
IBCCIIP: 1
IBCGPM: 1
BvpCluster: 1
IBCBiPred: 0
IBCNonAdjCand: 1
IBCFilter: 1
ItmpLicExtension: 1
InterSliceSeparateTree: 0
GeoInterIbc: 1
GeoInterIbc: 1
IntraToolControlMode: 2
MaxMTTHierarchyDepthByTidOverrideByQP: 22 322222
\ No newline at end of file
......@@ -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 );
......@@ -1636,6 +1673,9 @@ void EncApp::xInitLibCfg()
#if JVET_AB0171_ASYMMETRIC_DB_FOR_GDR
m_cEncLib.setAsymmetricILF(m_asymmetricILF);
#endif
#if JVET_AJ0249_NEURAL_NETWORK_BASED
m_cEncLib.setNnipMode(m_intraNN);
#endif
}
void EncApp::xCreateLib( std::list<PelUnitBuf*>& recBufList, const int layerId )
......
......@@ -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
......@@ -1984,6 +2018,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("TemporalFilterFutureRefs", m_gopBasedTemporalFilterFutureRefs, TF_DEFAULT_REFS, "Number of future references for temporal prefilter")
("FirstValidFrame", m_firstValidFrame, 0, "First valid frame")
("LastValidFrame", m_lastValidFrame, MAX_INT, "Last valid frame")
#if JVET_AJ0249_NEURAL_NETWORK_BASED
("IntraNN", m_intraNN, true, "Neural Network Intra Prediction: 1 activated, 0 deactivated")
#endif
("TemporalFilterStrengthFrame*", m_gopBasedTemporalFilterStrengths, std::map<int, double>(), "Strength for every * frame in GOP based temporal filter, where * is an integer."
" E.g. --TemporalFilterStrengthFrame8 0.95 will enable GOP based temporal filter at every 8th frame with strength 0.95");
// clang-format on
......@@ -3588,6 +3625,21 @@ 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))
{
m_CCSAO = false;
}
#endif
// check validity of input parameters
if( xCheckParameter() )
{
......@@ -4173,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)
{
......@@ -4335,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
......@@ -5668,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 );
......@@ -5690,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)
{
......@@ -5718,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 )
......@@ -5902,6 +5982,9 @@ void EncAppCfg::xPrintParameter()
#if JVET_AH0209_PDP
msg( VERBOSE, "PDP:%d ", m_pdp );
#endif
#if JVET_AJ0249_NEURAL_NETWORK_BASED
msg(VERBOSE, "IntraNN:%d ", m_intraNN);
#endif
#if ENABLE_DIMD
msg( VERBOSE, "DIMD:%d ", m_dimd );
#endif
......@@ -5920,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
......@@ -5979,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
......@@ -6021,7 +6110,7 @@ void EncAppCfg::xPrintParameter()
{
msg( VERBOSE, "FastPicLevelLIC:%d ", m_fastPicLevelLIC );
#if JVET_AG0276_LIC_SLOPE_ADJUST
msg( VERBOSE, "LicSlopeAdust:%d ", m_licSlopeAdjust );
msg( VERBOSE, "LicSlopeAdjust:%d ", m_licSlopeAdjust );
#endif
}
#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;
......@@ -1169,6 +1201,9 @@ protected:
CfgVPSParameters m_cfgVPSParameters;
Level::Name m_levelPtl[MAX_NUM_OLSS];
int m_olsPtlIdx[MAX_NUM_OLSS];
#if JVET_AJ0249_NEURAL_NETWORK_BASED
bool m_intraNN;
#endif
#if EXTENSION_360_VIDEO
TExt360AppEncCfg m_ext360;
......
......@@ -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;
......@@ -584,6 +745,9 @@ struct ScaleAlf
bool usePrev;
int apsIdx;
#if JVET_AJ0237_INTERNAL_12BIT
int bitDepth;
#endif
void reset()
{
......@@ -608,14 +772,20 @@ struct ScaleAlf
void setMinMax( const Pel lumaMin = 0, const Pel lumaMax = 1024, const bool bCheckClassifier = true )
{
const int c = classifierIdx;
#if !JVET_AJ0237_INTERNAL_12BIT
const int bitDepth = 10;
#endif
idxClassMin = (!bCheckClassifier || c == 1) ? ((lumaMin * ALF_NUM_CLASSES_CLASSIFIER[c]) >> bitDepth) : 0 ;
idxClassMax = (!bCheckClassifier || c == 1) ? ((lumaMax * ALF_NUM_CLASSES_CLASSIFIER[c]) >> bitDepth) : (ALF_NUM_CLASSES_CLASSIFIER[c] - 1) ;
initMinMaxDone = true;
}
void init( const int f, const int a, const int c )
#if JVET_AJ0237_INTERNAL_12BIT
void init(const int f, const int a, const int c, const int bDepth)
#else
void init( const int f, const int a, const int c )
#endif
{
filterSetIndex = f;
alt_num = a;
......@@ -625,7 +795,9 @@ struct ScaleAlf
idxClassMin = 0 ;
idxClassMax = ALF_NUM_CLASSES_CLASSIFIER[c] - 1 ;
#if JVET_AJ0237_INTERNAL_12BIT
bitDepth = bDepth;
#endif
initDone = true;
}
......@@ -687,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
......@@ -721,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()
{
......@@ -736,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 ) );
......@@ -756,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 )
......@@ -767,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 ) );
......@@ -785,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;
}
......@@ -815,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 ) ) )
{
......@@ -867,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;
}
......@@ -1052,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__
......@@ -62,6 +62,9 @@ BilateralFilter::BilateralFilter()
initBilateralFilterX86();
#endif
#endif
#if JVET_AJ0237_INTERNAL_12BIT
internalBitDepth = 10;
#endif
}
BilateralFilter::~BilateralFilter()
......@@ -94,16 +97,29 @@ 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);
int h = floorLog2(height);
int mad = m_calcMAD(block, stride, width, height, w + h);
#if JVET_AJ0237_INTERNAL_12BIT
int bdShift = std::max(0, internalBitDepth - 10);
int offset = (bdShift == 0) ? 0 : (1 << (bdShift - 1));
mad = (mad + offset) >> bdShift;
#endif
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
......@@ -163,7 +179,11 @@ const char* BilateralFilter::getFilterLutParameters(int16_t* block, const int st
}
#endif
#if JVET_AJ0237_INTERNAL_12BIT
inline void bifApplyLut(int diff, int& res, int cutBitsNum, int bitsRound, int bitsRound2, int shift, const char* lutRowPtr, int lutShift, int bdShift)
#else
inline void bifApplyLut(int diff, int& res, int cutBitsNum, int bitsRound, int bitsRound2, int shift, const char* lutRowPtr, int lutShift)
#endif
{
int sg0 = diff >> shift;
int v0 = (diff + sg0) ^ sg0;
......@@ -177,14 +197,30 @@ inline void bifApplyLut(int diff, int& res, int cutBitsNum, int bitsRound, int b
int idx = (v0 + 4) >> 3;
idx = 15 + ((idx - 15) & ((idx - 15) >> shift));
int w0 = lutRowPtr[idx] >> lutShift;
#endif
#if JVET_AJ0237_INTERNAL_12BIT
w0 = (w0 << bdShift);
#endif
res = (w0 + sg0) ^ sg0;
}
#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
#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
{
int pad = NUMBER_PADDED_SAMPLES;
#if JVET_AJ0237_INTERNAL_12BIT
cutBitsNum += bdShift;
#endif
int padwidth = iWidthExtSIMD;
int downbuffer[128];
int downleftbuffer[129];
......@@ -204,13 +240,25 @@ void BilateralFilter::blockBilateralFilterDiamond5x5( uint32_t uiWidth, uint32_t
{
int pixel = block[(-1 + pad)*padwidth + x + pad];
int below = block[(-1 + pad + 1)*padwidth + x + pad];
#if JVET_AJ0237_INTERNAL_12BIT
bifApplyLut(below - pixel, downbuffer[x], cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift1, bdShift);
#else
bifApplyLut(below - pixel, downbuffer[x], cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift1);
#endif
int belowright = block[(-1 + pad + 1)*padwidth + x + pad + 1];
#if JVET_AJ0237_INTERNAL_12BIT
bifApplyLut(belowright - pixel, downrightbuffer[1][x + 1], cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift2, bdShift);
#else
bifApplyLut(belowright - pixel, downrightbuffer[1][x + 1], cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift2);
#endif
int belowleft = block[(-1 + pad + 1)*padwidth + x + pad - 1];
#if JVET_AJ0237_INTERNAL_12BIT
bifApplyLut(belowleft - pixel, downleftbuffer[x], cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift2, bdShift);
#else
bifApplyLut(belowleft - pixel, downleftbuffer[x], cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift2);
#endif
}
int width = uiWidth;
for( int y = 0; y < uiHeight; y++ )
......@@ -220,15 +268,27 @@ void BilateralFilter::blockBilateralFilterDiamond5x5( uint32_t uiWidth, uint32_t
int pixel = rowStart[-1];
int right = rowStart[0], rightmod = 0;
#if JVET_AJ0237_INTERNAL_12BIT
bifApplyLut(right - pixel, rightmod, cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift1, bdShift);
#else
bifApplyLut(right - pixel, rightmod, cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift1);
#endif
pixel = rowStart[-padwidth - 1];
int belowright = right;
#if JVET_AJ0237_INTERNAL_12BIT
bifApplyLut(belowright - pixel, downrightbuffer[(y + 1) % 2][0], cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift2, bdShift);
#else
bifApplyLut(belowright - pixel, downrightbuffer[(y + 1) % 2][0], cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift2);
#endif
pixel = rowStart[-padwidth + width];
int belowleft = rowStart[width - 1];
#if JVET_AJ0237_INTERNAL_12BIT
bifApplyLut(belowleft - pixel, downleftbuffer[width], cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift2, bdShift);
#else
bifApplyLut(belowleft - pixel, downleftbuffer[width], cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift2);
#endif
for( int x = 0; x < uiWidth; x++ )
{
......@@ -242,12 +302,20 @@ void BilateralFilter::blockBilateralFilterDiamond5x5( uint32_t uiWidth, uint32_t
modsum += leftmod;
right = rowStart[x + 1];
#if JVET_AJ0237_INTERNAL_12BIT
bifApplyLut(right - pixel, mod, cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift1, bdShift);
#else
bifApplyLut(right - pixel, mod, cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift1);
#endif
modsum += mod;
rightmod = mod;
int below = rowStart[x + padwidth];
#if JVET_AJ0237_INTERNAL_12BIT
bifApplyLut(below - pixel, mod, cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift1, bdShift);
#else
bifApplyLut(below - pixel, mod, cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift1);
#endif
modsum += mod;
downbuffer[x] = mod;
......@@ -258,12 +326,20 @@ void BilateralFilter::blockBilateralFilterDiamond5x5( uint32_t uiWidth, uint32_t
modsum += aboveleftmod;
int belowleft = rowStart[x + padwidth - 1];
#if JVET_AJ0237_INTERNAL_12BIT
bifApplyLut(belowleft - pixel, mod, cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift2, bdShift);
#else
bifApplyLut(belowleft - pixel, mod, cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift2);
#endif
modsum += mod;
downleftbuffer[x] = mod;
int belowright = rowStart[x + padwidth + 1];
#if JVET_AJ0237_INTERNAL_12BIT
bifApplyLut(belowright - pixel, mod, cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift2, bdShift);
#else
bifApplyLut(belowright - pixel, mod, cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift2);
#endif
modsum += mod;
downrightbuffer[y % 2][x + 1] = mod;
......@@ -272,28 +348,65 @@ void BilateralFilter::blockBilateralFilterDiamond5x5( uint32_t uiWidth, uint32_t
// speed when SIMD is turned off.
int above = rowStart[x - 2 * padwidth];
#if JVET_AJ0237_INTERNAL_12BIT
bifApplyLut(above - pixel, mod, cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift3, bdShift);
#else
bifApplyLut(above - pixel, mod, cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift3);
#endif
modsum += mod;
below = rowStart[x + 2 * padwidth];
#if JVET_AJ0237_INTERNAL_12BIT
bifApplyLut(below - pixel, mod, cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift3, bdShift);
#else
bifApplyLut(below - pixel, mod, cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift3);
#endif
modsum += mod;
int left = rowStart[x - 2];
#if JVET_AJ0237_INTERNAL_12BIT
bifApplyLut(left - pixel, mod, cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift3, bdShift);
#else
bifApplyLut(left - pixel, mod, cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift3);
#endif
modsum += mod;
right = rowStart[x + 2];
#if JVET_AJ0237_INTERNAL_12BIT
bifApplyLut(right - pixel, mod, cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift3, bdShift);
#else
bifApplyLut(right - pixel, mod, cutBitsNum, bitsRound, bitsRound2, shift, lutRowPtr, lutShift3);
#endif
modsum += mod;
#if JVET_AF0112_BIF_DYNAMIC_SCALING
#if JVET_AJ0237_INTERNAL_12BIT
blkFilt[(y + pad) * padwidth + x + pad] = ((int16_t)((modsum * bfac + (bifRoundAdd << 3)) >> (bifRoundShift + 3)));
#else
blkFilt[(y + pad) * padwidth + x + pad] = ((int16_t)((uint16_t)((modsum * bfac + (bifRoundAdd << 3)) >> (bifRoundShift + 3))));
#endif
#else
blkFilt[(y + pad) * padwidth + x + pad] = (( int16_t ) (( uint16_t ) ((modsum*bfac + bifRoundAdd) >> bifRoundShift)));
#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;
......@@ -396,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 )
......@@ -570,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
{
......@@ -592,7 +713,16 @@ void BilateralFilter::bilateralFilterRDOdiamond5x5(const ComponentID compID, Pel
CHECK(doReshape, "Reshape domain is not used for chroma");
#endif
}
#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
#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
if( !useReco )
{
......@@ -619,6 +749,13 @@ void BilateralFilter::bilateralFilterDiamond5x5( const ComponentID compID, const
#endif
)
{
#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 );
......@@ -878,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
{
......@@ -902,7 +1043,15 @@ 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, 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
xStart = xEnd;
}
......@@ -1145,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
{
......@@ -1168,8 +1321,15 @@ 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
#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
}
}
void BilateralFilter::clipNotBilaterallyFilteredBlocks(const ComponentID compID, const CPelUnitBuf& src, PelUnitBuf& rec, const ClpRng& clpRng, TransformUnit & currTU)
......@@ -1595,6 +1755,11 @@ const char* BilateralFilter::getFilterLutParametersChroma(int16_t* block, const
int h = floorLog2(heightForStrength);
int mad = m_calcMAD(block, stride, width, height, floorLog2(width) + floorLog2(height));
#if JVET_AJ0237_INTERNAL_12BIT
int bdShift = std::max(0, internalBitDepth - 10);
int offset = (bdShift == 0) ? 0 : (1 << (bdShift - 1));
mad = (mad + offset) >> bdShift;
#endif
w = std::min(w, 7);
h = std::min(h, 7);
......
......@@ -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];
......@@ -67,8 +71,21 @@ private:
Pel *tempblock = (Pel*)tempblockSIMD;
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
#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);
#endif
#if JVET_AF0112_BIF_DYNAMIC_SCALING
int (*m_calcMAD)(int16_t* block, int stride, int width, int height, int whlog2);
......@@ -213,12 +230,22 @@ private:
{ 0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1, },
};
#endif
#if JVET_AJ0237_INTERNAL_12BIT
int internalBitDepth;
#endif
public:
BilateralFilter();
~BilateralFilter();
void create();
void destroy();
#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);
......@@ -229,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
......@@ -243,8 +274,17 @@ public:
#if ENABLE_SIMD_BILATERAL_FILTER || JVET_X0071_CHROMA_BILATERAL_FILTER_ENABLE_SIMD
#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
#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);
#endif
#if JVET_AF0112_BIF_DYNAMIC_SCALING
template<X86_VEXT vext>
static int simdCalcMAD(int16_t* block, int stride, int width, int height, int whlog2);
......
......@@ -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;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.