mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
Add VPS every intra frame.
- Just rdo=0 for now. Later this can be extended to be configured separately.
This commit is contained in:
parent
d685ee86d6
commit
5d16fa6c4f
|
@ -296,6 +296,9 @@ int main(int argc, char *argv[])
|
|||
// AUD
|
||||
encoder.aud_enable = (int8_t)encoder.cfg->aud_enable;
|
||||
|
||||
// TODO: Add config option for vps_period.
|
||||
encoder.vps_period = (encoder.cfg->rdo == 0 ? encoder.cfg->intra_period : 0);
|
||||
|
||||
encoder.in.file = input;
|
||||
|
||||
fprintf(stderr, "Input: %s, output: %s\n", cfg->input, cfg->output);
|
||||
|
|
|
@ -142,6 +142,9 @@ typedef struct encoder_control
|
|||
uint8_t max;
|
||||
} pu_depth_inter, pu_depth_intra;
|
||||
|
||||
// How often Video Parameter Set is re-sent.
|
||||
uint32_t vps_period;
|
||||
|
||||
} encoder_control;
|
||||
|
||||
int encoder_control_init(encoder_control *encoder, const config *cfg);
|
||||
|
|
|
@ -697,32 +697,32 @@ static void encoder_state_write_bitstream_main(encoder_state * const main_state)
|
|||
encoder_state_write_bitstream_aud(main_state);
|
||||
}
|
||||
|
||||
if (main_state->global->is_radl_frame) {
|
||||
// Only write the parameter sets in the first frame.
|
||||
// TODO: Add option to include parameter sets before intra frames.
|
||||
if (main_state->global->frame == 0) {
|
||||
first_nal_in_au = false;
|
||||
if ((encoder->vps_period > 0 && main_state->global->frame % encoder->vps_period == 0)
|
||||
|| main_state->global->frame == 0)
|
||||
{
|
||||
first_nal_in_au = false;
|
||||
|
||||
// Video Parameter Set (VPS)
|
||||
nal_write(stream, NAL_VPS_NUT, 0, 1);
|
||||
encoder_state_write_bitstream_vid_parameter_set(main_state);
|
||||
bitstream_align(stream);
|
||||
// Video Parameter Set (VPS)
|
||||
nal_write(stream, NAL_VPS_NUT, 0, 1);
|
||||
encoder_state_write_bitstream_vid_parameter_set(main_state);
|
||||
bitstream_align(stream);
|
||||
|
||||
// Sequence Parameter Set (SPS)
|
||||
nal_write(stream, NAL_SPS_NUT, 0, 1);
|
||||
encoder_state_write_bitstream_seq_parameter_set(main_state);
|
||||
bitstream_align(stream);
|
||||
// Sequence Parameter Set (SPS)
|
||||
nal_write(stream, NAL_SPS_NUT, 0, 1);
|
||||
encoder_state_write_bitstream_seq_parameter_set(main_state);
|
||||
bitstream_align(stream);
|
||||
|
||||
// Picture Parameter Set (PPS)
|
||||
nal_write(stream, NAL_PPS_NUT, 0, 1);
|
||||
encoder_state_write_bitstream_pic_parameter_set(main_state);
|
||||
bitstream_align(stream);
|
||||
// Picture Parameter Set (PPS)
|
||||
nal_write(stream, NAL_PPS_NUT, 0, 1);
|
||||
encoder_state_write_bitstream_pic_parameter_set(main_state);
|
||||
bitstream_align(stream);
|
||||
}
|
||||
|
||||
// Prefix SEI
|
||||
nal_write(stream, PREFIX_SEI_NUT, 0, first_nal_in_au);
|
||||
encoder_state_write_bitstream_prefix_sei_version(main_state);
|
||||
bitstream_align(stream);
|
||||
}
|
||||
// Send Kvazaar version information only in the first frame.
|
||||
if (main_state->global->frame == 0) {
|
||||
nal_write(stream, PREFIX_SEI_NUT, 0, first_nal_in_au);
|
||||
encoder_state_write_bitstream_prefix_sei_version(main_state);
|
||||
bitstream_align(stream);
|
||||
}
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue