Newer
Older

Karsten Suehring
committed
{ 139, 139,},
{ 139, 139,},
{ 139, 139,},

Karsten Suehring
committed
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
});
const CtxSet ContextSetCfg::TransquantBypassFlag = ContextSetCfg::addCtxSet
({
{ 154,},
{ 154,},
{ 154,},
});
const CtxSet ContextSetCfg::RdpcmFlag = ContextSetCfg::addCtxSet
({
{ 139, 139,},
{ 139, 139,},
{ CNU, CNU,},
});
const CtxSet ContextSetCfg::RdpcmDir = ContextSetCfg::addCtxSet
({
{ 139, 139,},
{ 139, 139,},
{ CNU, CNU,},
});
const CtxSet ContextSetCfg::EMTTuIndex = ContextSetCfg::addCtxSet
({
#if TRAINED_CABAC_INIT_TABLES
{ 153, 138, CNU, CNU, },
{ 138, 167, CNU, CNU, },
{ 167, 123, CNU, CNU, },
#else

Karsten Suehring
committed
{ CNU, CNU, CNU, CNU,},
{ CNU, CNU, CNU, CNU,},
{ CNU, CNU, CNU, CNU,},

Karsten Suehring
committed
});
const CtxSet ContextSetCfg::EMTCuFlag = ContextSetCfg::addCtxSet
({
#if TRAINED_CABAC_INIT_TABLES
{ 155, 141, 155, 155, 140, CNU, },
{ 141, 141, 141, 126, 155, CNU, },
{ CNU, CNU, 140, 155, 155, CNU, },
#else

Karsten Suehring
committed
{ CNU, CNU, CNU, CNU, CNU, CNU,},
{ CNU, CNU, CNU, CNU, CNU, CNU,},
{ CNU, CNU, CNU, CNU, CNU, CNU,},

Karsten Suehring
committed
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
});
const CtxSet ContextSetCfg::CrossCompPred = ContextSetCfg::addCtxSet
({
{ 154, 154, 154, 154, 154, 154, 154, 154, 154, 154,},
{ 154, 154, 154, 154, 154, 154, 154, 154, 154, 154,},
{ 154, 154, 154, 154, 154, 154, 154, 154, 154, 154,},
});
const CtxSet ContextSetCfg::ChromaQpAdjFlag = ContextSetCfg::addCtxSet
({
{ 154,},
{ 154,},
{ 154,},
});
const CtxSet ContextSetCfg::ChromaQpAdjIdc = ContextSetCfg::addCtxSet
({
{ 154,},
{ 154,},
{ 154,},
});
const CtxSet ContextSetCfg::ImvFlag = ContextSetCfg::addCtxSet
({
#if TRAINED_CABAC_INIT_TABLES
{ 212, 214, 230, 182, },
{ 212, 214, 230, 182, },
{ CNU, CNU, CNU, CNU, },
#else

Karsten Suehring
committed
{ 197, 185, 201, 185,},
{ 197, 185, 201, 185,},
{ CNU, CNU, CNU, CNU,},

Karsten Suehring
committed
});
const CtxSet ContextSetCfg::ctbAlfFlag =
{
ContextSetCfg::addCtxSet
( {
Nan Hu
committed
#if JVET_L0392_ALF_INIT_STATE
#if TRAINED_CABAC_INIT_TABLES
{ 138, 141, 173, 122, 170, 203, 151, 170, 203, },
{ 153, 156, 188, 137, 185, 218, 152, 185, 218, },
{ 155, 205, 253, 168, 187, 234, 168, 187, 220, },
#else
Nan Hu
committed
{ 100, 153, 200, 100, 153, 200, 100, 153, 200 },
{ 100, 153, 200, 100, 153, 200, 100, 153, 200 },
{ 100, 153, 200, 100, 153, 200, 100, 153, 200 },
Nan Hu
committed
#else

Karsten Suehring
committed
{ 100, 100, 100, 100, 100, 100, 100, 100, 100 },
{ 153, 153, 153, 153, 153, 153, 153, 153, 153 },
{ 200, 200, 200, 200, 200, 200, 200, 200, 200 },
Nan Hu
committed
#endif

Karsten Suehring
committed
} )
};
#if JVET_L0100_MULTI_HYPOTHESIS_INTRA
const CtxSet ContextSetCfg::MHIntraFlag = ContextSetCfg::addCtxSet
({
#if TRAINED_CABAC_INIT_TABLES
{ 226, },
{ 227, },
{ CNU, },
#else
{ 154, },
{ 110, },
{ CNU, },
});
const CtxSet ContextSetCfg::MHIntraPredMode = ContextSetCfg::addCtxSet
({
#if TRAINED_CABAC_INIT_TABLES
{ 155, CNU, CNU, CNU, },
{ 141, CNU, CNU, CNU, },
{ CNU, CNU, CNU, CNU, },
#else
{ 183, CNU, CNU, CNU, },
{ 154, CNU, CNU, CNU, },
{ 184, CNU, CNU, CNU, },
});
#endif

