Note

This is the documentation for the latest development branch and may refer to features that are not available in released versions. If you are looking for the documentation for a specific release, use the drop-down menu on the left and select the desired version.

K230 DPU API Reference#

Overview#

Overview#

The DPU is mainly responsible for the depth calculation of 3D structured light and provides depth information for 3D face recognition.

Functional Description#

Binding mode calling process#

Illustration, schematic description has been automatically generated

Non-binding mode calling process#

Illustration description has been automatically generated

API Reference#

DPU usage#

This function module provides the following APIs:

kd_mpi_dpu_init#

Description

Initialize dpu device

Syntax

k_s32 kd_mpi_dpu_init(k_dpu_init_t *init);

Parameters

Parameter Name

Description

Input/Output

init

Initialize the structure pointer of the dpu device.

Input

Return Value

Return Value

Description

0

Success

non-0

Failure, please refer to the error code for its value.

Chip differences

None.

Requirements

  • Header File: mpi_dpu_api.h

  • Library File: libdpu.a

Notes

None

Example

None

Related Topics

k_dpu_init_t

kd_mpi_dpu_delete#

Description

Delete the initialized dpu device.

Syntax

k_s32 kd_mpi_dpu_delete();

Parameters

Parameter Name

Description

Input/Output

None

None

None

Return Value

Return Value

Description

0

Success

non-0

Failure, please refer to the error code for its value.

Chip differences

None

Requirements

  • Header File: mpi_dpu_api.h

  • Library File: libdpu.a

Notes

This function delete dpu needs to be called after the dpu device has been initialized.

Example

None

Related Topics

None

kd_mpi_dpu_parse_file#

Description

Parse dpu configuration parameters from the dpu configuration file.

Syntax

k_s32 kd_mpi_dpu_parse_file(const k_char *param_path, k_dpu_dev_param_t *param, k_dpu_lcn_param_t *lcn_param, k_dpu_ir_param_t *ir_param, k_dpu_user_space_t *g_temp_space);

Parameters

Parameter Name

Description

Input/Output

param_path

The path to the configuration file

Input

param

The structure pointer of dpu device parameters. The device parameters parsed from the configuration file are stored in this structure.

Output

lcn_param

lcn is the structure pointer of the channel parameter. The channel parameters parsed from the configuration file are stored in this structure.

Output

ir_param

ir is the structure pointer of the channel parameter. The channel parameters parsed from the configuration file are stored in this structure.

Output

g_temp_space

Template map structure pointer, the first address of the template map parsed from the configuration file is stored in this structure.

Output

Return Value

Return Value

Description

0

Success

non-0

Failure, please refer to the error code for its value.

Chip differences

None

Requirements

  • Header File: mpi_dpu_api.h

  • Library File: libdpu.a

Notes

  • Dpu device parameters include long-cycle parameters and short-cycle parameters.

  • The two channel parameters lcn_param and ir_param are a subset of the dpu device parameters. If the dpu device parameters have been configured, these two channel parameters can be ignored. If you need to change the parameters in the two channel parameter structures, you can either change the channel parameters and then call kd_mpi_dpu_set_chn_attr to make the changes take effect, or you can change the device parameters and then call kd_mpi_dpu_set_dev_attr to make the changes take effect. If only the channel parameters are changed, it is more efficient to call kd_mpi_dpu_set_chn_attr.

  • The template map structure contains the virtual address and physical address of the template map parsed from the configuration file, as well as the size of the template map.

Example

None

Related Topics

k_dpu_dev_param_t

kd_mpi_dpu_set_dev_attr#

Description

Configure dpu device properties.

Syntax

k_s32 kd_mpi_dpu_set_dev_attr(k_dpu_dev_attr_t *attr);

Parameters

Parameter Name

Description

Input/Output

attr

dpu device properties

Input

Return Value

Return Value

Description

0

Success

non-0

Failure, please refer to the error code for its value.

Chip differences

None

Requirements

  • Header File: mpi_dpu_api.h

  • Library File: libdpu.a

Notes

  • This function can be called to configure the dpu device properties only after the dpu device is initialized.

  • When configuring the dpu device properties for the first time, tytz_temp_recfg and align_depth_recfg in attr should be configured as K_TRUE to enable the dpu to load the corresponding parameters. When the DPU device attributes are subsequently changed, if the corresponding long-period parameters have not changed, configuring these two members to K_FALSE can save the time for the DPU to load the long-period parameters again.

