34 #ifndef __TCOMCODINGSTATISTICS__
35 #define __TCOMCODINGSTATISTICS__
99 static const TChar *statNames[]=
101 "NAL_UNIT_TOTAL_BODY",
103 "EMULATION_PREVENTION_3_BYTES",
104 "NAL_UNIT_HEADER_BITS",
105 "CABAC_INITIALISATION-and-rounding",
106 "CABAC_BITS__TQ_BYPASS_FLAG",
107 "CABAC_BITS__SKIP_FLAG",
108 "CABAC_BITS__MERGE_FLAG",
109 "CABAC_BITS__MERGE_INDEX",
110 "CABAC_BITS__MVP_IDX",
111 "CABAC_BITS__SPLIT_FLAG",
112 "CABAC_BITS__PART_SIZE",
113 "CABAC_BITS__PRED_MODE",
114 "CABAC_BITS__INTRA_DIR_ANG",
115 "CABAC_BITS__INTER_DIR",
116 "CABAC_BITS__REF_FRM_IDX",
118 "CABAC_BITS__MVD_EP",
119 "CABAC_BITS__TRANSFORM_SUBDIV_FLAG",
120 "CABAC_BITS__QT_ROOT_CBF",
121 "CABAC_BITS__DELTA_QP_EP",
122 "CABAC_BITS__CHROMA_QP_ADJUSTMENT",
123 "CABAC_BITS__QT_CBF",
124 "CABAC_BITS__CROSS_COMPONENT_PREDICTION",
125 "CABAC_BITS__TRANSFORM_SKIP_FLAGS",
126 "CABAC_BITS__LAST_SIG_X_Y",
127 "CABAC_BITS__SIG_COEFF_GROUP_FLAG",
128 "CABAC_BITS__SIG_COEFF_MAP_FLAG",
129 "CABAC_BITS__GT1_FLAG",
130 "CABAC_BITS__GT2_FLAG",
131 "CABAC_BITS__SIGN_BIT",
132 "CABAC_BITS__ESCAPE_BITS",
136 "CABAC_PCM_ALIGN_BITS",
137 "CABAC_PCM_CODE_BITS",
138 "BYTE_ALIGNMENT_BITS",
140 "EXPLICIT_RDPCM_BITS",
141 "CABAC_EP_BIT_ALIGNMENT",
142 "CABAC_BITS__ALIGNED_SIGN_BIT",
143 "CABAC_BITS__ALIGNED_ESCAPE_BITS"
146 return statNames[name];
249 OutputLine(pName, sep,
"-", pSubClassStr, sCABAC, sEP);
253 printf(
"%c%-45s%c %6d %6s %12lld %12lld %12lld %12lld %12lld %12lld %12lld (%12lld)%c\n",
254 sep==
'~'?
'[':
' ', pName, sep, 1<<width, pSubClassStr,
260 printf(
"%c%-45s%c %6s %6s %12lld %12lld %12lld %12lld %12lld %12lld %12lld (%12lld)%c\n",
261 sep==
'~'?
'[':
' ', pName, sep, pWidthString, pSubClassStr,
266 printf(
"%c%-45s%c %6s %6s %12s %12s %12s %12lld %12lld %12lld %12lld (%12lld)%c\n",
267 sep==
'~'?
'[':
' ', pName, sep, pWidthString, pSubClassStr,
273 printf(
"--%s",pText);
275 for(;pText[tot]!=0; tot++);
278 for (; tot<168; tot++)
291 Int64 totalCABACbits=0, roundedCABACbits=0;
300 Int64 remainder=totalCABACbits - roundedCABACbits*es;
301 cr=(remainder+es/2)/es;
305 printf(
" %-45s- Width Type CABAC Count CABAC Sum CABAC bits EP Count EP Sum EP bits Total bits ( Total bytes)\n",
"Decoder statistics");
308 SStat cabacTotalBits, epTotalBits;
314 SStat cabacSubTotal, epSubTotal;
315 Bool bHadClassifiedEntry=
false;
323 if (sCABACorig.
bits==0 && sEP.
bits==0)
336 sCABAC.
bits=thisCABACbits;
338 sCABAC.
sum=sCABACorig.
sum;
342 cabacSubTotal+=sCABAC;
346 cabacTotalBits+=sCABAC;
348 statTotals_cabac[c]+=sCABAC;
349 statTotals_ep[c]+=sEP;
351 bHadClassifiedEntry=bHadClassifiedEntry||(c!=0);
353 if (bHadClassifiedEntry)
355 OutputLine(pName,
'~',
"~~ST~~",
"~~ST~~", cabacSubTotal, epSubTotal);
363 OutputLine(
"CABAC Sub-total",
'~',
"~~ST~~",
"~~ST~~", cabacTotalBits, epTotalBits);
366 SStat cavlcTotalBits;
371 OutputLine(it->first.c_str(),
':',
"-",
"-", s);
375 OutputLine(
"CAVLC Header Sub-total",
'~',
"~~ST~~",
"~~ST~~", cavlcTotalBits);
381 SStat subTotalCabac, subTotalEP;
384 subTotalCabac+=statTotals_cabac[c+s];
385 subTotalEP+=statTotals_ep[c+s];
387 if (subTotalCabac.
bits!=0 || subTotalEP.
bits!=0)
389 OutputLine(
"CABAC by size Sub-total",
'=', s,
"All", subTotalCabac, subTotalEP);
395 SStat subTotalCabac, subTotalEP;
398 subTotalCabac+=statTotals_cabac[c+s];
399 subTotalEP+=statTotals_ep[c+s];
401 if (subTotalCabac.
bits!=0 || subTotalEP.
bits!=0)
411 SStat subTotalCabac, subTotalEP;
412 subTotalCabac+=statTotals_cabac[c+s];
413 subTotalEP+=statTotals_ep[c+s];
414 if (subTotalCabac.
bits!=0 || subTotalEP.
bits!=0)
422 OutputLine(
"CABAC Sub-total",
'~',
"~~ST~~",
"~~ST~~", cabacTotalBits, epTotalBits);
423 OutputLine(
"CAVLC Header Sub-total",
'~',
"~~ST~~",
"~~ST~~", cavlcTotalBits);
425 epTotalBits+=cavlcTotalBits;
426 OutputLine(
"TOTAL",
'~',
"~~GT~~",
"~~GT~~", cabacTotalBits, epTotalBits);
SStat statistics[STATS__NUM_STATS+1][CODING_STATS_NUM_SUBCLASSES]
static Void OutputDashedLine(const TChar *pText)
static Bool isAlignedBins(TComCodingStatisticsType statT)
TComCodingStatisticsData data
static Void OutputLine(const TChar *pName, const TChar sep, const TChar *pWidthString, const TChar *pSubClassStr, const SStat &sCABAC, const SStat &sEP)
Defines version information, constants and small in-line functions.
TComCodingStatisticsClassType(const TComCodingStatisticsType t, const Int log2w)
std::map< std::string, SStat > mappings_ep
static const TChar * GetSubClassString(const UInt subClass)
static const UInt CODING_STATS_NUM_WIDTHS
SStat statistics_ep[STATS__NUM_STATS+1][CODING_STATS_NUM_SUBCLASSES]
static SStat & GetStatisticEP(const TComCodingStatisticsClassType &stat)
TComCodingStatisticsClassType(const TComCodingStatisticsType t, const ChannelType chid)
TComCodingStatisticsType type
static const UInt CODING_STATS_NUM_SUBCLASSES
static Void IncrementStatisticEP(const std::string &str, const Int numBits, const Int value)
TComCodingStatisticsClassType(const TComCodingStatisticsType t, const UInt log2w, const ComponentID cid)
static SStat & GetStatisticEP(const TChar *pKey)
static Void IncrementStatisticEP(const TChar *pKey, const Int numBits, const Int value)
static Void OutputLine(const TChar *pName, const TChar sep, const TChar *pWidthString, const TChar *pSubClassStr, const SStat &sEP)
TComCodingStatisticsClassType(const TComCodingStatisticsType t, const UInt log2w, const ChannelType chid)
static Void UpdateCABACStat(const TComCodingStatisticsClassType &stat, UInt uiRangeBefore, UInt uiRangeAfter, Int val)
SStat & operator+=(const SStat &src)
TComCodingStatisticsClassType(const TComCodingStatisticsType t)
static UInt GetSubClassWidth(const UInt subClass)
static const TChar * getName(TComCodingStatisticsType name)
TComCodingStatisticsClassType(const TComCodingStatisticsType t, const ComponentID cid)
static const TComCodingStatisticsData & GetStatistics()
static Void OutputLine(const TChar *pName, const TChar sep, UInt width, const TChar *pSubClassStr, const SStat &sCABAC, const SStat &sEP)
static SStat & GetStatisticEP(const std::string &str)
static Void SetStatistics(const TComCodingStatisticsData &src)
static const Int64 TCOMCODINGSTATISTICS_ENTROPYSCALE
static Void IncrementStatisticEP(const TComCodingStatisticsClassType &stat, const Int numBits, const Int value)
TComCodingStatisticsClassType(const TComCodingStatisticsType t, const UInt log2w)
static TComCodingStatistics & GetSingletonInstance()