diff --git a/src/encoder.c b/src/encoder.c index 874e3c50..e011397c 100644 --- a/src/encoder.c +++ b/src/encoder.c @@ -433,7 +433,11 @@ encoder_control_t* kvz_encoder_control_init(const kvz_config *const cfg) { // AUD encoder->aud_enable = (int8_t)encoder->cfg->aud_enable; - encoder->vps_period = encoder->cfg->vps_period * encoder->cfg->intra_period; + if (encoder->cfg->vps_period >= 0) { + encoder->vps_period = encoder->cfg->vps_period * encoder->cfg->intra_period; + } else { + encoder->vps_period = -1; + } return encoder; diff --git a/src/encoder.h b/src/encoder.h index bf6e7463..6f98ce08 100644 --- a/src/encoder.h +++ b/src/encoder.h @@ -140,7 +140,7 @@ typedef struct encoder_control_t } pu_depth_inter, pu_depth_intra; // How often Video Parameter Set is re-sent. - uint32_t vps_period; + int32_t vps_period; bool sign_hiding; diff --git a/src/encoder_state-bitstream.c b/src/encoder_state-bitstream.c index 7e037370..b6f3c409 100644 --- a/src/encoder_state-bitstream.c +++ b/src/encoder_state-bitstream.c @@ -838,7 +838,7 @@ static void encoder_state_write_bitstream_main(encoder_state_t * const state) } if ((encoder->vps_period > 0 && state->global->frame % encoder->vps_period == 0) - || state->global->frame == 0) + || (state->global->frame == 0 && encoder->vps_period >= 0)) { first_nal_in_au = false; kvz_encoder_state_write_parameter_sets(&state->stream, state); diff --git a/src/kvazaar.h b/src/kvazaar.h index a2aa1154..df4146bc 100644 --- a/src/kvazaar.h +++ b/src/kvazaar.h @@ -106,7 +106,18 @@ typedef struct kvz_config { int32_t qp; /*!< \brief Quantization parameter */ int32_t intra_period; /*!< \brief the period of intra frames in stream */ - int32_t vps_period; /*!< \brief how often the vps is re-sent */ + + /** \brief How often the VPS, SPS and PPS are re-sent + * + * -1: never + * 0: first frame only + * 1: every intra frame + * 2: every other intra frame + * 3: every third intra frame + * and so on + */ + int32_t vps_period; + int32_t width; /*!< \brief frame width, must be a multiple of 8 */ int32_t height; /*!< \brief frame height, must be a multiple of 8 */ double framerate; /*!< \brief Input framerate */