Example

None

Related Topics

k_dpu_dev_attr_t

kd_mpi_dpu_get_dev_attr#

Description

Get dpu device properties.

Syntax

k_s32 kd_mpi_dpu_set_dev_attr(k_dpu_dev_attr_t *attr);

Parameters

Parameter Name

Description

Input/Output

attr

dpu device properties

Output

Return Value

Return Value

Description

0

Success

non-0

Failure, please refer to the error code for its value.

Chip differences

None

Requirements

  • Header File: mpi_dpu_api.h

  • Library File: libdpu.a

Notes

None

Example

None

Related Topics

k_dpu_dev_attr_t

kd_mpi_dpu_set_ref_image#

Description

Configure dpu reference diagram.

Syntax

k_s32 kd_mpi_dpu_set_ref_image(const k_char *ref_path);

Parameters

Parameter Name

Description

Input/Output

ref_path

Reference map path

Input

Return Value

Return Value

Description

0

Success

non-0

Failure, please refer to the error code for its value.

Chip differences

None

Requirements

  • Header File: mpi_dpu_api.h

  • Library File: libdpu.a

Notes

  • You need to call this function to configure the reference map after configuring the dpu device properties.

Example

None

Related Topics

None

kd_mpi_dpu_set_processed_ref_image#

Description

Configure the dpu reference map after offline processing.

Syntax

k_s32 kd_mpi_dpu_set_processed_ref_image(const k_char *ref_path);

Parameters

Parameter Name

Description

Input/Output

ref_path

Processed reference image path

Input

Return Value

Return Value

Description

0

Success

non-0

Failure, please refer to the error code for its value.

Chip differences

None

Requirements

  • Header File: mpi_dpu_api.h

  • Library File: libdpu.a

Notes

  • You need to call this function to configure the reference image after configuring the dpu device properties. The configured reference image needs to be processed offline. Calling this function can save about 70ms compared to kd_mpi_dpu_set_ref_image.

Example

None

Related Topics

None

kd_mpi_dpu_set_template_image#

Description

Configure dpu template map

Syntax

k_s32 kd_mpi_dpu_set_template_image(k_dpu_user_space_t *temp_space);

Parameters

Parameter Name

Description

Input/Output

temp_space

Template graph structure.

Input

Return Value

Return Value

Description

0

Success

non-0

Failure, please refer to the error code for its value.

Chip differences

None

Requirements

  • Header File: mpi_dpu_api.h

  • Library File: libdpu.a

Notes

  • You need to call this function to configure the reference map after configuring the dpu device properties.

  • temp_space needs to be passed in as a parameter at kd_mpi_dpu_parse_file to obtain the template graph information from the configuration file.

Example

None

Related Topics

k_dpu_user_space_t kd_mpi_dpu_parse_file

kd_mpi_dpu_start_dev#

Description

Start the dpu device

Syntax

k_s32 kd_mpi_dpu_start_dev();

Parameters

Parameter Name

Description

Input/Output

None

None

None

Return Value

Return Value

Description

0

Success

non-0

Failure, please refer to the error code for its value.

Chip differences

None

Requirements

  • Header File: mpi_dpu_api.h

  • Library File: libdpu.a

Notes

None

Example

None

Related Topics

None

kd_mpi_dpu_set_chn_attr#

Description

Configure dpu channel properties

Syntax

k_s32 kd_mpi_dpu_set_chn_attr(k_dpu_chn_lcn_attr_t *lcn_attr, k_dpu_chn_ir_attr_t *ir_attr);

Parameters

Parameter Name

Description

Input/Output

lcn_attr

Speckle plot channel properties.

Input

ir_attr

Infrared image channel properties.

Input

Return Value

Return Value

Description

0

Success

non-0

Failure, please refer to the error code for its value.

Chip differences

None

Requirements

  • Header File: mpi_dpu_api.h

  • Library File: libdpu.a