Karsten Suehring
committed
#if JVET_L0124_L0208_TRIANGLE
const CtxSet ContextSetCfg::TriangleFlag = ContextSetCfg::addCtxSet
({
#if TRAINED_CABAC_INIT_TABLES
{ 165, 137, 153, },
{ 106, 122, 138, },
{ CNU, CNU, CNU, },
#else
{ 151, 137, 154, },
{ 151, 137, 154, },
{ CNU, CNU, CNU, },
});
const CtxSet ContextSetCfg::TriangleIdx = ContextSetCfg::addCtxSet
({
#if TRAINED_CABAC_INIT_TABLES
{ 155, },
{ 126, },
{ CNU, },
#else
{ 140, },
{ 140, },
{ CNU, },
});
#endif

Karsten Suehring
committed
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
const unsigned ContextSetCfg::NumberOfContexts = (unsigned)ContextSetCfg::sm_InitTables[0].size();
// combined sets
const CtxSet ContextSetCfg::Sao = { ContextSetCfg::SaoMergeFlag, ContextSetCfg::SaoTypeIdx };
template <class BinProbModel>
CtxStore<BinProbModel>::CtxStore()
: m_CtxBuffer ()
, m_Ctx ( nullptr )
{}
template <class BinProbModel>
CtxStore<BinProbModel>::CtxStore( bool dummy )
: m_CtxBuffer ( ContextSetCfg::NumberOfContexts )
, m_Ctx ( m_CtxBuffer.data() )
{}
template <class BinProbModel>
CtxStore<BinProbModel>::CtxStore( const CtxStore<BinProbModel>& ctxStore )
: m_CtxBuffer ( ctxStore.m_CtxBuffer )
, m_Ctx ( m_CtxBuffer.data() )
{}
template <class BinProbModel>
void CtxStore<BinProbModel>::init( int qp, int initId )
{
const std::vector<uint8_t>& initTable = ContextSetCfg::getInitTable( initId );
CHECK( m_CtxBuffer.size() != initTable.size(),
"Size of init table (" << initTable.size() << ") does not match size of context buffer (" << m_CtxBuffer.size() << ")." );
int clippedQP = Clip3( 0, MAX_QP, qp );

Karsten Suehring
committed
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
for( std::size_t k = 0; k < m_CtxBuffer.size(); k++ )
{
m_CtxBuffer[k].init( clippedQP, initTable[k] );
}
}
template <class BinProbModel>
void CtxStore<BinProbModel>::setWinSizes( const std::vector<uint8_t>& log2WindowSizes )
{
CHECK( m_CtxBuffer.size() != log2WindowSizes.size(),
"Size of window size table (" << log2WindowSizes.size() << ") does not match size of context buffer (" << m_CtxBuffer.size() << ")." );
for( std::size_t k = 0; k < m_CtxBuffer.size(); k++ )
{
m_CtxBuffer[k].setLog2WindowSize( log2WindowSizes[k] );
}
}
template <class BinProbModel>
void CtxStore<BinProbModel>::loadPStates( const std::vector<uint16_t>& probStates )
{
CHECK( m_CtxBuffer.size() != probStates.size(),
"Size of prob states table (" << probStates.size() << ") does not match size of context buffer (" << m_CtxBuffer.size() << ")." );
for( std::size_t k = 0; k < m_CtxBuffer.size(); k++ )
{
m_CtxBuffer[k].setState( probStates[k] );
}
}
template <class BinProbModel>
void CtxStore<BinProbModel>::savePStates( std::vector<uint16_t>& probStates ) const
{
probStates.resize( m_CtxBuffer.size(), uint16_t(0) );
for( std::size_t k = 0; k < m_CtxBuffer.size(); k++ )
{
probStates[k] = m_CtxBuffer[k].getState();
}
}
template class CtxStore<BinProbModel_Std>;
Ctx::Ctx() : m_BPMType( BPM_Undefined ) {}
Ctx::Ctx( const BinProbModel_Std* dummy ) : m_BPMType( BPM_Std ), m_CtxStore_Std ( true ) {}
Ctx::Ctx( const Ctx& ctx )
: m_BPMType ( ctx.m_BPMType )
, m_CtxStore_Std ( ctx.m_CtxStore_Std )
{
::memcpy( m_GRAdaptStats, ctx.m_GRAdaptStats, sizeof( unsigned ) * RExt__GOLOMB_RICE_ADAPTATION_STATISTICS_SETS );
}