1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- #include <ufo/ufo.h>
- #include <stdio.h>
- #include "piv-scheduler.h"
- #include "piv-nodes.h"
- #include "piv-ufo-base.h"
- int main (void)
- {
- struct piv_nodes piv;
- struct piv_ufo_base piv_base;
- #if !(GLIB_CHECK_VERSION (2, 36, 0))
- g_type_init ();
- #endif
- piv_ufo_base_init(&piv_base);
- piv_nodes_init(&piv, &piv_base);
- if (piv_base.error)
- printf("Error %s\n", piv_base.error->message);
- /* This file include all the configurations that can be passed to the
- * plugins */
- /*********************/
- /* CONFIGURATION *****/
- /*********************/
- UfoTaskNode *global_reader;
- global_reader = ufo_plugin_manager_get_task (piv_base.manager, "reader",
- &piv_base.error);
- #include "config.h"
- g_object_set (G_OBJECT (piv.ringwriter), "scale", scale, NULL);
- g_object_set (G_OBJECT (piv.fft), "dimensions", 2, NULL);
- g_object_set (G_OBJECT (piv.ifft), "dimensions", 2, NULL);
- g_object_set (G_OBJECT (piv.ringfft), "dimensions", 2, NULL);
- g_object_set (G_OBJECT (piv.ringifft), "dimensions", 2, NULL);
- /* Give ring scale, when image is reduced by two, then scale should be 2 */
- g_object_set (G_OBJECT (piv.dump_ring), "scale", scale, NULL);
- /* Does not need user configuration */
- unsigned number_of_rings = (ring_end - ring_start) / ring_step + 1;
- g_object_set (G_OBJECT (piv.duplicater), "dup_count", number_of_rings,
- NULL);
- g_object_set (G_OBJECT (piv.concatenate_result), "ring_count", number_of_rings, NULL);
- g_object_set (G_OBJECT (piv.loop_ringfft), "loop", 1, NULL);
- g_object_set (G_OBJECT (piv.loop_ringfft), "dup_count", number_of_images, NULL);
- /*********************/
- /* GRAPH SETUP *******/
- /*********************/
- GList* piv_nodes = NULL;
- GList* it = piv_base.gpu_nodes;
- if (!it) {
- g_print("Main : No GPUs found\n");
- return 1;
- }
- g_print("Main : Connecting nodes %p\n", it->data);
- piv_nodes_set_gpu(&piv, it->data);
- piv_nodes = g_list_append(piv_nodes, &piv);
- piv_ufo_base_connect(&piv_base, &piv, scale, dump_ring_to_image, global_reader);
- // Graph expansion for usage of multiple GPUs. Uncomment lines when UFO
- // supports calling plug-ins on demand
- //for (it = it->next; it; it = it->next) {
- // g_print("Main : Connecting nodes %p\n", it->data);
- // struct piv_nodes *cpy = piv_nodes_copy(&piv);
- // piv_nodes = g_list_append(piv_nodes, cpy);
- // piv_nodes_set_gpu(cpy, it->data);
- // piv_ufo_base_connect(&piv_base, cpy, scale, dump_ring_to_image, global_reader);
- //}
- ufo_base_scheduler_run(piv_base.scheduler, piv_base.graph, &piv_base.error);
- if (piv_base.error)
- g_print("Error %s\n", piv_base.error->message);
- /*********************/
- /* CLEANUP ***********/
- /*********************/
- piv_ufo_base_unref(&piv_base);
- for (it = piv_nodes; it; it = it->next)
- piv_nodes_unref(it->data);
- g_object_unref (global_reader);
- return 0;
- }
|