Adding error-concealment to the decoder.
The error-concealer is plugged in after any motion vectors have been
decoded. It tries to estimate any missing motion vectors from the
motion vectors of the previous frame. Intra blocks with missing
residual are replaced with inter blocks with estimated motion vectors.
This feature was developed in a separate sandbox
(sandbox/holmer/error-concealment).
Change-Id: I5c8917b031078d79dbafd90f6006680e84a23412
diff --git a/vpxdec.c b/vpxdec.c
index 968ad15..304608b 100644
--- a/vpxdec.c
+++ b/vpxdec.c
@@ -87,6 +87,9 @@
"Max threads to use");
static const arg_def_t verbosearg = ARG_DEF("v", "verbose", 0,
"Show version string");
+static const arg_def_t error_concealment = ARG_DEF(NULL, "error-concealment", 0,
+ "Enable decoder error-concealment");
+
#if CONFIG_MD5
static const arg_def_t md5arg = ARG_DEF(NULL, "md5", 0,
@@ -100,6 +103,7 @@
#if CONFIG_MD5
&md5arg,
#endif
+ &error_concealment,
NULL
};
@@ -700,6 +704,7 @@
FILE *infile;
int frame_in = 0, frame_out = 0, flipuv = 0, noblit = 0, do_md5 = 0, progress = 0;
int stop_after = 0, postproc = 0, summary = 0, quiet = 1;
+ int ec_enabled = 0;
vpx_codec_iface_t *iface = NULL;
unsigned int fourcc;
unsigned long dx_time = 0;
@@ -724,6 +729,7 @@
#endif
struct input_ctx input = {0};
int frames_corrupted = 0;
+ int dec_flags = 0;
/* Parse command line */
exec_name = argv_[0];
@@ -843,6 +849,10 @@
vp8_dbg_display_mv = flags;
}
}
+ else if (arg_match(&arg, &error_concealment, argi))
+ {
+ ec_enabled = 1;
+ }
#endif
else
@@ -963,8 +973,10 @@
break;
}
+ dec_flags = (postproc ? VPX_CODEC_USE_POSTPROC : 0) |
+ (ec_enabled ? VPX_CODEC_USE_ERROR_CONCEALMENT : 0);
if (vpx_codec_dec_init(&decoder, iface ? iface : ifaces[0].iface, &cfg,
- postproc ? VPX_CODEC_USE_POSTPROC : 0))
+ dec_flags))
{
fprintf(stderr, "Failed to initialize decoder: %s\n", vpx_codec_error(&decoder));
return EXIT_FAILURE;