From 0ce4e8d52fd491268a56c10dbb32fd5c996e2589 Mon Sep 17 00:00:00 2001
From: "Suren A. Chilingaryan" <csa@suren.me>
Date: Sat, 1 Feb 2020 13:07:46 +0100
Subject: Initial Python infrastructure to build more complex processing
 pipelines and the corresponding changes in ROOF filters

---
 src/ufo-roof-build-task.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

(limited to 'src/ufo-roof-build-task.c')

diff --git a/src/ufo-roof-build-task.c b/src/ufo-roof-build-task.c
index 93cb133..9d55d38 100644
--- a/src/ufo-roof-build-task.c
+++ b/src/ufo-roof-build-task.c
@@ -44,6 +44,7 @@ struct _UfoRoofBuildTaskPrivate {
     BuildType			build;					// What dataset do we build: ROOF sinogram or raw network data
     guint                       number;                                 // Number of datasets to read
     gboolean                    stop;                                   // Stop flag
+    gboolean                    simulate;                               // Indicates if we are running in network or simulation modes
 
     guint 			announced;				// For debugging
 
@@ -71,6 +72,7 @@ static GEnumValue build_values[] = {
 enum {
     PROP_0,
     PROP_STOP,
+    PROP_SIMULATE,
     PROP_NUMBER,
     PROP_BUILD,
     PROP_CONFIG,
@@ -97,7 +99,7 @@ ufo_roof_build_task_setup (UfoTask *task,
     if (!priv->config)
         roof_setup_error(error, "ROOF configuration is not specified");
 
-    priv->cfg = ufo_roof_config_new(priv->config, &gerr);
+    priv->cfg = ufo_roof_config_new(priv->config, priv->simulate?UFO_ROOF_CONFIG_SIMULATION:UFO_ROOF_CONFIG_DEFAULT, &gerr);
     if (!priv->cfg)
         roof_propagate_error(error, gerr, "roof-build-setup: ");
 
@@ -281,15 +283,23 @@ ufo_roof_build_task_generate (UfoTask *task,
 	    case 32:
 		ufo_buffer_convert(output, UFO_BUFFER_DEPTH_32U);
 		break;
+            default:
+                printf("Usupported bit-depth %u\n", cfg->bit_depth);
 	}
     }
 
 	// Metadata: plane and sequential number within the plane
     g_value_init (&ival, G_TYPE_UINT);
     g_value_init (&lval, G_TYPE_ULONG);
+    if (priv->build != BUILD_UFO) {
+        g_value_set_uint (&ival, cfg->bit_depth);
+        ufo_buffer_set_metadata (output, "bpp", &ival);
+    }
     g_value_set_uint (&ival, 1 + seqid % cfg->n_planes);
     ufo_buffer_set_metadata (output, "plane", &ival);
     g_value_set_ulong (&lval, seqid / cfg->n_planes);
+    ufo_buffer_set_metadata (output, "plane_id", &lval);
+    g_value_set_ulong (&lval, seqid);
     ufo_buffer_set_metadata (output, "seqid", &lval);
     g_value_unset(&lval);
     g_value_unset(&ival);
@@ -325,6 +335,9 @@ ufo_roof_build_task_set_property (GObject *object,
         case PROP_STOP:
             priv->stop = g_value_get_boolean (value);
             break;
+        case PROP_SIMULATE:
+            priv->simulate = g_value_get_boolean (value);
+            break;
         case PROP_NUMBER:
             priv->number = g_value_get_uint (value);
             break;
@@ -356,6 +369,9 @@ ufo_roof_build_task_get_property (GObject *object,
         case PROP_STOP:
             g_value_set_boolean (value, priv->stop);
             break;
+        case PROP_SIMULATE:
+            g_value_set_boolean (value, priv->simulate);
+            break;
         case PROP_NUMBER:
             g_value_set_uint (value, priv->number);
             break;
@@ -403,6 +419,14 @@ ufo_roof_build_task_class_init (UfoRoofBuildTaskClass *klass)
             FALSE,
             G_PARAM_READWRITE);
 
+
+    properties[PROP_SIMULATE] =
+        g_param_spec_boolean ("simulate",
+            "Simulation mode",
+            "Read data from the specified files instead of network",
+            FALSE,
+            G_PARAM_READWRITE);
+
     properties[PROP_NUMBER] =
         g_param_spec_uint("number",
             "Number of datasets to receive",
-- 
cgit v1.2.3