diff --git a/src/cabac.h b/src/cabac.h index f1b50dcf..f5ffafa2 100644 --- a/src/cabac.h +++ b/src/cabac.h @@ -115,36 +115,36 @@ void kvz_cabac_write_unary_max_symbol_ep(cabac_data_t *data, unsigned int symbol // Macros -#define CTX_STATE(ctx) (ctx->uc_state >> 1) -#define CTX_MPS(ctx) (ctx->uc_state & 1) +#define CTX_STATE(ctx) ((ctx)->uc_state >> 1) +#define CTX_MPS(ctx) ((ctx)->uc_state & 1) #define CTX_UPDATE_LPS(ctx) { (ctx)->uc_state = kvz_g_auc_next_state_lps[ (ctx)->uc_state ]; } #define CTX_UPDATE_MPS(ctx) { (ctx)->uc_state = kvz_g_auc_next_state_mps[ (ctx)->uc_state ]; } #ifdef VERBOSE #define CABAC_BIN(data, value, name) { \ uint32_t prev_state = (data)->ctx->uc_state; \ - kvz_cabac_encode_bin(data, value); \ + kvz_cabac_encode_bin((data), (value)) \ printf("%s = %u, state = %u -> %u\n", \ - name, (uint32_t)value, (uint32_t)prev_state, (data)->ctx->uc_state); } + (name), (uint32_t)(value), prev_state, (data)->ctx->uc_state); } #define CABAC_BINS_EP(data, value, bins, name) { \ uint32_t prev_state = (data)->ctx->uc_state; \ - kvz_cabac_encode_bins_ep(data, value, bins); \ + kvz_cabac_encode_bins_ep((data), (value), (bins)); \ printf("%s = %u(%u bins), state = %u -> %u\n", \ - name, (uint32_t)value, (uint32_t)bins, prev_state, (data)->ctx->uc_state); } + (name), (uint32_t)(value), (bins), prev_state, (data)->ctx->uc_state); } #define CABAC_BIN_EP(data, value, name) { \ uint32_t prev_state = (data)->ctx->uc_state; \ - kvz_cabac_encode_bin_ep(data, value); \ + kvz_cabac_encode_bin_ep((data), (value)); \ printf("%s = %u, state = %u -> %u\n", \ - name, (uint32_t)value, (uint32_t)prev_state, (data)->ctx->uc_state); } + (name), (uint32_t)(value), prev_state, (data)->ctx->uc_state); } #else #define CABAC_BIN(data, value, name) \ - kvz_cabac_encode_bin(data, value); + kvz_cabac_encode_bin((data), (value)); #define CABAC_BINS_EP(data, value, bins, name) \ - kvz_cabac_encode_bins_ep(data, value, bins); + kvz_cabac_encode_bins_ep((data), (value), (bins)); #define CABAC_BIN_EP(data, value, name) \ - kvz_cabac_encode_bin_ep(data, value); + kvz_cabac_encode_bin_ep((data), (value)); #endif #endif