Disable writing VPS when vps_period is negative.

Turns vps_period in struct encoder_control_t into a signed value.
Negative values are interpreted as "never send parameter sets."
This commit is contained in:
Arttu Ylä-Outinen 2015-10-15 15:11:12 +03:00
parent d5f3778f72
commit 024fedff57
4 changed files with 19 additions and 4 deletions

View file

@ -433,7 +433,11 @@ encoder_control_t* kvz_encoder_control_init(const kvz_config *const cfg) {
// AUD // AUD
encoder->aud_enable = (int8_t)encoder->cfg->aud_enable; 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; return encoder;

View file

@ -140,7 +140,7 @@ typedef struct encoder_control_t
} pu_depth_inter, pu_depth_intra; } pu_depth_inter, pu_depth_intra;
// How often Video Parameter Set is re-sent. // How often Video Parameter Set is re-sent.
uint32_t vps_period; int32_t vps_period;
bool sign_hiding; bool sign_hiding;

View file

@ -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) 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; first_nal_in_au = false;
kvz_encoder_state_write_parameter_sets(&state->stream, state); kvz_encoder_state_write_parameter_sets(&state->stream, state);

View file

@ -106,7 +106,18 @@ typedef struct kvz_config
{ {
int32_t qp; /*!< \brief Quantization parameter */ int32_t qp; /*!< \brief Quantization parameter */
int32_t intra_period; /*!< \brief the period of intra frames in stream */ 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 width; /*!< \brief frame width, must be a multiple of 8 */
int32_t height; /*!< \brief frame height, must be a multiple of 8 */ int32_t height; /*!< \brief frame height, must be a multiple of 8 */
double framerate; /*!< \brief Input framerate */ double framerate; /*!< \brief Input framerate */