videoaggregator: improve find_best_format heuristic.

The goal here is to minimize the work needed to bring all images
to a common format. A better criteria than the number of pads
with a given format is the number of pixels with a given format.

https://bugzilla.gnome.org/show_bug.cgi?id=786078
This commit is contained in:
Mathieu Duponchelle 2017-08-10 01:45:53 +02:00
parent 29c4ecbc25
commit 388b7ee275

View file

@ -514,7 +514,7 @@ gst_video_aggregator_find_best_format (GstVideoAggregator * vagg,
format_number =
GPOINTER_TO_INT (g_hash_table_lookup (formats_table,
GINT_TO_POINTER (GST_VIDEO_INFO_FORMAT (&pad->info))));
format_number += 1;
format_number += pad->info.width * pad->info.height;
g_hash_table_replace (formats_table,
GINT_TO_POINTER (GST_VIDEO_INFO_FORMAT (&pad->info)),