Notes

  • The current dpu device has two channels: 0 and 1. Specify the respective input and output channels of the speckle image and infrared image by configuring lcn_attr->chn_num and ir_attr->chn_num (if the infrared image channel is enabled).

  • After starting the dpu device kd_mpi_dpu_start_dev for the first time, this function should be called to configure the channel attributes. The speckle image channel must be configured, and the infrared image channel does not need to be configured if it is not enabled (configuration is NULL).

  • If you only need to change the attributes of a certain channel during operation, you can only pass in the structure parameters of this channel, and the parameters of another channel can be NULL. You can also pass in the parameters of two channels at the same time. If the parameters of both channels are NULL, this configuration will not take effect.

Example

None

Related Topics

k_dpu_chn_lcn_attr_t k_dpu_chn_ir_attr_t

kd_mpi_dpu_get_chn_attr#

Description

Get dpu channel properties.

Syntax

k_s32 kd_mpi_dpu_get_chn_attr(k_dpu_chn_lcn_attr_t *lcn_attr, k_dpu_chn_ir_attr_t *ir_attr);

Parameters

Parameter Name

Description

Input/Output

lcn_attr

Speckle plot channel properties.

Output

ir_attr

Infrared image channel properties.

Output

Return Value

Return Value

Description

0

Success

non-0

Failure, please refer to the error code for its value.

Chip differences

None

Requirements

  • Header File: mpi_dpu_api.h

  • Library File: libdpu.a

Notes

None

Example

None

Related Topics

k_dpu_chn_lcn_attr_t k_dpu_chn_ir_attr_t

kd_mpi_dpu_start_chn#

Description

Start dpu channel

Syntax

k_s32 kd_mpi_dpu_start_chn(k_u32 chn_num);

Parameters

Parameter Name

Description

Input/Output

chn_num

Channel number

Input

Return Value

Return Value

Description

0

Success

non-0

Failure, please refer to the error code for its value.

Chip differences

None

Requirements

  • Header File: mpi_dpu_api.h

  • Library File: libdpu.a

Notes

  • Channel number should be 0 or 1.

Example

None

Related Topics

None

kd_mpi_dpu_stop_chn#

Description

stop dpu channel

Syntax

k_s32 kd_mpi_dpu_stop_chn(k_u32 chn_num);

Parameters

Parameter Name

Description

Input/Output

chn_num

Channel number

Input

Return Value

Return Value

Description

0

Success

non-0

Failure, please refer to the error code for its value.

Chip differences

None

Requirements

  • Header File: mpi_dpu_api.h

  • Library File: libdpu.a

Notes

  • Channel number should be 0 or 1.

Example

None

Related Topics

None

kd_mpi_dpu_send_frame#

Description

In unbound mode, sends a frame of data to the dpu.

Syntax

k_s32 kd_mpi_dpu_send_frame(k_u32 chn_num, k_u64 addr, k_s32 s32_millisec);

Parameters

Parameter Name

Description

Input/Output

chn_num

Channel number

Input

addr

Physical address to send data to

Input

s32_millisec

Waiting time. When this parameter is set to -1, the blocking mode will not return until the transmission is successful; when this parameter is set to 0, the non-blocking mode will return zero immediately if the transmission is successful, and other values ​​will be returned immediately if the transmission fails. For specific failure information, refer to dpu error code;

Input

Return Value

Return Value

Description

0

Success

non-0

Failure, please refer to the error code for its value.

Chip differences

None

Requirements

  • Header File: mpi_dpu_api.h

  • Library File: libdpu.a

Notes

  • If the speckle image and infrared image channels are enabled at the same time, the infrared image and speckle image need to be strictly cross-input.

Example

None

Related Topics

None

kd_mpi_dpu_get_frame#

Description

Get a frame of data from dpu.

Syntax

k_s32 kd_mpi_dpu_get_frame(k_u32 chn_num, k_dpu_chn_result_u *result, k_s32 s32_millisec);

Parameters

Parameter Name

Description

Input/Output

chn_num

Channel number

Input

result

dpu output result union, its member variables are k_dpu_chn_lcn_result_t and k_dpu_chn_ir_result_t respectively. Which member is selected as the output result of this channel is decided by the user according to the configuration of kd_mpi_dpu_set_chn_attr.

Output

s32_millisec

