SIMA_RESIZE

Description

This graph is responsible for taking in a frame and resizing it to the desired size. Different algorightms are available for this operation.

Graph Info

SIMA_RESIZE

Graph Name

SIMA_RESIZE

Graph ID

8

Operations Supported

SIMA_RESIZE_NEAREST(0)

SIMA_RESIZE_BILINEAR(1)

SIMA_RESIZE_BICUBIC(2)

Important Parameters to configure

“input_width” → Width of Input Image

“input_height” → Height of Input Image

“output_width” → Width of Output Image (same as input width)

“output_height” → Height of Output Image (same as input height)

“batch_size” → No:of input images

“rsz_type” → Resize interpolation type- 0 to 2 (Refer to Operations Supported column)

Available Since Yocto Build

B745

Example Config

Below is the example config json for this graph. We need to use such config for configuring the EV74 graph first. For this purpose, we need a CVU Configuration Application developed in C++.

{
     "version": 0.1,
     "node_name": "ev-atomic-resize",
     "simaai__params": {
             "params": 15,
             "index": 0,
             "cpu": 1,
             "next_cpu": 2,
             "graph_id": 8,
             "input_width": 800,
             "input_height": 800,
             "output_width": 400,
             "output_height": 400,
             "batch_size": 1,
             "rsz_type": 2,
             "format": 1,
             "in_type": 0,
             "no_of_outbuf": 1,
             "out_type": 2,
             "out_sz": 480000,
             "ibufname": "in-img-source",
             "debug": 0,
             "dump_data": 1
        }
}

Note

Please note that, the out_sz in above json needs to be calculated based on your output format. Ex. If the output format is RGB, then the out_sz will be output_height * output_width * 3. Here, 3 is the number of channels

CVU Configuration Application

To configure any CVU graph, a C++ CVU Configuration Application must be cross-compiled and executed on the board before using the CVU. Multiple graphs can be pre-programmed into the CVU before running any application. This guide provides a pre-written C++ application for download for each graph that can be cross-compiled on Palette, and executed on the board prior to running the simaaiprocesscvu GStreamer plugin. An pre-compiled version is also included for direct use. If you encounter issues, please re-compile the application from the sources provided.

Sample CVU Configuration Application Function to configure Parameters
 1#define SIMA_IPC_CODE_GRAPH_SIMA_ATOMIC_RESIZE (8)
 2#define INPUT_WIDTH   (1)
 3#define INPUT_HEIGHT  (2)
 4#define OUTPUT_WIDTH  (3)
 5#define OUTPUT_HEIGHT (4)
 6#define BATCH_SIZE    (5)
 7#define RSZ_TYPE      (6)
 8
 9void configure_resize(const char *json_in)
10{
11   simaai_params_t *params = parser_node_struct_init();
12
13   uint8_t *buf = (uint8_t *)calloc(1, sizeof(uint8_t) * 16);
14
15   int val = *((int *)parser_get_int(params, "img_height"));
16   send_i32_param(2, SIMA_IPC_CODE_GRAPH_SIMA_ATOMIC_RESIZE, INPUT_HEIGHT, buf, val);
17   send_i32_param(2, SIMA_IPC_CODE_GRAPH_SIMA_ATOMIC_RESIZE, INPUT_HEIGHT, buf, val);
18
19   val = *((int *)parser_get_int(params, "img_width"));
20   send_i32_param(2, SIMA_IPC_CODE_GRAPH_SIMA_ATOMIC_RESIZE, INPUT_WIDTH, buf, val);
21
22   val = *((int *)parser_get_int(params, "output_width"));
23   send_i32_param(2, SIMA_IPC_CODE_GRAPH_SIMA_ATOMIC_RESIZE, OUTPUT_WIDTH, buf, val);
24
25   val = *((int *)parser_get_int(params, "output_height"));
26   send_i32_param(2, SIMA_IPC_CODE_GRAPH_SIMA_ATOMIC_RESIZE, OUTPUT_HEIGHT, buf, val);
27
28   val = *((int *)parser_get_int(params, "batch_size"));
29   send_i32_param(2, SIMA_IPC_CODE_GRAPH_SIMA_ATOMIC_RESIZE, BATCH_SIZE, buf, val);
30
31   val = *((int *)parser_get_int(params, "rsz_type"));
32   send_i32_param(2, SIMA_IPC_CODE_GRAPH_SIMA_ATOMIC_RESIZE, RSZ_TYPE, buf, val);
33
34   std::cout << "Completed Resize Graph Configure \n";
35   free(buf);
36}

Please refer to How to compile CVU Configuration Application? for more info.