Ticket #106: 0001-Fix-output-of-bit-and-tool-statistics.-If-RExt__DECO.patch

File 0001-Fix-output-of-bit-and-tool-statistics.-If-RExt__DECO.patch, 3.9 KB (added by blaeser, 6 years ago)
  • source/Lib/CommonLib/CodingStatistics.h

    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 
    6666  STATS__CABAC_BITS__REF_FRM_IDX,
    6767  STATS__CABAC_BITS__MVD,
    6868  STATS__CABAC_BITS__MVD_EP,
     69  STATS__CABAC_BITS__AFFINE_FLAG,
     70  STATS__CABAC_BITS__AFFINE_TYPE,
    6971  STATS__CABAC_BITS__TRANSFORM_SUBDIV_FLAG,
    7072  STATS__CABAC_BITS__QT_ROOT_CBF,
    7173  STATS__CABAC_BITS__DELTA_QP_EP,
    enum CodingStatisticsType 
    7678  STATS__CABAC_BITS__LAST_SIG_X_Y,
    7779  STATS__CABAC_BITS__SIG_COEFF_GROUP_FLAG,
    7880  STATS__CABAC_BITS__SIG_COEFF_MAP_FLAG,
     81  STATS__CABAC_BITS__PAR_FLAG,
    7982  STATS__CABAC_BITS__GT1_FLAG,
    8083  STATS__CABAC_BITS__GT2_FLAG,
    8184  STATS__CABAC_BITS__SIGN_BIT,
    8285  STATS__CABAC_BITS__ESCAPE_BITS,
    8386  STATS__CABAC_BITS__SAO,
     87  STATS__CABAC_BITS__ALF,
    8488  STATS__CABAC_TRM_BITS,
    8589  STATS__CABAC_FIXED_BITS,
    8690  STATS__CABAC_PCM_ALIGN_BITS,
    enum CodingStatisticsType 
    9397  STATS__CABAC_BITS__ALIGNED_ESCAPE_BITS,
    9498  STATS__CABAC_BITS__OTHER,
    9599  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,
    102100  STATS__CABAC_BITS__IMV_FLAG,
    103101#if JVET_L0646_GBI
    104102  STATS__CABAC_BITS__GBI_IDX,
    105103#endif
    106104  STATS__CABAC_BITS__EMT_CU_FLAG,
    107105  STATS__CABAC_BITS__EMT_TU_INDEX,
    108   STATS__TOOL_EMT,
    109106#if JVET_L0100_MULTI_HYPOTHESIS_INTRA
    110107  STATS__CABAC_BITS__MH_INTRA_FLAG,
    111108#endif
    enum CodingStatisticsType 
    113110  STATS__CABAC_BITS__TRIANGLE_FLAG,
    114111  STATS__CABAC_BITS__TRIANGLE_INDEX,
    115112#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,
    116119  STATS__TOOL_TOTAL,
    117120  STATS__NUM_STATS
    118121};
    static inline const char* getName(CodingStatisticsType name) 
    179182    "CABAC_EP_BIT_ALIGNMENT",
    180183    "CABAC_BITS__ALIGNED_SIGN_BIT",
    181184    "CABAC_BITS__ALIGNED_ESCAPE_BITS",
     185    "CABAC_BITS__OTHER",
     186    "CABAC_BITS__INVALID",
    182187    "CABAC_BITS__IMV_FLAG",
    183188#if JVET_L0646_GBI
    184189    "CABAC_BITS__GBI_IDX",
    static inline const char* getName(CodingStatisticsType name) 
    192197    "CABAC_BITS__TRIANGLE_FLAG",
    193198    "CABAC_BITS__TRIANGLE_INDEX",
    194199#endif
    195     "CABAC_BITS__OTHER",
    196     "CABAC_BITS__INVALID",
     200#if JVET_L0283_MULTI_REF_LINE
     201    "CABAC_BITS__MULTI_REF_LINE",
     202#endif
    197203    "TOOL_FRAME",
     204    "TOOL_AFFINE",
     205    "TOOL_EMT",
    198206    "TOOL_TOTAL"
    199207  };
    200208  CHECK( STATS__NUM_STATS != sizeof( statNames ) / sizeof( char* ) || name >= STATS__NUM_STATS, "stats out of range" );
  • source/Lib/DecoderLib/CABACReader.cpp

    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) 
    954954    cu.firstPU->multiRefIdx = 0;
    955955    return;
    956956  }
     957  RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET(STATS__CABAC_BITS__MULTI_REF_LINE);
    957958
    958959  const int numBlocks = CU::getNumPUs(cu);
    959960  PredictionUnit* pu = cu.firstPU;