Commit 4226f0ce authored by John Koleszar's avatar John Koleszar

vpxdec: test for frame corruption

This change simply exercises the VP8D_GET_FRAME_CORRUPTED control,
outputting a warning message at the end if the bit was set for any
frames. Should never produce any output for good input.

Change-Id: Idaf6ba8f53660f47763cd563fa1485938580a37d
parent 64355eca
......@@ -725,6 +725,7 @@ int main(int argc, const char **argv_)
int vp8_dbg_display_mv = 0;
#endif
struct input_ctx input = {0};
int frames_corrupted = 0;
/* Parse command line */
exec_name = argv_[0];
......@@ -1018,6 +1019,7 @@ int main(int argc, const char **argv_)
vpx_codec_iter_t iter = NULL;
vpx_image_t *img;
struct vpx_usec_timer timer;
int corrupted;
vpx_usec_timer_start(&timer);
......@@ -1037,6 +1039,14 @@ int main(int argc, const char **argv_)
++frame_in;
if (vpx_codec_control(&decoder, VP8D_GET_FRAME_CORRUPTED, &corrupted))
{
fprintf(stderr, "Failed VP8_GET_FRAME_CORRUPTED: %s\n",
vpx_codec_error(&decoder));
goto fail;
}
frames_corrupted += corrupted;
if ((img = vpx_codec_get_frame(&decoder, &iter)))
++frame_out;
......@@ -1102,6 +1112,9 @@ int main(int argc, const char **argv_)
fprintf(stderr, "\n");
}
if (frames_corrupted)
fprintf(stderr, "WARNING: %d frames corrupted.\n",frames_corrupted);
fail:
if (vpx_codec_destroy(&decoder))
......@@ -1120,5 +1133,5 @@ fail:
fclose(infile);
free(argv);
return EXIT_SUCCESS;
return frames_corrupted ? EXIT_FAILURE : EXIT_SUCCESS;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment