diff --git a/src/cfg.c b/src/cfg.c index 7464f006..e6f867f1 100644 --- a/src/cfg.c +++ b/src/cfg.c @@ -604,10 +604,22 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value) cfg->aud_enable = atobool(value); else if OPT("cqmfile") cfg->cqmfile = strdup(value); - else if OPT("tiles-width-split") - return parse_tiles_specification(value, &cfg->tiles_width_count, &cfg->tiles_width_split); - else if OPT("tiles-height-split") - return parse_tiles_specification(value, &cfg->tiles_height_count, &cfg->tiles_height_split); + else if OPT("tiles-width-split") { + int retval = parse_tiles_specification(value, &cfg->tiles_width_count, &cfg->tiles_width_split); + if (cfg->tiles_width_count > 1 && cfg->tmvp_enable) { + cfg->tmvp_enable = false; + fprintf(stderr, "Disabling TMVP because tiles are used.\n"); + } + return retval; + } + else if OPT("tiles-height-split") { + int retval = parse_tiles_specification(value, &cfg->tiles_height_count, &cfg->tiles_height_split); + if (cfg->tiles_height_count > 1 && cfg->tmvp_enable) { + cfg->tmvp_enable = false; + fprintf(stderr, "Disabling TMVP because tiles are used.\n"); + } + return retval; + } else if OPT("tiles") { // A simpler interface for setting tiles, accepting only uniform split. @@ -632,6 +644,12 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value) FREE_POINTER(cfg->tiles_height_split); cfg->tiles_width_count = width; cfg->tiles_height_count = height; + + if (cfg->tmvp_enable) { + cfg->tmvp_enable = false; + fprintf(stderr, "Disabling TMVP because tiles are used.\n"); + } + return 1; } else if OPT("wpp") @@ -921,6 +939,10 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value) fprintf(stderr, "Cannot enable TMVP because GOP is used.\n"); cfg->tmvp_enable = false; } + if (cfg->tiles_width_count > 1 || cfg->tiles_height_count > 1) { + fprintf(stderr, "Cannot enable TMVP because tiles are used.\n"); + cfg->tmvp_enable = false; + } } else return 0; diff --git a/src/encoder_state-bitstream.c b/src/encoder_state-bitstream.c index bfd15588..4c938165 100644 --- a/src/encoder_state-bitstream.c +++ b/src/encoder_state-bitstream.c @@ -747,14 +747,15 @@ void kvz_encoder_state_write_bitstream_slice_header(encoder_state_t * const stat WRITE_U(stream, 1, 1, "used_by_curr_pic_s1_flag"); } //WRITE_UE(stream, 0, "short_term_ref_pic_set_idx"); + + if (state->encoder_control->cfg->tmvp_enable) { + WRITE_U(stream, 1, 1, "slice_temporal_mvp_enabled_flag"); + } } //end if //end if - if (state->encoder_control->cfg->tmvp_enable && state->frame->slicetype != KVZ_SLICE_I) { - WRITE_U(stream, 1, 1, "slice_temporal_mvp_enabled_flag"); - } if (encoder->sao_enable) { WRITE_U(stream, 1, 1, "slice_sao_luma_flag");