Waiting time. When this parameter is set to -1, the blocking mode will not return until the acquisition is successful; when this parameter is set to 0, the non-blocking mode will return zero immediately if the acquisition is successful, and other values ​​will be returned immediately if the acquisition fails. For specific failure information, refer to dpu error code;

Input

Return Value

Return Value

Description

0

Success

non-0

Failure, please refer to the error code for its value.

Chip differences

None

Requirements

  • Header File: mpi_dpu_api.h

  • Library File: libdpu.a

Notes

  • If the infrared image and speckle image are enabled at the same time, be careful to remove the output results of the two channels in time, otherwise the results in the buffer will overflow and further input will be impossible.

Example

None

Related Topics

k_dpu_chn_result_u k_dpu_chn_lcn_result_t k_dpu_chn_ir_result_t k_dpu_disp_out_t k_dpu_depth_out_t k_dpu_ir_out_t k_dpu_qlt_out_t

kd_mpi_dpu_release_frame#

Description

In unbound mode, release the obtained result.

Syntax

k_s32 kd_mpi_dpu_release_frame();

Parameters

None

Return Value

Return Value

Description

0

Success

non-0

Failure, please refer to the error code for its value.

Chip differences

None

Requirements

  • Header File: mpi_dpu_api.h

  • Library File: libdpu.a

Notes

  • This function will release the data in the buffer sequentially, with the result generated first being released first. The current dpu buffer is 3. Please release the results obtained by kd_mpi_dpu_get_frame as soon as possible after using them.

Example

None

Related Topics

None

data type#

public data type#

This module has the following data types:

k_dpu_init_t#

Description

dpu device initialization structure

definition

typedef struct {
    k_u32 start_num;
    k_u32 buffer_num;
} k_dpu_init_t;

member

member name

Description

start_num

dpu device starting frame number (that is, the frame number of the first frame calculated by dpu).

buffer_num

The number of dpu cache buffers, at least 1

Notes

None

Related Data Types and Interfaces

kd_mpi_dpu_init

k_dpu_dev_param_t#

Description

dpu device parameter structure.

definition

typedef struct
{
    k_dpu_long_parameter_t lpp;
    k_dpu_short_parameter_t spp;
} k_dpu_dev_param_t;

member

member name

Description

lpp

dpu long period parameter structure

spp

dpu short period parameter structure

Notes

  • When users need to change the values ​​in long-period parameters, they should use virtual address member variables.

Related Data Types and Interfaces

k_dpu_long_parameter_t kd_mpi_dpu_parse_file

k_dpu_lcn_param_t#

Description

Speckle map channel parameter structure.

definition

typedef struct {
    k_u8 matching_length_left_p0;
    k_u8 matching_length_right_p0;

    float image_check_match_threshold;
    float depth_p1;
    float depth_p2;
    float depth_precision;
} k_dpu_lcn_param_t;

member

member name

Description

matching_length_left_p0

Coarse search: disparity calculation left search range, value: 0~256, integer

matching_length_right_p0

Coarse search: disparity calculation search range to the right, value: 0~256, integer

image_check_match_threshold

Speckle pattern quality assessment: template matching threshold, value range: 0.0~1.0, floating point type: 0.01 accuracy

depth_p1

Parallax to depth: depth numerical calculation coefficient p1, value range: 0.0~50000.0, floating point type: 0.01 accuracy

depth_p2

Parallax to depth: depth numerical calculation coefficient p2, value range: -5.0~100.0, floating point type: 0.01 accuracy

depth_precision

Parallax to depth: depth numerical precision (multiple), value range: 0.0~100.0, floating point type: 0.1 precision

Notes

  • This channel structure parameter is a subset of the device structure parameters. If the device parameters have been configured and the channel parameters are the same as the device parameters, you do not need to configure the channel parameters.

Related Data Types and Interfaces

kd_mpi_dpu_parse_file

k_dpu_ir_param_t#

Description

Infrared image channel parameter structure.

definition

typedef struct {
    float depth_k1;
    float depth_k2;
    float tz;
} k_dpu_ir_param_t;

member

member name

Description

depth_k1

Directly corresponds to a register. Alignment of three images: depth numerical calculation coefficient k1, value range: 2e-4~1e-2, floating point type: 1e-5 accuracy

depth_k2

Directly corresponds to a register. Alignment of three images: depth numerical calculation coefficient k2, value range: 0.5~1.5, floating point type: 0.001 accuracy

tz

Directly corresponds to a register. Alignment of three images: projector z-direction offset (mm), value range: -5.0~5.0, floating point type: 0.001 accuracy

Notes

  • This channel structure parameter is a subset of the device structure parameters. If the device parameters have been configured and the channel parameters are the same as the device parameters, you do not need to configure the channel parameters.

Related Data Types and Interfaces

kd_mpi_dpu_parse_file

k_dpu_user_space_t#

Description

The user obtains the parameters of the template graph structure.

definition

typedef struct {
    k_bool used;
    k_u32 size;
    k_u64 phys_addr;
    void *virt_addr;
} k_dpu_user_space_t;

member

member name

Description

used

Users do not need to pay attention

size

The size of the template image obtained by the user

phys_addr

The physical address of the template map

virt_addr

The virtual address of the template map

Notes

None

Related Data Types and Interfaces

kd_mpi_dpu_parse_file

k_dpu_dev_attr_t#

Description

Configure the dpu device attribute structure.

definition

typedef struct {
    k_dpu_mode_e mode;
    k_bool tytz_temp_recfg;
    k_bool align_depth_recfg;
    k_bool ir_never_open;
    k_u32 param_valid;
    k_dpu_dev_param_t dev_param;
} k_dpu_dev_attr_t;

member

member name

Description

mode

dpu running mode, including bound mode and unbound mode.

tytz_temp_recfg

Whether to update the loaded SAD temperature compensation parameters and TyTz line compensation calculation algorithm. When this flag is K_FALSE, it indicates no update. When this flag is K_TRUE, it indicates update.

align_depth_recfg

Whether to update the alignment/depth calculation parameters of loading three images. When this flag is K_FALSE, it indicates no update. When this flag is K_TRUE, it indicates update.

ir_never_open

The vb pool is configured when the dpu device is started and is released when the dpu device is paused. Its size is initialized when the device is started, so when the device is started, space is reserved for a total of five parts: depth/parallax map, infrared output, quality detection, thickness column parallax, and initial determinant difference. Users can choose whether to enable three-image alignment through dev_param.spp.flag_align during the usage period. If there will be no infrared image output during the entire use cycle, there is no need to reserve space for the infrared image. Configuring it to K_TRUE indicates that there is no need to reserve space for infrared image output, and configuring it to K_FALSE indicates that space needs to be reserved for infrared image output.

param_valid

When the user configures the dpu device attribute, set this member to an arbitrary non-zero value. When the device attribute takes effect, the arbitrary value will be returned in the output result of the corresponding effective frame.

dev_param

dpu device parameter structure.

Notes

  • When configuring the dpu device properties for the first time, tytz_temp_recfg and align_depth_recfg should be configured as K_TRUE to enable the dpu to load the corresponding parameters.

Related Data Types and Interfaces

k_dpu_dev_param_t kd_mpi_dpu_set_dev_attr

k_dpu_chn_lcn_attr_t#

Description

Configure the speckle map channel attribute structure

definition

typedef struct {
    k_u8 param_valid;
    k_s32 chn_num;
    k_dpu_lcn_param_t lcn_param;
} k_dpu_chn_lcn_attr_t;

member

member name

Description

param_valid

When the user configures the speckle pattern channel attributes, set this member to an arbitrary non-zero value. When the device attribute takes effect, the arbitrary value will be returned in the output result of the corresponding effective frame.

chn_num

Channel number. The current DPU device has a total of two channels. The user can set this channel number to 0 or 1, and the speckle pattern channel will be input and output in the corresponding channel. If the infrared image channel is enabled, this channel number should be different from the infrared image channel number.

lcn_param

Speckle map channel parameters.

Notes

None

Related Data Types and Interfaces

kd_mpi_dpu_set_chn_attr

k_dpu_chn_ir_attr_t#

Description

Configure the infrared image channel attribute structure

definition

typedef struct {
    k_u8 param_valid;
    k_s32 chn_num;
    k_dpu_ir_param_t ir_param;
} k_dpu_chn_ir_attr_t;

member

member name

Description

param_valid

