commit 6c72b7e4fcc86a7d972331a383f6068c07bb064e Author: Nikhil Dasan Date: Thu Aug 22 17:05:17 2024 +0530 remove bidirection Signed-off-by: Nikhil Dasan diff --git a/conformance_tests/test_tiovx/test_bidir_ext_framework.c b/conformance_tests/test_tiovx/test_bidir_ext_framework.c deleted file mode 100644 index ecd3ea6..0000000 --- a/conformance_tests/test_tiovx/test_bidir_ext_framework.c +++ /dev/null @@ -1,963 +0,0 @@ -/* - * Copyright (c) 2013-2023 The Khronos Group Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "test_engine/test.h" -#include "test_tiovx/test_tiovx.h" - -#include -#include -#include -#include - -enum user_library_e -{ - USER_LIBRARY_EXAMPLE = 1 -}; - -enum user_kernel_e -{ - MY_USER_KERNEL = VX_KERNEL_BASE( VX_ID_USER, USER_LIBRARY_EXAMPLE ) + 0x001 -}; - -TESTCASE(bpExtFramework, CT_VXContext, ct_setup_vx_context, 0) - -/* Write some data on an image */ -void writeImage(vx_image image) -{ - vx_map_id id; - vx_rectangle_t rect = {.start_x = 0, .end_x = 1, .start_y = 0, .end_y = 2}; - vx_imagepatch_addressing_t ipa; - void *ptr; - VX_CALL(vxMapImagePatch(image, &rect, 0, &id, &ipa, &ptr, VX_READ_AND_WRITE, VX_MEMORY_TYPE_HOST, 0)); - *(vx_uint8 *)vxFormatImagePatchAddress2d(ptr, 0, 0, &ipa) = 1; - *(vx_uint8 *)vxFormatImagePatchAddress2d(ptr, 0, 1, &ipa) = 2; - VX_CALL(vxUnmapImagePatch(image, id)); -} - -/* Check data in an image */ -vx_status checkImage(vx_image image, vx_uint8 a, vx_uint8 b) -{ - vx_status status = (vx_status)VX_SUCCESS; - vx_map_id id; - vx_rectangle_t rect = {.start_x = 0, .end_x = 1, .start_y = 0, .end_y = 2}; - vx_imagepatch_addressing_t ipa; - void *ptr; - status = vxMapImagePatch(image, &rect, 0, &id, &ipa, &ptr, VX_READ_AND_WRITE, VX_MEMORY_TYPE_HOST, 0); - if (status != (vx_status)VX_SUCCESS) - { - return status; - } - vx_uint8 aa = *(vx_uint8 *)vxFormatImagePatchAddress2d(ptr, 0, 0, &ipa); - vx_uint8 bb = *(vx_uint8 *)vxFormatImagePatchAddress2d(ptr, 0, 1, &ipa); - status = vxUnmapImagePatch(image, id); - if (status != (vx_status)VX_SUCCESS) - { - return status; - } - if (aa == a && bb == b) - { - status = (vx_status)VX_SUCCESS; - } - else - { - status = (vx_status)VX_FAILURE; - } - return status; -} - -vx_status myKernelFunction(vx_node node, const vx_reference parameters[], vx_uint32 nparams) -{ - /* Implement a very simple operation on two of the pixels so that we can verify - that things have happened as they should, in the order they should. We will perform - these operations: - bidir(0,0) = bidir(0, 0) + input(0,0) + 1 - bidir(0,1) = bidir(0, 1) + input(0,1) + 2 - */ - vx_status status = (vx_status)VX_SUCCESS; - vx_image input = (vx_image)parameters[0]; - vx_image bidir = (vx_image)parameters[1]; - vx_map_id id_in, id_bid; - vx_rectangle_t rect = {.start_x = 0, .end_x = 1, .start_y = 0, .end_y = 2}; - vx_imagepatch_addressing_t ipa_in, ipa_bid; - void *ptr_in, *ptr_bid; - tivxTaskWaitMsecs(100); /* Slow this kernel down so anything executing in parallel may complete */ - status = vxMapImagePatch(input, &rect, 0, &id_in, &ipa_in, &ptr_in, VX_READ_ONLY, VX_MEMORY_TYPE_HOST, 0); - if (status != (vx_status)VX_SUCCESS) - { - return status; - } - status = vxMapImagePatch(bidir, &rect, 0, &id_bid, &ipa_bid, &ptr_bid, VX_READ_AND_WRITE, VX_MEMORY_TYPE_HOST, 0); - if (status != (vx_status)VX_SUCCESS) - { - return status; - } - vx_uint8 inpix1 = *(vx_uint8 *)vxFormatImagePatchAddress2d(ptr_in, 0, 0, &ipa_in); - vx_uint8 inpix2 = *(vx_uint8 *)vxFormatImagePatchAddress2d(ptr_in, 0, 1, &ipa_in); - vx_uint8 bidpix1 = *(vx_uint8 *)vxFormatImagePatchAddress2d(ptr_bid, 0, 0, &ipa_bid); - vx_uint8 bidpix2 = *(vx_uint8 *)vxFormatImagePatchAddress2d(ptr_bid, 0, 1, &ipa_bid); - vx_uint8 respix1 = inpix1 + bidpix1 + 1; - vx_uint8 respix2 = inpix2 + bidpix2 + 2; - - *(vx_uint8 *)vxFormatImagePatchAddress2d(ptr_bid, 0, 0, &ipa_bid) = respix1; - *(vx_uint8 *)vxFormatImagePatchAddress2d(ptr_bid, 0, 1, &ipa_bid) = respix2; - - status = vxUnmapImagePatch(input, id_in); - if (status != (vx_status)VX_SUCCESS) - { - return status; - } - status = vxUnmapImagePatch(bidir, id_bid); - return status; -} - -vx_status myKernelValidator(vx_node node, const vx_reference * parameters, vx_uint32 num, vx_meta_format * metas) -{ - return VX_SUCCESS; -} - -/* Create a user kernel */ -vx_status registerUserKernel(vx_context context) -{ - vx_status status = (vx_status)VX_SUCCESS; - vx_kernel kernel = vxAddUserKernel(context, "myUserKernel", MY_USER_KERNEL, myKernelFunction, 2, myKernelValidator, NULL, NULL); - EXPECT_VX_REFERENCE(kernel); - status = vxAddParameterToKernel(kernel, 0, VX_INPUT, VX_TYPE_IMAGE, VX_PARAMETER_STATE_REQUIRED); - if (status != (vx_status)VX_SUCCESS) - { - return status; - } - /* Check [REQ-BP01] at compile time */ - (void)VX_BIDIRECTIONAL; - //PASS("BP01"); - /* Check [REQ-BP02] */ - status = vxAddParameterToKernel(kernel, 1, VX_BIDIRECTIONAL, VX_TYPE_IMAGE, VX_PARAMETER_STATE_REQUIRED); - if (status != (vx_status)VX_SUCCESS) - { - return status; - } - status = vxFinalizeKernel(kernel); - if (status != (vx_status)VX_SUCCESS) - { - return status; - } - status = vxReleaseKernel(&kernel); - return status; -} - -vx_status unRegisterUserKernel(vx_context context) -{ - return (vxRemoveKernel(vxGetKernelByEnum(context, MY_USER_KERNEL))); -} - -/* Create a simple node with a bidirectional parameter */ -vx_node createUserNode(vx_graph graph, vx_image input, vx_image bidir) -{ - vx_context context = vxGetContext((vx_reference)graph); - vx_kernel kernel = vxGetKernelByEnum(context, MY_USER_KERNEL); - EXPECT_VX_REFERENCE(kernel); - vx_node node = vxCreateGenericNode(graph, kernel); - EXPECT_VX_REFERENCE(node); - vxSetParameterByIndex(node, 0, (vx_reference)input); - vxSetParameterByIndex(node, 1, (vx_reference)bidir); - vxReleaseKernel(&kernel); - return node; -} - -/* Function to get a parameter, add it to a graph and then release it */ -vx_status addParameterToGraph(vx_graph graph, vx_node node, vx_uint32 num) -{ - vx_status status = (vx_status)VX_SUCCESS; - vx_parameter p = vxGetParameterByIndex(node, num); - status = vxAddParameterToGraph(graph, p); - if (status != (vx_status)VX_SUCCESS) - { - return status; - } - status = vxReleaseParameter(&p); - return status; -} - -/* Graphs that should fail verification */ -/* Create a graph with a non-virtual attached to one output, two bidirectional and two inputs */ -void makeGraph1O2B2I(vx_context context) -{ - vx_graph graph; - vx_image image1, image2, image3; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image2 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image3 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - writeImage(image1); - vx_node nodea = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodea); - vx_node nodeb = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodeb); - vx_node nodec = vxNotNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodec); - vx_node noded = vxAndNode(graph, image2, image2, image3); - EXPECT_VX_REFERENCE(noded); - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); - VX_CALL(vxReleaseNode(&nodea)); - VX_CALL(vxReleaseNode(&nodeb)); - VX_CALL(vxReleaseNode(&nodec)); - VX_CALL(vxReleaseNode(&noded)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseImage(&image3)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Create a graph with a non-virtual attached to two bidirectional and two inputs */ -void makeGraph2B2I(vx_context context) -{ - vx_graph graph; - vx_image image1, image2, image3; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image2 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image3 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_node nodea = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodea); - vx_node nodeb = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodeb); - vx_node noded = vxAndNode(graph, image2, image2, image3); - EXPECT_VX_REFERENCE(noded); - writeImage(image1); - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); - VX_CALL(vxReleaseNode(&nodea)); - VX_CALL(vxReleaseNode(&nodeb)); - VX_CALL(vxReleaseNode(&noded)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseImage(&image3)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Create a graph with a non-virtual attached to one output, two bidirectional */ -void makeGraph1O2B(vx_context context) -{ - vx_graph graph; - vx_image image1, image2; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image2 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_node nodea = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodea); - vx_node nodeb = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodeb); - vx_node nodec = vxNotNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodec); - writeImage(image1); - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); - VX_CALL(vxReleaseNode(&nodea)); - VX_CALL(vxReleaseNode(&nodeb)); - VX_CALL(vxReleaseNode(&nodec)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Create a graph with a non-virtual attached to two bidirectional */ -void makeGraph2B(vx_context context) -{ - vx_graph graph; - vx_image image1, image2; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image2 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_node nodea = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodea); - vx_node nodeb = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodeb); - writeImage(image1); - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); - VX_CALL(vxReleaseNode(&nodea)); - VX_CALL(vxReleaseNode(&nodeb)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Create a graph with a virtual attached to one output, two bidirectional and one input */ -void makeGraphV1O2B1I(vx_context context) -{ - vx_graph graph; - vx_image image1, image2, image3; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image2 = vxCreateVirtualImage(graph, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image3 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_node nodea = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodea); - vx_node nodeb = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodeb); - vx_node nodec = vxNotNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodec); - vx_node noded = vxNotNode(graph, image2, image3); - EXPECT_VX_REFERENCE(noded); - writeImage(image1); - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); - VX_CALL(vxReleaseNode(&nodea)); - VX_CALL(vxReleaseNode(&nodeb)); - VX_CALL(vxReleaseNode(&nodec)); - VX_CALL(vxReleaseNode(&noded)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseImage(&image3)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Create a graph with a virtual attached to one bidirectional and one input */ -void makeGraphV1B1I(vx_context context) -{ - vx_graph graph; - vx_image image1, image2, image3; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image2 = vxCreateVirtualImage(graph, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image3 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_node nodea = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodea); - vx_node noded = vxNotNode(graph, image2, image3); - EXPECT_VX_REFERENCE(noded); - writeImage(image1); - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); - VX_CALL(vxReleaseNode(&nodea)); - VX_CALL(vxReleaseNode(&noded)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseImage(&image3)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Create a graph with a virtual attached to one output, one bidirectional */ -void makeGraphV1O1B(vx_context context) -{ - vx_graph graph; - vx_image image1, image2; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image2 = vxCreateVirtualImage(graph, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_node nodea = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodea); - vx_node nodec = vxNotNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodec); - writeImage(image1); - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); - VX_CALL(vxReleaseNode(&nodea)); - VX_CALL(vxReleaseNode(&nodec)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Create a graph with a virtual attached to one bidirectional */ -void makeGraphV1B(vx_context context) -{ - vx_graph graph; - vx_image image1, image2; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image2 = vxCreateVirtualImage(graph, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_node nodea = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodea); - writeImage(image1); - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); - VX_CALL(vxReleaseNode(&nodea)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Create a graph with a non-virtual attached to a bidirectional and an input of the same node */ -void makeGraphCycle0(vx_context context) -{ - vx_graph graph; - vx_image image1; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_node nodea = createUserNode(graph, image1, image1); - EXPECT_VX_REFERENCE(nodea); - writeImage(image1); - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); - VX_CALL(vxReleaseNode(&nodea)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Create a graph with a cycle: - object 1 is connected as bidirectional to node A and input to node B, - object 2 is connected as bidirectional to node B and input to node A */ -void makeGraphCycle1(vx_context context) -{ - vx_graph graph; - vx_image image1, image2; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image2 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_node nodea = createUserNode(graph, image2, image1); - EXPECT_VX_REFERENCE(nodea); - vx_node nodeb = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodeb); - writeImage(image1); - writeImage(image2); - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); - VX_CALL(vxReleaseNode(&nodea)); - VX_CALL(vxReleaseNode(&nodeb)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Create a graph with a cycle: - object 1 is connected as an input to node A, as bidirectional to node B - and the output of node A is connected as another input to node B */ -void makeGraphCycle2(vx_context context) -{ - vx_graph graph; - vx_image image1, image2; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image2 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_node nodea = vxNotNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodea); - vx_node nodeb = createUserNode(graph, image2, image1); - EXPECT_VX_REFERENCE(nodeb); - writeImage(image2); - writeImage(image1); - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); - VX_CALL(vxReleaseNode(&nodea)); - VX_CALL(vxReleaseNode(&nodeb)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Create a graph with a uniform image attached as a bidirectional */ -void makeGraphUniform(vx_context context) -{ - vx_graph graph; - vx_image image1, image2; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_pixel_value_t pixel = {.U32 = 0}; - ASSERT_VX_OBJECT(image2 = vxCreateUniformImage(context, 100, 100, VX_DF_IMAGE_U8, &pixel), VX_TYPE_IMAGE); - vx_node nodea = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodea); - writeImage(image1); - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); - VX_CALL(vxReleaseNode(&nodea)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Graphs that should pass verification */ -/* Create a graph with a non-virtual attached to one output, one bidirectional and two inputs */ -void makeGraph1O1B2I(vx_context context) -{ - vx_graph graph; - vx_image image1, image2, image3; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image2 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image3 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_node nodeb = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodeb); - vx_node nodec = vxNotNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodec); - vx_node noded = vxAndNode(graph, image2, image2, image3); - EXPECT_VX_REFERENCE(noded); - writeImage(image1); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxProcessGraph(graph)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImage(image3, 0, 1)); - VX_CALL(vxReleaseNode(&nodeb)); - VX_CALL(vxReleaseNode(&nodec)); - VX_CALL(vxReleaseNode(&noded)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseImage(&image3)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Create a graph with a non-virtual attached to one bidirectional and two inputs */ -void makeGraph1B2I(vx_context context) -{ - vx_graph graph; - vx_image image1, image2, image3; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image2 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image3 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_node nodeb = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodeb); - vx_node noded = vxAndNode(graph, image2, image2, image3); - EXPECT_VX_REFERENCE(noded); - writeImage(image1); - writeImage(image2); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxProcessGraph(graph)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImage(image3, 3, 6)); - VX_CALL(vxReleaseNode(&nodeb)); - VX_CALL(vxReleaseNode(&noded)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseImage(&image3)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Create a graph with a non-virtual attached to one output, one bidirectional */ -void makeGraph1O1B(vx_context context) -{ - vx_graph graph; - vx_image image1, image2; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image2 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_node nodeb = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodeb); - vx_node nodec = vxNotNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodec); - writeImage(image1); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxProcessGraph(graph)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImage(image2, 0, 1)); - VX_CALL(vxReleaseNode(&nodeb)); - VX_CALL(vxReleaseNode(&nodec)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Create a graph with a non-virtual attached to one bidirectional */ -void makeGraph1B(vx_context context) -{ - vx_graph graph; - vx_image image1, image2; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image2 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_node nodea = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodea); - writeImage(image1); - writeImage(image2); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxProcessGraph(graph)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImage(image2, 3, 6)); - VX_CALL(vxReleaseNode(&nodea)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Create a graph with a virtual attached to one output, one bidirectional and one input */ -void makeGraphV1O1B1I(vx_context context) -{ - vx_graph graph; - vx_image image1, image2, image3; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image2 = vxCreateVirtualImage(graph, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image3 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_node nodeb = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodeb); - vx_node nodec = vxNotNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodec); - vx_node noded = vxNotNode(graph, image2, image3); - EXPECT_VX_REFERENCE(noded); - writeImage(image1); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxProcessGraph(graph)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImage(image3, 255, 254)); - VX_CALL(vxReleaseNode(&nodeb)); - VX_CALL(vxReleaseNode(&nodec)); - VX_CALL(vxReleaseNode(&noded)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseImage(&image3)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Create a graph with a virtual attached to one output, one bidirectional and three inputs */ -void makeGraphV1O1B3I(vx_context context) -{ - vx_graph graph; - vx_image image1, image2, image3, image4; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image2 = vxCreateVirtualImage(graph, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image3 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image4 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_node nodea = vxOrNode(graph, image2, image2, image4); - EXPECT_VX_REFERENCE(nodea); - vx_node nodeb = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodeb); - vx_node nodec = vxNotNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodec); - vx_node noded = vxNotNode(graph, image2, image3); - EXPECT_VX_REFERENCE(noded); - writeImage(image1); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxProcessGraph(graph)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImage(image3, 255, 254) || checkImage(image4, 0, 1)); - VX_CALL(vxReleaseNode(&nodea)); - VX_CALL(vxReleaseNode(&nodeb)); - VX_CALL(vxReleaseNode(&nodec)); - VX_CALL(vxReleaseNode(&noded)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseImage(&image3)); - VX_CALL(vxReleaseImage(&image4)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Create a test graph and check operation, especially execution order */ -void checkGraphExecution(vx_context context) -{ - vx_graph graph; - vx_image image1, image2, image3; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image2 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image3 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_node nodeb = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodeb); - vx_node nodec = vxNotNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodec); - vx_node noded = vxAddNode(graph, image2, image1, VX_CONVERT_POLICY_WRAP, image3); - EXPECT_VX_REFERENCE(noded); - writeImage(image1); - writeImage(image2); - writeImage(image3); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxProcessGraph(graph)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImage(image1, 1, 2)); /* Image1 should be unchanged */ - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImage(image2, 0, 1)); /* Image2 should have been written by output before it was updated */ - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImage(image3, 1, 3)); /* Image2 should have been written and updated before being used as an input */ - VX_CALL(vxReleaseNode(&nodeb)); - VX_CALL(vxReleaseNode(&nodec)); - VX_CALL(vxReleaseNode(&noded)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseImage(&image3)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Create a test graph and check operation with graph parameters */ -void checkGraphParameters(vx_context context) -{ - /* - [REQ-BP10] A bidirectional parameter may be added as a graph parameter. - In this case the effective direction of the parameter depends upon the graph configuration and rules determining the execution order of the nodes: - The edge is connected between an output parameter of node A, a bidirectional parameter of node B, and any number of inputs. - In this case the graph parameter is effectively an output, becoming "written" after node B has executed. - This is the case whether the graph parameter was created as attached to node A or to node B. - If this is confusing, please use a Copy node for clarity, and understand the order of execution of the nodes. - The edge is not connected to any output parameter, but to one bidirectional parameter of node A and any number of inputs to other nodes. - In this case the graph parameter is truly bidirectional, being at first an input to the node A, and becoming "written" after node A has executed. - */ - vx_graph graph; - vx_image image1, image2, image3; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image1 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image2 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(image3 = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - vx_node nodeb = createUserNode(graph, image1, image2); - EXPECT_VX_REFERENCE(nodeb); - writeImage(image1); - writeImage(image2); - writeImage(image3); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, addParameterToGraph(graph, nodeb, 1)); /* Parameter 0 of the graph is the bidirectional parameter */ - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); /* Should verify */ - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxProcessGraph(graph)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImage(image1, 1, 2)); /* Image1 should be unchanged */ - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImage(image2, 3, 6)); /* Image2 should have these new values */ - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxSetGraphParameterByIndex(graph, 0, (vx_reference)image3)); /* Replace image 2 by image 3, should be allowed */ - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxProcessGraph(graph)); /* Should be no need to verify again */ - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImage(image2, 3, 6)); /* Image2 should not have been modified this time */ - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImage(image3, 3, 6)); /* But image3 should have been modified */ - VX_CALL(vxReleaseNode(&nodeb)); - VX_CALL(vxReleaseImage(&image1)); - VX_CALL(vxReleaseImage(&image2)); - VX_CALL(vxReleaseImage(&image3)); - VX_CALL(vxReleaseGraph(&graph)); -} - -void checkGraphPipelining(vx_context context) -{ - /* - [REQ-BP11] A bidirectional parameter, whether effectively an output or truly bidirectional (see above), - will not become ready for dequeueing until all the nodes to which it is connected have executed. - - Use a graph with one graph parameter connected to a bidirectional and an input, one connected to a - bidirectional and an output, one connected to a bidirectional, an output and an input, - and one connected to an input. Run through a 3-deep pipeline and check the values. - Does nothing unless the pipelining extension is present. - */ - #ifdef OPENVX_KHR_PIPELINING - vx_graph graph; - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - typedef vx_image image3[3]; /* for clarity */ - image3 images[5]; - for (int i = 0; i < 5; ++i) - for (int j = 0; j < 3; ++j) - { - images[i][j] = vxCreateImage(context, 2, 2, VX_DF_IMAGE_U8); - if (i < 3 ) writeImage(images[i][j]); - } - vx_node nodes[6] = { - createUserNode(graph, images[0][0], images[1][0]), - createUserNode(graph, images[0][0], images[2][0]), - createUserNode(graph, images[0][0], images[3][0]), - vxNotNode(graph, images[1][0], images[2][0]), - vxNotNode(graph, images[0][0], images[3][0]), - vxNotNode(graph, images[3][0], images[4][0]), - }; - for (int i = 3; i < 6; ++i) - { - /* We want to test that things are executed in sequence even if parallelised */ - VX_CALL(vxSetNodeTarget(nodes[i], VX_TARGET_STRING, TIVX_TARGET_DSP1)); - } - EXPECT_EQ_VX_STATUS(VX_SUCCESS, addParameterToGraph(graph, nodes[0], 0U)); /* Images[0][], Input only */ - EXPECT_EQ_VX_STATUS(VX_SUCCESS, addParameterToGraph(graph, nodes[0], 1U)); /* Images[1][], Bidirectional */ - EXPECT_EQ_VX_STATUS(VX_SUCCESS, addParameterToGraph(graph, nodes[1], 1U)); /* Images[2][], Effectively an output */ - EXPECT_EQ_VX_STATUS(VX_SUCCESS, addParameterToGraph(graph, nodes[5], 1U)); /* Images[4][], Output only */ - /* set up pipelining */ - vx_graph_parameter_queue_params_t graph_params[5] = - { - {.graph_parameter_index = 0U, .refs_list_size = 3U, .refs_list = (vx_reference *)&images[0][0]}, - {.graph_parameter_index = 1U, .refs_list_size = 3U, .refs_list = (vx_reference *)&images[1][0]}, - {.graph_parameter_index = 2U, .refs_list_size = 3U, .refs_list = (vx_reference *)&images[2][0]}, - {.graph_parameter_index = 3U, .refs_list_size = 3U, .refs_list = (vx_reference *)&images[4][0]} - }; - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxSetGraphScheduleConfig(graph, VX_GRAPH_SCHEDULE_MODE_QUEUE_AUTO, 4, graph_params)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); - /* At this point we want to output the graph information */ - EXPECT_EQ_VX_STATUS(VX_SUCCESS, tivxExportGraphToDot(graph, "./", "BP11")); - - /* Initial pixels values for all images are (1,2) here we calculate what they should be after execution */ - vx_uint8 pixels[4][2] = - { - {1, 2}, - {3, 6}, - {0xFE, 0xFD}, - {0xFF, 0xFE} - }; - - for (int j = 0; j < 4; ++j) { - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxGraphParameterEnqueueReadyRef(graph, j, graph_params[j].refs_list, 3)); - } - - for(int i = 0; i < 3; ++i) - { - vx_image params[5]; - char label[8]; - for (int j = 0; j < 4; ++j) - { - vx_uint32 num_refs = 0; - vx_uint32 timer = 200; - while (0 == num_refs && --timer > 0) - { - if (0 == num_refs) - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxGraphParameterCheckDoneRef(graph, j, &num_refs)); - if (num_refs) - { - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxGraphParameterDequeueDoneRef(graph, j, (vx_reference *)¶ms[j], 1, &num_refs)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImage(params[j], pixels[j][0], pixels[j][1])); - break; - } - else - tivxTaskWaitMsecs(100); - } - if (0 == timer) - { - FAIL(label); - } - } - } - - for (int i = 0; i < 5; ++i) - for (int j = 0; j < 3; ++j) - VX_CALL(vxReleaseImage(&images[i][j])); - for (int i = 0; i < 6; ++i) - VX_CALL(vxReleaseNode(&nodes[i])); - VX_CALL(vxReleaseGraph(&graph)); - #else - printf("Pipelining is not implemented\n"); - #endif -} - -/* Check replication works with object array, and that it fails unless bidirectional parameters are replicated */ -void checkGraphReplicationArray(vx_context context) -{ - vx_graph graph; - vx_image image, input, bidir0, bidir1; - vx_object_array inp_array, bid_array; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(image = vxCreateImage(context, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(inp_array = vxCreateObjectArray(context, (vx_reference)image, 3), VX_TYPE_OBJECT_ARRAY); - ASSERT_VX_OBJECT(bid_array = vxCreateObjectArray(context, (vx_reference)image, 3), VX_TYPE_OBJECT_ARRAY); - VX_CALL(vxReleaseImage(&image)); - input = (vx_image)vxGetObjectArrayItem(inp_array, 0); - bidir0 = (vx_image)vxGetObjectArrayItem(bid_array, 0); - bidir1 = (vx_image)vxGetObjectArrayItem(bid_array, 1); - vx_node node = createUserNode(graph, input, bidir0); - EXPECT_VX_REFERENCE(node); - vx_bool replicate[2] = {vx_false_e, vx_false_e}; - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxReplicateNode(graph, node, replicate, 2)); - replicate[1] = vx_true_e; - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxReplicateNode(graph, node, replicate, 2)); - writeImage(input); - writeImage(bidir0); - writeImage(bidir1); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxProcessGraph(graph)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImage(bidir0, 3, 6)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImage(bidir1, 3, 6)); - VX_CALL(vxRemoveNode(&node)); - VX_CALL(vxReleaseImage(&input)); - VX_CALL(vxReleaseImage(&bidir0)); - VX_CALL(vxReleaseImage(&bidir1)); - VX_CALL(vxReleaseObjectArray(&inp_array)); - VX_CALL(vxReleaseObjectArray(&bid_array)); - VX_CALL(vxReleaseGraph(&graph)); -} - -/* Check replication works with pyramids */ -void checkGraphReplicationPyramid(vx_context context) -{ - vx_graph graph; - vx_pyramid inp_pyramid, bid_pyramid; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(inp_pyramid = vxCreatePyramid(context, 2, VX_SCALE_PYRAMID_HALF, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_PYRAMID); - ASSERT_VX_OBJECT(bid_pyramid = vxCreatePyramid(context, 2, VX_SCALE_PYRAMID_HALF, 100, 100, VX_DF_IMAGE_U8), VX_TYPE_PYRAMID); - vx_image input0 = vxGetPyramidLevel(inp_pyramid, 0); - vx_image input1 = vxGetPyramidLevel(inp_pyramid, 1); - vx_image bidir0 = vxGetPyramidLevel(bid_pyramid, 0); - vx_image bidir1 = vxGetPyramidLevel(bid_pyramid, 1); - vx_node node = createUserNode(graph, input0, bidir0); - EXPECT_VX_REFERENCE(node); - vx_bool replicate[2] = {vx_true_e, vx_true_e}; - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxReplicateNode(graph, node, replicate, 2)); - writeImage(input0); - writeImage(input1); - writeImage(bidir0); - writeImage(bidir1); - VX_CALL(vxVerifyGraph(graph)); - VX_CALL(vxProcessGraph(graph)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImage(bidir0, 3, 6)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImage(bidir1, 3, 6)); - VX_CALL(vxReleaseNode(&node)); - VX_CALL(vxReleasePyramid(&inp_pyramid)); - VX_CALL(vxReleasePyramid(&bid_pyramid)); - VX_CALL(vxReleaseImage(&input0)); - VX_CALL(vxReleaseImage(&bidir0)); - VX_CALL(vxReleaseImage(&input1)); - VX_CALL(vxReleaseImage(&bidir1)); - VX_CALL(vxReleaseGraph(&graph)); -} - - -TEST(bpExtFramework, testGraphbidirFail) -{ - /* Graphs that should fail */ - vx_context context = context_->vx_context_; - registerUserKernel(context); - makeGraph1O2B2I(context); /* BP03 */ - makeGraph2B2I(context); - makeGraph1O2B(context); - makeGraph2B(context); - makeGraphV1O2B1I(context); /* BP04 */ - makeGraphV1B1I(context); - makeGraphV1O1B(context); - makeGraphV1B(context); - makeGraphCycle0(context); /* BP05 */ - makeGraphUniform(context); /* BP06 */ - makeGraphCycle1(context); /* BP09 */ - makeGraphCycle2(context); /* BP09 */ - unRegisterUserKernel(context); -} - -TEST(bpExtFramework, testGraphbidirSuccess) -{ - vx_context context = context_->vx_context_; - registerUserKernel(context); - makeGraph1O1B2I(context); /* BP03 */ - makeGraph1B2I(context); - makeGraph1O1B(context); - makeGraph1B(context); - makeGraphV1O1B1I(context); /* BP04 */ - makeGraphV1O1B3I(context); - unRegisterUserKernel(context); -} - -TEST(bpExtFramework, testGraphbidirExOrder) -{ - vx_context context = context_->vx_context_; - registerUserKernel(context); - checkGraphExecution(context); /* BP07, BO08 */ - unRegisterUserKernel(context); -} - -TEST(bpExtFramework, testGraphbidirGraphParam) -{ - vx_context context = context_->vx_context_; - registerUserKernel(context); - checkGraphParameters(context); /* BP10 */ - unRegisterUserKernel(context); -} - -TEST(bpExtFramework, testGraphbidirReplicate) -{ - vx_context context = context_->vx_context_; - registerUserKernel(context); - checkGraphReplicationArray(context); /* BP12 a*/ - checkGraphReplicationPyramid(context); /* BP12 p*/ - unRegisterUserKernel(context); -} - -TEST(bpExtFramework, testGraphbidirPipelining) -{ - vx_context context = context_->vx_context_; - registerUserKernel(context); - checkGraphPipelining(context); /* BP11 */ - unRegisterUserKernel(context); -} - -TESTCASE_TESTS(bpExtFramework, - testGraphbidirFail, - testGraphbidirSuccess, - testGraphbidirExOrder, - testGraphbidirGraphParam, - testGraphbidirReplicate, - testGraphbidirPipelining) \ No newline at end of file diff --git a/conformance_tests/test_tiovx/test_bidir_ext_standardnode.c b/conformance_tests/test_tiovx/test_bidir_ext_standardnode.c deleted file mode 100644 index 33ad35b..0000000 --- a/conformance_tests/test_tiovx/test_bidir_ext_standardnode.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) 2013-2023 The Khronos Group Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "test_engine/test.h" -#include "test_tiovx/test_tiovx.h" - -#include -#include -#include - -TESTCASE(bpExtStandardNodes, CT_VXContext, ct_setup_vx_context, 0) - -/* Write some data on an 8-bit image */ -void bd_std_node_writeImage(vx_image image, vx_uint8 a, vx_uint8 b) -{ - vx_map_id id; - vx_rectangle_t rect = {.start_x = 0, .end_x = 1, .start_y = 0, .end_y = 2}; - vx_imagepatch_addressing_t ipa; - void *ptr; - VX_CALL(vxMapImagePatch(image, &rect, 0, &id, &ipa, &ptr, VX_READ_AND_WRITE, VX_MEMORY_TYPE_HOST, 0)); - *(vx_uint8 *)vxFormatImagePatchAddress2d(ptr, 0, 0, &ipa) = a; - *(vx_uint8 *)vxFormatImagePatchAddress2d(ptr, 0, 1, &ipa) = b; - VX_CALL(vxUnmapImagePatch(image, id)); -} - -/* Check data in an 8-bit image */ -vx_status bd_std_node_checkImage(vx_image image, vx_uint8 a, vx_uint8 b) -{ - vx_status status = (vx_status)VX_SUCCESS; - vx_map_id id; - vx_rectangle_t rect = {.start_x = 0, .end_x = 1, .start_y = 0, .end_y = 2}; - vx_imagepatch_addressing_t ipa; - void *ptr; - status = vxMapImagePatch(image, &rect, 0, &id, &ipa, &ptr, VX_READ_AND_WRITE, VX_MEMORY_TYPE_HOST, 0); - if (status != (vx_status)VX_SUCCESS) - { - return status; - } - vx_uint8 aa = *(vx_uint8 *)vxFormatImagePatchAddress2d(ptr, 0, 0, &ipa); - vx_uint8 bb = *(vx_uint8 *)vxFormatImagePatchAddress2d(ptr, 0, 1, &ipa); - status = vxUnmapImagePatch(image, id); - if (status != (vx_status)VX_SUCCESS) - { - return status; - } - /* On failure return a non-zero value encoding the pixels, easily readable in decimal */ - return (aa == a) && (bb == b) ? status : aa * 1000 + bb + 1000000; -} - -/* Write some data on a 16-bit image */ -void bd_std_node_writeImageS16(vx_image image, vx_int16 a, vx_int16 b) -{ - vx_map_id id; - vx_rectangle_t rect = {.start_x = 0, .end_x = 1, .start_y = 0, .end_y = 2}; - vx_imagepatch_addressing_t ipa; - void *ptr; - VX_CALL(vxMapImagePatch(image, &rect, 0, &id, &ipa, &ptr, VX_READ_AND_WRITE, VX_MEMORY_TYPE_HOST, 0)); - *(vx_int16 *)vxFormatImagePatchAddress2d(ptr, 0, 0, &ipa) = a; - *(vx_int16 *)vxFormatImagePatchAddress2d(ptr, 0, 1, &ipa) = b; - VX_CALL(vxUnmapImagePatch(image, id)); -} - -/* Check data in an 8-bit image */ -vx_status checkImageS16(vx_image image, vx_int16 a, vx_int16 b) -{ - vx_status status = (vx_status)VX_SUCCESS; - vx_map_id id; - vx_rectangle_t rect = {.start_x = 0, .end_x = 1, .start_y = 0, .end_y = 2}; - vx_imagepatch_addressing_t ipa; - void *ptr; - status = vxMapImagePatch(image, &rect, 0, &id, &ipa, &ptr, VX_READ_AND_WRITE, VX_MEMORY_TYPE_HOST, 0); - if (status != (vx_status)VX_SUCCESS) - { - return status; - } - vx_int16 aa = *(vx_int16 *)vxFormatImagePatchAddress2d(ptr, 0, 0, &ipa); - vx_int16 bb = *(vx_int16 *)vxFormatImagePatchAddress2d(ptr, 0, 1, &ipa); - status = vxUnmapImagePatch(image, id); - if (status != (vx_status)VX_SUCCESS) - { - return status; - } - /* On failure output the data and return VX_FAILURE */ - if (aa == a && bb == b) - return status; - return VX_FAILURE; -} - -vx_status releaseNode(vx_node node) -{ - return vxReleaseNode(&node); -} - -void testAccumulate(vx_context context) -{ - vx_graph graph; - vx_image in_param, accum_param; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(in_param = vxCreateImage(context, 8, 8, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(accum_param = vxCreateImage(context, 8, 8, VX_DF_IMAGE_S16), VX_TYPE_IMAGE); - bd_std_node_writeImage(in_param, 0x01, 0xFF); - bd_std_node_writeImageS16(accum_param, 0x0100, 0x7F03); - VX_CALL(releaseNode(vxAccumulateImageNode(graph, in_param, accum_param))); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxProcessGraph(graph)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImageS16(accum_param, 0x0101, 0x7FFF)); - VX_CALL(vxReleaseImage(&in_param)); - VX_CALL(vxReleaseImage(&accum_param)); - VX_CALL(vxReleaseGraph(&graph)); -} - -void testAccumulateBad(vx_context context) -{ - vx_graph graph; - vx_image in_param, accum_param; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(in_param = vxCreateImage(context, 8, 8, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(accum_param = vxCreateImage(context, 8, 8, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - bd_std_node_writeImage(in_param, 0x01, 0xFF); - bd_std_node_writeImage(accum_param, 0xFF, 0x03); - vx_node node = vxAccumulateImageNode(graph, NULL, accum_param); - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxGetStatus((vx_reference)node)); - VX_CALL(releaseNode(vxAccumulateImageNode(graph, in_param, accum_param))); - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); - VX_CALL(vxReleaseImage(&in_param)); - VX_CALL(vxReleaseImage(&accum_param)); - VX_CALL(vxReleaseGraph(&graph)); -} - -void testAccumulateSquare(vx_context context) -{ - vx_graph graph; - vx_image in_param, accum_param; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(in_param = vxCreateImage(context, 8, 8, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(accum_param = vxCreateImage(context, 8, 8, VX_DF_IMAGE_S16), VX_TYPE_IMAGE); - bd_std_node_writeImage(in_param, 04, 0xFF); - bd_std_node_writeImageS16(accum_param, 100, 0x7F03); - VX_CALL(releaseNode(vxAccumulateSquareImageNodeX(graph, in_param, 0, accum_param))); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxProcessGraph(graph)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, checkImageS16(accum_param, 116, 0x7FFF)); - VX_CALL(vxReleaseImage(&in_param)); - VX_CALL(vxReleaseImage(&accum_param)); - VX_CALL(vxReleaseGraph(&graph)); -} - -void testAccumulateSquareBad(vx_context context) -{ - vx_graph graph; - vx_image in_param, accum_param; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(in_param = vxCreateImage(context, 8, 8, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(accum_param = vxCreateImage(context, 8, 8, VX_DF_IMAGE_S16), VX_TYPE_IMAGE); - bd_std_node_writeImage(in_param, 0x01, 0xFF); - bd_std_node_writeImageS16(accum_param, 0xFF, 0x03); - vx_node node = vxAccumulateSquareImageNodeX(graph, in_param, 0, NULL); - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxGetStatus((vx_reference)node)); - VX_CALL(releaseNode(vxAccumulateSquareImageNodeX(graph, in_param, 17, accum_param))); - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); - VX_CALL(vxReleaseImage(&in_param)); - VX_CALL(vxReleaseImage(&accum_param)); - VX_CALL(vxReleaseGraph(&graph)); -} - -void testAccumulateWeighted(vx_context context) -{ - vx_graph graph; - vx_image in_param, accum_param; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(in_param = vxCreateImage(context, 8, 8, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(accum_param = vxCreateImage(context, 8, 8, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - - bd_std_node_writeImage(in_param, 04, 100); - bd_std_node_writeImage(accum_param, 100, 200); - VX_CALL(releaseNode(vxAccumulateWeightedImageNodeX(graph, in_param, 0.25f, accum_param))); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, vxProcessGraph(graph)); - EXPECT_EQ_VX_STATUS(VX_SUCCESS, bd_std_node_checkImage(accum_param, 76, 175)); - VX_CALL(vxReleaseImage(&in_param)); - VX_CALL(vxReleaseImage(&accum_param)); - VX_CALL(vxReleaseGraph(&graph)); -} - -void testAccumulateWeightedBad(vx_context context) -{ - vx_graph graph; - vx_image in_param, accum_param; - - ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH); - ASSERT_VX_OBJECT(in_param = vxCreateImage(context, 8, 8, VX_DF_IMAGE_U8), VX_TYPE_IMAGE); - ASSERT_VX_OBJECT(accum_param = vxCreateImage(context, 8, 8, VX_DF_IMAGE_S16), VX_TYPE_IMAGE); - - bd_std_node_writeImage(in_param, 0x01, 0xFF); - bd_std_node_writeImageS16(accum_param, 0xFF, 0x03); - vx_node node = vxAccumulateWeightedImageNodeX(graph, in_param, 0.2f, NULL); - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxGetStatus((vx_reference)node)); - VX_CALL(releaseNode(vxAccumulateWeightedImageNodeX(graph, in_param, 1.5f, accum_param))); - EXPECT_NE_VX_STATUS(VX_SUCCESS, vxVerifyGraph(graph)); - VX_CALL(vxReleaseImage(&in_param)); - VX_CALL(vxReleaseImage(&accum_param)); - VX_CALL(vxReleaseGraph(&graph)); -} - -TEST(bpExtStandardNodes, testbidirAccumulatedNodeGood) -{ - vx_context context = context_->vx_context_; - testAccumulate(context); - testAccumulateSquare(context); - testAccumulateWeighted(context); -} - -TEST(bpExtStandardNodes, testbidirAccumulatedNodeFail) -{ - vx_context context = context_->vx_context_; - testAccumulateBad(context); - testAccumulateSquareBad(context); - testAccumulateWeightedBad(context); -} - -TESTCASE_TESTS(bpExtStandardNodes, - testbidirAccumulatedNodeFail, - testbidirAccumulatedNodeGood) \ No newline at end of file diff --git a/conformance_tests/test_tiovx/test_main.h b/conformance_tests/test_tiovx/test_main.h index b7bc3da..4b127ad 100644 --- a/conformance_tests/test_tiovx/test_main.h +++ b/conformance_tests/test_tiovx/test_main.h @@ -116,6 +116,4 @@ TESTCASE(tivxSafeCasts) TESTCASE(tivxNestedUserNode) #endif TESTCASE(tivxTgKnl) -TESTCASE(bpExtStandardNodes) -TESTCASE(bpExtFramework) #endif diff --git a/include/TI/tivx.h b/include/TI/tivx.h index 74fb91b..0d9fd81 100755 --- a/include/TI/tivx.h +++ b/include/TI/tivx.h @@ -66,7 +66,6 @@ #include #include #include -#include #include #include #include diff --git a/include/VX/vx_khr_bidirectional_parameters.h b/include/VX/vx_khr_bidirectional_parameters.h deleted file mode 100644 index caa1f16..0000000 --- a/include/VX/vx_khr_bidirectional_parameters.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2023 The Khronos Group Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _OPENVX_BIDIRECTIONAL_H_ -#define _OPENVX_BIDIRECTIONAL_H_ - -/*! - * \file - * \brief The OpenVX Bidirectional Parameters extension API. - */ - -#define OPENVX_KHR_BIDIRECTIONAL_PARAMETERS "vx_khr_bidirectional_parameters" - -#define OPENVX_KHR_BIDIRECTIONAL_OPTIONAL_KERNELS /* Remove if optional kernels are not implemented */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/*! \brief Extra enums. - * - * \ingroup group_parameter - */ - -enum vx_bidirectional_enum_e -{ - VX_BIDIRECTIONAL = VX_ENUM_BASE(VX_ID_KHRONOS, VX_ENUM_DIRECTION) + 0x2 /* Additional parameter direction enumeration */ -}; - -#ifdef OPENVX_KHR_BIDIRECTIONAL_OPTIONAL_KERNELS - -#ifndef VX_VERSION_1_1 -/*! \brief [Graph] Creates an accumulate node. - * \param [in] graph The reference to the graph. - * \param [in] input The input \ref VX_DF_IMAGE_U8 image. - * \param [in,out] accum The accumulation image in \ref VX_DF_IMAGE_S16. - * \ingroup group_vision_function_accumulate - * \return \ref vx_node. - * \retval vx_node A node reference. Any possible errors preventing a successful creation should be checked using \ref vxGetStatus - */ -VX_API_ENTRY vx_node VX_API_CALL vxAccumulateImageNode(vx_graph graph, vx_image input, vx_image accum); -#endif - -/*! \brief [Graph] Creates a weighted accumulate node. - * \param [in] graph The reference to the graph. - * \param [in] input The input \ref VX_DF_IMAGE_U8 image. - * \param [in] alpha The input \ref VX_TYPE_FLOAT32 scalar value with a value in the range of \f$ 0.0 \le \alpha \le 1.0 \f$. - * \param [in,out] accum The \ref VX_DF_IMAGE_U8 accumulation image. - * \ingroup group_vision_function_accumulate_weighted - * \return \ref vx_node. - * \retval vx_node A node reference. Any possible errors preventing a successful creation should be checked using \ref vxGetStatus - */ -VX_API_ENTRY vx_node VX_API_CALL vxAccumulateWeightedImageNodeX(vx_graph graph, vx_image input, vx_float32 alpha, vx_image accum); - -/*! \brief [Graph] Creates an accumulate square node. - * \param [in] graph The reference to the graph. - * \param [in] input The input \ref VX_DF_IMAGE_U8 image. - * \param [in] shift The input \ref VX_TYPE_UINT32 with a value in the range of \f$ 0 \le shift \le 15 \f$. - * \param [in,out] accum The accumulation image in \ref VX_DF_IMAGE_S16. - * \ingroup group_vision_function_accumulate_square - * \return \ref vx_node. - * \retval vx_node A node reference. Any possible errors preventing a successful creation should be checked using \ref vxGetStatus - */ -VX_API_ENTRY vx_node VX_API_CALL vxAccumulateSquareImageNodeX(vx_graph graph, vx_image input, vx_uint32 shift, vx_image accum); -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/VX/vx_types.h b/include/VX/vx_types.h index ff19fb4..1ee3570 100755 --- a/include/VX/vx_types.h +++ b/include/VX/vx_types.h @@ -564,7 +564,9 @@ enum vx_direction_e { /*! \brief The parameter is an input only. */ VX_INPUT = VX_ENUM_BASE(VX_ID_KHRONOS, VX_ENUM_DIRECTION) + 0x0, /*! \brief The parameter is an output only. */ - VX_OUTPUT = VX_ENUM_BASE(VX_ID_KHRONOS, VX_ENUM_DIRECTION) + 0x1 + VX_OUTPUT = VX_ENUM_BASE(VX_ID_KHRONOS, VX_ENUM_DIRECTION) + 0x1, + /*! \brief The parameter is both an input and output. */ + VX_BIDIRECTIONAL = VX_ENUM_BASE(VX_ID_KHRONOS, VX_ENUM_DIRECTION) + 0x2, }; /*! \brief These enumerations are given to the \ref vxHint API to enable/disable platform diff --git a/kernels/openvx-core/host/vx_accumulate_host.c b/kernels/openvx-core/host/vx_accumulate_host.c index 9aba35f..854fd69 100644 --- a/kernels/openvx-core/host/vx_accumulate_host.c +++ b/kernels/openvx-core/host/vx_accumulate_host.c @@ -258,7 +258,7 @@ vx_status tivxAddKernelAccumulate(vx_context context) { status = vxAddParameterToKernel(kernel, index, - (vx_enum)VX_BIDIRECTIONAL, + (vx_enum)VX_OUTPUT, (vx_enum)VX_TYPE_IMAGE, (vx_enum)VX_PARAMETER_STATE_REQUIRED ); diff --git a/kernels/openvx-core/host/vx_accumulate_square_host.c b/kernels/openvx-core/host/vx_accumulate_square_host.c index 4ca1f47..5b80125 100644 --- a/kernels/openvx-core/host/vx_accumulate_square_host.c +++ b/kernels/openvx-core/host/vx_accumulate_square_host.c @@ -297,7 +297,7 @@ vx_status tivxAddKernelAccumulateSquare(vx_context context) { status = vxAddParameterToKernel(kernel, index, - (vx_enum)VX_BIDIRECTIONAL, + (vx_enum)VX_OUTPUT, (vx_enum)VX_TYPE_IMAGE, (vx_enum)VX_PARAMETER_STATE_REQUIRED ); diff --git a/kernels/openvx-core/host/vx_accumulate_weighted_host.c b/kernels/openvx-core/host/vx_accumulate_weighted_host.c index 82f60dd..ebc937b 100644 --- a/kernels/openvx-core/host/vx_accumulate_weighted_host.c +++ b/kernels/openvx-core/host/vx_accumulate_weighted_host.c @@ -297,7 +297,7 @@ vx_status tivxAddKernelAccumulateWeighted(vx_context context) { status = vxAddParameterToKernel(kernel, index, - (vx_enum)VX_BIDIRECTIONAL, + (vx_enum)VX_OUTPUT, (vx_enum)VX_TYPE_IMAGE, (vx_enum)VX_PARAMETER_STATE_REQUIRED ); diff --git a/source/framework/vx_graph_export_dot.c b/source/framework/vx_graph_export_dot.c index 780dbbf..22af24a 100644 --- a/source/framework/vx_graph_export_dot.c +++ b/source/framework/vx_graph_export_dot.c @@ -74,7 +74,7 @@ #define TIVX_EXPORT_MAX_NODE_COLOR_NAME (64u) #define TIVX_EXPORT_WRITELN(fp, message, ...) do { \ - (void)snprintf(line, TIVX_EXPORT_MAX_LINE_SIZE, message"\n", ##__VA_ARGS__); \ + (void)snprintf(line, TIVX_EXPORT_MAX_FILENAME, message"\n", ##__VA_ARGS__); \ (void)fwrite(line, 1, strlen(line), fp); \ } while (1 == 0) @@ -797,27 +797,20 @@ static vx_status ownExportGraphTopLevelToDot(vx_graph graph, const char *output_ ref = ref->scope; exportDataRef(fp, ref); } - if((vx_enum)VX_INPUT == dir) + if(dir==(vx_enum)VX_INPUT) { TIVX_EXPORT_WRITELN(fp, "%s -> _%s %s", ref->name, node->base.name, replicated_label); } - else if ((vx_enum)VX_OUTPUT == dir) + else { TIVX_EXPORT_WRITELN(fp, "_%s -> %s %s", node->base.name, ref->name, replicated_label ); } - else /* Bidirectional */ - { - TIVX_EXPORT_WRITELN(fp, "_%s -> %s [dir=both]%s", - node->base.name, - ref->name, - replicated_label ); - } } else { @@ -827,7 +820,7 @@ static vx_status ownExportGraphTopLevelToDot(vx_graph graph, const char *output_ ); /* optional parameter */ - if ((vx_enum)VX_INPUT == dir) + if(dir==(vx_enum)VX_INPUT) { TIVX_EXPORT_WRITELN(fp, "null_%s_%d -> _%s %s", node->base.name, @@ -835,22 +828,13 @@ static vx_status ownExportGraphTopLevelToDot(vx_graph graph, const char *output_ node->base.name, replicated_label); } - else if ((vx_enum)VX_OUTPUT == dir) - { - TIVX_EXPORT_WRITELN(fp, "_%s -> null_%s_%d %s", - node->base.name, - node->base.name, - data_id, - replicated_label); - } else { - TIVX_EXPORT_WRITELN(fp, "_%s -> null_%s_%d [dir=both]%s", + TIVX_EXPORT_WRITELN(fp, "_%s -> null_%s_%d %s", node->base.name, node->base.name, data_id, replicated_label); - } } } @@ -1143,14 +1127,14 @@ static vx_status ownExportGraphFirstPipelineToDot(vx_graph graph, const char *ou { char replicated_label[32]=""; vx_bool is_replicated; - vx_enum prm_dir = ownNodeGetParameterDir(node, data_id); + is_replicated = tivxFlagIsBitSet(node_desc->is_prm_replicated, ((uint32_t)1<<(uint32_t)data_id)); if(is_replicated != 0) { (void)snprintf(replicated_label, 32, "[label=\" replicated\"]"); } - if ((vx_enum)VX_INPUT == prm_dir) + if(tivxFlagIsBitSet(node_desc->is_prm_input, ((uint32_t)1<<(uint32_t)data_id)) != 0) { if(tivxFlagIsBitSet(node_desc->is_prm_data_ref_q, ((uint32_t)1<<(uint32_t)data_id)) != 0) { @@ -1169,23 +1153,18 @@ static vx_status ownExportGraphFirstPipelineToDot(vx_graph graph, const char *ou } else { - char * edge_dir = ""; - if((vx_enum)VX_BIDIRECTIONAL == prm_dir) - { - edge_dir = "[dir=both]"; - } if(tivxFlagIsBitSet(node_desc->is_prm_data_ref_q, ((uint32_t)1<<(uint32_t)data_id)) != 0) { if((vx_enum)node_desc->data_ref_q_id[data_id]!=(vx_enum)TIVX_OBJ_DESC_INVALID) { - TIVX_EXPORT_WRITELN(fp, "n_%d -> d_%d %s%s", node_desc->base.obj_desc_id, node_desc->data_ref_q_id[data_id], edge_dir, replicated_label); + TIVX_EXPORT_WRITELN(fp, "n_%d -> d_%d %s", node_desc->base.obj_desc_id, node_desc->data_ref_q_id[data_id], replicated_label); } } else { if((vx_enum)node_desc->data_id[data_id]!=(vx_enum)TIVX_OBJ_DESC_INVALID) { - TIVX_EXPORT_WRITELN(fp, "n_%d -> d_%d %s%s", node_desc->base.obj_desc_id, node_desc->data_id[data_id], edge_dir, replicated_label); + TIVX_EXPORT_WRITELN(fp, "n_%d -> d_%d %s", node_desc->base.obj_desc_id, node_desc->data_id[data_id], replicated_label); } } } @@ -1565,7 +1544,6 @@ static vx_status ownExportGraphPipelineToDot(vx_graph graph, const char *output_ { char replicated_label[32]=""; vx_bool is_replicated; - vx_enum prm_dir = ownNodeGetParameterDir(node, data_id); is_replicated = tivxFlagIsBitSet(node_desc->is_prm_replicated, ((uint32_t)1<<(uint32_t)data_id)); if(is_replicated != 0) @@ -1573,7 +1551,7 @@ static vx_status ownExportGraphPipelineToDot(vx_graph graph, const char *output_ (void)snprintf(replicated_label, 32, "[label=\" replicated\"]"); } - if((vx_enum)VX_INPUT == prm_dir) + if(tivxFlagIsBitSet(node_desc->is_prm_input, ((uint32_t)1<<(uint32_t)data_id)) != 0) { if(tivxFlagIsBitSet(node_desc->is_prm_data_ref_q, ((uint32_t)1<<(uint32_t)data_id)) != 0) { @@ -1592,23 +1570,18 @@ static vx_status ownExportGraphPipelineToDot(vx_graph graph, const char *output_ } else { - char * edge_dir = ""; - if((vx_enum)VX_BIDIRECTIONAL == prm_dir) - { - edge_dir = "[dir=both]"; - } if(tivxFlagIsBitSet(node_desc->is_prm_data_ref_q, ((uint32_t)1<<(uint32_t)data_id)) != 0) { if((vx_enum)node_desc->data_ref_q_id[data_id]!=(vx_enum)TIVX_OBJ_DESC_INVALID) { - TIVX_EXPORT_WRITELN(fp, "n_%d -> d_%d %s%s", node_desc->base.obj_desc_id, node_desc->data_ref_q_id[data_id], edge_dir, replicated_label); + TIVX_EXPORT_WRITELN(fp, "n_%d -> d_%d %s", node_desc->base.obj_desc_id, node_desc->data_ref_q_id[data_id], replicated_label); } } else { if((vx_enum)node_desc->data_id[data_id]!=(vx_enum)TIVX_OBJ_DESC_INVALID) { - TIVX_EXPORT_WRITELN(fp, "n_%d -> d_%d %s%s", node_desc->base.obj_desc_id, node_desc->data_id[data_id], edge_dir, replicated_label); + TIVX_EXPORT_WRITELN(fp, "n_%d -> d_%d %s", node_desc->base.obj_desc_id, node_desc->data_id[data_id], replicated_label); } } } diff --git a/source/framework/vx_graph_pipeline.c b/source/framework/vx_graph_pipeline.c index 4d5ca92..4cc5f4e 100644 --- a/source/framework/vx_graph_pipeline.c +++ b/source/framework/vx_graph_pipeline.c @@ -1082,7 +1082,7 @@ void ownGraphDetectAndSetNumBuf(vx_graph graph) ref = ownNodeGetParameterRef(node_cur, prm_cur_idx); prm_dir = (uint32_t)ownNodeGetParameterDir(node_cur, prm_cur_idx); - if( (ref!=NULL) && ((vx_enum)prm_dir != (vx_enum)VX_INPUT)) /* ref could be NULL due to optional parameters */ + if( (ref!=NULL) && ((vx_enum)prm_dir == VX_OUTPUT)) /* ref could be NULL due to optional parameters */ { is_ref_graph_param = (vx_bool)vx_false_e; diff --git a/source/framework/vx_graph_verify.c b/source/framework/vx_graph_verify.c index bb07790..896fc2f 100644 --- a/source/framework/vx_graph_verify.c +++ b/source/framework/vx_graph_verify.c @@ -139,9 +139,8 @@ static vx_status ownGraphAddSingleDataReference(vx_graph graph, vx_reference ref if((check != 0U) && (ownGraphCheckIsRefMatch(graph, graph->data_ref[i], ref) != (vx_bool)vx_false_e)) { /* increment num_in_node count for ref */ - if((uint32_t)VX_OUTPUT != prm_dir) + if(prm_dir==(uint32_t)VX_INPUT) { - /* Input or bidirectional */ graph->data_ref_num_in_nodes[i]++; } status = (vx_status)VX_SUCCESS; @@ -154,11 +153,15 @@ static vx_status ownGraphAddSingleDataReference(vx_graph graph, vx_reference ref /* 'ref' not present in 'data_ref' list so add it */ graph->data_ref[i] = ref; graph->data_ref_num_in_nodes[i] = 0; - if((uint32_t)VX_OUTPUT != prm_dir) + graph->data_ref_num_out_nodes[i] = 0; + if(prm_dir==(uint32_t)VX_INPUT) { - /* input */ graph->data_ref_num_in_nodes[i]++; } + else + { + graph->data_ref_num_out_nodes[i]++; + } graph->num_data_ref++; ownLogSetResourceUsedValue("TIVX_GRAPH_MAX_DATA_REF", (uint16_t)graph->num_data_ref); status = (vx_status)VX_SUCCESS; @@ -306,7 +309,7 @@ static vx_status ownGraphValidRectCallback( { ref = node->parameters[i]; - if( ((vx_enum)VX_OUTPUT != node->kernel->signature.directions[i]) + if( (node->kernel->signature.directions[i] == (vx_enum)VX_INPUT) && (NULL != ref) && @@ -329,7 +332,7 @@ static vx_status ownGraphValidRectCallback( ref = node->parameters[i]; mf = meta[i]; - if( ((vx_enum)VX_INPUT != node->kernel->signature.directions[i]) + if( (node->kernel->signature.directions[i] == (vx_enum)VX_OUTPUT) && (NULL != ref) && @@ -420,7 +423,7 @@ static vx_status ownGraphInitVirtualNode( if( (ref != NULL) && (mf != NULL) ) { - if (((vx_enum)VX_OUTPUT == node->kernel->signature.directions[i]) && + if ((node->kernel->signature.directions[i] == (vx_enum)VX_OUTPUT) && ((vx_bool)vx_true_e == ref->is_virtual)) { if ((ref->scope->type == (vx_enum)VX_TYPE_GRAPH) && (ref->scope != vxCastRefFromGraph(graph))) @@ -756,152 +759,98 @@ static vx_status ownGraphCalcInAndOutNodes(vx_graph graph) vx_reference ref1, ref2; vx_status status = (vx_status)VX_SUCCESS; - for (node_cur_idx = 0; (node_cur_idx < graph->num_nodes) && ((vx_status)VX_SUCCESS == status); node_cur_idx++) + for(node_cur_idx=0; node_cur_idxnum_nodes; node_cur_idx++) { node_cur = graph->nodes[node_cur_idx]; - uint32_t num_node_params = ownNodeGetNumParameters(node_cur); - if (TIVX_KERNEL_MAX_PARAMS < num_node_params) - { - /* HARD limit on the number of kernel parameters that can be processed */ - VX_PRINT(VX_ZONE_ERROR, "No more than TIVX_KERNEL_MAX_PARAMS parameters are allowed per kernel!"); - status = (vx_status)VX_ERROR_NO_RESOURCES; - } - for (prm_cur_idx = 0; - (prm_cur_idx < num_node_params) && - ((vx_status)VX_SUCCESS == status); - prm_cur_idx++) + + for(prm_cur_idx=0; prm_cur_idxtype == (vx_enum)VX_TYPE_IMAGE) && - ((vx_enum)TIVX_IMAGE_UNIFORM ==(vx_enum)((tivx_obj_desc_image_t *)ref1->obj_desc)->create_type)) - { - status = (vx_status)VX_FAILURE; - VX_PRINT(VX_ZONE_ERROR,"Cannot write to uniform image at node index %d failed\n", node_cur_idx); - } /* for each output, see if it matches any node input data */ - for (node_next_idx = 0; (node_next_idx < graph->num_nodes) && ((vx_status)VX_SUCCESS == status); node_next_idx++) + for(node_next_idx=(node_cur_idx+1U)%graph->num_nodes; + node_next_idx!=node_cur_idx; + node_next_idx=(node_next_idx+1U)%graph->num_nodes) { node_next = graph->nodes[node_next_idx]; - for (prm_next_idx = 0; - (prm_next_idx < ownNodeGetNumParameters(node_next)) && - ((vx_status)VX_SUCCESS == status); - prm_next_idx++) + + for(prm_next_idx=0; prm_next_idx < ownNodeGetNumParameters(node_next); prm_next_idx++) { prm_next_dir = (uint32_t)ownNodeGetParameterDir(node_next, prm_next_idx); + ref2 = ownNodeGetParameterRef(node_next, prm_next_idx); - if (ref2 != NULL) + + if(ref2 != NULL) { - if (ownGraphCheckIsRefMatch(graph, ref1, ref2) != 0) + if( (prm_next_dir == (uint32_t)VX_INPUT) || (prm_next_dir == (uint32_t)VX_BIDIRECTIONAL) ) { - if (node_cur_idx == node_next_idx) + /* check if input data reference of next node is equal to + output data reference of current */ + if( ownGraphCheckIsRefMatch(graph, ref1, ref2) != 0 ) { - if (prm_cur_idx != prm_next_idx) - { - /* We have an error: output connected to same node */ - status = (vx_status)VX_FAILURE; - VX_PRINT(VX_ZONE_ERROR,"Output of node connected to same node at index %d failed\n", node_cur_idx); - } - } - else if (prm_cur_dir == prm_next_dir) - { - /* We have an error: two modifiers or two writers of the same edge */ - status = (vx_status)VX_FAILURE; - VX_PRINT(VX_ZONE_ERROR,"Two modifiers or two writers of the same edge, nodes %d and %d\n", node_cur_idx, node_next_idx); - } - else if ((uint32_t)VX_INPUT == prm_next_dir) - { - ++inputs_attached; /* add node_next as output node for current node if not already added */ - /* but we don't do it if this parameter is an output attached to a bidirectional */ - if (0U == biputs_attached) + status = ownNodeAddOutNode(node_cur, node_next); + + if(status == (vx_status)VX_SUCCESS) { - status = ownNodeAddOutNode(node_cur, node_next); - if(status == (vx_status)VX_SUCCESS) + /* add node_current as input node for next node if not already added */ + status = ownNodeAddInNode(node_next, node_cur); + if (status != (vx_status)VX_SUCCESS) { - /* add node_current as input node for next node if not already added */ - status = ownNodeAddInNode(node_next, node_cur); - if (status != (vx_status)VX_SUCCESS) - { - VX_PRINT(VX_ZONE_ERROR,"Add in node at index %d failed\n", node_cur_idx); - } - } - else - { - VX_PRINT(VX_ZONE_ERROR,"Add out node at index %d failed\n", node_cur_idx); + VX_PRINT(VX_ZONE_ERROR,"Add in node at index %d failed\n", node_cur_idx); } } - } - else if ((vx_enum)VX_BIDIRECTIONAL == (vx_enum)prm_next_dir) - { - /* Current node must be an output, proceed as if it was the only input attached */ - /* We must make the bidirectional parameter node the only one following the - output parameter node; to do this we go through all the out nodes and replace - the output parameter node by the bidirectional parameter node in the in node list */ - ++biputs_attached; - uint32_t i; - for (i = 0; (i < ownNodeGetNumOutNodes(node_cur)) && ((vx_status)VX_SUCCESS == status); ++i) - { - vx_node out_node = ownNodeGetNextNode(node_cur, i); - if ((vx_node)NULL != out_node) - { - status = ownNodeReplaceInNode(out_node, node_cur, node_next); - } - else - { - status = (vx_status)VX_FAILURE; - } - } - if ((vx_status)VX_SUCCESS != (vx_status)status) - { - VX_PRINT(VX_ZONE_ERROR, "Failed to replace input node %d with input node %d\n", node_cur_idx, node_next_idx); - } else { - node_cur->obj_desc[0]->num_out_nodes = 0; - node_next->obj_desc[0]->num_in_nodes = 0; - status = ownNodeAddOutNode(node_cur, node_next); - if ((vx_status)VX_SUCCESS == (vx_status)status) - { - status = ownNodeAddInNode(node_next, node_cur); - if ((vx_status)VX_SUCCESS != (vx_status)status) - { - VX_PRINT(VX_ZONE_ERROR, "Add in node for bidirectional at index %d failed\n", node_cur_idx); - } - } - else - { - VX_PRINT(VX_ZONE_ERROR, "Add out node for bidirectional at index %d failed\n", node_cur_idx); - } + VX_PRINT(VX_ZONE_ERROR,"Add out node at index %d failed\n", node_cur_idx); } } - else + } + else + if( prm_next_dir == (uint32_t)VX_OUTPUT ) + { + vx_reference parent_ref_node_cur, parent_ref_node_next; + + parent_ref_node_cur = NULL; + parent_ref_node_next = NULL; + + if(0 != node_cur->replicated_flags[prm_cur_idx]) + { + parent_ref_node_cur = ref1->scope; + } + + if(0 != node_next->replicated_flags[prm_next_idx]) + { + parent_ref_node_next = ref2->scope; + } + + /* check if any output of next node matches current node + * This would mean two nodes output to same data object which is not allowed + */ + if( (ownGraphIsRefMatch(graph, ref1, ref2) != (vx_bool)vx_false_e) || + (ownGraphIsRefMatch(graph, ref1, parent_ref_node_next) != (vx_bool)vx_false_e) || + (ownGraphIsRefMatch(graph, parent_ref_node_cur, ref2) != (vx_bool)vx_false_e)) { - /* prm_cur_dir must be bidirectional and prm_next_dir must be an output; here - we count the number of times that the bidirectional has an output attached. */ - ++outputs_attached; + status = (vx_status)VX_FAILURE; + VX_PRINT(VX_ZONE_ERROR,"Output of next node matches current node at index %d failed\n", node_cur_idx); } } + else + { + /* Do nothing as there is no other + direction possible */ + } } } } - if ((prm_cur_dir == (uint32_t)VX_BIDIRECTIONAL) && - (ref1->is_virtual == (vx_bool)vx_true_e) && - ( (outputs_attached != 1U) || (inputs_attached == 0U))) - { - /* A virtual bidirectional parameter must be connected to exactly one output and at least one input */ - status = (vx_status)VX_FAILURE; - VX_PRINT(VX_ZONE_ERROR,"Virtual bidirectional parameter must be connected to an output and at least one input at index %d failed\n", node_cur_idx); - } } } } + return status; } @@ -1721,35 +1670,34 @@ static vx_status ownGraphAddDataRefQ(vx_graph graph, vx_node node, uint32_t idx) /* Dont make a data ref queue if below is true * - if node parameter is input - * - or if this is a leaf node + * - or node parameter is output but this is a leaf node * - Note: exception here is if it is a delay b/c the delay slot in question * may not be connected to another node * - or no node reference specified at the node,idx * Here no data ref queue is required since if user really wanted to access * the data ref, user would have a graph parameter out of this node, idx */ - if((ownNodeGetParameterDir(node, idx) == (vx_enum)VX_INPUT) /* input parameter */ + if((ownNodeGetParameterDir(node, idx) != (vx_enum)VX_OUTPUT) /* input parameter */ || (param_ref == NULL) /* no reference specified at node,index */ - || ( (ownGraphGetNumInNodes(graph, node, idx) == 0U) - && !((param_ref->delay != NULL) /* leaf parameter and not a delay */ - && (ownIsValidSpecificReference(vxCastRefFromDelay(param_ref->delay), (vx_enum)VX_TYPE_DELAY) != (vx_bool)vx_false_e)) - ) + || ((ownGraphGetNumInNodes(graph, node, idx) == 0U) && /* leaf parameter and not a delay */ + !(ownIsValidSpecificReference((vx_reference)param_ref->delay, (vx_enum)VX_TYPE_DELAY) != (vx_bool)vx_false_e)) ) { skip_add_data_ref_q = (vx_bool)vx_true_e; } - else + + if(skip_add_data_ref_q==(vx_bool)vx_false_e) { uint32_t i; - /* check if there is any graph parameter with the same reference and with queueing already enabled, + /* check if (node, idx) is a graph parameter and if queueing is already enabled, * if yes then do nothing */ - for(i = 0; i < graph->num_params; i++) + for(i=0; inum_params; i++) { if(i < TIVX_GRAPH_MAX_PARAMS) { - vx_reference gparam_ref; - gparam_ref = ownNodeGetParameterRef(graph->parameters[i].node, graph->parameters[i].index); - if ((param_ref == gparam_ref) && (graph->parameters[i].queue_enable == (vx_bool)vx_true_e)) + if((graph->parameters[i].node==node) && + (graph->parameters[i].index==idx) && + (graph->parameters[i].queue_enable == (vx_bool)vx_true_e)) { skip_add_data_ref_q = (vx_bool)vx_true_e; break; diff --git a/source/framework/vx_meta_format.c b/source/framework/vx_meta_format.c index 22b153e..85a287a 100644 --- a/source/framework/vx_meta_format.c +++ b/source/framework/vx_meta_format.c @@ -1305,7 +1305,7 @@ static vx_bool ownIsMetaFormatRawImageEqual( is_equal = (vx_bool)vx_true_e; } } - if ((vx_bool)vx_false_e == is_equal) + else { VX_PRINT(VX_ZONE_INFO, "Raw Image object meta data are not equivalent!\n"); } diff --git a/source/framework/vx_node.c b/source/framework/vx_node.c index be4426b..a1430a1 100644 --- a/source/framework/vx_node.c +++ b/source/framework/vx_node.c @@ -200,8 +200,7 @@ static vx_status ownRemoveNodeInt(const vx_node *n) vx_status status = (vx_status)VX_ERROR_INVALID_REFERENCE; - if ((NULL != node) && - (ownIsValidSpecificReference(vxCastRefFromNode(node), (vx_enum)VX_TYPE_NODE) != (vx_bool)vx_false_e)) + if (ownIsValidSpecificReference((vx_reference)node, (vx_enum)VX_TYPE_NODE) != (vx_bool)vx_false_e) { if (node->graph != NULL) { @@ -809,7 +808,7 @@ vx_status ownNodeUserKernelExecute(vx_node node, vx_reference prm_ref[]) { vx_status status = (vx_status)VX_SUCCESS; - if ((NULL != node) && (ownIsValidSpecificReference(vxCastRefFromNode(node), (vx_enum)VX_TYPE_NODE) != (vx_bool)vx_false_e)) + if (ownIsValidSpecificReference((vx_reference)node, (vx_enum)VX_TYPE_NODE) != (vx_bool)vx_false_e) { if((NULL != node->kernel) && (node->is_kernel_created == (vx_bool)vx_true_e)) { @@ -1306,11 +1305,7 @@ void ownNodeSetObjDescParamDirection(vx_node node) if(prm_dir==(uint32_t)VX_INPUT) { - tivxFlagBitSet(&is_prm_input, ((uint32_t)1U<scope, (vx_enum)VX_TYPE_PYRAMID) == (vx_bool)vx_true_e) @@ -2112,22 +2106,6 @@ VX_API_ENTRY vx_status VX_API_CALL vxReplicateNode(vx_graph graph, vx_node first VX_PRINT(VX_ZONE_ERROR, "Parameter %d is NULL!\n", p); status = (vx_status)VX_FAILURE; } - if ((vx_reference)NULL != ref) - { - if((vx_status)VX_SUCCESS != vxReleaseReference(&ref)) - { - status = (vx_status)VX_FAILURE; - VX_PRINT(VX_ZONE_ERROR,"Failed to release reference\n"); - } - } - if ((vx_parameter)NULL !=param) - { - if((vx_status)VX_SUCCESS != vxReleaseParameter(¶m)) - { - status = (vx_status)VX_FAILURE; - VX_PRINT(VX_ZONE_ERROR,"Failed to release reference to parameter\n"); - } - } if(status != (vx_status)VX_SUCCESS) { break; @@ -2541,7 +2519,7 @@ uint32_t ownNodeGetParameterNumBuf(vx_node node, vx_uint32 idx) if((node != NULL) && (idx < ownNodeGetNumParameters(node)) - && ((vx_enum)VX_INPUT != ownNodeGetParameterDir(node, idx))) + && (ownNodeGetParameterDir(node, idx) == (vx_enum)VX_OUTPUT)) { num_buf = node->parameter_index_num_buf[idx]; @@ -2572,7 +2550,7 @@ vx_status VX_API_CALL tivxSetNodeParameterNumBufByIndex(vx_node node, vx_uint32 { if( (idx < ownNodeGetNumParameters(node)) && (num_buf < TIVX_OBJ_DESC_QUEUE_MAX_DEPTH) - && ((vx_enum)VX_INPUT != ownNodeGetParameterDir(node, idx)) + && (ownNodeGetParameterDir(node, idx) == (vx_enum)VX_OUTPUT) ) { node->parameter_index_num_buf[idx] = num_buf; diff --git a/source/framework/vx_node_api.c b/source/framework/vx_node_api.c index 7798b70..9d2c475 100644 --- a/source/framework/vx_node_api.c +++ b/source/framework/vx_node_api.c @@ -500,20 +500,6 @@ VX_API_ENTRY vx_node VX_API_CALL vxAccumulateWeightedImageNode(vx_graph graph, v dimof(params)); } -VX_API_ENTRY vx_node VX_API_CALL vxAccumulateWeightedImageNodeX(vx_graph graph, vx_image input, vx_float32 alpha, vx_image accum) -{ - vx_status status = (vx_status)VX_SUCCESS; - vx_scalar salpha = vxCreateScalar(vxGetContext(vxCastRefFromGraph(graph)), (vx_enum)VX_TYPE_FLOAT32, &alpha); - vx_node node = vxAccumulateWeightedImageNode(graph, input, salpha, accum); - - status = vxReleaseScalar(&salpha); - if((vx_status)VX_SUCCESS != status) - { - VX_PRINT(VX_ZONE_ERROR,"Failed to release reference to scalar object"); - } - return node; -} - VX_API_ENTRY vx_node VX_API_CALL vxAccumulateSquareImageNode(vx_graph graph, vx_image input, vx_scalar scalar, vx_image accum) { vx_reference params[] = { @@ -527,20 +513,6 @@ VX_API_ENTRY vx_node VX_API_CALL vxAccumulateSquareImageNode(vx_graph graph, vx_ dimof(params)); } -VX_API_ENTRY vx_node VX_API_CALL vxAccumulateSquareImageNodeX(vx_graph graph, vx_image input, vx_uint32 shift, vx_image accum) -{ - vx_status status = (vx_status)VX_SUCCESS; - vx_scalar scalar = vxCreateScalar(vxGetContext(vxCastRefFromGraph(graph)), (vx_enum)VX_TYPE_UINT32, &shift); - vx_node node = vxAccumulateSquareImageNode(graph, input, scalar, accum); - - status = vxReleaseScalar(&scalar); - if((vx_status)VX_SUCCESS != status) - { - VX_PRINT(VX_ZONE_ERROR,"Failed to release reference to scalar object"); - } - return node; -} - VX_API_ENTRY vx_node VX_API_CALL vxMinMaxLocNode(vx_graph graph, vx_image input, vx_scalar minVal, vx_scalar maxVal, diff --git a/source/framework/vx_parameter.c b/source/framework/vx_parameter.c index e6fd047..8a598c4 100644 --- a/source/framework/vx_parameter.c +++ b/source/framework/vx_parameter.c @@ -53,10 +53,7 @@ vx_bool ownIsValidDirection(vx_enum dir) { vx_bool is_valid; - if ((dir == (vx_enum)VX_INPUT) || - (dir == (vx_enum)VX_OUTPUT) || - (dir == (vx_enum)VX_BIDIRECTIONAL) /* Bidirectional is valid for user kernels with the bidirectional parameters extension*/ - ) + if ((dir == (vx_enum)VX_INPUT) || (dir == (vx_enum)VX_OUTPUT)) /* Bidirectional is not valid for user kernels */ { is_valid = (vx_bool)vx_true_e; } diff --git a/source/framework/vx_target.c b/source/framework/vx_target.c index ac939ff..53fab96 100644 --- a/source/framework/vx_target.c +++ b/source/framework/vx_target.c @@ -238,7 +238,6 @@ static vx_bool ownTargetNodeDescCanNodeExecute( TIVX_NODE_FLAG_IS_EXECUTED) == (vx_bool)vx_false_e) { can_execute = (vx_bool)vx_false_e; - break; } } } @@ -1401,8 +1400,7 @@ void ownTargetSetTimestamp( { if (NULL != obj_desc[prm_id]) { - if ((tivxFlagIsBitSet(is_prm_input_flag, ((uint32_t)1U<timestamp; diff --git a/source/framework/vx_target_acquire_parameters.c b/source/framework/vx_target_acquire_parameters.c index b1a2f4a..9920755 100644 --- a/source/framework/vx_target_acquire_parameters.c +++ b/source/framework/vx_target_acquire_parameters.c @@ -373,7 +373,7 @@ static void ownTargetNodeDescReleaseParameter( flags = data_ref_q_obj_desc->flags; - if((vx_bool)vx_true_e == is_prm_input) + if(is_prm_input == (vx_bool)vx_true_e) { data_ref_q_obj_desc->in_node_done_cnt++; if(data_ref_q_obj_desc->in_node_done_cnt==data_ref_q_obj_desc->num_in_nodes) @@ -427,7 +427,7 @@ static void ownTargetNodeDescReleaseParameter( } else { - /* this is a output or bidirectional and is used as input by some other node */ + /* this is a output and is used as input but some other node */ data_ref_q_obj_desc->ref_obj_desc_id = ref_obj_desc_id; } if((do_release_ref != (vx_bool)vx_false_e) || (do_release_ref_to_queue != (vx_bool)vx_false_e)) @@ -628,11 +628,10 @@ void ownTargetNodeDescReleaseAllParameters(tivx_obj_desc_node_t *node_obj_desc, if(0 != ownObjDescIsValidType((tivx_obj_desc_t*)data_ref_q_obj_desc, TIVX_OBJ_DESC_DATA_REF_Q)) { bool temp; - temp = (bool)tivxFlagIsBitSet(is_prm_input_flag, ((uint32_t)1U<