Newer
Older

Karsten Suehring
committed
1001
1002
1003
1004
1005
1006
1007
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
1033
uint32_t m_ltRefPicPocLsbSps[MAX_NUM_LONG_TERM_REF_PICS];
bool m_usedByCurrPicLtSPSFlag[MAX_NUM_LONG_TERM_REF_PICS];
// Max physical transform size
uint32_t m_uiMaxTrSize;
bool m_bUseSAO;
bool m_bTemporalIdNestingFlag; // temporal_id_nesting_flag
#if HEVC_USE_SCALING_LISTS
bool m_scalingListEnabledFlag;
bool m_scalingListPresentFlag;
ScalingList m_scalingList;
#endif
uint32_t m_uiMaxDecPicBuffering[MAX_TLAYER];
uint32_t m_uiMaxLatencyIncreasePlus1[MAX_TLAYER];
#if HEVC_USE_INTRA_SMOOTHING_T32 || HEVC_USE_INTRA_SMOOTHING_T64
bool m_useStrongIntraSmoothing;
#endif
bool m_vuiParametersPresentFlag;
VUI m_vuiParameters;
SPSRExt m_spsRangeExtension;
SPSNext m_spsNextExtension;
static const int m_winUnitX[NUM_CHROMA_FORMAT];
static const int m_winUnitY[NUM_CHROMA_FORMAT];
PTL m_pcPTL;
bool m_useALF;
bool m_useWrapAround;
unsigned m_wrapAroundOffset;

Karsten Suehring
committed
public:
SPS();
virtual ~SPS();
#if HEVC_VPS
int getVPSId() const { return m_VPSId; }
void setVPSId(int i) { m_VPSId = i; }
Zhipin Deng
committed
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
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
#endif
bool getIntraOnlyConstraintFlag() const { return m_bIntraOnlyConstraintFlag; }
void setIntraOnlyConstraintFlag(bool bVal) { m_bIntraOnlyConstraintFlag = bVal; }
uint32_t getMaxBitDepthConstraintIdc() const { return m_maxBitDepthConstraintIdc; }
void setMaxBitDepthConstraintIdc(uint32_t u) { m_maxBitDepthConstraintIdc = u; }
uint32_t getMaxChromaFormatConstraintIdc() const { return m_maxChromaFormatConstraintIdc; }
void setMaxChromaFormatConstraintIdc(uint32_t u) { m_maxChromaFormatConstraintIdc = u; }
bool getFrameConstraintFlag() const { return m_bFrameConstraintFlag; }
void setFrameConstraintFlag(bool bVal) { m_bFrameConstraintFlag = bVal; }
bool getNoQtbttDualTreeIntraConstraintFlag() const { return m_bNoQtbttDualTreeIntraConstraintFlag; }
void setNoQtbttDualTreeIntraConstraintFlag(bool bVal) { m_bNoQtbttDualTreeIntraConstraintFlag = bVal; }
bool getNoCclmConstraintFlag() const { return m_bNoCclmConstraintFlag; }
void setNoCclmConstraintFlag(bool bVal) { m_bNoCclmConstraintFlag = bVal; }
bool getNoSaoConstraintFlag() const { return m_bNoSaoConstraintFlag; }
void setNoSaoConstraintFlag(bool bVal) { m_bNoSaoConstraintFlag = bVal; }
bool getNoAlfConstraintFlag() const { return m_bNoAlfConstraintFlag; }
void setNoAlfConstraintFlag(bool bVal) { m_bNoAlfConstraintFlag = bVal; }
bool getNoPcmConstraintFlag() const { return m_bNoPcmConstraintFlag; }
void setNoPcmConstraintFlag(bool bVal) { m_bNoPcmConstraintFlag = bVal; }
bool getNoTemporalMvpConstraintFlag() const { return m_bNoTemporalMvpConstraintFlag; }
void setNoTemporalMvpConstraintFlag(bool bVal) { m_bNoTemporalMvpConstraintFlag = bVal; }
bool getNoSbtmvpConstraintFlag() const { return m_bNoSbtmvpConstraintFlag; }
void setNoSbtmvpConstraintFlag(bool bVal) { m_bNoSbtmvpConstraintFlag = bVal; }
bool getNoAmvrConstraintFlag() const { return m_bNoAmvrConstraintFlag; }
void setNoAmvrConstraintFlag(bool bVal) { m_bNoAmvrConstraintFlag = bVal; }
bool getNoAffineMotionConstraintFlag() const { return m_bNoAffineMotionConstraintFlag; }
void setNoAffineMotionConstraintFlag(bool bVal) { m_bNoAffineMotionConstraintFlag = bVal; }
bool getNoMtsConstraintFlag() const { return m_bNoMtsConstraintFlag; }
void setNoMtsConstraintFlag(bool bVal) { m_bNoMtsConstraintFlag = bVal; }
bool getNoLadfConstraintFlag() const { return m_bNoLadfConstraintFlag; }
void setNoLadfConstraintFlag(bool bVal) { m_bNoLadfConstraintFlag = bVal; }
bool getNoDepQuantConstraintFlag() const { return m_bNoDepQuantConstraintFlag; }
void setNoDepQuantConstraintFlag(bool bVal) { m_bNoDepQuantConstraintFlag = bVal; }
bool getNoSignDataHidingConstraintFlag() const { return m_bNoSignDataHidingConstraintFlag; }
void setNoSignDataHidingConstraintFlag(bool bVal) { m_bNoSignDataHidingConstraintFlag = bVal; }