When the user configures the speckle pattern channel attributes, set this member to an arbitrary non-zero value. When the device attribute takes effect, the arbitrary value will be returned in the output result of the corresponding effective frame.

chn_num

Channel number. The current DPU device has a total of two channels. The user can set this channel number to 0 or 1, and the infrared image channel will be input and output in the corresponding channel. This channel number should be different from the speckle plot channel number.

ir_param

Infrared image channel parameters.

Notes

None

Related Data Types and Interfaces

kd_mpi_dpu_set_chn_attr

k_dpu_chn_result_u#

Description

Get the union of dpu output results

definition

typedef union {
    k_dpu_chn_lcn_result_t lcn_result;
    k_dpu_chn_ir_result_t ir_result;
} k_dpu_chn_result_u;

member

member name

Description

lcn_result

Speckle map channel output result structure. k_dpu_chn_lcn_result_t

ir_result

Infrared image channel output result structure. k_dpu_chn_ir_result_t

Notes

  • Which member the user selects as the output result needs to be selected according to the user’s own configuration. In kd_mpi_dpu_set_chn_attr, the user configures the corresponding relationship between channel number and channel type.

Related Data Types and Interfaces

k_dpu_chn_lcn_result_t k_dpu_chn_ir_result_t kd_mpi_dpu_get_frame

k_dpu_chn_lcn_result_t#

Description

dpu The structure of the output result of the speckle map channel

definition

typedef struct {
    k_u32 time_ref;
    k_u64 pts;
    k_dpu_disp_out_t disp_out;
    k_dpu_depth_out_t depth_out;
    k_dpu_qlt_out_t qlt_out;
    k_dpu_param_flag_t flag;
} k_dpu_chn_lcn_result_t;

member

member name

Description

pts

Timestamp, valid in binding mode.

disp_out

Disparity map output result structure.

depth_out

Depth map output result structure.

qlt_out

Quality inspection output result structure. Including quality inspection results, thickness_column disparity (initial resolution) results, and initial determinant difference results.

flag

This structure is used to mark the frame in which the user-configured parameters take effect. The structure contains param_valid variables in k_dpu_dev_attr_t, k_dpu_chn_lcn_attr_t, and k_dpu_chn_ir_attr_t.

Notes

None

Related Data Types and Interfaces

k_dpu_disp_out_t k_dpu_depth_out_t k_dpu_qlt_out_t kd_mpi_dpu_get_frame

k_dpu_chn_ir_result_t#

Description

dpu structure of infrared image channel output result

definition

typedef struct {
    k_u32 time_ref;
    k_u64 pts;
    k_dpu_ir_out_t ir_out;
    k_dpu_param_flag_t flag;
} k_dpu_chn_ir_result_t;

member

member name

Description

pts

Timestamp, valid in binding mode.

ir_out

Infrared image output result structure.

flag

This structure is used to mark the frame in which the user-configured parameters take effect. The structure contains param_valid variables in k_dpu_dev_attr_t, k_dpu_chn_lcn_attr_t, and k_dpu_chn_ir_attr_t.

Notes

None

Related Data Types and Interfaces

k_dpu_ir_out_t kd_mpi_dpu_get_frame

k_dpu_disp_out_t#

Description

The structure of the disparity map output result

definition

typedef struct {
    k_bool valid;
    k_u32 length;
    k_u64 disp_phys_addr;
    k_u64 disp_virt_addr;
} k_dpu_disp_out_t;

member

member name

Description

valid

K_TRUE: indicates that the output result is valid; K_FALSE: indicates that the output result is invalid.

length

The length of the output result.

disp_phys_addr

Disparity map output results physical address.

disp_virt_addr

The disparity map outputs the resulting virtual address.

Notes

None

Related Data Types and Interfaces

k_dpu_chn_lcn_result_t kd_mpi_dpu_get_frame

k_dpu_depth_out_t#

Description

Structure of depth map output result

definition

typedef struct {
    k_bool valid;
    k_u32 length;
    k_u64 depth_phys_addr;
    k_u64 depth_virt_addr;
} k_dpu_depth_out_t;

member

member name

Description

valid

K_TRUE: indicates that the output result is valid; K_FALSE: indicates that the output result is invalid.

length

The length of the output result.

