mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 11:24:05 +00:00
Fix NAL packet and missing fields in SPS
This commit is contained in:
parent
74514981a9
commit
b309ed90be
|
@ -473,6 +473,8 @@ static void encoder_state_write_bitstream_seq_parameter_set(bitstream_t* stream,
|
|||
WRITE_U(stream, (TR_MAX_LOG2_SIZE - 5) ? 1 : 0, 1, "sps_max_luma_transform_size_64_flag");
|
||||
// #endif
|
||||
|
||||
WRITE_U(stream, 0, 1, "sps_joint_cbcr_enabled_flag");
|
||||
|
||||
if (encoder->chroma_format != KVZ_CSP_400) {
|
||||
WRITE_U(stream, 1, 1, "same_qp_table_for_chroma");
|
||||
|
||||
|
@ -553,6 +555,22 @@ static void encoder_state_write_bitstream_seq_parameter_set(bitstream_t* stream,
|
|||
WRITE_U(stream, encoder->vui.time_scale, 32, "time_scale");
|
||||
|
||||
WRITE_U(stream, 0, 1, "sub_layer_cpb_parameters_present_flag");
|
||||
|
||||
WRITE_U(stream, 0, 1, "general_nal_hrd_parameters_present_flag");
|
||||
WRITE_U(stream, 0, 1, "general_vcl_hrd_parameters_present_flag");
|
||||
//// if nal_hrd or vlc_hrt
|
||||
// WRITE_U(stream, 0, 1, "decoding_unit_hrd_params_present_flag");
|
||||
// WRITE_U(stream, 0, 8, "tick_divisor_minus2");
|
||||
// WRITE_U(stream, 0, 1, "decoding_unit_cpb_params_in_pic_timing_sei_flag");
|
||||
// WRITE_U(stream, 0, 4, "bit_rate_scale");
|
||||
// WRITE_U(stream, 0, 4, "cpb_size_scale");
|
||||
// WRITE_U(stream, 0, 4, "cpb_size_du_scale");
|
||||
|
||||
WRITE_U(stream, 0, 1, "fixed_pic_rate_general_flag");
|
||||
//WRITE_U(stream, 0, 1, "fixed_pic_rate_within_cvs_flag");
|
||||
WRITE_U(stream, 0, 1, "low_delay_hrd_flag");
|
||||
|
||||
WRITE_UE(stream, 0, "cpb_cnt_minus1");
|
||||
}
|
||||
|
||||
WRITE_U(stream, 0, 1, "vui_parameters_present_flag");
|
||||
|
|
12
src/nal.c
12
src/nal.c
|
@ -54,19 +54,23 @@ void kvz_nal_write(bitstream_t * const bitstream, const uint8_t nal_type,
|
|||
// Handle header bits with full bytes instead of using bitstream
|
||||
// forbidden_zero_flag(1) + nuh_temporal_id_plus1(3) + nal_unit_type(4)
|
||||
uint8_t zero_tid_required_flag = 0;
|
||||
|
||||
if ((nal_type >= 16) && (nal_type <= 31)) {
|
||||
zero_tid_required_flag = 1;
|
||||
}
|
||||
uint8_t nal_type_lsb = nal_type - (zero_tid_required_flag << 4);
|
||||
|
||||
byte = (zero_tid_required_flag<<7) + ((temporal_id + 1) << 4) + nal_type_lsb;
|
||||
|
||||
// forbidden zero (1bit) + reserver zero (1bit) layer_id (6 bits)
|
||||
byte = 1;
|
||||
kvz_bitstream_writebyte(bitstream, byte);
|
||||
|
||||
// 7bits of nuh_layer_id_plus1
|
||||
byte = 1<<1;
|
||||
// nal_unit_type (5bits) + temporal_id_plus1 (3 bits)
|
||||
byte = (nal_type<<3)+(temporal_id + 1);
|
||||
kvz_bitstream_writebyte(bitstream, byte);
|
||||
|
||||
|
||||
#if VERBOSE
|
||||
// ToDo: Match with the actual bits
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue