Minor Clean ups for graph
[keystone-rtos/fvid2.git] / include / fvid2_graph.h
index deba224c1b7f86b1fd8fd0337bb97e9a797a46b9..9f15db3814cfafb74c21cb0abba5783b3a9975dd 100755 (executable)
@@ -53,79 +53,144 @@ extern "C" {
 /*                           Macros & Typedefs                                */
 /* ========================================================================== */
 
+/**
+ *  \brief Graph Alignment
+ */
 #define FVID2_GRAPH_DEF_ALIGN        ((uint32_t) 16U)
-#define FVID2_GRAPH_INVALID_NODE_ID  ((uint32_t) 0U)
-#define FVID2_GRAPH_MAX_NODES        ((uint32_t) 80U)
+
+/**
+ *  \brief Invalid Node Id
+ */
+#define FVID2_GRAPH_INVALID_NODE_ID  ((uint32_t) 0xFFU)
+
+/**
+ *  \brief Maximum number of nodes
+ */
+#define FVID2_GRAPH_MAX_NODES        ((uint32_t) 10U)
+
+/**
+ *  \brief Maximum number of paths
+ */
 #define FVID2_GRAPH_MAX_NUM_PATHS    ((uint32_t) 20U)
 
-typedef enum
-{
-    FVID2_GRAPH_NM_DISABLE,
-    FVID2_GRAPH_NM_ENABLE,
-    FVID2_GRAPH_NM_CHECK
-} Fvid2_GraphNodeMode;
+/**
+ *  \anchor Fvid2_GraphNodeMode
+ *  \name   Mode of the node
+ *
+ *  @{
+ */
+/** \brief  Disable mode */
+#define FVID2_GRAPH_NODE_MODE_DISABLE            ((uint32_t) 0x0U)
+/** \brief Enable mode */
+#define FVID2_GRAPH_NODE_MODE_ENABLE             ((uint32_t) 0x1U)
+/** \brief Check Mode */
+#define FVID2_GRAPH_NODE_MODE_CHECK              ((uint32_t) 0x2U)
+/* @} */
 
-typedef enum
-{
-    FVID2_GRAPH_NT_DUMMY,
-    FVID2_GRAPH_NT_DSS,  /* DSS */
-    FVID2_GRAPH_NT_MAX_NODETYPE
-} Fvid2_GraphNodeTypes;
+/**
+ *  \anchor Fvid2_GraphNodeType
+ *  \name   Node Type
+ *
+ *  @{
+ */
+/** \brief Node type is dummy */
+#define FVID2_GRAPH_NODE_TYPE_DUMMY            ((uint32_t) 0x0U)
+/** \brief Node type is DSS Pipe */
+#define FVID2_GRAPH_NODE_TYPE_DSS_PIPE         ((uint32_t) 0x1U)
+/** \brief Node type is DSS Overlay */
+#define FVID2_GRAPH_NODE_TYPE_DSS_OVERLAY      ((uint32_t) 0x2U)
+/** \brief Node type is DSS Video Port */
+#define FVID2_GRAPH_NODE_TYPE_DSS_VP           ((uint32_t) 0x3U)
+/** \brief Node type is DSS Output */
+#define FVID2_GRAPH_NODE_TYPE_DSS_OUT          ((uint32_t) 0x4U)
+/** \brief Maximum Node types */
+#define FVID2_GRAPH_NODE_TYPE_MAX              ((uint32_t) 0x5U)
+/* @} */
 
-typedef enum
-{
-    FVID2_GRAPH_NT_IN_SINGLE,
-    FVID2_GRAPH_NT_IN_MULTI,
-    FVID2_GRAPH_NT_IN_EMPTY
-} Fvid2_GraphNodeInputType;
+/**
+ *  \anchor Fvid2_GraphNodeInputNum
+ *  \name   Number of inputs to a particular node
+ *
+ *  @{
+ */
+/** \brief No Input */
+#define FVID2_GRAPH_NODE_IN_NONE               ((uint32_t) 0x0U)
+/** \brief Single Input */
+#define FVID2_GRAPH_NODE_IN_SINGLE             ((uint32_t) 0x1U)
+/** \brief Multiple Inputs */
+#define FVID2_GRAPH_NODE_IN_MULTI              ((uint32_t) 0x2U)
+/* @} */
 
-typedef enum
-{
-    FVID2_GRAPH_NT_OUT_SINGLE,
-    FVID2_GRAPH_NT_OUT_MULTI,
-    FVID2_GRAPH_NT_OUT_EMPTY
-} Fvid2_GraphNodeOutputType;
+/**
+ *  \anchor Fvid2_GraphNodeOutputNum
+ *  \name   Number of outputs from a particular node
+ *
+ *  @{
+ */
+/** \brief No Output */
+#define FVID2_GRAPH_NODE_OUT_NONE              ((uint32_t) 0x0U)
+/** \brief Single Output */
+#define FVID2_GRAPH_NODE_OUT_SINGLE            ((uint32_t) 0x1U)
+/** \brief Multiple Outputs */
+#define FVID2_GRAPH_NODE_OUT_MULTI             ((uint32_t) 0x2U)
+/* @} */
 
 /* ========================================================================== */
 /*                         Structure Declarations                             */
 /* ========================================================================== */
 
+/** \brief Forward declaration for Node Information. */
 typedef struct Fvid2_GraphNodeInfo_t Fvid2_GraphNodeInfo;
 
-typedef struct Fvid2_GraphNodeSet_t
+/**
+ *  \brief Structure containing Node Set Configuration.
+ */
+typedef struct
 {
-    uint32_t                numNodes;
+    uint32_t numNodes;
     /**< Number of input/output nodes */
-    Fvid2_GraphNodeInfo    *node[FVID2_GRAPH_MAX_NUM_PATHS];
+    Fvid2_GraphNodeInfo *node[FVID2_GRAPH_MAX_NUM_PATHS];
     /**< Pointer to the input/output node */
-    uint32_t                isEnabled[FVID2_GRAPH_MAX_NUM_PATHS];
+    uint32_t isEnabled[FVID2_GRAPH_MAX_NUM_PATHS];
     /**< Flag to indicate whether input/output is enabled or not. */
 } Fvid2_GraphNodeSet;
 
+/**
+ *  \brief Structure containing Node Information.
+ */
 struct Fvid2_GraphNodeInfo_t
 {
-    /*Used to select config structure from the CreateParams */
-    uint32_t                    nodeNum;
-
-    /* Tree-connections */
-    Fvid2_GraphNodeInputType    inType;
-    Fvid2_GraphNodeOutputType   outType;
-
-    /* SI/SO/MI/MO */
-    uint32_t                    nodeType;
-    
-    void                       *corePtr;
-    uint32_t                    isDummy;
-    uint32_t                    inUse;
-    Fvid2_GraphNodeSet          input;
-    Fvid2_GraphNodeSet          output;
+    uint32_t nodeId;
+    /**< Node Id */
+    uint32_t nodeInNum;
+    /**< Number of inputs to this particular node. Refer \ref
+     *   Fvid2_GraphNodeInputNum for values */
+    uint32_t nodeOutNum;
+    /**< Number of outputs from this particular node. Refer \ref
+     *   Fvid2_GraphNodeOutputNum for values */
+    uint32_t nodeType;
+    /**< Node type for the particular node. Refer \ref Fvid2_GraphNodeType
+     *   for values */
+    uint32_t isDummy;
+    /**< Variable defining whether node type is dummy */
+    uint32_t inUse;
+    /**< Variable defining whether node is used in the present context */
+    Fvid2_GraphNodeSet inputNodeSet;
+    /**< Input Node Set */
+    Fvid2_GraphNodeSet outputNodeSet;
+    /**< Output Node Set */
 };
 
+/**
+ *  \brief Structure containing Node List
+ */
 typedef struct
 {
-    uint32_t                    numNodes;
-    Fvid2_GraphNodeInfo        *list;
-} Fvid2_GraphNodeInfoList;
+    uint32_t numNodes;
+    /**< Number of nodes */
+    Fvid2_GraphNodeInfo *list;
+    /**< Pointer to node list */
+} Fvid2_GraphNodeList;
 
 /**
  * \brief Structure containing edge information. Edge is a connection
@@ -141,47 +206,55 @@ typedef struct
     /**< End node of the edge */
 } Fvid2_GraphEdgeInfo;
 
+/**
+ *  \brief Structure containing Edge List.
+ */
 typedef struct
 {
-    uint32_t                numEdges;
+    uint32_t numEdges;
     /**< Number of the edge */
-    Fvid2_GraphEdgeInfo    *list;
+    Fvid2_GraphEdgeInfo *list;
     /**< Edge list */
-} Fvid2_GraphEdgeInfoList;
+} Fvid2_GraphEdgeList;
 
+/**
+ *  \brief Structure containing Graph information.
+ */
 typedef struct
 {
-    Fvid2_GraphNodeInfoList    *nodeList;
-    Fvid2_GraphEdgeInfoList    *edgeList;
+    Fvid2_GraphNodeList *nodeList;
+    /**< Node list of the graph */
+    Fvid2_GraphEdgeList *edgeList;
+    /**< Edge list of the graph */
 } Fvid2_GraphInfo;
 
 /* ========================================================================== */
 /*                          Function Declarations                             */
 /* ========================================================================== */
 
-Fvid2_GraphInfo *Fvid2_graphInit(const Fvid2_GraphNodeInfoList *inNodeList,
-                                 const Fvid2_GraphEdgeInfoList *inEdgeList,
+Fvid2_GraphInfo *Fvid2_graphInit(const Fvid2_GraphNodeList *inNodeList,
+                                 const Fvid2_GraphEdgeList *inEdgeList,
                                  Fvid2_GraphInfo *graphHandle);
 
 int32_t Fvid2_graphDeInit(Fvid2_GraphInfo *graphHandle);
 
 Fvid2_GraphNodeInfo *Fvid2_graphGetNodeInfo(
-                            const Fvid2_GraphNodeInfoList *nodeList,
+                            const Fvid2_GraphNodeList *nodeList,
                             uint32_t cnt);
 
-int32_t Fvid2_graphAllocNodes(const Fvid2_GraphNodeInfoList *nodeList,
-                              const Fvid2_GraphEdgeInfoList *edgeList,
-                              Fvid2_GraphNodeMode mode);
+int32_t Fvid2_graphAllocNodes(const Fvid2_GraphNodeList *nodeList,
+                              const Fvid2_GraphEdgeList *edgeList,
+                              uint32_t mode); /* Fvid2_GraphNodeMode */
 
-int32_t Fvid2_graphGetPath(const Fvid2_GraphNodeInfoList *inNodeList,
-                           const Fvid2_GraphEdgeInfoList *inEdgeList,
-                           Fvid2_GraphNodeInfoList *outNodeList,
-                           Fvid2_GraphEdgeInfoList *outEdgeList,
+int32_t Fvid2_graphGetPath(const Fvid2_GraphNodeList *inNodeList,
+                           const Fvid2_GraphEdgeList *inEdgeList,
+                           Fvid2_GraphNodeList *outNodeList,
+                           Fvid2_GraphEdgeList *outEdgeList,
                            uint32_t maxOutNodeCnt,
                            uint32_t maxOutEdgeCnt);
 
-int32_t Fvid2_graphFreePath(Fvid2_GraphNodeInfoList *nodeList,
-                      Fvid2_GraphEdgeInfoList *edgeList);
+int32_t Fvid2_graphFreePath(Fvid2_GraphNodeList *nodeList,
+                            Fvid2_GraphEdgeList *edgeList);
 
 int32_t Fvid2_graphStackIsLastNode(const Fvid2_GraphNodeInfo *currNode,
                                    uint32_t isForward);
@@ -191,12 +264,12 @@ void Fvid2_graphStackInitTraverser(Fvid2_GraphNodeInfo *node);
 Fvid2_GraphNodeInfo *Fvid2_graphGetNextNodeToTraverse(uint32_t isForward);
 
 uint32_t Fvid2_graphIsNodeInputAvailable(
-                            const Fvid2_GraphNodeInfoList *nodeList,
-                            uint32_t nodeNum);
+                            const Fvid2_GraphNodeList *nodeList,
+                            uint32_t nodeId);
 
 uint32_t Fvid2_graphIsNodeOutputAvailable(
-                            const Fvid2_GraphNodeInfoList *nodeList,
-                            uint32_t nodeNum);
+                            const Fvid2_GraphNodeList *nodeList,
+                            uint32_t nodeId);
 
 void Fvid2_graphInitTraverser(Fvid2_GraphNodeInfo *node);