depth_phys_addr

The physical address of the depth map output result.

depth_virt_addr

Depth map output result virtual address.

Notes

None

Related Data Types and Interfaces

k_dpu_chn_lcn_result_t kd_mpi_dpu_get_frame

k_dpu_ir_out_t#

Description

Structure of infrared image output result

definition

typedef struct {
    k_bool valid;
    k_u32 length;
    k_u64 ir_phys_addr;
    k_u64 ir_virt_addr;
} k_dpu_ir_out_t;

member

member name

Description

valid

K_TRUE: indicates that the output result is valid; K_FALSE: indicates that the output result is invalid.

length

The length of the output result.

ir_phys_addr

The physical address of the infrared image output result.

ir_virt_addr

Infrared image output result virtual address.

Notes

None

Related Data Types and Interfaces

k_dpu_chn_ir_result_t kd_mpi_dpu_get_frame

k_dpu_qlt_out_t#

Description

Structure of quality inspection output results

definition

typedef struct {
    k_bool valid;
    k_u32 qlt_length;
    k_u32 sad_disp_length;
    k_u32 init_sad_disp_length;
    k_u64 qlt_phys_addr;
    k_u64 qlt_virt_addr;
    k_u64 sad_disp_phys_addr;
    k_u64 sad_disp_virt_addr;
    k_u64 init_sad_disp_phys_addr;
    k_u64 init_sad_disp_virt_addr;
} k_dpu_qlt_out_t;

member

member name

Description

valid

K_TRUE: indicates that the output result is valid; K_FALSE: indicates that the output result is invalid.

qlt_length

Quality inspection output result length.

sad_disp_length

Thick and thin column disparity (initial resolution) output result length.

init_sad_disp_length

The length of the initial determinant difference output result.

qlt_phys_addr

The physical address of the quality inspection output result.

qlt_virt_addr

Quality inspection output result virtual address.

sad_disp_phys_addr

Thick and thin column disparity (original resolution) output results physical address.

sad_disp_virt_addr

Thick and thin column disparity (original resolution) output results virtual address.

init_sad_disp_phys_addr

The initial determinant difference outputs the resulting physical address.

init_sad_disp_virt_addr

The initial determinant difference outputs the resulting virtual address.

Notes

None

Related Data Types and Interfaces

k_dpu_chn_lcn_result_t kd_mpi_dpu_get_frame

Long and short period parameter types#

This module has the following data types:

k_dpu_long_parameter_t#

Description

dpu long period parameter structure

definition

There are too many long-period parameter members, which are not shown here. You can refer to the structure k_dpu_long_parameter_t in k_dpu_comm.h in K230_SDK.

Notes

  • When users need to change the values ​​in long-period parameters, they should use virtual address member variables.

Related Data Types and Interfaces

k_dpu_dev_param_t kd_mpi_dpu_parse_file kd_mpi_dpu_set_dev_attr

k_dpu_short_parameter_t#

Description

dpu short period parameter structure

definition

There are too many short-period parameter members, which are not shown here. You can refer to the structure k_dpu_short_parameter_t in k_dpu_comm.h in K230_SDK.

Notes

None

Related Data Types and Interfaces

k_dpu_dev_param_t kd_mpi_dpu_set_dev_attr kd_mpi_dpu_get_dev_attr

error code#

dpu error code#

Table 41

error code

Macro definition

Description

0xa0118001

K_ERR_DPU_INVALID_DEVID

Invalid device number

0xa0118002

K_ERR_DPU_INVALID_CHNID

Invalid channel number

0xa0118003

K_ERR_DPU_ILLEGAL_PARAM

Parameter error

0xa0118004

K_ERR_DPU_EXIST

DPU device already exists

0xa0118005

K_ERR_DPU_UNEXIST

DPU device does not exist

0xa0118006

K_ERR_DPU_NULL_PTR

Null pointer error

0xa0118007

K_ERR_DPU_NOT_CONFIG

DPU not configured yet

0xa0118008

K_ERR_DPU_NOT_SUPPORT

Unsupported features

0xa0118009

K_ERR_DPU_NOT_PERM

Operation not allowed

0xa011800c

K_ERR_DPU_NOMEM

Failed to allocate memory, such as insufficient system memory

