From: Max Blaeser <blaeser@ient.rwth-aachen.de>
Date: Tue, 13 Nov 2018 15:25:46 +0100
Subject: [PATCH] Fix output of bit and tool statistics. If
RExt__DECODER_DEBUG_BIT_STATISTICS and RExt__DECODER_DEBUG_TOOL_STATISTICS
are enabled, the decoder throws and exception as size of enum
CodingStatisticsType and the size of the statNames array don't match.
Further, the order of the enum has to match the order of the labels. Also,
the bit counter for JVET_L0283_MULTI_REF_LINE was missing.
---
source/Lib/CommonLib/CodingStatistics.h | 26 +++++++++++++++++---------
source/Lib/DecoderLib/CABACReader.cpp | 1 +
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/source/Lib/CommonLib/CodingStatistics.h b/source/Lib/CommonLib/CodingStatistics.h
index a00a49b..c9bf3b3 100644
a
|
b
|
enum CodingStatisticsType |
66 | 66 | STATS__CABAC_BITS__REF_FRM_IDX, |
67 | 67 | STATS__CABAC_BITS__MVD, |
68 | 68 | STATS__CABAC_BITS__MVD_EP, |
| 69 | STATS__CABAC_BITS__AFFINE_FLAG, |
| 70 | STATS__CABAC_BITS__AFFINE_TYPE, |
69 | 71 | STATS__CABAC_BITS__TRANSFORM_SUBDIV_FLAG, |
70 | 72 | STATS__CABAC_BITS__QT_ROOT_CBF, |
71 | 73 | STATS__CABAC_BITS__DELTA_QP_EP, |
… |
… |
enum CodingStatisticsType |
76 | 78 | STATS__CABAC_BITS__LAST_SIG_X_Y, |
77 | 79 | STATS__CABAC_BITS__SIG_COEFF_GROUP_FLAG, |
78 | 80 | STATS__CABAC_BITS__SIG_COEFF_MAP_FLAG, |
| 81 | STATS__CABAC_BITS__PAR_FLAG, |
79 | 82 | STATS__CABAC_BITS__GT1_FLAG, |
80 | 83 | STATS__CABAC_BITS__GT2_FLAG, |
81 | 84 | STATS__CABAC_BITS__SIGN_BIT, |
82 | 85 | STATS__CABAC_BITS__ESCAPE_BITS, |
83 | 86 | STATS__CABAC_BITS__SAO, |
| 87 | STATS__CABAC_BITS__ALF, |
84 | 88 | STATS__CABAC_TRM_BITS, |
85 | 89 | STATS__CABAC_FIXED_BITS, |
86 | 90 | STATS__CABAC_PCM_ALIGN_BITS, |
… |
… |
enum CodingStatisticsType |
93 | 97 | STATS__CABAC_BITS__ALIGNED_ESCAPE_BITS, |
94 | 98 | STATS__CABAC_BITS__OTHER, |
95 | 99 | STATS__CABAC_BITS__INVALID, |
96 | | STATS__TOOL_TOTAL_FRAME,// This is a special case and is not included in the report. |
97 | | STATS__CABAC_BITS__AFFINE_FLAG, |
98 | | STATS__TOOL_AFF, |
99 | | STATS__CABAC_BITS__AFFINE_TYPE, |
100 | | STATS__CABAC_BITS__PAR_FLAG, |
101 | | STATS__CABAC_BITS__ALF, |
102 | 100 | STATS__CABAC_BITS__IMV_FLAG, |
103 | 101 | #if JVET_L0646_GBI |
104 | 102 | STATS__CABAC_BITS__GBI_IDX, |
105 | 103 | #endif |
106 | 104 | STATS__CABAC_BITS__EMT_CU_FLAG, |
107 | 105 | STATS__CABAC_BITS__EMT_TU_INDEX, |
108 | | STATS__TOOL_EMT, |
109 | 106 | #if JVET_L0100_MULTI_HYPOTHESIS_INTRA |
110 | 107 | STATS__CABAC_BITS__MH_INTRA_FLAG, |
111 | 108 | #endif |
… |
… |
enum CodingStatisticsType |
113 | 110 | STATS__CABAC_BITS__TRIANGLE_FLAG, |
114 | 111 | STATS__CABAC_BITS__TRIANGLE_INDEX, |
115 | 112 | #endif |
| 113 | #if JVET_L0283_MULTI_REF_LINE |
| 114 | STATS__CABAC_BITS__MULTI_REF_LINE, |
| 115 | #endif |
| 116 | STATS__TOOL_TOTAL_FRAME,// This is a special case and is not included in the report. |
| 117 | STATS__TOOL_AFF, |
| 118 | STATS__TOOL_EMT, |
116 | 119 | STATS__TOOL_TOTAL, |
117 | 120 | STATS__NUM_STATS |
118 | 121 | }; |
… |
… |
static inline const char* getName(CodingStatisticsType name) |
179 | 182 | "CABAC_EP_BIT_ALIGNMENT", |
180 | 183 | "CABAC_BITS__ALIGNED_SIGN_BIT", |
181 | 184 | "CABAC_BITS__ALIGNED_ESCAPE_BITS", |
| 185 | "CABAC_BITS__OTHER", |
| 186 | "CABAC_BITS__INVALID", |
182 | 187 | "CABAC_BITS__IMV_FLAG", |
183 | 188 | #if JVET_L0646_GBI |
184 | 189 | "CABAC_BITS__GBI_IDX", |
… |
… |
static inline const char* getName(CodingStatisticsType name) |
192 | 197 | "CABAC_BITS__TRIANGLE_FLAG", |
193 | 198 | "CABAC_BITS__TRIANGLE_INDEX", |
194 | 199 | #endif |
195 | | "CABAC_BITS__OTHER", |
196 | | "CABAC_BITS__INVALID", |
| 200 | #if JVET_L0283_MULTI_REF_LINE |
| 201 | "CABAC_BITS__MULTI_REF_LINE", |
| 202 | #endif |
197 | 203 | "TOOL_FRAME", |
| 204 | "TOOL_AFFINE", |
| 205 | "TOOL_EMT", |
198 | 206 | "TOOL_TOTAL" |
199 | 207 | }; |
200 | 208 | CHECK( STATS__NUM_STATS != sizeof( statNames ) / sizeof( char* ) || name >= STATS__NUM_STATS, "stats out of range" ); |
diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp
index 76db0e4..fd58a5a 100644
a
|
b
|
void CABACReader::extend_ref_line(CodingUnit& cu) |
954 | 954 | cu.firstPU->multiRefIdx = 0; |
955 | 955 | return; |
956 | 956 | } |
| 957 | RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET(STATS__CABAC_BITS__MULTI_REF_LINE); |
957 | 958 | |
958 | 959 | const int numBlocks = CU::getNumPUs(cu); |
959 | 960 | PredictionUnit* pu = cu.firstPU; |