diff --git a/configure.ac b/configure.ac index 832b584d..8171fec6 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ AC_CONFIG_SRCDIR([src/encmain.c]) # # Here is a somewhat sane guide to lib versioning: http://apr.apache.org/versioning.html ver_major=6 -ver_minor=6 +ver_minor=7 ver_release=0 # Prevents configure from adding a lot of defines to the CFLAGS diff --git a/src/cfg.c b/src/cfg.c index c8a3dfa4..61a23d33 100644 --- a/src/cfg.c +++ b/src/cfg.c @@ -185,6 +185,7 @@ int kvz_config_init(kvz_config *cfg) cfg->fastrd_learning_outdir_fn = NULL; cfg->combine_intra_cus = 1; + cfg->force_inter = 0; return 1; } @@ -1426,6 +1427,9 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value) else if OPT("combine-intra-cus") { cfg->combine_intra_cus = atobool(value); } + else if OPT("force-inter") { + cfg->force_inter = atobool(value); + } else { return 0; } diff --git a/src/cli.c b/src/cli.c index 2212aa9b..69fffb3a 100644 --- a/src/cli.c +++ b/src/cli.c @@ -169,6 +169,8 @@ static const struct option long_options[] = { { "fastrd-outdir", required_argument, NULL, 0 }, { "combine-intra-cus", no_argument, NULL, 0 }, { "no-combine-intra-cus", no_argument, NULL, 0 }, + { "force-inter", no_argument, NULL, 0 }, + { "no-force-inter", no_argument, NULL, 0 }, {0, 0, 0, 0} }; @@ -586,6 +588,10 @@ void print_help(void) " be disabled if cus absolutely must not\n" " be larger than limited by the search.\n" " [enabled]" + " --force-inter : Force the encoder to use inter always.\n" + " This is mostly for debugging and is not\n" + " guaranteed to produce sensible bitstream or\n" + " work at all. [disabled]" " --tr-depth-intra : Transform split depth for intra blocks [0]\n" " --(no-)bipred : Bi-prediction [disabled]\n" " --cu-split-termination : CU split search termination [zero]\n" diff --git a/src/kvazaar.h b/src/kvazaar.h index 0e6779b4..1bd59392 100644 --- a/src/kvazaar.h +++ b/src/kvazaar.h @@ -482,6 +482,8 @@ typedef struct kvz_config /** \brief whether to try combining intra cus at the lower depth when search * is not performed at said depth*/ uint8_t combine_intra_cus; + + uint8_t force_inter; } kvz_config; /** diff --git a/src/search.c b/src/search.c index d2de84cb..931555f8 100644 --- a/src/search.c +++ b/src/search.c @@ -577,12 +577,13 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth, int32_t cu_width_intra_min = LCU_WIDTH >> pu_depth_intra.max; bool can_use_intra = - WITHIN(depth, pu_depth_intra.min, pu_depth_intra.max) || + (WITHIN(depth, pu_depth_intra.min, pu_depth_intra.max) || // When the split was forced because the CTU is partially outside // the frame, we permit intra coding even if pu_depth_intra would // otherwise forbid it. (x & ~(cu_width_intra_min - 1)) + cu_width_intra_min > frame->width || - (y & ~(cu_width_intra_min - 1)) + cu_width_intra_min > frame->height; + (y & ~(cu_width_intra_min - 1)) + cu_width_intra_min > frame->height) && + !(state->encoder_control->cfg.force_inter && state->frame->slicetype != KVZ_SLICE_I); if (can_use_intra && !skip_intra) { int8_t intra_mode; @@ -710,7 +711,7 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth, // If the CU is partially outside the frame, we need to split it even // if pu_depth_intra and pu_depth_inter would not permit it. cur_cu->type == CU_NOTSET || - depth < pu_depth_intra.max || + (depth < pu_depth_intra.max && !(state->encoder_control->cfg.force_inter&& state->frame->slicetype != KVZ_SLICE_I)) || (state->frame->slicetype != KVZ_SLICE_I && depth < pu_depth_inter.max);