validate:ssim: Inform about min average and min minimum similarities

This commit is contained in:
Thibault Saunier 2015-06-18 11:09:26 +02:00
parent de40a24b8f
commit 8e37c81811
3 changed files with 21 additions and 3 deletions

View file

@ -736,6 +736,7 @@ _check_directory (GstValidateSsim * self, const gchar * ref_dir,
gboolean res = TRUE;
GFileInfo *info;
GFileEnumerator *fenum;
gfloat min_avg = 1.0, min_min = 1.0, total_avg = 0;
GFile *file = g_file_new_for_path (ref_dir);
if (!(fenum = g_file_enumerate_children (file,
@ -773,6 +774,9 @@ _check_directory (GstValidateSsim * self, const gchar * ref_dir,
}
}
min_avg = MIN (min_avg, *mean);
min_min = MIN (min_min, *lowest);
total_avg += *mean;
gst_validate_printf (NULL,
"<position: %s duration: %" GST_TIME_FORMAT
" avg: %f min: %f (Passed: %d failed: %d, %d not found)/>\r",
@ -787,6 +791,10 @@ _check_directory (GstValidateSsim * self, const gchar * ref_dir,
g_object_unref (info);
}
gst_validate_printf (NULL,
"\nAverage similarity: %f, min_avg: %f, min_min: %f\n",
total_avg / nfiles, min_avg, min_min);
done:
gst_object_unref (file);
if (fenum)

View file

@ -201,7 +201,8 @@ runner_stopping (GstValidateRunner * runner, ValidateSsimOverride * self)
guint i, nfiles;
gfloat mssim = 0, lowest = 1, highest = -1, total_avg = 0;
gint npassed = 0, nfailures = 0;
gdouble min_avg_similarity = 0.95, min_lowest_similarity = -1.0;
gdouble min_avg_similarity = 0.95, min_lowest_similarity = -1.0,
min_avg = 1.0, min_min = 1.0;
const gchar *compared_files_dir =
gst_structure_get_string (self->priv->config,
"reference-images-dir");
@ -245,17 +246,21 @@ runner_stopping (GstValidateRunner * runner, ValidateSsimOverride * self)
else
npassed++;
min_avg = MIN (min_avg, mssim);
min_min = MIN (lowest, min_min);
total_avg += mssim;
gst_validate_printf (NULL,
"<position: %" GST_TIME_FORMAT " duration: %" GST_TIME_FORMAT
" %d / %d avg: %f min: %f (Passed: %d failed: %d)/>\r",
" %d / %d avg: %f min: %f (Passed: %d failed: %d)/>\n",
GST_TIME_ARGS (frame->position), GST_TIME_ARGS (GST_CLOCK_TIME_NONE),
i + 1, nfiles, mssim, lowest, npassed, nfailures);
g_free (bname);
}
gst_validate_printf (NULL, "\nAverage similarity: %f\n", total_avg / nfiles);
gst_validate_printf (NULL,
"\nAverage similarity: %f, min_avg: %f, min_min: %f\n",
total_avg / nfiles, min_avg, min_min);
}
static void

View file

@ -94,6 +94,11 @@ main (int argc, char **argv)
gst_validate_ssim_compare_image_files (ssim, argv[1], argv[2], &mssim,
&lowest, &highest, outfolder);
if (!g_file_test (argv[1], G_FILE_TEST_IS_DIR)) {
gst_validate_printf (ssim, "Compared %s with %s, average: %f, Min %f\n",
argv[1], argv[2], mssim, lowest);
}
rep_err = gst_validate_runner_exit (runner, TRUE);
if (ret == 0) {
ret = rep_err;