45 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
46 #include "../TLibCommon/Debug.h"
61 , m_numContextModels ( 0 )
62 , m_cCUSplitFlagSCModel ( 1, 1,
NUM_SPLIT_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)
63 , m_cCUSkipFlagSCModel ( 1, 1,
NUM_SKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)
64 , m_cCUMergeFlagExtSCModel ( 1, 1,
NUM_MERGE_FLAG_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels)
65 , m_cCUMergeIdxExtSCModel ( 1, 1,
NUM_MERGE_IDX_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels)
66 , m_cCUPartSizeSCModel ( 1, 1,
NUM_PART_SIZE_CTX , m_contextModels + m_numContextModels, m_numContextModels)
67 , m_cCUPredModeSCModel ( 1, 1,
NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels)
68 , m_cCUIntraPredSCModel ( 1, 1,
NUM_INTRA_PREDICT_CTX , m_contextModels + m_numContextModels, m_numContextModels)
69 , m_cCUChromaPredSCModel ( 1, 1,
NUM_CHROMA_PRED_CTX , m_contextModels + m_numContextModels, m_numContextModels)
70 , m_cCUDeltaQpSCModel ( 1, 1,
NUM_DELTA_QP_CTX , m_contextModels + m_numContextModels, m_numContextModels)
71 , m_cCUInterDirSCModel ( 1, 1,
NUM_INTER_DIR_CTX , m_contextModels + m_numContextModels, m_numContextModels)
72 , m_cCURefPicSCModel ( 1, 1,
NUM_REF_NO_CTX , m_contextModels + m_numContextModels, m_numContextModels)
73 , m_cCUMvdSCModel ( 1, 1,
NUM_MV_RES_CTX , m_contextModels + m_numContextModels, m_numContextModels)
75 , m_cCUTransSubdivFlagSCModel ( 1, 1,
NUM_TRANS_SUBDIV_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)
76 , m_cCUQtRootCbfSCModel ( 1, 1,
NUM_QT_ROOT_CBF_CTX , m_contextModels + m_numContextModels, m_numContextModels)
77 , m_cCUSigCoeffGroupSCModel ( 1, 2,
NUM_SIG_CG_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)
78 , m_cCUSigSCModel ( 1, 1,
NUM_SIG_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)
81 , m_cCUOneSCModel ( 1, 1,
NUM_ONE_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)
82 , m_cCUAbsSCModel ( 1, 1,
NUM_ABS_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)
83 , m_cMVPIdxSCModel ( 1, 1,
NUM_MVP_IDX_CTX , m_contextModels + m_numContextModels, m_numContextModels)
84 , m_cSaoMergeSCModel ( 1, 1,
NUM_SAO_MERGE_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)
85 , m_cSaoTypeIdxSCModel ( 1, 1,
NUM_SAO_TYPE_IDX_CTX , m_contextModels + m_numContextModels, m_numContextModels)
113 eSliceType = encCABACTableIdx;
171 SliceType bestSliceType = aSliceTypeChoices[0];
172 for (
UInt idx=0; idx<2; idx++)
175 SliceType curSliceType = aSliceTypeChoices[idx];
209 if (curCost < bestCost)
211 bestSliceType = curSliceType;
215 return bestSliceType;
282 if (uiMaxSymbol == 0)
294 Bool bCodeLast = ( uiMaxSymbol > uiSymbol );
313 while( uiSymbol >= (
UInt)(1<<uiCount) )
317 uiSymbol -= 1 << uiCount;
323 bins = (bins << uiCount) | uiSymbol;
326 assert( numBins <= 32 );
339 Int codeNumber = (
Int)symbol;
344 length = codeNumber>>rParam;
348 else if (useLimitedPrefixLength)
352 UInt prefixLength = 0;
356 if (codeValue >= ((1 << maximumPrefixLength) - 1))
358 prefixLength = maximumPrefixLength;
359 suffixLength = maxLog2TrDynamicRange - rParam;
363 while (codeValue > ((2 << prefixLength) - 2))
368 suffixLength = prefixLength + 1;
371 const UInt suffix = codeValue - ((1 << prefixLength) - 1);
374 const UInt prefix = (1 << totalPrefixLength) - 1;
375 const UInt rParamBitMask = (1 << rParam) - 1;
385 while (codeNumber >= (1<<length))
387 codeNumber -= (1<<(length++));
440 if ( pcCU->
isIntra( uiAbsPartIdx ) )
442 if( uiDepth == log2DiffMaxMinCodingBlockSize )
483 if( uiDepth == log2DiffMaxMinCodingBlockSize && !( pcCU->
getWidth(uiAbsPartIdx) == 8 && pcCU->
getHeight(uiAbsPartIdx) == 8 ) )
504 if( uiDepth == log2DiffMaxMinCodingBlockSize && !( pcCU->
getWidth(uiAbsPartIdx) == 8 && pcCU->
getHeight(uiAbsPartIdx) == 8 ) )
589 for(
UInt ui = 0; ui < uiNumCand - 1; ++ui )
591 const UInt uiSymbol = ui == uiUnaryIdx ? 0 : 1;
621 UInt uiCurrSplitFlag = ( pcCU->
getDepth( uiAbsPartIdx ) > uiDepth ) ? 1 : 0;
646 Int preds[4][
NUM_MOST_PROBABLE_MODES] = {{-1, -1, -1},{-1, -1, -1},{-1, -1, -1},{-1, -1, -1}};
647 Int predIdx[4] ={ -1,-1,-1,-1};
651 for (j=0;j<partNum;j++)
657 if(dir[j] == preds[j][i])
664 for (j=0;j<partNum;j++)
676 if (preds[j][0] > preds[j][1])
678 std::swap(preds[j][0], preds[j][1]);
680 if (preds[j][0] > preds[j][2])
682 std::swap(preds[j][0], preds[j][2]);
684 if (preds[j][1] > preds[j][2])
686 std::swap(preds[j][1], preds[j][2]);
690 dir[j] = dir[j] > preds[j][i] ? dir[j] - 1 : dir[j];
715 if( uiIntraDirChroma == uiAllowedChromaDir[i] )
717 uiIntraDirChroma = i;
759 for(
UInt ui = 0; ui < uiRefNum; ++ui )
761 const UInt uiSymbol = ui == iRefFrame ? 0 : 1;
794 const Bool bHorAbsGr0 = iHor != 0;
795 const Bool bVerAbsGr0 = iVer != 0;
796 const UInt uiHorAbs = 0 > iHor ? -iHor : iHor;
797 const UInt uiVerAbs = 0 > iVer ? -iVer : iVer;
859 static const Int log2AbsAlphaMinus1Table[8] = { 0, 1, 1, 2, 2, 2, 3, 3 };
860 assert(abs(alpha) <= 8);
884 iDQp = (iDQp + 78 + qpBdOffsetY + (qpBdOffsetY/2)) % (52 + qpBdOffsetY) - 26 - (qpBdOffsetY/2);
886 UInt uiAbsDQp = (
UInt)((iDQp > 0)? iDQp : (-iDQp));
896 UInt uiSign = (iDQp > 0 ? 0 : 1);
914 if (internalIdc > 0 && chromaQpOffsetListLen > 1)
947 const UInt lowestTUDepth = TUDepth + ((!lowestLevel && !canQuadSplit) ? 1 : 0);
949 if ((width != height) && (lowestLevel || !canQuadSplit))
951 const UInt subTUDepth = lowestTUDepth + 1;
954 for (
UInt subTU = 0; subTU < 2; subTU++)
956 const UInt subTUAbsPartIdx = absPartIdx + (subTU * partIdxesPerSubTU);
957 const UInt uiCbf = pcCU->
getCbf(subTUAbsPartIdx, compID, subTUDepth);
978 const UInt uiCbf = pcCU->
getCbf( absPartIdx, compID, lowestTUDepth );
1042 if (writePCMSampleFlag)
1047 const UInt offsetY = minCoeffSizeY * uiAbsPartIdx;
1056 for (
UInt y=0; y<height; y++)
1058 for (
UInt x=0; x<width; x++)
1060 UInt sample = pPCMSample[x];
1063 pPCMSample += width;
1120 swap( uiPosX, uiPosY );
1121 swap( width, height );
1131 Int blkSizeOffsetX, blkSizeOffsetY, shiftX, shiftY;
1138 for( uiCtxLast = 0; uiCtxLast < uiGroupIdxX; uiCtxLast++ )
1149 for( uiCtxLast = 0; uiCtxLast < uiGroupIdxY; uiCtxLast++ )
1160 if ( uiGroupIdxX > 3 )
1162 UInt uiCount = ( uiGroupIdxX - 2 ) >> 1;
1164 for (
Int i = uiCount - 1 ; i >= 0; i-- )
1169 if ( uiGroupIdxY > 3 )
1171 UInt uiCount = ( uiGroupIdxY - 2 ) >> 1;
1173 for (
Int i = uiCount - 1 ; i >= 0; i-- )
1222 std::cerr <<
"ERROR: codeCoeffNxN was passed a TU with dimensions larger than the maximum allowed size" << std::endl;
1230 if ( uiNumSig == 0 )
1232 std::cerr <<
"ERROR: codeCoeffNxN called for empty TU!" << std::endl;
1254 Int uiIntraMode = -1;
1256 Int isIntra = pcCU->
isIntra(uiAbsPartIdx) ? 1 : 0;
1313 Int scanPosLast = -1;
1322 posLast = codingParameters.
scan[ ++scanPosLast ];
1324 if( pcCoef[ posLast ] != 0 )
1327 UInt uiPosY = posLast >> uiLog2BlockWidth;
1328 UInt uiPosX = posLast - ( uiPosY << uiLog2BlockWidth );
1331 uiSigCoeffGroupFlag[ uiBlkIdx ] = 1;
1335 }
while ( uiNumSig > 0 );
1338 Int posLastY = posLast >> uiLog2BlockWidth;
1339 Int posLastX = posLast - ( posLastY << uiLog2BlockWidth );
1349 UInt uiGoRiceParam = 0;
1350 Int iScanPosSig = scanPosLast;
1352 for(
Int iSubSet = iLastScanSet; iSubSet >= 0; iSubSet-- )
1357 Bool updateGolombRiceStatistics = bUseGolombRiceParameterAdaptation;
1358 UInt coeffSigns = 0;
1362 Int lastNZPosInCG = -1;
1365 Bool escapeDataPresentInGroup =
false;
1367 if( iScanPosSig == scanPosLast )
1369 absCoeff[ 0 ] =
Int(abs( pcCoef[ posLast ] ));
1370 coeffSigns = ( pcCoef[ posLast ] < 0 );
1372 lastNZPosInCG = iScanPosSig;
1373 firstNZPosInCG = iScanPosSig;
1378 Int iCGBlkPos = codingParameters.
scanCG[ iSubSet ];
1382 if( iSubSet == iLastScanSet || iSubSet == 0)
1384 uiSigCoeffGroupFlag[ iCGBlkPos ] = 1;
1388 UInt uiSigCoeffGroup = (uiSigCoeffGroupFlag[ iCGBlkPos ] != 0);
1394 if( uiSigCoeffGroupFlag[ iCGBlkPos ] )
1398 UInt uiBlkPos, uiSig, uiCtxSig;
1399 for( ; iScanPosSig >= iSubPos; iScanPosSig-- )
1401 uiBlkPos = codingParameters.
scan[ iScanPosSig ];
1402 uiSig = (pcCoef[ uiBlkPos ] != 0);
1403 if( iScanPosSig > iSubPos || iSubSet == 0 || numNonZero )
1405 uiCtxSig =
TComTrQuant::getSigCtxInc( patternSigCtx, codingParameters, iScanPosSig, uiLog2BlockWidth, uiLog2BlockHeight, chType );
1410 absCoeff[ numNonZero ] =
Int(abs( pcCoef[ uiBlkPos ] ));
1411 coeffSigns = 2 * coeffSigns + ( pcCoef[ uiBlkPos ] < 0 );
1413 if( lastNZPosInCG == -1 )
1415 lastNZPosInCG = iScanPosSig;
1417 firstNZPosInCG = iScanPosSig;
1423 iScanPosSig = iSubPos - 1;
1426 if( numNonZero > 0 )
1436 Int firstC2FlagIdx = -1;
1437 for(
Int idx = 0; idx < numC1Flag; idx++ )
1439 UInt uiSymbol = absCoeff[ idx ] > 1;
1445 if (firstC2FlagIdx == -1)
1447 firstC2FlagIdx = idx;
1451 escapeDataPresentInGroup =
true;
1454 else if( (c1 < 3) && (c1 > 0) )
1463 if ( firstC2FlagIdx != -1)
1465 UInt symbol = absCoeff[ firstC2FlagIdx ] > 2;
1469 escapeDataPresentInGroup =
true;
1474 escapeDataPresentInGroup = escapeDataPresentInGroup || (numNonZero >
C1FLAG_NUMBER);
1476 if (escapeDataPresentInGroup && alignCABACBeforeBypass)
1481 if( beValid && signHidden )
1490 Int iFirstCoeff2 = 1;
1491 if (escapeDataPresentInGroup)
1493 for (
Int idx = 0; idx < numNonZero; idx++ )
1497 if( absCoeff[ idx ] >= baseLevel)
1499 const UInt escapeCodeValue = absCoeff[idx] - baseLevel;
1503 if (absCoeff[idx] > (3 << uiGoRiceParam))
1505 uiGoRiceParam = bUseGolombRiceParameterAdaptation ? (uiGoRiceParam + 1) : (std::min<UInt>((uiGoRiceParam + 1), 4));
1508 if (updateGolombRiceStatistics)
1512 if (escapeCodeValue >= (3 << initialGolombRiceParameter))
1514 currentGolombRiceStatistic++;
1516 else if (((escapeCodeValue * 2) < (1 << initialGolombRiceParameter)) && (currentGolombRiceStatistic > 0))
1518 currentGolombRiceStatistic--;
1521 updateGolombRiceStatistics =
false;
1525 if(absCoeff[ idx ] >= 2)
1533 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
1556 Bool bCodeLast = ( maxSymbol > code );
1565 for ( i=0; i<code-1; i++ )
1616 if(bIsFirstCompOfChType)
1640 for(
Int i=0; i< numClasses; i++)
1647 offset[k] = ctbParam.
offset[classIdx];
1652 for(
Int i=0; i< 4; i++)
1654 codeSaoMaxUvlc((offset[i]<0)?(-offset[i]):(offset[i]), maxOffsetQVal );
1660 for(
Int i=0; i< 4; i++)
1672 if(bIsFirstCompOfChType)
1684 ,
Bool* sliceEnabled
1685 ,
Bool leftMergeAvail
1686 ,
Bool aboveMergeAvail
1687 ,
Bool onlyEstMergeInfo
1691 Bool isLeftMerge =
false;
1692 Bool isAboveMerge=
false;
1700 if( aboveMergeAvail && !isLeftMerge)
1706 if(onlyEstMergeInfo)
1711 if(!isLeftMerge && !isAboveMerge)
1762 for(
UInt uiCtxInc = 0; uiCtxInc < 4; uiCtxInc++ )
1780 for (
Int ctxIdx = firstCtx; ctxIdx < firstCtx + numCtx; ctxIdx++ )
1782 for(
UInt uiBin = 0; uiBin < 2; uiBin++ )
1810 if ((width == 4) && (height == 4))
1815 else if ((width == 8) && (height == 8))
1830 for (
UInt component = firstComponent; component <= lastComponent; component++)
1836 for(
UInt bin = 0; bin < 2; bin++ )
1844 for(
UInt bin = 0; bin < 2; bin++ )
1850 for (
Int ctxIdx = firstCtx; ctxIdx < firstCtx + numCtx; ctxIdx++ )
1852 for(
UInt uiBin = 0; uiBin < 2; uiBin++ )
1874 swap(width, height);
1888 for (
UInt componentIndex = firstComponent; componentIndex <= lastComponent; componentIndex++)
1892 Int iBitsX = 0, iBitsY = 0;
1894 Int blkSizeOffsetX, blkSizeOffsetY, shiftX, shiftY;
1903 Int *
const lastXBitsArray = pcEstBitsSbac->
lastXBits[channelType];
1904 Int *
const lastYBitsArray = pcEstBitsSbac->
lastYBits[channelType];
1912 Int ctxOffset = blkSizeOffsetX + (ctx >>shiftX);
1913 lastXBitsArray[ ctx ] = iBitsX + pCtxX[ ctxOffset ].
getEntropyBits( 0 );
1917 lastXBitsArray[ctx] = iBitsX;
1923 for (ctx = 0; ctx < g_uiGroupIdx[ height - 1 ]; ctx++)
1925 Int ctxOffset = blkSizeOffsetY + (ctx >>shiftY);
1926 lastYBitsArray[ ctx ] = iBitsY + pCtxY[ ctxOffset ].
getEntropyBits( 0 );
1930 lastYBitsArray[ctx] = iBitsY;
1954 for (
Int ctxIdx = oneStartIndex; ctxIdx < oneStopIndex; ctxIdx++)
1960 for (
Int ctxIdx = absStartIndex; ctxIdx < absStopIndex; ctxIdx++)
1995 assert(tuHeight == tuWidth);
1996 assert(tuHeight < 4);
#define NUM_SAO_EO_TYPES_LOG2
SChar g_aucConvertToBit[MAX_CU_SIZE+1]
ContextModel3DBuffer m_cSaoTypeIdxSCModel
Void codeQtCbfZero(TComTU &rTu, const ChannelType chType)
#define NUM_SAO_BO_CLASSES_LOG2
Bool getCrossComponentPredictionEnabledFlag() const
Int getEntropyBits(Short val)
Void estSignificantMapBit(estBitsSbacStruct *pcEstBitsSbac, Int width, Int height, ChannelType chType)
estimate SAMBAC bit cost for significant coefficient map
ContextModel3DBuffer m_explicitRdpcmFlagSCModel
Void codeSplitFlag(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
static Int countNonZeroCoeffs(TCoeff *pcCoef, UInt uiSize)
static const UChar INIT_SAO_MERGE_FLAG[NUMBER_OF_SLICE_TYPES][1]
#define NUM_QT_ROOT_CBF_CTX
number of context models for QT ROOT CBF
Void codeSPS(const TComSPS *pcSPS)
SliceType
supported slice type
Int getMVPIdx(RefPicList eRefPicList, UInt uiIdx) const
Bool getPersistentRiceAdaptationEnabledFlag() const
Int getRefIdx(Int iIdx) const
SChar * getPartitionSize()
static Int getSigCtxInc(Int patternSigCtx, const TUEntropyCodingParameters &codingParameters, const Int scanPosition, const Int log2BlockWidth, const Int log2BlockHeight, const ChannelType chanType)
SliceType getSliceType() const
ContextModel3DBuffer m_cCUMergeFlagExtSCModel
static const UChar INIT_PART_SIZE[NUMBER_OF_SLICE_TYPES][4]
virtual Void resetBac()=0
Int lastYBits[MAX_NUM_CHANNEL_TYPE][LAST_SIGNIFICANT_GROUPS]
Void codeCoeffNxN(TComTU &rTu, TCoeff *pcCoef, const ComponentID compID)
static const Int HOR_IDX
index for intra HORIZONTAL mode
static const UChar INIT_LAST[NUMBER_OF_SLICE_TYPES][2 *15]
Void estSignificantCoefficientsBit(estBitsSbacStruct *pcEstBitsSbac, ChannelType chType)
estimate bit cost of significant coefficient
ContextModel3DBuffer m_cCUPredModeSCModel
ContextModel3DBuffer m_cCURefPicSCModel
Void estCBFBit(estBitsSbacStruct *pcEstBitsSbac)
estimate bit cost for each CBP bit
static const UInt significanceMapContextSetSize[MAX_NUM_CHANNEL_TYPE][CONTEXT_NUMBER_OF_TYPES]
Void codeSliceHeader(TComSlice *pcSlice)
UChar * getExplicitRdpcmMode(ComponentID component)
const TComPPSRExt & getPpsRangeExtension() const
static const UChar INIT_SIG_FLAG[NUMBER_OF_SLICE_TYPES][(28+16)]
static const Int DM_CHROMA_IDX
chroma mode index for derived from luma intra mode
static const Int NUM_CHROMA_MODE
total number of chroma modes
const TComSPSRExt & getSpsRangeExtension() const
SChar * getCrossComponentPredictionAlpha(ComponentID compID)
#define NUM_INTER_DIR_CTX
number of context models for inter prediction direction
#define NUM_ONE_FLAG_CTX_LUMA
number of context models for greater than 1 flag of luma
Void estSignificantCoeffGroupMapBit(estBitsSbacStruct *pcEstBitsSbac, ChannelType chType)
estimate SAMBAC bit cost for significant coefficient group map
Int lastXBits[MAX_NUM_CHANNEL_TYPE][LAST_SIGNIFICANT_GROUPS]
Void codeSaoTypeIdx(UInt uiCode)
UChar getQtRootCbf(UInt uiIdx) const
Int blockCbpBits[2 *5][2]
#define NUM_MERGE_FLAG_EXT_CTX
number of context models for merge flag of merge extended
static const Int MLS_GRP_NUM
Max number of coefficient groups, max(16, 64)
#define NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX
Bool getCabacInitPresentFlag() const
ChromaFormat GetChromaFormat() const
#define NUM_MVP_IDX_CTX
number of context models for MVP index
SChar * getPredictionMode()
UInt getNumPartitionsInCtu() const
Bool getMvdL1ZeroFlag() const
ContextModel3DBuffer m_cCUInterDirSCModel
Void codeSkipFlag(TComDataCU *pcCU, UInt uiAbsPartIdx)
#define NUM_CTX_LAST_FLAG_XY
number of context models for last coefficient position
#define NUM_SAO_TYPE_IDX_CTX
number of context models for SAO type index
#define NUM_PRED_MODE_CTX
number of context models for prediction mode
Void codeSAOSign(UInt uiCode)
Int blockRootCbpBits[4][2]
static const Int MIN_TU_SIZE
symmetric motion partition, 2Nx N
static const UChar INIT_CHROMA_QP_ADJ_FLAG[NUMBER_OF_SLICE_TYPES][1]
#define NUM_ONE_FLAG_CTX
number of context models for greater than 1 flag
UInt m_golombRiceAdaptationStatistics[RExt__GOLOMB_RICE_ADAPTATION_STATISTICS_SETS]
UInt GetTransformDepthRel() const
Int getNumberValidComponents() const
UInt getCtxSkipFlag(UInt uiAbsPartIdx) const
#define NUM_SKIP_FLAG_CTX
number of context models for skip flag
ContextModel3DBuffer m_cCUChromaPredSCModel
Void codeSaoMaxUvlc(UInt code, UInt maxSymbol)
ContextModel3DBuffer m_cCuCtxLastX
TComMv const & getMvd(Int iIdx) const
UChar getCbf(UInt uiIdx, ComponentID eType) const
Void codeLastSignificantXY(UInt uiPosX, UInt uiPosY, Int width, Int height, ComponentID component, UInt uiScanIdx)
static const UChar INIT_ABS_FLAG[NUMBER_OF_SLICE_TYPES][((1 *4)+(1 *2))]
UInt getLog2MaxTransformSkipBlockSize() const
static const UChar INIT_INTER_DIR[NUMBER_OF_SLICE_TYPES][5]
UInt getCtxInterDir(UInt uiAbsPartIdx) const
Int recon[MAX_NUM_CHANNEL_TYPE]
the bit depth as indicated in the SPS
Int getChromaQpOffsetListLen() const
static const UChar INIT_QT_ROOT_CBF[NUMBER_OF_SLICE_TYPES][1]
Int getNumRefIdx(RefPicList e) const
Void codeVPS(const TComVPS *pcVPS)
#define NUM_SAO_MERGE_FLAG_CTX
number of context models for SAO merge flags
virtual Void encodeBinTrm(UInt uiBin)=0
UInt getMinCUWidth() const
ContextModel3DBuffer m_cCUDeltaQpSCModel
#define NUM_MV_RES_CTX
number of context models for motion vector difference
UInt getMaxTrSize() const
Bool getSignDataHidingEnabledFlag() const
static UInt getSigCoeffGroupCtxInc(const UInt *uiSigCoeffGroupFlag, const UInt uiCGPosX, const UInt uiCGPosY, const UInt widthInGroups, const UInt heightInGroups)
Int m_greaterOneBits[((4 *4)+(4 *2))][2]
Void codePPS(const TComPPS *pcPPS)
Void getAllowedChromaDir(UInt uiAbsPartIdx, UInt *uiModeList) const
Void codeCrossComponentPrediction(TComTU &rTu, ComponentID compID)
UInt GetAbsPartIdxTU() const
static const UChar INIT_CHROMA_PRED_MODE[NUMBER_OF_SLICE_TYPES][2]
static const UChar INIT_MERGE_FLAG_EXT[NUMBER_OF_SLICE_TYPES][1]
#define NUM_ONE_FLAG_CTX_PER_SET
number of context models for greater than 1 flag in a set
class for motion information in one CU
UInt getMaxTotalCUDepth() const
Int significantBits[(28+16)][2]
ContextModel3DBuffer m_cCUAbsSCModel
PartSize
supported partition shape
static const UChar INIT_TRANSFORMSKIP_FLAG[NUMBER_OF_SLICE_TYPES][2 *1]
ContextModel3DBuffer m_cCUOneSCModel
Void loadContexts(const TEncSbac *pSrc)
Void estLastSignificantPositionBit(estBitsSbacStruct *pcEstBitsSbac, Int width, Int height, ChannelType chType, COEFF_SCAN_TYPE scanType)
estimate bit cost of significant coefficient
Void codeIntraDirChroma(TComDataCU *pcCU, UInt uiAbsPartIdx)
static const UChar INIT_SKIP_FLAG[NUMBER_OF_SLICE_TYPES][3]
ContextModel3DBuffer m_cCUQtCbfSCModel
ContextModel3DBuffer m_cCUSigSCModel
UChar * getIntraDir(const ChannelType channelType) const
Void xWriteCoefRemainExGolomb(UInt symbol, UInt &rParam, const Bool useLimitedPrefixLength, const Int maxLog2TrDynamicRange)
static const UChar INIT_QT_CBF[NUMBER_OF_SLICE_TYPES][2 *5]
Void codeSAOBlkParam(SAOBlkParam &saoBlkParam, const BitDepths &bitDepths, Bool *sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, Bool onlyEstMergeInfo=false)
#define NUM_SIG_CG_FLAG_CTX
number of context models for MULTI_LEVEL_SIGNIFICANCE
Int golombRiceAdaptationStatistics[RExt__GOLOMB_RICE_ADAPTATION_STATISTICS_SETS]
UInt getGolombRiceStatisticsIndex(const ComponentID compID)
#define NUM_ABS_FLAG_CTX_LUMA
number of context models for greater than 2 flag of luma
UInt getMaxNumMergeCand() const
ContextModel3DBuffer m_cCUSkipFlagSCModel
#define NUM_SAO_BO_CLASSES
ContextModel3DBuffer m_cCUTransSubdivFlagSCModel
symmetric motion partition, 2Nx2N
Void codeIPCMInfo(TComDataCU *pcCU, UInt uiAbsPartIdx)
Void codeMergeFlag(TComDataCU *pcCU, UInt uiAbsPartIdx)
Int getQpBDOffset(ChannelType type) const
static const Int MLS_CG_LOG2_WIDTH
Bool getUseTransformSkip() const
static const UChar INIT_PRED_MODE[NUMBER_OF_SLICE_TYPES][1]
Bool isIntra(UInt uiPartIdx) const
ContextModel3DBuffer m_cCUPartSizeSCModel
static const UChar INIT_CHROMA_QP_ADJ_IDC[NUMBER_OF_SLICE_TYPES][1]
Void xCopyContextsFrom(const TEncSbac *pSrc)
Void xCopyFrom(const TEncSbac *pSrc)
#define NUM_CHROMA_PRED_CTX
number of context models for intra prediction (chroma)
virtual Void xWritePCMCode(UInt uiCode, UInt uiLength)=0
static const Int VER_IDX
index for intra VERTICAL mode
Void xWriteUnarySymbol(UInt uiSymbol, ContextModel *pcSCModel, Int iOffset)
ContextModel3DBuffer m_cCUQtRootCbfSCModel
static const UChar INIT_EXPLICIT_RDPCM_FLAG[NUMBER_OF_SLICE_TYPES][2 *1]
static const Int AMVP_MAX_NUM_CANDS
AMVP: advanced motion vector prediction - max number of final candidates.
static const Int RExt__GOLOMB_RICE_INCREMENT_DIVISOR
Void codeSAOOffsetParam(ComponentID compIdx, SAOOffset &ctbParam, Bool sliceEnabled, const Int channelBitDepth)
UInt getMinCUHeight() const
Bool isRDPCMEnabled(UInt uiAbsPartIdx) const
UInt getCtxSplitFlag(UInt uiAbsPartIdx, UInt uiDepth) const
Void codeQtCbf(TComTU &rTu, const ComponentID compID, const Bool lowestLevel)
asymmetric motion partition, 2Nx( N/2) + 2Nx(3N/2)
static const UChar INIT_TRANS_SUBDIV_FLAG[NUMBER_OF_SLICE_TYPES][3]
Void codeExplicitRdpcmMode(TComTU &rTu, const ComponentID compID)
asymmetric motion partition, (3N/2)x2N + ( N/2)x2N
#define NUM_REF_NO_CTX
number of context models for reference index
static const Int MAX_INT
max. value of signed 32-bit integer
Void load(const TEncSbac *pSrc)
static const UChar INIT_SPLIT_FLAG[NUMBER_OF_SLICE_TYPES][3]
#define NUM_DELTA_QP_CTX
number of context models for dQP
Void getIntraDirPredictor(UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int *piMode=0) const
static const UChar INIT_DQP[NUMBER_OF_SLICE_TYPES][3]
UInt calcCost(SliceType sliceType, Int qp, UChar *ctxModel)
determine cost of choosing a probability table based on current probabilities
static const Int CU_DQP_TU_CMAX
max number bins for truncated unary
Void loadIntraDirMode(const TEncSbac *pScr, const ChannelType chType)
Void codeTransformSubdivFlag(UInt uiSymbol, UInt uiCtx)
#define NUM_EXPLICIT_RDPCM_FLAG_CTX
number of context models for the flag which specifies whether to use RDPCM on inter coded residues ...
static const UChar INIT_CROSS_COMPONENT_PREDICTION[NUMBER_OF_SLICE_TYPES][10]
Void estBit(estBitsSbacStruct *pcEstBitsSbac, Int width, Int height, ChannelType chType, COEFF_SCAN_TYPE scanType)
estimate bit cost for CBP, significant map and significant coefficients
ContextModel3DBuffer m_ChromaQpAdjFlagSCModel
virtual Void copyState(const TEncBinIf *pcTEncBinIf)=0
Int TCoeff
transform coefficient
#define NUM_EXPLICIT_RDPCM_DIR_CTX
number of context models for the flag which specifies which RDPCM direction is used on inter coded re...
Int getComponentScaleX(const ComponentID id) const
RefPicList
reference list index
Void xWriteEpExGolomb(UInt uiSymbol, UInt uiCount)
Void codeTransformSkipFlags(TComTU &rTu, ComponentID component)
Bool getCabacBypassAlignmentEnabledFlag() const
#define DTRACE_CABAC_VL(x)
static const UChar INIT_SIG_CG_FLAG[NUMBER_OF_SLICE_TYPES][2 *2]
ContextModel3DBuffer m_cMVPIdxSCModel
const TComRectangle & getRect(const ComponentID compID) const
Void codeSaoMerge(UInt uiCode)
ContextModel & get(UInt uiZ, UInt uiY, UInt uiX)
COEFF_SCAN_TYPE
coefficient scanning type used in ACS
Int getMaxLog2TrDynamicRange(ChannelType channelType) const
Void codeMvd(TComDataCU *pcCU, UInt uiAbsPartIdx, RefPicList eRefList)
Bool isSkipped(UInt uiPartIdx) const
returns true, if the partiton is skipped
UInt g_auiZscanToRaster[MAX_NUM_PART_IDXS_IN_CTU_WIDTH *MAX_NUM_PART_IDXS_IN_CTU_WIDTH]
const TComPPS * getPPS() const
static const UInt significanceMapContextSetStart[MAX_NUM_CHANNEL_TYPE][CONTEXT_NUMBER_OF_TYPES]
#define NUM_QT_CBF_CTX_PER_SET
number of context models for QT CBF
Void codeTilesWPPEntryPoint(TComSlice *pSlice)
static const UChar INIT_MERGE_IDX_EXT[NUMBER_OF_SLICE_TYPES][1]
static const UChar INIT_MVD[NUMBER_OF_SLICE_TYPES][2]
Void codeDeltaQP(TComDataCU *pcCU, UInt uiAbsPartIdx)
UChar * getTransformSkip(ComponentID compID)
ContextModel3DBuffer m_cCrossComponentPredictionSCModel
Void codePartSize(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
ContextModel3DBuffer m_cCUIntraPredSCModel
Void codeCUTransquantBypassFlag(TComDataCU *pcCU, UInt uiAbsPartIdx)
ContextModel3DBuffer m_cTransformSkipSCModel
#define DTRACE_CABAC_T(x)
Void codePredMode(TComDataCU *pcCU, UInt uiAbsPartIdx)
#define NUM_CTX_LAST_FLAG_SETS
const UInt g_uiMinInGroup[LAST_SIGNIFICANT_GROUPS]
Int getLog2DiffMaxMinCodingBlockSize() const
virtual Void encodeBinEP(UInt uiBin)=0
Bool * getCUTransquantBypass()
ContextModel m_contextModels[512]
#define NUM_ABS_FLAG_CTX
number of context models for greater than 2 flag
asymmetric motion partition, ( N/2)x2N + (3N/2)x2N
virtual Void encodeBin(UInt uiBin, ContextModel &rcCtxModel)=0
Context-adaptive entropy encoder class (header)
UInt GetAbsPartIdxNumParts() const
static const UChar INIT_ONE_FLAG[NUMBER_OF_SLICE_TYPES][((4 *4)+(4 *2))]
static Int getMaxOffsetQVal(const Int channelBitDepth)
ContextModel3DBuffer m_cCUSplitFlagSCModel
ContextModel3DBuffer m_ChromaQpAdjIdcSCModel
Bool getFinalized() const
ContextModel3DBuffer m_cCUSigCoeffGroupSCModel
#define NUM_TRANS_SUBDIV_FLAG_CTX
number of context models for transform subdivision flags
Void codeTerminatingBit(UInt uilsLast)
static const UChar INIT_SAO_TYPE_IDX[NUMBER_OF_SLICE_TYPES][1]
#define NUM_CROSS_COMPONENT_PREDICTION_CTX
#define NUM_CHROMA_QP_ADJ_IDC_CTX
number of context models for chroma_qp_adjustment_idc
const UChar g_chroma422IntraAngleMappingTable[NUM_INTRA_MODE]
Void codeMergeIndex(TComDataCU *pcCU, UInt uiAbsPartIdx)
const UInt g_uiGroupIdx[MAX_TU_SIZE]
static const UChar INIT_REF_PIC[NUMBER_OF_SLICE_TYPES][2]
Void resetEntropy(const TComSlice *pSlice)
#define NUM_TRANSFORMSKIP_FLAG_CTX
number of context models for transform skipping
SliceType getEncCABACTableIdx() const
static Int calcPatternSigCtx(const UInt *sigCoeffGroupFlag, UInt uiCGPosX, UInt uiCGPosY, UInt widthInGroups, UInt heightInGroups)
Int significantCoeffGroupBits[2][2]
UInt getCtxQtCbf(TComTU &rTu, const ChannelType chType) const
static const Int MLS_CG_SIZE
Coefficient group size of 4x4; = MLS_CG_LOG2_WIDTH + MLS_CG_LOG2_HEIGHT.
virtual Void encodeBinsEP(UInt uiBins, Int numBins)=0
Void store(TEncSbac *pDest) const
Void codeMVPIdx(TComDataCU *pcCU, UInt uiAbsPartIdx, RefPicList eRefList)
ContextModel3DBuffer m_cSaoMergeSCModel
virtual Void encodePCMAlignBits()=0
ContextModel3DBuffer m_explicitRdpcmDirSCModel
TComCUMvField * getCUMvField(RefPicList e)
static const UChar INIT_CU_TRANSQUANT_BYPASS_FLAG[NUMBER_OF_SLICE_TYPES][1]
#define DTRACE_CABAC_V(x)
#define NUM_INTRA_PREDICT_CTX
number of context models for intra prediction
#define MAX_NUM_CTX_MOD
maximum number of supported contexts
static const Int MLS_CG_LOG2_HEIGHT
static const UChar INIT_INTRA_PRED_MODE[NUMBER_OF_SLICE_TYPES][1]
Int m_levelAbsBits[((1 *4)+(1 *2))][2]
static const Int RExt__GOLOMB_RICE_ADAPTATION_STATISTICS_SETS
UInt getPCMBitDepth(ChannelType type) const
ContextModel3DBuffer m_cCUMvdSCModel
static const UInt MAX_UINT
max. value of unsigned 32-bit integer
Int getComponentScaleY(const ComponentID id) const
Void codeChromaQpAdjustment(TComDataCU *cu, UInt absPartIdx)
static const UChar INIT_MVP_IDX[NUMBER_OF_SLICE_TYPES][1]
Void printSBACCoeffData(const UInt lastX, const UInt lastY, const UInt width, const UInt height, const UInt chan, const UInt absPart, const UInt scanIdx, const TCoeff *const pCoeff, const Bool finalEncode)
SChar getRefQP(UInt uiCurrAbsIdxInCtu) const
Void codeSaoUflc(UInt uiLength, UInt uiCode)
asymmetric motion partition, 2Nx(3N/2) + 2Nx( N/2)
Void codeRefFrmIdx(TComDataCU *pcCU, UInt uiAbsPartIdx, RefPicList eRefList)
#define NUM_QT_CBF_CTX_SETS
symmetric motion partition, Nx N
static const Int CU_DQP_EG_k
expgolomb order
Pel * getPCMSample(ComponentID component)
#define NUM_CHROMA_QP_ADJ_FLAG_CTX
number of context models for chroma_qp_adjustment_flag
#define NUM_PART_SIZE_CTX
number of context models for partition size
UInt g_auiRasterToPelX[MAX_NUM_PART_IDXS_IN_CTU_WIDTH *MAX_NUM_PART_IDXS_IN_CTU_WIDTH]
Void codeInterDir(TComDataCU *pcCU, UInt uiAbsPartIdx)
Void codeIntraDirLumaAng(TComDataCU *pcCU, UInt absPartIdx, Bool isMultiple)
static const UInt NUM_MOST_PROBABLE_MODES
ContextModel3DBuffer m_cCuCtxLastY
#define NUM_MERGE_IDX_EXT_CTX
number of context models for merge index of merge extended
Void copyFrom(const ContextModel3DBuffer *src)
UChar * getChromaQpAdj()
array of chroma QP adjustments (indexed). when value = 0, cu_chroma_qp_offset_flag=0; when value>0...
Void xWriteUnaryMaxSymbol(UInt uiSymbol, ContextModel *pcSCModel, Int iOffset, UInt uiMaxSymbol)
static const Int COEF_REMAIN_BIN_REDUCTION
indicates the level at which the VLC transitions from Golomb-Rice to TU+EG(k)
#define NUM_ABS_FLAG_CTX_PER_SET
number of context models for greater than 2 flag in a set
#define NUM_SIG_FLAG_CTX
number of context models for sig flag
ContextModel3DBuffer m_cCUMergeIdxExtSCModel
symmetric motion partition, Nx2N
ContextModel3DBuffer m_CUTransquantBypassFlagSCModel
SliceType determineCabacInitIdx(const TComSlice *pSlice)
Void initBuffer(SliceType eSliceType, Int iQp, UChar *ctxModel)
initialize 3D buffer by slice type & QP
UInt g_auiRasterToPelY[MAX_NUM_PART_IDXS_IN_CTU_WIDTH *MAX_NUM_PART_IDXS_IN_CTU_WIDTH]
Bool getExtendedPrecisionProcessingFlag() const
static const UChar INIT_EXPLICIT_RDPCM_DIR[NUMBER_OF_SLICE_TYPES][2 *1]
#define NUM_SPLIT_FLAG_CTX
number of context models for split flag
UInt GetTransformDepthTotal() const
const TComSPS * getSPS() const
static const Int SBH_THRESHOLD
value of the fixed SBH controlling threshold
static const Int C1FLAG_NUMBER
Void codeQtRootCbf(TComDataCU *pcCU, UInt uiAbsPartIdx)