0xa011800d

K_ERR_DPU_NOBUF

Not enough BUFF

0xa011800e

K_ERR_DPU_BUF_EMPTY

BUFF is empty

0xa011800f

K_ERR_DPU_BUF_FULL

BUFF is full

0xa0118010

K_ERR_DPU_NOTREADY

Device is not ready

0xa0118011

K_ERR_DPU_BADADDR

wrong address

0xa0118012

K_ERR_DPU_BUSY

DPU is in busy state

debugging information#

Overview#

The debugging information uses the proc file system, which can reflect the current running status of the system in real time. The recorded information can be used for problem location and analysis.

File directory

/proc/

Document list

File name

Description

umap/dpu

Record some information about the current dpu module

debugging information#

debugging information

----------------------DPU Device Information----------------------
--------------------Pathway Switch Information--------------------
downScale: false align: false
align_ir: false align_rgbCoord: false
depthout: false denoise: false
median_p0: false median_denoise: false
median_post: false median_ir: false
check: false

----------------------Image Size Information----------------------
width_speckle: 0 height_speckle: 0
width_color: 0 height_color: 0
width_output: 0 height_output: 0

---------------------Result Length Information--------------------
sad_disp_x: 0 init_sad_disp_xy: 0
quanlity_check: 0 ir: 0
disp/depth: 0

----------------------------Frame Count---------------------------
from open to close, dpu has send 0 frames

Path selection information

parameter

describe

downScale

Whether to coarse search and reduce resolution

align

Whether the three pictures are aligned

align_ir

Whether the infrared image is aligned

align_rgbCoord

Whether disparity values ​​are aligned to the color map coordinate system

depthout

Whether to output depth map

denoise

Whether to denoise the disparity map

median_p0

Whether to use coarse search median filtering

median_denoise

Whether to disparity denoise internal median filtering

median_post

Whether to disparity post-processing/three-image alignment disparity map median filtering

median_ir

Whether to align three images with infrared image median filtering

check

Whether object speckle pattern quality detection and initial search

Image size information

parameter

describe

width_speckle

Original speckle image/infrared image width pixel number

height_speckle

Original speckle image/infrared image height pixel number

width_color

Original color image width in pixels

height_color

Original color image height pixels

width_output

Output disparity image/depth image/infrared image width pixel number

height_output

Output disparity image/depth image/infrared image height pixel number

Result length information

parameter

describe

sad_disp_x

Thick and Thin Column Disparity (Initial Resolution) Result Length

init_sad_disp_xy

Initial row-column disparity output result length

quanlity_check

Quality test result length

ir

Infrared image result length

disp/depth

Disparity map/depth map result length

Debugging information needs to be viewed while the DPU is running. After the DPU ends running, all current information will be reset to zero.

demo description#

dpu demo introduction#

The dpu demo implements two modes: bound and unbound. Enter /bin/sample_dpu.elf in msh to execute the non-bound mode, and it will end after running for ten frames; enter /bin/sample_dpu.elf BOUND in msh to execute the bound mode, using vvi as the simulation superior to continuously input data to the dpu, and the information will be displayed after the dpu calculation is completed.

Feature Description#

The demo includes functions such as initializing and deleting dpu, parsing parameters from configuration files, configuring device properties, configuring channel properties, starting and pausing devices, starting and pausing channels, input and output data, pipeline binding, etc.

Unbound mode#

Complete the initialization of the DPU device by calling the API, parse the parameters from the configuration file, configure the device properties according to the parsed parameters, call the API to set the reference image and template image, start the DPU device, configure the speckle image and infrared image channel properties, start the channel, input ten frames in a loop and compare the results before stopping, stop the channel, stop the device, and delete the device.

binding mode#

Complete the initialization of the dpu device by calling the API, parse the parameters from the configuration file, bind the vvi and dpu channels, configure the device properties according to the parsed parameters, call the API to set the reference image and template image, start the dpu device, configure the speckle image and infrared image channel properties, start the dpu channel, start the vvi channel, vvi serves as the simulated superior data to continuously input data to the dpu. The user enters e to stop the channel and device.

Compile and execute#

For compilation and execution, please refer to the document “K230 SDK Demo User Guide”.

Comments list
Comments
Log in