mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-12-18 03:04:06 +00:00
Disable output of cabac debug when in "count only" mode
- Some code cleanup
This commit is contained in:
parent
fa25621c77
commit
3c7eb55292
|
@ -153,22 +153,22 @@ extern uint32_t kvz_cabac_bins_count;
|
||||||
extern bool kvz_cabac_bins_verbose;
|
extern bool kvz_cabac_bins_verbose;
|
||||||
#define CABAC_BIN(data, value, name) { \
|
#define CABAC_BIN(data, value, name) { \
|
||||||
uint32_t prev_state = CTX_STATE(data->cur_ctx); \
|
uint32_t prev_state = CTX_STATE(data->cur_ctx); \
|
||||||
if(kvz_cabac_bins_verbose) printf("%d %d [%d:%d] %s = %u, range = %u LPS = %u state = %u -> ", \
|
if(kvz_cabac_bins_verbose && !data->only_count) printf("%d %d [%d:%d] %s = %u, range = %u LPS = %u state = %u -> ", \
|
||||||
kvz_cabac_bins_count++, (data)->range, (data)->range-CTX_LPS(data->cur_ctx,(data)->range), CTX_LPS(data->cur_ctx,(data)->range), (name), (uint32_t)(value), (data)->range, CTX_LPS(data->cur_ctx,(data)->range), prev_state); \
|
kvz_cabac_bins_count++, (data)->range, (data)->range-CTX_LPS(data->cur_ctx,(data)->range), CTX_LPS(data->cur_ctx,(data)->range), (name), (uint32_t)(value), (data)->range, CTX_LPS(data->cur_ctx,(data)->range), prev_state); \
|
||||||
kvz_cabac_encode_bin((data), (value)); \
|
kvz_cabac_encode_bin((data), (value)); \
|
||||||
if(kvz_cabac_bins_verbose) printf("%u\n", CTX_STATE(data->cur_ctx)); }
|
if(kvz_cabac_bins_verbose && !data->only_count) printf("%u\n", CTX_STATE(data->cur_ctx)); }
|
||||||
|
|
||||||
|
|
||||||
#define CABAC_BINS_EP(data, value, bins, name) { \
|
#define CABAC_BINS_EP(data, value, bins, name) { \
|
||||||
uint32_t prev_state = CTX_STATE(data->cur_ctx); \
|
uint32_t prev_state = CTX_STATE(data->cur_ctx); \
|
||||||
kvz_cabac_encode_bins_ep((data), (value), (bins)); \
|
kvz_cabac_encode_bins_ep((data), (value), (bins)); \
|
||||||
if(kvz_cabac_bins_verbose) printf("%d %s = %u(%u bins), state = %u -> %u\n", \
|
if(kvz_cabac_bins_verbose && !data->only_count) printf("%d %s = %u(%u bins), state = %u -> %u\n", \
|
||||||
kvz_cabac_bins_count, (name), (uint32_t)(value), (bins), prev_state, CTX_STATE(data->cur_ctx)); kvz_cabac_bins_count+=bins;}
|
kvz_cabac_bins_count, (name), (uint32_t)(value), (bins), prev_state, CTX_STATE(data->cur_ctx)); kvz_cabac_bins_count+=bins;}
|
||||||
|
|
||||||
#define CABAC_BIN_EP(data, value, name) { \
|
#define CABAC_BIN_EP(data, value, name) { \
|
||||||
uint32_t prev_state = CTX_STATE(data->cur_ctx); \
|
uint32_t prev_state = CTX_STATE(data->cur_ctx); \
|
||||||
kvz_cabac_encode_bin_ep((data), (value)); \
|
kvz_cabac_encode_bin_ep((data), (value)); \
|
||||||
if(kvz_cabac_bins_verbose) printf("%d %s = %u, state = %u -> %u\n", \
|
if(kvz_cabac_bins_verbose && !data->only_count) printf("%d %s = %u, state = %u -> %u\n", \
|
||||||
kvz_cabac_bins_count++, (name), (uint32_t)(value), prev_state, CTX_STATE(data->cur_ctx)); }
|
kvz_cabac_bins_count++, (name), (uint32_t)(value), prev_state, CTX_STATE(data->cur_ctx)); }
|
||||||
#else
|
#else
|
||||||
#define CABAC_BIN(data, value, name) \
|
#define CABAC_BIN(data, value, name) \
|
||||||
|
|
|
@ -530,7 +530,7 @@ static void encoder_state_write_bitstream_seq_parameter_set(bitstream_t* stream,
|
||||||
WRITE_UE(stream, encoder->bitdepth-8, "bit_depth_minus8");
|
WRITE_UE(stream, encoder->bitdepth-8, "bit_depth_minus8");
|
||||||
|
|
||||||
WRITE_U(stream, encoder->cfg.wpp, 1, "entropy_coding_sync_enabled_flag");
|
WRITE_U(stream, encoder->cfg.wpp, 1, "entropy_coding_sync_enabled_flag");
|
||||||
WRITE_U(stream, 0, 1, "sps_entry_point_offsets_present_flag");
|
WRITE_U(stream, encoder->tiles_enable, 1, "sps_entry_point_offsets_present_flag");
|
||||||
|
|
||||||
WRITE_U(stream, 1, 4, "log2_max_pic_order_cnt_lsb_minus4");
|
WRITE_U(stream, 1, 4, "log2_max_pic_order_cnt_lsb_minus4");
|
||||||
WRITE_U(stream, 0, 1, "sps_poc_msb_flag");
|
WRITE_U(stream, 0, 1, "sps_poc_msb_flag");
|
||||||
|
@ -601,13 +601,13 @@ static void encoder_state_write_bitstream_seq_parameter_set(bitstream_t* stream,
|
||||||
WRITE_U(stream, 0, 1, "sps_joint_cbcr_enabled_flag");
|
WRITE_U(stream, 0, 1, "sps_joint_cbcr_enabled_flag");
|
||||||
|
|
||||||
if (encoder->chroma_format != KVZ_CSP_400) {
|
if (encoder->chroma_format != KVZ_CSP_400) {
|
||||||
WRITE_U(stream, 1, 1, "same_qp_table_for_chroma");
|
WRITE_U(stream, 1, 1, "same_qp_table_for_chroma"); //TODO: Enable chroma QP scaling and fix kvz_get_scaled_qp()
|
||||||
|
|
||||||
WRITE_SE(stream, 0, "qp_table_starts_minus26");
|
WRITE_SE(stream, 0, "qp_table_starts_minus26");
|
||||||
WRITE_UE(stream, 0, "num_points_in_qp_table_minus1");
|
WRITE_UE(stream, 0, "num_points_in_qp_table_minus1");
|
||||||
|
|
||||||
WRITE_UE(stream, 0, "delta_qp_in_val_minus1");
|
WRITE_UE(stream, 0, "delta_qp_in_val_minus1");
|
||||||
WRITE_UE(stream, 1, "delta_qp_diff_val");
|
WRITE_UE(stream, 1, "delta_qp_diff_val");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1272,7 +1272,7 @@ static void encoder_state_write_slice_header(
|
||||||
encoder_state_t * state,
|
encoder_state_t * state,
|
||||||
bool independent)
|
bool independent)
|
||||||
{
|
{
|
||||||
kvz_nal_write(stream, state->frame->pictype, 0, state->frame->first_nal);
|
kvz_nal_write(stream, state->frame->pictype, (state->frame->pictype==KVZ_NAL_STSA)?1:0, state->frame->first_nal);
|
||||||
state->frame->first_nal = false;
|
state->frame->first_nal = false;
|
||||||
|
|
||||||
kvz_encoder_state_write_bitstream_slice_header(stream, state, independent);
|
kvz_encoder_state_write_bitstream_slice_header(stream, state, independent);
|
||||||
|
|
Loading…
Reference in a new issue