Improve CABAC debugging by including similar info as in VTM

This commit is contained in:
Marko Viitanen 2018-09-10 11:00:00 +03:00
parent ce84407c69
commit a7ca09108c
2 changed files with 11 additions and 6 deletions

View file

@ -25,6 +25,10 @@
#include "extras/crypto.h"
#include "kvazaar.h"
#ifdef VERBOSE
uint32_t kvz_cabac_bins_count = 0;
#endif
const uint8_t kvz_g_auc_next_state_mps[128] =
{
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,

View file

@ -124,10 +124,11 @@ void kvz_cabac_write_unary_max_symbol_ep(cabac_data_t *data, unsigned int symbol
#define CTX_UPDATE_MPS(ctx) { (ctx)->uc_state = kvz_g_auc_next_state_mps[ (ctx)->uc_state ]; }
#ifdef VERBOSE
extern uint32_t kvz_cabac_bins_count;
#define CABAC_BIN(data, value, name) { \
uint32_t prev_state = (data)->cur_ctx->uc_state; \
printf("%s = %u, range = %u LPS = %u state = %u -> ", \
(name), (uint32_t)(value), (data)->range, kvz_g_auc_lpst_table[CTX_STATE(data->cur_ctx)][((data)->range >> 6) & 3], prev_state); \
printf("%d %d [%d:%d] %s = %u, range = %u LPS = %u state = %u -> ", \
kvz_cabac_bins_count++, (data)->range, (data)->range-kvz_g_auc_lpst_table[CTX_STATE(data->cur_ctx)][((data)->range >> 6) & 3], kvz_g_auc_lpst_table[CTX_STATE(data->cur_ctx)][((data)->range >> 6) & 3], (name), (uint32_t)(value), (data)->range, kvz_g_auc_lpst_table[CTX_STATE(data->cur_ctx)][((data)->range >> 6) & 3], prev_state); \
kvz_cabac_encode_bin((data), (value)); \
printf("%u\n", (data)->cur_ctx->uc_state); }
@ -135,14 +136,14 @@ void kvz_cabac_write_unary_max_symbol_ep(cabac_data_t *data, unsigned int symbol
#define CABAC_BINS_EP(data, value, bins, name) { \
uint32_t prev_state = (data)->cur_ctx->uc_state; \
kvz_cabac_encode_bins_ep((data), (value), (bins)); \
printf("%s = %u(%u bins), state = %u -> %u\n", \
(name), (uint32_t)(value), (bins), prev_state, (data)->cur_ctx->uc_state); }
printf("%d %s = %u(%u bins), state = %u -> %u\n", \
kvz_cabac_bins_count, (name), (uint32_t)(value), (bins), prev_state, (data)->cur_ctx->uc_state); kvz_cabac_bins_count+=bins;}
#define CABAC_BIN_EP(data, value, name) { \
uint32_t prev_state = (data)->cur_ctx->uc_state; \
kvz_cabac_encode_bin_ep((data), (value)); \
printf("%s = %u, state = %u -> %u\n", \
(name), (uint32_t)(value), prev_state, (data)->cur_ctx->uc_state); }
printf("%d %s = %u, state = %u -> %u\n", \
kvz_cabac_bins_count++, (name), (uint32_t)(value), prev_state, (data)->cur_ctx->uc_state); }
#else
#define CABAC_BIN(data, value, name) \
kvz_cabac_encode_bin((data), (value));