Karsten Suehring
committed
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
int getSPSId() const { return m_SPSId; }
void setSPSId(int i) { m_SPSId = i; }
ChromaFormat getChromaFormatIdc () const { return m_chromaFormatIdc; }
void setChromaFormatIdc (ChromaFormat i) { m_chromaFormatIdc = i; }
static int getWinUnitX (int chromaFormatIdc) { CHECK(chromaFormatIdc < 0 || chromaFormatIdc >= NUM_CHROMA_FORMAT, "Invalid chroma format parameter"); return m_winUnitX[chromaFormatIdc]; }
static int getWinUnitY (int chromaFormatIdc) { CHECK(chromaFormatIdc < 0 || chromaFormatIdc >= NUM_CHROMA_FORMAT, "Invalid chroma format parameter"); return m_winUnitY[chromaFormatIdc]; }
// structure
void setPicWidthInLumaSamples( uint32_t u ) { m_picWidthInLumaSamples = u; }
uint32_t getPicWidthInLumaSamples() const { return m_picWidthInLumaSamples; }
void setPicHeightInLumaSamples( uint32_t u ) { m_picHeightInLumaSamples = u; }
uint32_t getPicHeightInLumaSamples() const { return m_picHeightInLumaSamples; }
Window& getConformanceWindow() { return m_conformanceWindow; }
const Window& getConformanceWindow() const { return m_conformanceWindow; }
void setConformanceWindow(Window& conformanceWindow ) { m_conformanceWindow = conformanceWindow; }
uint32_t getNumLongTermRefPicSPS() const { return m_numLongTermRefPicSPS; }
void setNumLongTermRefPicSPS(uint32_t val) { m_numLongTermRefPicSPS = val; }
uint32_t getLtRefPicPocLsbSps(uint32_t index) const { CHECK( index >= MAX_NUM_LONG_TERM_REF_PICS, "Index exceeds boundary" ); return m_ltRefPicPocLsbSps[index]; }
void setLtRefPicPocLsbSps(uint32_t index, uint32_t val) { CHECK( index >= MAX_NUM_LONG_TERM_REF_PICS, "Index exceeds boundary" ); m_ltRefPicPocLsbSps[index] = val; }
bool getUsedByCurrPicLtSPSFlag(int i) const { CHECK( i >= MAX_NUM_LONG_TERM_REF_PICS, "Index exceeds boundary" ); return m_usedByCurrPicLtSPSFlag[i]; }
void setUsedByCurrPicLtSPSFlag(int i, bool x) { CHECK( i >= MAX_NUM_LONG_TERM_REF_PICS, "Index exceeds boundary" ); m_usedByCurrPicLtSPSFlag[i] = x; }
int getLog2MinCodingBlockSize() const { return m_log2MinCodingBlockSize; }
void setLog2MinCodingBlockSize(int val) { m_log2MinCodingBlockSize = val; }
int getLog2DiffMaxMinCodingBlockSize() const { return m_log2DiffMaxMinCodingBlockSize; }
void setLog2DiffMaxMinCodingBlockSize(int val) { m_log2DiffMaxMinCodingBlockSize = val; }
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
void setCTUSize(unsigned ctuSize) { m_CTUSize = ctuSize; }
unsigned getCTUSize() const { return m_CTUSize; }
void setSplitConsOverrideEnabledFlag(bool b) { m_partitionOverrideEnalbed = b; }
bool getSplitConsOverrideEnabledFlag() const { return m_partitionOverrideEnalbed; }
void setMinQTSizes(unsigned* minQT) { m_minQT[0] = minQT[0]; m_minQT[1] = minQT[1]; m_minQT[2] = minQT[2]; }
unsigned getMinQTSize(SliceType slicetype,
ChannelType chType = CHANNEL_TYPE_LUMA)
const { return slicetype == I_SLICE ? (chType == CHANNEL_TYPE_LUMA ? m_minQT[0] : m_minQT[2]) : m_minQT[1]; }
void setMaxBTDepth(unsigned maxBTDepth,
unsigned maxBTDepthI,
unsigned maxBTDepthIChroma)
{ m_maxBTDepth[1] = maxBTDepth; m_maxBTDepth[0] = maxBTDepthI; m_maxBTDepth[2] = maxBTDepthIChroma; }
unsigned getMaxBTDepth() const { return m_maxBTDepth[1]; }
unsigned getMaxBTDepthI() const { return m_maxBTDepth[0]; }
unsigned getMaxBTDepthIChroma() const { return m_maxBTDepth[2]; }
void setMaxBTSize(unsigned maxBTSize,
unsigned maxBTSizeI,
unsigned maxBTSizeC)
{ m_maxBTSize[1] = maxBTSize; m_maxBTSize[0] = maxBTSizeI; m_maxBTSize[2] = maxBTSizeC; }
unsigned getMaxBTSize() const { return m_maxBTSize[1]; }
unsigned getMaxBTSizeI() const { return m_maxBTSize[0]; }
unsigned getMaxBTSizeIChroma() const { return m_maxBTSize[2]; }
void setMaxTTSize(unsigned maxTTSize,
unsigned maxTTSizeI,
unsigned maxTTSizeC)
{ m_maxTTSize[1] = maxTTSize; m_maxTTSize[0] = maxTTSizeI; m_maxTTSize[2] = maxTTSizeC; }
unsigned getMaxTTSize() const { return m_maxTTSize[1]; }
unsigned getMaxTTSizeI() const { return m_maxTTSize[0]; }
unsigned getMaxTTSizeIChroma() const { return m_maxTTSize[2]; }
void setUseDualITree(bool b) { m_dualITree = b; }
bool getUseDualITree() const { return m_dualITree; }

Karsten Suehring
committed
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
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
1201
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
void setMaxCUWidth( uint32_t u ) { m_uiMaxCUWidth = u; }
uint32_t getMaxCUWidth() const { return m_uiMaxCUWidth; }
void setMaxCUHeight( uint32_t u ) { m_uiMaxCUHeight = u; }
uint32_t getMaxCUHeight() const { return m_uiMaxCUHeight; }
void setMaxCodingDepth( uint32_t u ) { m_uiMaxCodingDepth = u; }
uint32_t getMaxCodingDepth() const { return m_uiMaxCodingDepth; }
void setUsePCM( bool b ) { m_usePCM = b; }
bool getUsePCM() const { return m_usePCM; }
void setPCMLog2MaxSize( uint32_t u ) { m_pcmLog2MaxSize = u; }
uint32_t getPCMLog2MaxSize() const { return m_pcmLog2MaxSize; }
void setPCMLog2MinSize( uint32_t u ) { m_uiPCMLog2MinSize = u; }
uint32_t getPCMLog2MinSize() const { return m_uiPCMLog2MinSize; }
void setBitsForPOC( uint32_t u ) { m_uiBitsForPOC = u; }
uint32_t getBitsForPOC() const { return m_uiBitsForPOC; }
bool getUseAMP() const { return m_useAMP; }
void setUseAMP( bool b ) { m_useAMP = b; }
void setQuadtreeTULog2MaxSize( uint32_t u ) { m_uiQuadtreeTULog2MaxSize = u; }
uint32_t getQuadtreeTULog2MaxSize() const { return m_uiQuadtreeTULog2MaxSize; }
void setQuadtreeTULog2MinSize( uint32_t u ) { m_uiQuadtreeTULog2MinSize = u; }
uint32_t getQuadtreeTULog2MinSize() const { return m_uiQuadtreeTULog2MinSize; }
void setQuadtreeTUMaxDepthInter( uint32_t u ) { m_uiQuadtreeTUMaxDepthInter = u; }
void setQuadtreeTUMaxDepthIntra( uint32_t u ) { m_uiQuadtreeTUMaxDepthIntra = u; }
uint32_t getQuadtreeTUMaxDepthInter() const { return m_uiQuadtreeTUMaxDepthInter; }
uint32_t getQuadtreeTUMaxDepthIntra() const { return m_uiQuadtreeTUMaxDepthIntra; }
void setNumReorderPics(int i, uint32_t tlayer) { m_numReorderPics[tlayer] = i; }
int getNumReorderPics(uint32_t tlayer) const { return m_numReorderPics[tlayer]; }
void createRPSList( int numRPS );
const RPSList* getRPSList() const { return &m_RPSList; }
RPSList* getRPSList() { return &m_RPSList; }
bool getLongTermRefsPresent() const { return m_bLongTermRefsPresent; }
void setLongTermRefsPresent(bool b) { m_bLongTermRefsPresent=b; }
bool getSPSTemporalMVPEnabledFlag() const { return m_SPSTemporalMVPEnabledFlag; }
void setSPSTemporalMVPEnabledFlag(bool b) { m_SPSTemporalMVPEnabledFlag=b; }
// physical transform
void setMaxTrSize( uint32_t u ) { m_uiMaxTrSize = u; }
uint32_t getMaxTrSize() const { return m_uiMaxTrSize; }
// Bit-depth
int getBitDepth(ChannelType type) const { return m_bitDepths.recon[type]; }
void setBitDepth(ChannelType type, int u ) { m_bitDepths.recon[type] = u; }
const BitDepths& getBitDepths() const { return m_bitDepths; }
int getMaxLog2TrDynamicRange(ChannelType channelType) const { return getSpsRangeExtension().getExtendedPrecisionProcessingFlag() ? std::max<int>(15, int(m_bitDepths.recon[channelType] + 6)) : 15; }
int getDifferentialLumaChromaBitDepth() const { return int(m_bitDepths.recon[CHANNEL_TYPE_LUMA]) - int(m_bitDepths.recon[CHANNEL_TYPE_CHROMA]); }
int getQpBDOffset(ChannelType type) const { return m_qpBDOffset[type]; }
void setQpBDOffset(ChannelType type, int i) { m_qpBDOffset[type] = i; }
void setUseSAO(bool bVal) { m_bUseSAO = bVal; }
bool getUseSAO() const { return m_bUseSAO; }
uint32_t getMaxTLayers() const { return m_uiMaxTLayers; }
void setMaxTLayers( uint32_t uiMaxTLayers ) { CHECK( uiMaxTLayers > MAX_TLAYER, "Invalid number T-layers" ); m_uiMaxTLayers = uiMaxTLayers; }
bool getTemporalIdNestingFlag() const { return m_bTemporalIdNestingFlag; }
void setTemporalIdNestingFlag( bool bValue ) { m_bTemporalIdNestingFlag = bValue; }
uint32_t getPCMBitDepth(ChannelType type) const { return m_pcmBitDepths[type]; }
void setPCMBitDepth(ChannelType type, uint32_t u) { m_pcmBitDepths[type] = u; }
void setPCMFilterDisableFlag( bool bValue ) { m_bPCMFilterDisableFlag = bValue; }
bool getPCMFilterDisableFlag() const { return m_bPCMFilterDisableFlag; }
#if HEVC_USE_SCALING_LISTS
bool getScalingListFlag() const { return m_scalingListEnabledFlag; }
void setScalingListFlag( bool b ) { m_scalingListEnabledFlag = b; }
bool getScalingListPresentFlag() const { return m_scalingListPresentFlag; }
void setScalingListPresentFlag( bool b ) { m_scalingListPresentFlag = b; }
ScalingList& getScalingList() { return m_scalingList; }
const ScalingList& getScalingList() const { return m_scalingList; }
#endif
uint32_t getMaxDecPicBuffering(uint32_t tlayer) const { return m_uiMaxDecPicBuffering[tlayer]; }
void setMaxDecPicBuffering( uint32_t ui, uint32_t tlayer ) { CHECK(tlayer >= MAX_TLAYER, "Invalid T-layer"); m_uiMaxDecPicBuffering[tlayer] = ui; }
uint32_t getMaxLatencyIncreasePlus1(uint32_t tlayer) const { return m_uiMaxLatencyIncreasePlus1[tlayer]; }
void setMaxLatencyIncreasePlus1( uint32_t ui , uint32_t tlayer) { m_uiMaxLatencyIncreasePlus1[tlayer] = ui; }
#if HEVC_USE_INTRA_SMOOTHING_T32 || HEVC_USE_INTRA_SMOOTHING_T64
void setUseStrongIntraSmoothing(bool bVal) { m_useStrongIntraSmoothing = bVal; }
bool getUseStrongIntraSmoothing() const { return m_useStrongIntraSmoothing; }
#endif
bool getVuiParametersPresentFlag() const { return m_vuiParametersPresentFlag; }
void setVuiParametersPresentFlag(bool b) { m_vuiParametersPresentFlag = b; }
VUI* getVuiParameters() { return &m_vuiParameters; }
const VUI* getVuiParameters() const { return &m_vuiParameters; }
const PTL* getPTL() const { return &m_pcPTL; }
PTL* getPTL() { return &m_pcPTL; }
const SPSRExt& getSpsRangeExtension() const { return m_spsRangeExtension; }
SPSRExt& getSpsRangeExtension() { return m_spsRangeExtension; }
const SPSNext& getSpsNext() const { return m_spsNextExtension; }
SPSNext& getSpsNext() { return m_spsNextExtension; }
bool getUseALF() const { return m_useALF; }
void setUseALF( bool b ) { m_useALF = b; }
void setUseWrapAround(bool b) { m_useWrapAround = b; }
bool getUseWrapAround() const { return m_useWrapAround; }
void setWrapAroundOffset(unsigned offset) { m_wrapAroundOffset = offset; }
unsigned getWrapAroundOffset() const { return m_wrapAroundOffset; }

