Fixed VUI header writing. Fixed debug prints of NAL headers and rbsp_stop_one_bit.

This commit is contained in:
Sami Ahovainio 2019-05-31 11:13:11 +03:00
parent 8282a18c36
commit 76d56290ed
3 changed files with 16 additions and 4 deletions

View file

@ -265,6 +265,9 @@ void kvz_bitstream_put_se(bitstream_t *stream, int32_t data)
*/
void kvz_bitstream_add_rbsp_trailing_bits(bitstream_t * const stream)
{
#if VERBOSE
printf("%-40s u(%d) : %d\n", "rbsp_stop_one_bit", 1, 1);
#endif
kvz_bitstream_put(stream, 1, 1);
kvz_bitstream_align_zero(stream);
}

View file

@ -250,6 +250,9 @@ static void encoder_state_write_bitstream_VUI(bitstream_t *stream,
WRITE_U(stream, 0, 1, "colour_description_present_flag");
WRITE_U(stream, 0, 1, "field_seq_flag");
WRITE_U(stream, 0, 1, "chroma_loc_info_present_flag");
if (encoder->cfg.vui.overscan > 0) {
WRITE_U(stream, 1, 1, "overscan_info_present_flag");
WRITE_U(stream, encoder->cfg.vui.overscan - 1, 1, "overscan_appropriate_flag");
@ -257,9 +260,13 @@ static void encoder_state_write_bitstream_VUI(bitstream_t *stream,
WRITE_U(stream, 0, 1, "overscan_info_present_flag");
WRITE_U(stream, 1, 1, "video_signal_type_present_flag");
WRITE_U(stream, encoder->cfg.vui.fullrange, 1, "video_full_range_flag");
//IF overscan info
//ENDIF
/*
if (encoder->cfg.vui.videoformat != 5 ||
encoder->cfg.vui.fullrange != 0 ||
encoder->cfg.vui.colorprim != 2 ||
@ -315,6 +322,8 @@ static void encoder_state_write_bitstream_VUI(bitstream_t *stream,
//IF bitstream restriction
//ENDIF
*/
}
@ -526,9 +535,9 @@ if (encoder->scaling_list.enable) {
WRITE_U(stream, 0, 1, "vui_hrd_parameters_present_flag");
}
WRITE_U(stream, 0, 1, "vui_parameters_present_flag");
WRITE_U(stream, 1, 1, "vui_parameters_present_flag");
//encoder_state_write_bitstream_VUI(stream, state);
encoder_state_write_bitstream_VUI(stream, state);
encoder_state_write_bitstream_SPS_extension(stream, state);

View file

@ -70,8 +70,8 @@ void kvz_nal_write(bitstream_t * const bitstream, const uint8_t nal_type,
printf("%-40s u(%d) : %d\n", "zero_tid_required_flag", 1, zero_tid_required_flag);
printf("%-40s u(%d) : %d\n", "nuh_temporal_id_plus1", 3, temporal_id + 1);
printf("%-40s u(%d) : %d\n", "nal_unit_type_lsb", 4, nal_type_lsb);
printf("%-40s u(%d) : %d\n", "nuh_layer_id_plus1", 6, 1);
printf("%-40s u(%d) : %d\n", "nuh_layer_id_plus1", 7, 1);
printf("%-40s u(%d) : %d\n", "nuh_reserved_zero_bit", 1, 0);
#endif
}