Skip to content
Snippets Groups Projects
Commit 4226f0ce authored by John Koleszar's avatar John Koleszar
Browse files

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
No related branches found
No related tags found
No related merge requests found
...@@ -725,6 +725,7 @@ int main(int argc, const char **argv_) ...@@ -725,6 +725,7 @@ int main(int argc, const char **argv_)
int vp8_dbg_display_mv = 0; int vp8_dbg_display_mv = 0;
#endif #endif
struct input_ctx input = {0}; struct input_ctx input = {0};
int frames_corrupted = 0;
/* Parse command line */ /* Parse command line */
exec_name = argv_[0]; exec_name = argv_[0];
...@@ -1018,6 +1019,7 @@ int main(int argc, const char **argv_) ...@@ -1018,6 +1019,7 @@ int main(int argc, const char **argv_)
vpx_codec_iter_t iter = NULL; vpx_codec_iter_t iter = NULL;
vpx_image_t *img; vpx_image_t *img;
struct vpx_usec_timer timer; struct vpx_usec_timer timer;
int corrupted;
vpx_usec_timer_start(&timer); vpx_usec_timer_start(&timer);
...@@ -1037,6 +1039,14 @@ int main(int argc, const char **argv_) ...@@ -1037,6 +1039,14 @@ int main(int argc, const char **argv_)
++frame_in; ++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))) if ((img = vpx_codec_get_frame(&decoder, &iter)))
++frame_out; ++frame_out;
...@@ -1102,6 +1112,9 @@ int main(int argc, const char **argv_) ...@@ -1102,6 +1112,9 @@ int main(int argc, const char **argv_)
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }
if (frames_corrupted)
fprintf(stderr, "WARNING: %d frames corrupted.\n",frames_corrupted);
fail: fail:
if (vpx_codec_destroy(&decoder)) if (vpx_codec_destroy(&decoder))
...@@ -1120,5 +1133,5 @@ fail: ...@@ -1120,5 +1133,5 @@ fail:
fclose(infile); fclose(infile);
free(argv); free(argv);
return EXIT_SUCCESS; return frames_corrupted ? EXIT_FAILURE : EXIT_SUCCESS;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment