Add VPS every intra frame.

- Just rdo=0 for now. Later this can be extended to be configured separately.
This commit is contained in:
Ari Koivula 2015-01-22 13:13:23 +02:00
parent d685ee86d6
commit 5d16fa6c4f
3 changed files with 28 additions and 22 deletions

View file

@ -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);

View file

@ -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);

View file

@ -697,10 +697,9 @@ 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) {
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)
@ -717,13 +716,14 @@ static void encoder_state_write_bitstream_main(encoder_state * const main_state)
nal_write(stream, NAL_PPS_NUT, 0, 1);
encoder_state_write_bitstream_pic_parameter_set(main_state);
bitstream_align(stream);
}
// Prefix SEI
// 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);
}
}
{
uint8_t nal_type = (main_state->global->is_radl_frame ? NAL_IDR_W_RADL : NAL_TRAIL_R);