Karsten Suehring
committed
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
};
/// Reference Picture Lists class
class RefPicListModification
{
private:
bool m_refPicListModificationFlagL0;
bool m_refPicListModificationFlagL1;
uint32_t m_RefPicSetIdxL0[REF_PIC_LIST_NUM_IDX];
uint32_t m_RefPicSetIdxL1[REF_PIC_LIST_NUM_IDX];
public:
RefPicListModification();
virtual ~RefPicListModification();
bool getRefPicListModificationFlagL0() const { return m_refPicListModificationFlagL0; }
void setRefPicListModificationFlagL0(bool flag) { m_refPicListModificationFlagL0 = flag; }
bool getRefPicListModificationFlagL1() const { return m_refPicListModificationFlagL1; }
void setRefPicListModificationFlagL1(bool flag) { m_refPicListModificationFlagL1 = flag; }
uint32_t getRefPicSetIdxL0(uint32_t idx) const { CHECK(idx>=REF_PIC_LIST_NUM_IDX, "Invalid ref-pic-list index"); return m_RefPicSetIdxL0[idx]; }
void setRefPicSetIdxL0(uint32_t idx, uint32_t refPicSetIdx) { CHECK(idx>=REF_PIC_LIST_NUM_IDX, "Invalid ref-pic-list index"); m_RefPicSetIdxL0[idx] = refPicSetIdx; }
uint32_t getRefPicSetIdxL1(uint32_t idx) const { CHECK(idx>=REF_PIC_LIST_NUM_IDX, "Invalid ref-pic-list index"); return m_RefPicSetIdxL1[idx]; }
void setRefPicSetIdxL1(uint32_t idx, uint32_t refPicSetIdx) { CHECK(idx>=REF_PIC_LIST_NUM_IDX, "Invalid ref-pic-list index"); m_RefPicSetIdxL1[idx] = refPicSetIdx; }
};
/// PPS RExt class
class PPSRExt // Names aligned to text specification
{
private:
int m_log2MaxTransformSkipBlockSize;
bool m_crossComponentPredictionEnabledFlag;
// Chroma QP Adjustments
int m_diffCuChromaQpOffsetDepth;
int m_chromaQpOffsetListLen; // size (excludes the null entry used in the following array).
ChromaQpAdj m_ChromaQpAdjTableIncludingNullEntry[1+MAX_QP_OFFSET_LIST_SIZE]; //!< Array includes entry [0] for the null offset used when cu_chroma_qp_offset_flag=0, and entries [cu_chroma_qp_offset_idx+1...] otherwise
uint32_t m_log2SaoOffsetScale[MAX_NUM_CHANNEL_TYPE];
public:
PPSRExt();
bool settingsDifferFromDefaults(const bool bTransformSkipEnabledFlag) const
{
return (bTransformSkipEnabledFlag && (getLog2MaxTransformSkipBlockSize() !=2))
|| (getCrossComponentPredictionEnabledFlag() )
|| (getChromaQpOffsetListEnabledFlag() )
|| (getLog2SaoOffsetScale(CHANNEL_TYPE_LUMA) !=0 )
|| (getLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA) !=0 );
}
uint32_t getLog2MaxTransformSkipBlockSize() const { return m_log2MaxTransformSkipBlockSize; }
void setLog2MaxTransformSkipBlockSize( uint32_t u ) { m_log2MaxTransformSkipBlockSize = u; }
bool getCrossComponentPredictionEnabledFlag() const { return m_crossComponentPredictionEnabledFlag; }
void setCrossComponentPredictionEnabledFlag(bool value) { m_crossComponentPredictionEnabledFlag = value; }
void clearChromaQpOffsetList() { m_chromaQpOffsetListLen = 0; }
uint32_t getDiffCuChromaQpOffsetDepth () const { return m_diffCuChromaQpOffsetDepth; }
void setDiffCuChromaQpOffsetDepth ( uint32_t u ) { m_diffCuChromaQpOffsetDepth = u; }
bool getChromaQpOffsetListEnabledFlag() const { return getChromaQpOffsetListLen()>0; }
int getChromaQpOffsetListLen() const { return m_chromaQpOffsetListLen; }
const ChromaQpAdj& getChromaQpOffsetListEntry( int cuChromaQpOffsetIdxPlus1 ) const
{
CHECK(cuChromaQpOffsetIdxPlus1 >= m_chromaQpOffsetListLen+1, "Invalid chroma QP offset");
return m_ChromaQpAdjTableIncludingNullEntry[cuChromaQpOffsetIdxPlus1]; // Array includes entry [0] for the null offset used when cu_chroma_qp_offset_flag=0, and entries [cu_chroma_qp_offset_idx+1...] otherwise
}
void setChromaQpOffsetListEntry( int cuChromaQpOffsetIdxPlus1, int cbOffset, int crOffset )
{
CHECK(cuChromaQpOffsetIdxPlus1 == 0 || cuChromaQpOffsetIdxPlus1 > MAX_QP_OFFSET_LIST_SIZE, "Invalid chroma QP offset");
m_ChromaQpAdjTableIncludingNullEntry[cuChromaQpOffsetIdxPlus1].u.comp.CbOffset = cbOffset; // Array includes entry [0] for the null offset used when cu_chroma_qp_offset_flag=0, and entries [cu_chroma_qp_offset_idx+1...] otherwise
m_ChromaQpAdjTableIncludingNullEntry[cuChromaQpOffsetIdxPlus1].u.comp.CrOffset = crOffset;
m_chromaQpOffsetListLen = std::max(m_chromaQpOffsetListLen, cuChromaQpOffsetIdxPlus1);
}
// Now: getPpsRangeExtension().getLog2SaoOffsetScale and getPpsRangeExtension().setLog2SaoOffsetScale
uint32_t getLog2SaoOffsetScale(ChannelType type) const { return m_log2SaoOffsetScale[type]; }
void setLog2SaoOffsetScale(ChannelType type, uint32_t uiBitShift) { m_log2SaoOffsetScale[type] = uiBitShift; }
};
/// PPS class
class PPS
{
private:
int m_PPSId; // pic_parameter_set_id
int m_SPSId; // seq_parameter_set_id
int m_picInitQPMinus26;
bool m_useDQP;
bool m_bConstrainedIntraPred; // constrained_intra_pred_flag
bool m_bSliceChromaQpFlag; // slicelevel_chroma_qp_flag
// access channel
uint32_t m_uiMaxCuDQPDepth;
int m_chromaCbQpOffset;
int m_chromaCrQpOffset;
uint32_t m_numRefIdxL0DefaultActive;
uint32_t m_numRefIdxL1DefaultActive;
bool m_bUseWeightPred; //!< Use of Weighting Prediction (P_SLICE)
bool m_useWeightedBiPred; //!< Use of Weighting Bi-Prediction (B_SLICE)
bool m_OutputFlagPresentFlag; //!< Indicates the presence of output_flag in slice header
bool m_TransquantBypassEnabledFlag; //!< Indicates presence of cu_transquant_bypass_flag in CUs.
bool m_useTransformSkip;
#if HEVC_DEPENDENT_SLICES
bool m_dependentSliceSegmentsEnabledFlag; //!< Indicates the presence of dependent slices
#endif
#if HEVC_TILES_WPP
bool m_tilesEnabledFlag; //!< Indicates the presence of tiles
bool m_entropyCodingSyncEnabledFlag; //!< Indicates the presence of wavefronts
bool m_loopFilterAcrossTilesEnabledFlag;
bool m_uniformSpacingFlag;
int m_numTileColumnsMinus1;
int m_numTileRowsMinus1;
std::vector<int> m_tileColumnWidth;
std::vector<int> m_tileRowHeight;
#endif
bool m_cabacInitPresentFlag;
bool m_sliceHeaderExtensionPresentFlag;
bool m_loopFilterAcrossSlicesEnabledFlag;
bool m_deblockingFilterControlPresentFlag;
bool m_deblockingFilterOverrideEnabledFlag;
bool m_ppsDeblockingFilterDisabledFlag;
int m_deblockingFilterBetaOffsetDiv2; //< beta offset for deblocking filter
int m_deblockingFilterTcOffsetDiv2; //< tc offset for deblocking filter
#if HEVC_USE_SCALING_LISTS
bool m_scalingListPresentFlag;
ScalingList m_scalingList; //!< ScalingList class
#endif
bool m_listsModificationPresentFlag;
uint32_t m_log2ParallelMergeLevelMinus2;
int m_numExtraSliceHeaderBits;
PPSRExt m_ppsRangeExtension;
public:
PreCalcValues *pcv;
public:
PPS();
virtual ~PPS();
int getPPSId() const { return m_PPSId; }
void setPPSId(int i) { m_PPSId = i; }
int getSPSId() const { return m_SPSId; }
void setSPSId(int i) { m_SPSId = i; }
int getPicInitQPMinus26() const { return m_picInitQPMinus26; }
void setPicInitQPMinus26( int i ) { m_picInitQPMinus26 = i; }
bool getUseDQP() const { return m_useDQP; }
void setUseDQP( bool b ) { m_useDQP = b; }
bool getConstrainedIntraPred() const { return m_bConstrainedIntraPred; }
void setConstrainedIntraPred( bool b ) { m_bConstrainedIntraPred = b; }
bool getSliceChromaQpFlag() const { return m_bSliceChromaQpFlag; }
void setSliceChromaQpFlag( bool b ) { m_bSliceChromaQpFlag = b; }
void setMaxCuDQPDepth( uint32_t u ) { m_uiMaxCuDQPDepth = u; }
uint32_t getMaxCuDQPDepth() const { return m_uiMaxCuDQPDepth; }
void setQpOffset(ComponentID compID, int i )
{
if (compID==COMPONENT_Cb)
{
m_chromaCbQpOffset = i;
}
else if (compID==COMPONENT_Cr)
{
m_chromaCrQpOffset = i;
}
else
{
THROW( "Invalid chroma QP offset" );
}
}
int getQpOffset(ComponentID compID) const
{
return (compID==COMPONENT_Y) ? 0 : (compID==COMPONENT_Cb ? m_chromaCbQpOffset : m_chromaCrQpOffset );
}
void setNumRefIdxL0DefaultActive(uint32_t ui) { m_numRefIdxL0DefaultActive=ui; }
uint32_t getNumRefIdxL0DefaultActive() const { return m_numRefIdxL0DefaultActive; }
void setNumRefIdxL1DefaultActive(uint32_t ui) { m_numRefIdxL1DefaultActive=ui; }
uint32_t getNumRefIdxL1DefaultActive() const { return m_numRefIdxL1DefaultActive; }
bool getUseWP() const { return m_bUseWeightPred; }
bool getWPBiPred() const { return m_useWeightedBiPred; }
void setUseWP( bool b ) { m_bUseWeightPred = b; }
void setWPBiPred( bool b ) { m_useWeightedBiPred = b; }
void setOutputFlagPresentFlag( bool b ) { m_OutputFlagPresentFlag = b; }
bool getOutputFlagPresentFlag() const { return m_OutputFlagPresentFlag; }
void setTransquantBypassEnabledFlag( bool b ) { m_TransquantBypassEnabledFlag = b; }
bool getTransquantBypassEnabledFlag() const { return m_TransquantBypassEnabledFlag; }
bool getUseTransformSkip() const { return m_useTransformSkip; }
void setUseTransformSkip( bool b ) { m_useTransformSkip = b; }
#if HEVC_TILES_WPP
void setLoopFilterAcrossTilesEnabledFlag(bool b) { m_loopFilterAcrossTilesEnabledFlag = b; }
bool getLoopFilterAcrossTilesEnabledFlag() const { return m_loopFilterAcrossTilesEnabledFlag; }
#endif
#if HEVC_DEPENDENT_SLICES
bool getDependentSliceSegmentsEnabledFlag() const { return m_dependentSliceSegmentsEnabledFlag; }
void setDependentSliceSegmentsEnabledFlag(bool val) { m_dependentSliceSegmentsEnabledFlag = val; }
#endif
#if HEVC_TILES_WPP
bool getEntropyCodingSyncEnabledFlag() const { return m_entropyCodingSyncEnabledFlag; }
void setEntropyCodingSyncEnabledFlag(bool val) { m_entropyCodingSyncEnabledFlag = val; }
void setTilesEnabledFlag(bool val) { m_tilesEnabledFlag = val; }
bool getTilesEnabledFlag() const { return m_tilesEnabledFlag; }
void setTileUniformSpacingFlag(bool b) { m_uniformSpacingFlag = b; }
bool getTileUniformSpacingFlag() const { return m_uniformSpacingFlag; }
void setNumTileColumnsMinus1(int i) { m_numTileColumnsMinus1 = i; }
int getNumTileColumnsMinus1() const { return m_numTileColumnsMinus1; }
void setTileColumnWidth(const std::vector<int>& columnWidth ) { m_tileColumnWidth = columnWidth; }
uint32_t getTileColumnWidth(uint32_t columnIdx) const { return m_tileColumnWidth[columnIdx]; }
void setNumTileRowsMinus1(int i) { m_numTileRowsMinus1 = i; }
int getNumTileRowsMinus1() const { return m_numTileRowsMinus1; }
void setTileRowHeight(const std::vector<int>& rowHeight) { m_tileRowHeight = rowHeight; }
uint32_t getTileRowHeight(uint32_t rowIdx) const { return m_tileRowHeight[rowIdx]; }
#endif
void setCabacInitPresentFlag( bool flag ) { m_cabacInitPresentFlag = flag; }
bool getCabacInitPresentFlag() const { return m_cabacInitPresentFlag; }
void setDeblockingFilterControlPresentFlag( bool val ) { m_deblockingFilterControlPresentFlag = val; }
bool getDeblockingFilterControlPresentFlag() const { return m_deblockingFilterControlPresentFlag; }
void setDeblockingFilterOverrideEnabledFlag( bool val ) { m_deblockingFilterOverrideEnabledFlag = val; }
bool getDeblockingFilterOverrideEnabledFlag() const { return m_deblockingFilterOverrideEnabledFlag; }
void setPPSDeblockingFilterDisabledFlag(bool val) { m_ppsDeblockingFilterDisabledFlag = val; } //!< set offset for deblocking filter disabled
bool getPPSDeblockingFilterDisabledFlag() const { return m_ppsDeblockingFilterDisabledFlag; } //!< get offset for deblocking filter disabled
void setDeblockingFilterBetaOffsetDiv2(int val) { m_deblockingFilterBetaOffsetDiv2 = val; } //!< set beta offset for deblocking filter
int getDeblockingFilterBetaOffsetDiv2() const { return m_deblockingFilterBetaOffsetDiv2; } //!< get beta offset for deblocking filter
void setDeblockingFilterTcOffsetDiv2(int val) { m_deblockingFilterTcOffsetDiv2 = val; } //!< set tc offset for deblocking filter
int getDeblockingFilterTcOffsetDiv2() const { return m_deblockingFilterTcOffsetDiv2; } //!< get tc offset for deblocking filter
#if HEVC_USE_SCALING_LISTS
bool getScalingListPresentFlag() const { return m_scalingListPresentFlag; }
void setScalingListPresentFlag( bool b ) { m_scalingListPresentFlag = b; }
ScalingList& getScalingList() { return m_scalingList; }
const ScalingList& getScalingList() const { return m_scalingList; }
#endif
bool getListsModificationPresentFlag() const { return m_listsModificationPresentFlag; }
void setListsModificationPresentFlag( bool b ) { m_listsModificationPresentFlag = b; }
uint32_t getLog2ParallelMergeLevelMinus2() const { return m_log2ParallelMergeLevelMinus2; }
void setLog2ParallelMergeLevelMinus2(uint32_t mrgLevel) { m_log2ParallelMergeLevelMinus2 = mrgLevel; }
int getNumExtraSliceHeaderBits() const { return m_numExtraSliceHeaderBits; }
void setNumExtraSliceHeaderBits(int i) { m_numExtraSliceHeaderBits = i; }
void setLoopFilterAcrossSlicesEnabledFlag( bool bValue ) { m_loopFilterAcrossSlicesEnabledFlag = bValue; }
bool getLoopFilterAcrossSlicesEnabledFlag() const { return m_loopFilterAcrossSlicesEnabledFlag; }
bool getSliceHeaderExtensionPresentFlag() const { return m_sliceHeaderExtensionPresentFlag; }
void setSliceHeaderExtensionPresentFlag(bool val) { m_sliceHeaderExtensionPresentFlag = val; }
const PPSRExt& getPpsRangeExtension() const { return m_ppsRangeExtension; }
PPSRExt& getPpsRangeExtension() { return m_ppsRangeExtension; }
};
struct WPScalingParam
{
// Explicit weighted prediction parameters parsed in slice header,
// or Implicit weighted prediction parameters (8 bits depth values).
bool bPresentFlag;
uint32_t uiLog2WeightDenom;
int iWeight;
int iOffset;
// Weighted prediction scaling values built from above parameters (bitdepth scaled):
int w;
int o;
int offset;
int shift;
int round;
};
struct WPACDCParam
{
int64_t iAC;
int64_t iDC;
};
/// slice header class
class Slice
{
private:
// Bitstream writing
bool m_saoEnabledFlag[MAX_NUM_CHANNEL_TYPE];
int m_iPPSId; ///< picture parameter set ID
bool m_PicOutputFlag; ///< pic_output_flag
int m_iPOC;
int m_iLastIDR;
int m_iAssociatedIRAP;
NalUnitType m_iAssociatedIRAPType;
const ReferencePictureSet* m_pRPS; //< pointer to RPS, either in the SPS or the local RPS in the same slice header
ReferencePictureSet m_localRPS; //< RPS when present in slice header
int m_rpsIdx; //< index of used RPS in the SPS or -1 for local RPS in the slice header
RefPicListModification m_RefPicListModification;
NalUnitType m_eNalUnitType; ///< Nal unit type for the slice
SliceType m_eSliceType;
int m_iSliceQp;
int m_iSliceQpBase;
#if HEVC_DEPENDENT_SLICES
bool m_dependentSliceSegmentFlag;
#endif
bool m_ChromaQpAdjEnabled;
bool m_deblockingFilterDisable;
bool m_deblockingFilterOverrideFlag; //< offsets for deblocking filter inherit from PPS
int m_deblockingFilterBetaOffsetDiv2; //< beta offset for deblocking filter
int m_deblockingFilterTcOffsetDiv2; //< tc offset for deblocking filter
int m_list1IdxToList0Idx[MAX_NUM_REF];
int m_aiNumRefIdx [NUM_REF_PIC_LIST_01]; // for multiple reference of current slice
bool m_pendingRasInit;
bool m_depQuantEnabledFlag;
#if HEVC_USE_SIGN_HIDING
bool m_signDataHidingEnabledFlag;
#endif
bool m_bCheckLDC;
// Data
int m_iSliceQpDelta;
int m_iSliceChromaQpDelta[MAX_NUM_COMPONENT];
Picture* m_apcRefPicList [NUM_REF_PIC_LIST_01][MAX_NUM_REF+1];
int m_aiRefPOCList [NUM_REF_PIC_LIST_01][MAX_NUM_REF+1];
bool m_bIsUsedAsLongTerm[NUM_REF_PIC_LIST_01][MAX_NUM_REF+1];
int m_iDepth;
// access channel
#if HEVC_VPS
const VPS* m_pcVPS;
#endif
const SPS* m_pcSPS;
const PPS* m_pcPPS;
Picture* m_pcPic;
bool m_colFromL0Flag; // collocated picture from List0 flag
bool m_noOutputPriorPicsFlag;
bool m_noRaslOutputFlag;
bool m_handleCraAsBlaFlag;
uint32_t m_colRefIdx;
uint32_t m_maxNumMergeCand;
uint32_t m_maxNumAffineMergeCand;

Karsten Suehring
committed
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
double m_lambdas[MAX_NUM_COMPONENT];
bool m_abEqualRef [NUM_REF_PIC_LIST_01][MAX_NUM_REF][MAX_NUM_REF];
uint32_t m_uiTLayer;
bool m_bTLayerSwitchingFlag;
SliceConstraint m_sliceMode;
uint32_t m_sliceArgument;
uint32_t m_sliceCurStartCtuTsAddr;
uint32_t m_sliceCurEndCtuTsAddr;
uint32_t m_independentSliceIdx;
#if HEVC_DEPENDENT_SLICES
uint32_t m_sliceSegmentIdx;
SliceConstraint m_sliceSegmentMode;
uint32_t m_sliceSegmentArgument;
uint32_t m_sliceSegmentCurStartCtuTsAddr;
uint32_t m_sliceSegmentCurEndCtuTsAddr;
#endif
bool m_nextSlice;
#if HEVC_DEPENDENT_SLICES
bool m_nextSliceSegment;
#endif
uint32_t m_sliceBits;
#if HEVC_DEPENDENT_SLICES
uint32_t m_sliceSegmentBits;
#endif
bool m_bFinalized;
bool m_bTestWeightPred;
bool m_bTestWeightBiPred;
WPScalingParam m_weightPredTable[NUM_REF_PIC_LIST_01][MAX_NUM_REF][MAX_NUM_COMPONENT]; // [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V]
WPACDCParam m_weightACDCParam[MAX_NUM_COMPONENT];
ClpRngs m_clpRngs;
std::vector<uint32_t> m_substreamSizes;
bool m_cabacInitFlag;
int m_cabacWinUpdateMode;
bool m_bLMvdL1Zero;
bool m_temporalLayerNonReferenceFlag;
bool m_LFCrossSliceBoundaryFlag;
bool m_enableTMVPFlag;
SliceType m_encCABACTableIdx; // Used to transmit table selection across slices.
clock_t m_iProcessingStartTime;
double m_dProcessingTime;
bool m_splitConsOverrideFlag;
uint32_t m_uiMinQTSize;
uint32_t m_uiMaxBTDepth;
uint32_t m_uiMaxTTSize;
uint32_t m_uiMinQTSizeIChroma;
uint32_t m_uiMaxBTDepthIChroma;
uint32_t m_uiMaxBTSizeIChroma;
uint32_t m_uiMaxTTSizeIChroma;

Karsten Suehring
committed
uint32_t m_uiMaxBTSize;
AlfSliceParam m_alfSliceParam;

Karsten Suehring
committed
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
public:
Slice();
virtual ~Slice();
void initSlice();
int getRefIdx4MVPair( RefPicList eCurRefPicList, int nCurRefIdx );
#if HEVC_VPS
void setVPS( VPS* pcVPS ) { m_pcVPS = pcVPS; }
const VPS* getVPS() const { return m_pcVPS; }
#endif
void setSPS( const SPS* pcSPS ) { m_pcSPS = pcSPS; }
const SPS* getSPS() const { return m_pcSPS; }
void setPPS( const PPS* pcPPS ) { m_pcPPS = pcPPS; m_iPPSId = (pcPPS) ? pcPPS->getPPSId() : -1; }
const PPS* getPPS() const { return m_pcPPS; }
void setPPSId( int PPSId ) { m_iPPSId = PPSId; }
int getPPSId() const { return m_iPPSId; }
void setPicOutputFlag( bool b ) { m_PicOutputFlag = b; }
bool getPicOutputFlag() const { return m_PicOutputFlag; }
void setSaoEnabledFlag(ChannelType chType, bool s) {m_saoEnabledFlag[chType] =s; }
bool getSaoEnabledFlag(ChannelType chType) const { return m_saoEnabledFlag[chType]; }
void setRPS( const ReferencePictureSet *pcRPS ) { m_pRPS = pcRPS; }
const ReferencePictureSet* getRPS() { return m_pRPS; }
ReferencePictureSet* getLocalRPS() { return &m_localRPS; }
void setRPSidx( int rpsIdx ) { m_rpsIdx = rpsIdx; }
int getRPSidx() const { return m_rpsIdx; }
RefPicListModification* getRefPicListModification() { return &m_RefPicListModification; }
void setLastIDR(int iIDRPOC) { m_iLastIDR = iIDRPOC; }
int getLastIDR() const { return m_iLastIDR; }
void setAssociatedIRAPPOC(int iAssociatedIRAPPOC) { m_iAssociatedIRAP = iAssociatedIRAPPOC; }
int getAssociatedIRAPPOC() const { return m_iAssociatedIRAP; }
void setAssociatedIRAPType(NalUnitType associatedIRAPType) { m_iAssociatedIRAPType = associatedIRAPType; }
NalUnitType getAssociatedIRAPType() const { return m_iAssociatedIRAPType; }
SliceType getSliceType() const { return m_eSliceType; }
int getPOC() const { return m_iPOC; }
int getSliceQp() const { return m_iSliceQp; }
bool getUseWeightedPrediction() const { return( (m_eSliceType==P_SLICE && testWeightPred()) || (m_eSliceType==B_SLICE && testWeightBiPred()) ); }
#if HEVC_DEPENDENT_SLICES
bool getDependentSliceSegmentFlag() const { return m_dependentSliceSegmentFlag; }
void setDependentSliceSegmentFlag(bool val) { m_dependentSliceSegmentFlag = val; }
#endif
int getSliceQpDelta() const { return m_iSliceQpDelta; }
int getSliceChromaQpDelta(ComponentID compID) const { return isLuma(compID) ? 0 : m_iSliceChromaQpDelta[compID]; }
bool getUseChromaQpAdj() const { return m_ChromaQpAdjEnabled; }
bool getDeblockingFilterDisable() const { return m_deblockingFilterDisable; }
bool getDeblockingFilterOverrideFlag() const { return m_deblockingFilterOverrideFlag; }
int getDeblockingFilterBetaOffsetDiv2()const { return m_deblockingFilterBetaOffsetDiv2; }
int getDeblockingFilterTcOffsetDiv2() const { return m_deblockingFilterTcOffsetDiv2; }
bool getPendingRasInit() const { return m_pendingRasInit; }
void setPendingRasInit( bool val ) { m_pendingRasInit = val; }
int getNumRefIdx( RefPicList e ) const { return m_aiNumRefIdx[e]; }
Picture* getPic() { return m_pcPic; }
const Picture* getPic() const { return m_pcPic; }
const Picture* getRefPic( RefPicList e, int iRefIdx) const { return m_apcRefPicList[e][iRefIdx]; }
int getRefPOC( RefPicList e, int iRefIdx) const { return m_aiRefPOCList[e][iRefIdx]; }
int getDepth() const { return m_iDepth; }
bool getColFromL0Flag() const { return m_colFromL0Flag; }
uint32_t getColRefIdx() const { return m_colRefIdx; }
void checkColRefIdx(uint32_t curSliceSegmentIdx, const Picture* pic);
bool getIsUsedAsLongTerm(int i, int j) const { return m_bIsUsedAsLongTerm[i][j]; }
void setIsUsedAsLongTerm(int i, int j, bool value) { m_bIsUsedAsLongTerm[i][j] = value; }
bool getCheckLDC() const { return m_bCheckLDC; }
bool getMvdL1ZeroFlag() const { return m_bLMvdL1Zero; }
int getNumRpsCurrTempList() const;
int getList1IdxToList0Idx( int list1Idx ) const { return m_list1IdxToList0Idx[list1Idx]; }
bool isReferenceNalu() const { return ((getNalUnitType() <= NAL_UNIT_RESERVED_VCL_R15) && (getNalUnitType()%2 != 0)) || ((getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && (getNalUnitType() <= NAL_UNIT_RESERVED_IRAP_VCL23) ); }
void setPOC( int i ) { m_iPOC = i; }
void setNalUnitType( NalUnitType e ) { m_eNalUnitType = e; }
NalUnitType getNalUnitType() const { return m_eNalUnitType; }
bool getRapPicFlag() const;
bool getIdrPicFlag() const { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
bool isIRAP() const { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); }
bool isIDRorBLA() const { return (getNalUnitType() >= 16) && (getNalUnitType() <= 20); }
void checkCRA(const ReferencePictureSet *pReferencePictureSet, int& pocCRA, NalUnitType& associatedIRAPType, PicList& rcListPic);
void decodingRefreshMarking(int& pocCRA, bool& bRefreshPending, PicList& rcListPic, const bool bEfficientFieldIRAPEnabled);
void setSliceType( SliceType e ) { m_eSliceType = e; }
void setSliceQp( int i ) { m_iSliceQp = i; }
void setSliceQpDelta( int i ) { m_iSliceQpDelta = i; }
void setSliceChromaQpDelta( ComponentID compID, int i ) { m_iSliceChromaQpDelta[compID] = isLuma(compID) ? 0 : i; }
void setUseChromaQpAdj( bool b ) { m_ChromaQpAdjEnabled = b; }
void setDeblockingFilterDisable( bool b ) { m_deblockingFilterDisable= b; }
void setDeblockingFilterOverrideFlag( bool b ) { m_deblockingFilterOverrideFlag = b; }
void setDeblockingFilterBetaOffsetDiv2( int i ) { m_deblockingFilterBetaOffsetDiv2 = i; }
void setDeblockingFilterTcOffsetDiv2( int i ) { m_deblockingFilterTcOffsetDiv2 = i; }
void setNumRefIdx( RefPicList e, int i ) { m_aiNumRefIdx[e] = i; }
void setPic( Picture* p ) { m_pcPic = p; }
void setDepth( int iDepth ) { m_iDepth = iDepth; }
void setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr = false, bool bCopyL0toL1ErrorCase = false );
void setRefPOCList();
void setColFromL0Flag( bool colFromL0 ) { m_colFromL0Flag = colFromL0; }
void setColRefIdx( uint32_t refIdx) { m_colRefIdx = refIdx; }
void setCheckLDC( bool b ) { m_bCheckLDC = b; }
void setMvdL1ZeroFlag( bool b) { m_bLMvdL1Zero = b; }
bool isIntra() const { return m_eSliceType == I_SLICE; }
bool isInterB() const { return m_eSliceType == B_SLICE; }
bool isInterP() const { return m_eSliceType == P_SLICE; }
void setLambdas( const double lambdas[MAX_NUM_COMPONENT] ) { for (int component = 0; component < MAX_NUM_COMPONENT; component++) m_lambdas[component] = lambdas[component]; }
const double* getLambdas() const { return m_lambdas; }
void setSplitConsOverrideFlag(bool b) { m_splitConsOverrideFlag = b; }
bool getSplitConsOverrideFlag() const { return m_splitConsOverrideFlag; }
void setMinQTSize(int i) { m_uiMinQTSize = i; }
uint32_t getMinQTSize() const { return m_uiMinQTSize; }
void setMaxBTDepth(int i) { m_uiMaxBTDepth = i; }
uint32_t getMaxBTDepth() const { return m_uiMaxBTDepth; }
void setMaxTTSize(int i) { m_uiMaxTTSize = i; }
uint32_t getMaxTTSize() const { return m_uiMaxTTSize; }
void setMinQTSizeIChroma(int i) { m_uiMinQTSizeIChroma = i; }
uint32_t getMinQTSizeIChroma() const { return m_uiMinQTSizeIChroma; }
void setMaxBTDepthIChroma(int i) { m_uiMaxBTDepthIChroma = i; }
uint32_t getMaxBTDepthIChroma() const { return m_uiMaxBTDepthIChroma; }
void setMaxBTSizeIChroma(int i) { m_uiMaxBTSizeIChroma = i; }
uint32_t getMaxBTSizeIChroma() const { return m_uiMaxBTSizeIChroma; }
void setMaxTTSizeIChroma(int i) { m_uiMaxTTSizeIChroma = i; }
uint32_t getMaxTTSizeIChroma() const { return m_uiMaxTTSizeIChroma; }

Karsten Suehring
committed
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
void setMaxBTSize(int i) { m_uiMaxBTSize = i; }
uint32_t getMaxBTSize() const { return m_uiMaxBTSize; }
void setDepQuantEnabledFlag( bool b ) { m_depQuantEnabledFlag = b; }
bool getDepQuantEnabledFlag() const { return m_depQuantEnabledFlag; }
#if HEVC_USE_SIGN_HIDING
void setSignDataHidingEnabledFlag( bool b ) { m_signDataHidingEnabledFlag = b; }
bool getSignDataHidingEnabledFlag() const { return m_signDataHidingEnabledFlag; }
#endif
void initEqualRef();
bool isEqualRef( RefPicList e, int iRefIdx1, int iRefIdx2 )
{
CHECK(e>=NUM_REF_PIC_LIST_01, "Invalid reference picture list");
if (iRefIdx1 < 0 || iRefIdx2 < 0)
{
return false;
}
else
{
return m_abEqualRef[e][iRefIdx1][iRefIdx2];
}
}
void setEqualRef( RefPicList e, int iRefIdx1, int iRefIdx2, bool b)
{
CHECK( e >= NUM_REF_PIC_LIST_01, "Invalid reference picture list" );
m_abEqualRef[e][iRefIdx1][iRefIdx2] = m_abEqualRef[e][iRefIdx2][iRefIdx1] = b;
}
static void sortPicList( PicList& rcListPic );
void setList1IdxToList0Idx();
uint32_t getTLayer() const { return m_uiTLayer; }
void setTLayer( uint32_t uiTLayer ) { m_uiTLayer = uiTLayer; }
void checkLeadingPictureRestrictions( PicList& rcListPic ) const;
void applyReferencePictureSet( PicList& rcListPic, const ReferencePictureSet *RPSList) const;
bool isTemporalLayerSwitchingPoint( PicList& rcListPic ) const;
bool isStepwiseTemporalLayerSwitchingPointCandidate( PicList& rcListPic ) const;
int checkThatAllRefPicsAreAvailable( PicList& rcListPic, const ReferencePictureSet *pReferencePictureSet, bool printErrors, int pocRandomAccess = 0, bool bUseRecoveryPoint = false) const;
void createExplicitReferencePictureSetFromReference(PicList& rcListPic, const ReferencePictureSet *pReferencePictureSet, bool isRAP, int pocRandomAccess, bool bUseRecoveryPoint, const bool bEfficientFieldIRAPEnabled
, bool isEncodeLtRef, bool isCompositeRefEnable
);

Karsten Suehring
committed
void setMaxNumMergeCand(uint32_t val ) { m_maxNumMergeCand = val; }
uint32_t getMaxNumMergeCand() const { return m_maxNumMergeCand; }
void setMaxNumAffineMergeCand( uint32_t val ) { m_maxNumAffineMergeCand = val; }
uint32_t getMaxNumAffineMergeCand() const { return m_maxNumAffineMergeCand; }

Karsten Suehring
committed
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
void setNoOutputPriorPicsFlag( bool val ) { m_noOutputPriorPicsFlag = val; }
bool getNoOutputPriorPicsFlag() const { return m_noOutputPriorPicsFlag; }
void setNoRaslOutputFlag( bool val ) { m_noRaslOutputFlag = val; }
bool getNoRaslOutputFlag() const { return m_noRaslOutputFlag; }
void setHandleCraAsBlaFlag( bool val ) { m_handleCraAsBlaFlag = val; }
bool getHandleCraAsBlaFlag() const { return m_handleCraAsBlaFlag; }
void setSliceMode( SliceConstraint mode ) { m_sliceMode = mode; }
SliceConstraint getSliceMode() const { return m_sliceMode; }
void setSliceArgument( uint32_t uiArgument ) { m_sliceArgument = uiArgument; }
uint32_t getSliceArgument() const { return m_sliceArgument; }
void setSliceCurStartCtuTsAddr( uint32_t ctuTsAddr ) { m_sliceCurStartCtuTsAddr = ctuTsAddr; } // CTU Tile-scan address (as opposed to raster-scan)
uint32_t getSliceCurStartCtuTsAddr() const { return m_sliceCurStartCtuTsAddr; } // CTU Tile-scan address (as opposed to raster-scan)
void setSliceCurEndCtuTsAddr( uint32_t ctuTsAddr ) { m_sliceCurEndCtuTsAddr = ctuTsAddr; } // CTU Tile-scan address (as opposed to raster-scan)
uint32_t getSliceCurEndCtuTsAddr() const { return m_sliceCurEndCtuTsAddr; } // CTU Tile-scan address (as opposed to raster-scan)
void setIndependentSliceIdx( uint32_t i) { m_independentSliceIdx = i; }
uint32_t getIndependentSliceIdx() const { return m_independentSliceIdx; }
#if HEVC_DEPENDENT_SLICES
void setSliceSegmentIdx( uint32_t i) { m_sliceSegmentIdx = i; }
uint32_t getSliceSegmentIdx() const { return m_sliceSegmentIdx; }
#endif
void copySliceInfo(Slice *pcSliceSrc, bool cpyAlmostAll = true);
#if HEVC_DEPENDENT_SLICES
void setSliceSegmentMode( SliceConstraint mode ) { m_sliceSegmentMode = mode; }
SliceConstraint getSliceSegmentMode() const { return m_sliceSegmentMode; }
void setSliceSegmentArgument( uint32_t uiArgument ) { m_sliceSegmentArgument = uiArgument; }
uint32_t getSliceSegmentArgument() const { return m_sliceSegmentArgument; }
#if HEVC_TILES_WPP
void setSliceSegmentCurStartCtuTsAddr( uint32_t ctuTsAddr ) { m_sliceSegmentCurStartCtuTsAddr = ctuTsAddr; } // CTU Tile-scan address (as opposed to raster-scan)
uint32_t getSliceSegmentCurStartCtuTsAddr() const { return m_sliceSegmentCurStartCtuTsAddr; } // CTU Tile-scan address (as opposed to raster-scan)
void setSliceSegmentCurEndCtuTsAddr( uint32_t ctuTsAddr ) { m_sliceSegmentCurEndCtuTsAddr = ctuTsAddr; } // CTU Tile-scan address (as opposed to raster-scan)
uint32_t getSliceSegmentCurEndCtuTsAddr() const { return m_sliceSegmentCurEndCtuTsAddr; } // CTU Tile-scan address (as opposed to raster-scan)
#endif
#endif
void setSliceBits( uint32_t uiVal ) { m_sliceBits = uiVal; }
uint32_t getSliceBits() const { return m_sliceBits; }
#if HEVC_DEPENDENT_SLICES
void setSliceSegmentBits( uint32_t uiVal ) { m_sliceSegmentBits = uiVal; }
uint32_t getSliceSegmentBits() const { return m_sliceSegmentBits; }
#endif
void setFinalized( bool uiVal ) { m_bFinalized = uiVal; }
bool getFinalized() const { return m_bFinalized; }
bool testWeightPred( ) const { return m_bTestWeightPred; }
void setTestWeightPred( bool bValue ) { m_bTestWeightPred = bValue; }
bool testWeightBiPred( ) const { return m_bTestWeightBiPred; }
void setTestWeightBiPred( bool bValue ) { m_bTestWeightBiPred = bValue; }
void setWpScaling( WPScalingParam wp[NUM_REF_PIC_LIST_01][MAX_NUM_REF][MAX_NUM_COMPONENT] )
{
memcpy(m_weightPredTable, wp, sizeof(WPScalingParam)*NUM_REF_PIC_LIST_01*MAX_NUM_REF*MAX_NUM_COMPONENT);
}
void getWpScaling( RefPicList e, int iRefIdx, WPScalingParam *&wp) const;
void resetWpScaling();
void initWpScaling(const SPS *sps);
void setWpAcDcParam( WPACDCParam wp[MAX_NUM_COMPONENT] ) { memcpy(m_weightACDCParam, wp, sizeof(WPACDCParam)*MAX_NUM_COMPONENT); }
void getWpAcDcParam( const WPACDCParam *&wp ) const;
void initWpAcDcParam();
void clearSubstreamSizes( ) { return m_substreamSizes.clear(); }
uint32_t getNumberOfSubstreamSizes( ) { return (uint32_t) m_substreamSizes.size(); }
void addSubstreamSize( uint32_t size ) { m_substreamSizes.push_back(size); }
uint32_t getSubstreamSize( uint32_t idx ) { CHECK(idx>=getNumberOfSubstreamSizes(),"Invalid index"); return m_substreamSizes[idx]; }
void setCabacInitFlag( bool val ) { m_cabacInitFlag = val; } //!< set CABAC initial flag
bool getCabacInitFlag() const { return m_cabacInitFlag; } //!< get CABAC initial flag
void setCabacWinUpdateMode( int mode ) { m_cabacWinUpdateMode = mode; }
int getCabacWinUpdateMode() const { return m_cabacWinUpdateMode; }
bool getTemporalLayerNonReferenceFlag() const { return m_temporalLayerNonReferenceFlag; }
void setTemporalLayerNonReferenceFlag(bool x) { m_temporalLayerNonReferenceFlag = x; }
void setLFCrossSliceBoundaryFlag( bool val ) { m_LFCrossSliceBoundaryFlag = val; }
bool getLFCrossSliceBoundaryFlag() const { return m_LFCrossSliceBoundaryFlag; }
void setEnableTMVPFlag( bool b ) { m_enableTMVPFlag = b; }
bool getEnableTMVPFlag() const { return m_enableTMVPFlag; }
void setEncCABACTableIdx( SliceType idx ) { m_encCABACTableIdx = idx; }
SliceType getEncCABACTableIdx() const { return m_encCABACTableIdx; }
void setSliceQpBase( int i ) { m_iSliceQpBase = i; }
int getSliceQpBase() const { return m_iSliceQpBase; }
void setDefaultClpRng( const SPS& sps );
const ClpRngs& clpRngs() const { return m_clpRngs;}
const ClpRng& clpRng( ComponentID id) const { return m_clpRngs.comp[id];}
ClpRngs& getClpRngs() { return m_clpRngs;}
unsigned getMinPictureDistance() const ;
void startProcessingTimer();
void stopProcessingTimer();
void resetProcessingTime() { m_dProcessingTime = m_iProcessingStartTime = 0; }
double getProcessingTime() const { return m_dProcessingTime; }
void setAlfSliceParam( AlfSliceParam& alfSliceParam ) { m_alfSliceParam = alfSliceParam; }
AlfSliceParam& getAlfSliceParam() { return m_alfSliceParam; }
void initMotionLUTs ();
void destroyMotionLUTs ();
void resetMotionLUTs();
int getAvailableLUTMrgNum() const { return m_MotionCandLut->currCnt; }
MotionInfo getMotionInfoFromLUTs(int MotCandIdx) const;
LutMotionCand* getMotionLUTs() { return m_MotionCandLut; }
void addMotionInfoToLUTs(LutMotionCand* lutMC, MotionInfo newMi);
void updateMotionLUTs(LutMotionCand* lutMC, CodingUnit & cu);
void copyMotionLUTs(LutMotionCand* Src, LutMotionCand* Dst);

Karsten Suehring
committed
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
protected:
Picture* xGetRefPic (PicList& rcListPic, int poc);
Picture* xGetLongTermRefPic(PicList& rcListPic, int poc, bool pocHasMsb);
};// END CLASS DEFINITION Slice
void calculateParameterSetChangedFlag(bool &bChanged, const std::vector<uint8_t> *pOldData, const std::vector<uint8_t> *pNewData);
template <class T> class ParameterSetMap
{
public:
template <class Tm>
struct MapData
{
bool bChanged;
std::vector<uint8_t> *pNaluData; // Can be null
Tm* parameterSet;
};
ParameterSetMap(int maxId)
:m_maxId (maxId)
,m_activePsId(-1)
,m_lastActiveParameterSet(NULL)
{}
~ParameterSetMap()
{
for (typename std::map<int,MapData<T> >::iterator i = m_paramsetMap.begin(); i!= m_paramsetMap.end(); i++)
{
delete (*i).second.pNaluData;
delete (*i).second.parameterSet;
}
delete m_lastActiveParameterSet; m_lastActiveParameterSet = NULL;
}
T *allocatePS(const int psId)
{
CHECK( psId >= m_maxId, "Invalid PS id" );
if ( m_paramsetMap.find(psId) == m_paramsetMap.end() )
{
m_paramsetMap[psId].bChanged = true;
m_paramsetMap[psId].pNaluData=0;
m_paramsetMap[psId].parameterSet = new T;
setID(m_paramsetMap[psId].parameterSet, psId);
}
return m_paramsetMap[psId].parameterSet;
}
void storePS(int psId, T *ps, const std::vector<uint8_t> *pNaluData)