MCUXpresso SDK Documentation

eIQ MCU Media Processing Pipeline API

Contents

eIQ MCU Media Processing Pipeline API#

MPP VERSION 4.4

1. MPP API#

Functions

1.1 Detailed Description#

This section provides the detailed documentation for the MCU Media Processing Pipeline API.

1.1.1 Function Documentation#

mpp_api_init#

int mpp_api_init ( mpp_api_params_t * params )

Pipeline initialization.

This function initializes the library and its data structures. It must be called before any other function of the API is called.

Parameters

in/out

name

description

in

params

API global parameters

Returns

Return Codes

mpp_create#

mpp_t mpp_create ( mpp_params_t * params, int * ret )

Basic pipeline creation.

This function returns a handle to the pipeline.

Parameters

in/out

name

description

in

params

pipeline parameters

out

ret

return code (0 - success, non-zero - error)

Returns

handle to the pipeline if success, NULL if there is an error.

mpp_camera_add#

int mpp_camera_add ( mpp_t mpp, const char * name, mpp_camera_params_t * params, mpp_elem_handle_t * elem_h )

Camera addition.

This function adds a camera to the pipeline.

Parameters

in/out

name

description

in

mpp

input pipeline

in

name

camera driver name

in

params

parameters to be configured on the camera

out

elem_h

element handle in pipeline

Returns

Return Codes

mpp_static_img_add#

int mpp_static_img_add ( mpp_t mpp, mpp_img_params_t * params, void * addr, mpp_elem_handle_t * elem_h )

Static image addition.

Parameters

in/out

name

description

in

mpp

input pipeline

in

params

static image parameters

in

addr

image buffer

out

elem_h

element handle in pipeline

Returns

Return Codes

Precondition

  • Image buffer allocation/free is the responsibility of the user.

mpp_filesrc_add#

int mpp_filesrc_add ( mpp_t mpp, mpp_filesrc_params_t * params, void * addr, mpp_elem_handle_t * elem_h )

Source file addition.

Parameters

in/out

name

description

in

mpp

input pipeline

in

params

file parameters

in

addr

file buffer

out

elem_h

element handle in pipeline

Returns

Return Codes

mpp_filesink_add#

int mpp_filesink_add ( mpp_t mpp, mpp_filesink_params_t * params, mpp_elem_handle_t * elem_h )

Sink file addition.

Parameters

in/out

name

description

in

mpp

input pipeline

in

params

file parameters

out

elem_h

element handle in pipeline

Returns

Return Codes

mpp_rtspsrc_add#

int mpp_rtspsrc_add ( mpp_t mpp, mpp_rtspsrc_params_t * params, mpp_elem_handle_t * elem_h )

Source RTSP addition.

Parameters

in/out

name

description

in

mpp

input pipeline

in

params

RTSP parameters

out

elem_h

element handle in pipeline

Returns

Return Codes

mpp_rtspsink_add#

int mpp_rtspsink_add ( mpp_t mpp, mpp_rtspsink_params_t * params, mpp_elem_handle_t * elem_h )

Sink RTSP addition.

Parameters

in/out

name

description

in

mpp

input pipeline

in

params

RTSP parameters

out

elem_h

element handle in pipeline

Returns

Return Codes

mpp_mc_source_add#

int mpp_mc_source_add ( mpp_t mpp, mpp_mc_params_t * params, mpp_elem_handle_t * elem_h )

Multi core source addition.

This function adds a multi core source to the pipeline.

Parameters

in/out

name

description

in

mpp

input pipeline

in

params

parameters that are configured on the multi core source

out

elem_h

element handle in pipeline

Returns

Return Codes

mpp_display_add#

int mpp_display_add ( mpp_t mpp, const char * name, mpp_display_params_t * params )

Display addition.

This function adds a display to the pipeline.

Parameters

in/out

name

description

in

mpp

input pipeline

in

name

display driver name

in

params

parameters that are configured on the display

Returns

Return Codes

mpp_mc_sink_add#

int mpp_mc_sink_add ( mpp_t mpp, mpp_mc_params_t * params )

Multi core sink addition.

This function adds a multi core sink to the pipeline.

Parameters

in/out

name

description

in

mpp

input pipeline

in

params

parameters that are configured on the multi core sink

Returns

Return Codes

mpp_nullsink_add#

int mpp_nullsink_add ( mpp_t mpp )

Null sink addition.

This function adds a null-type sink to the pipeline. After this call pipeline is closed and no further elements can be added. Input frames are discarded.

Parameters

in/out

name

description

in

mpp

input pipeline

Returns

Return Codes

mpp_get_output_buff_address#

void * mpp_get_output_buff_address ( mpp_elem_handle_t elem, uint32_t index )

Get output buffer address.

This function returns the address of an output buffer for a given element.

Parameters

in/out

name

description

in

elem

element handle in pipeline

in

index

output buffer index (must be less than MAX_OUTPUT_PORTS and element’s nb_out_buf)

Returns

pointer to the output buffer address if successful, NULL if element is invalid or index is out of range

mpp_get_input_buff_address#

void * mpp_get_input_buff_address ( mpp_elem_handle_t elem, uint32_t index )

Get input buffer address.

This function returns the address of an input buffer for a given element.

Parameters

in/out

name

description

in

elem

element handle in pipeline

in

index

input buffer index (must be less than MAX_INPUT_PORTS and element’s nb_in_buf)

Returns

pointer to the input buffer address if successful, NULL if element is invalid or index is out of range

mpp_element_add#

int mpp_element_add ( mpp_t mpp, mpp_element_id_t id, mpp_element_params_t * params, mpp_elem_handle_t * elem_h )

Add processing element (single input, single output)

This function adds an element to the pipeline. Available elements are:

  • 2D image processing

  • ML inference engine

  • Labeled rectangle

  • Compositor

Parameters

in/out

name

description

in

mpp

input pipeline

in

id

element id

in

params

element parameters

out

elem_h

element handle in pipeline

Returns

Return Codes

mpp_split#

int mpp_split ( mpp_t mpp, unsigned int num, mpp_params_t * params, mpp_t * out_list )

Pipeline multiplication.

Parameters

in/out

name

description

in

mpp

input pipeline

in

num

number of output pipeline

in

params

split mpp parameters

out

out_list

list of output pipelines

Returns

Return Codes

Precondition

  • out_list array must contain at least num elements.

mpp_background#

int mpp_background ( mpp_t mpp, mpp_params_t * params, mpp_t * out_mpp )

Put next elements processing in background.

Parameters

in/out

name

description

in

mpp

input pipeline

in

params

new mpp parameters (exec_flag must be MPP_EXEC_PREEMPT)

out

out_mpp

output pipeline

Returns

Return Codes

mpp_multipass_element_add#

int mpp_multipass_element_add ( mpp_t mpp, mpp_element_id_t id, mpp_element_params_t * params_array, uint32_t n_params, mpp_elem_handle_t * elem_h )

Add processing element with per-pass parameter sets (single input, single output)

This function adds an element configured to run with a different set of parameters on each pass. params_array[i] is selected for pass index i. If the effective pass count exceeds n_params, the last entry is reused. Available elements are the same as for mpp_element_add.

Parameters

in/out

name

description

in

mpp

input pipeline

in

id

element id

in

params_array

array of element parameters, one per pass (must have at least 1 entry)

in

n_params

number of entries in params_array

out

elem_h

element handle in pipeline

Returns

Return Codes

mpp_set_n_passes#

int mpp_set_n_passes ( mpp_t mpp, uint32_t n_passes )

Set the number of passes per source frame for a pipeline branch.

This function sets how many times the pipeline branch is executed per source frame. A value of 0 is invalid and returns MPP_INVALID_PARAM; n_passes must be at least 1. Can be called before or after mpp_start to update the pass count at runtime. Sub-branches that share the same execution heap inherit the pass count from the topmost ancestor whose n_passes is non-zero; a sub-branch whose own n_passes is 0 (unset) falls back to that inherited value.

Parameters

in/out

name

description

in

mpp

pipeline branch handle

in

n_passes

desired pass count (must be >= 1)

Returns

Return Codes

mpp_element_update#

int mpp_element_update ( mpp_t mpp, mpp_elem_handle_t elem_h, mpp_element_params_t * params, bool force_update )

Update element parameters.

Parameters

in/out

name

description

in

mpp

input pipeline

in

elem_h

element handle in the pipeline.

in

params

new element parameters

in

force_update

force the pipeline to run even though there is no input frame update for processing elements after update. If the force_update flag was already requested before, the current value is ignored

Returns

Return Codes

mpp_multipass_element_update#

int mpp_multipass_element_update ( mpp_t mpp, mpp_elem_handle_t elem_h, mpp_element_params_t * params_array, uint32_t n_params, bool force_update )

Update element parameters for multiple pipeline passes.

Parameters

in/out

name

description

in

mpp

input pipeline

in

elem_h

element handle in the pipeline

in

params_array

array of element parameters, one entry per pass

in

n_params

number of entries in params_array

in

force_update

force the pipeline to run even though there is no input frame update for processing elements after update. If the force_update flag was already requested before, the current value is ignored

Returns

Return Codes

mpp_is_running#

bool mpp_is_running ( mpp_t mpp )

Check if the pipeline is currently running.

Parameters

in/out

name

description

in

mpp

input pipeline

Returns

true if pipeline is in running state, else false

mpp_start#

int mpp_start ( mpp_t mpp, int last, bool force_update )

Start pipeline.

When called with last=0, this function prepares the branch of the pipeline specified with mpp. When called with last!=0, this function starts the data flow of the pipeline. Data flow should start after all the branches of the pipeline have been prepared.

Parameters

in/out

name

description

in

mpp

pipeline branch handle to start/prepare

in

last

if non-zero start pipeline processing. No further start call is possible thereafter.

in

force_update

force the pipeline to run even though there is no input frame update for processing elements. If the force_update flag was already requested before, the current value is ignored

Returns

Return Codes

mpp_stop#

int mpp_stop ( mpp_t mpp )

Stop a branch of the pipeline.

This function stops the data processing and peripherals of a pipeline branch.

Parameters

in/out

name

description

in

mpp

pipeline branch to stop

Returns

Return Codes

mpp_force_update#

int mpp_force_update ( mpp_t mpp )

Force the update of a branch of the pipeline.

This function forces an update of the branch of the pipeline even if there is no new input frame.

Parameters

in/out

name

description

in

mpp

pipeline branch to set the flag force_update to true

Returns

Return Codes

mpp_stats_enable#

void mpp_stats_enable ( mpp_stats_grp_t grp )

Enable statistics collection.

This function enables statistics collection for a given group. Statistics collection is disabled by default after API initialization. Calling this function when stats are enabled has no effect.

Parameters

in/out

name

description

in

grp

statistics group

mpp_stats_disable#

void mpp_stats_disable ( mpp_stats_grp_t grp )

Disable statistics collection.

This function disables statistics collection for a given group. Calling this function when stats are disabled has no effect. This function is used to ensure stats are not updated while application tasks use the stats structures.

Parameters

in/out

name

description

in

grp

statistics group

mpp_get_version#

char * mpp_get_version ( void )

Get MPP version.

Returns

pointer to the MPP version string

mpp_storage_init#

int mpp_storage_init ( void )

Initialize the storage subsystem.

Returns

MPP_SUCCESS on success, MPP_ERROR on failure

mpp_storage_get_free_space#

int mpp_storage_get_free_space ( uint64_t * free_bytes, uint64_t * total_bytes )

Get free and total storage space.

Parameters

in/out

name

description

out

free_bytes

Pointer to store the free space in bytes

out

total_bytes

Pointer to store the total space in bytes

Returns

MPP_SUCCESS on success, MPP_ERROR on failure

mpp_eth_netif_init#

int mpp_eth_netif_init ( uint8_t ip_addr, uint8_t netmask, uint8_t gateway )

Initialize Ethernet network interface.

This function initializes the Ethernet network interface with the specified IP address, netmask, and gateway configuration.

Parameters

in/out

name

description

in

ip_addr

IP address as array of 4 octets (e.g., {192, 168, 0, 102})

in

netmask

Network mask as array of 4 octets (e.g., {255, 255, 255, 0})

in

gateway

Gateway address as array of 4 octets (e.g., {192, 168, 0, 100})

Returns

0 on success, non-zero on error

mpp_destroy#

int mpp_destroy ( mpp_t mpp )

Destroy a stopped pipeline and free all its resources.

The pipeline must not be in MPP_RUNNING state. All HAL device deinit functions are called and all memory allocated for elements, device structs, and output buffer descriptors is freed.

Parameters

in/out

name

description

in

mpp

handle to the pipeline to destroy

Returns

MPP_SUCCESS on success, MPP_ERROR if the pipeline is still running, MPP_INVALID_PARAM if mpp is NULL.

mpp_api_ctl_tasks_destroy#

int mpp_api_ctl_tasks_destroy ( void )

Destroy the three pipeline control tasks created by mpp_api_init() .

Also destroys the associated event groups, semaphore, and stats mutexes. May only be called after all pipelines have been destroyed (prio lists empty).

Returns

MPP_SUCCESS on success, MPP_ERROR if any pipeline is still registered.

mpp_print_heap#

void mpp_print_heap ( void )

Print the current free heap size to the log.

Useful to call before and after mpp_destroy() to verify full cleanup. Implemented for FreeRTOS only; prints a notice on other OSes.

mpp_get_free_heap#

uint32_t mpp_get_free_heap ( void )

Get the current free heap size.

Returns

The amount of free heap memory in bytes

2. MPP Types#

Data Structures

Macros

Typedefs

Enumerations

2.1 Detailed Description#

This section provides the detailed documentation for the MCU Media Processing Pipeline types.

2.1.1 Data Structure Documentation#

mpp_stats_t#

union mpp_stats_t

Statistics data container, content depends on the group.

Data Fields

type

name

description

struct mpp_stats_t::@0

api

Global execution performance counters.

struct mpp_stats_t::@1

mpp

Pipeline execution performance counters.

struct mpp_stats_t::@2

elem

Element execution performance counters.

mpp_api_params_t#

struct mpp_api_params_t

API initialization parameters.

Data Fields

type

name

description

mpp_stats_t *

stats

API stats.

unsigned int

rc_cycle_min

minimum cycle duration for RC tasks (ms), 0: sets default value

unsigned int

rc_cycle_inc

time increment for RC tasks (ms), 0: sets default value

int

pipeline_task_max_prio

pipeline tasks maximum priority.

int

pipeline_rc_task_prio

0: sets default value

int

pipeline_pr_task_prio

0: sets default value

struct mpp_api_params_t::@3

multicore

mpp_params_t#

struct mpp_params_t

Pipeline creation parameters.

Data Fields

type

name

description

int

(*evt_callback_f)(mpp_t mpp, mpp_evt_t evt, void *evt_data, void *user_data)

event callback function

mpp_evt_mask_t

mask

event mask

mpp_exec_flag_t

exec_flag

execution flag

void *

cb_userdata

user data pointer passed to the callback

mpp_stats_t *

stats

pointer to statistics structure

uint32_t

core_id

core ID where the pipeline runs

mpp_camera_stream_cfg#

struct mpp_camera_stream_cfg

Camera stream configuration for multi-stream cameras.

Data Fields

type

name

description

mpp_camera_stream_type

type

Stream type (member of enum mpp_camera_stream_type)

bool

active

Stream is active or not.

int

height

int

width

int

usb_camera_index

Set to -1 (or leave zero-initialised) for automatic assignment (first free g_Videos[] slot). Use a non-negative value to select a specific camera when a single USB device exposes multiple UVC interfaces (e.g. 0 = RGB, 1 = IR).

mpp_camera_params_t#

struct mpp_camera_params_t

Camera parameters.

Data Fields

type

name

description

int

height

buffer height

int

width

buffer width

mpp_pixel_format_t

format

pixel format

int

fps

frames per second

bool

stripe

stripe mode

void *

rpmsg_inst

pointer to rpmsg instance

uint16_t *

mcmgr_event_data

pointer to mcmgr event data

uint32_t

n_streams

number of total output video streams

mpp_camera_stream_cfg

stream[NUM_STREAMS]

streams configuration

bool

in_advance_enqueue

enable in-advance enqueue mode

mpp_img_params_t#

struct mpp_img_params_t

Static image parameters.

Data Fields

type

name

description

int

height

buffer height

int

width

buffer width

mpp_pixel_format_t

format

pixel format

bool

stripe

stripe mode

int

compressed_size

size in bytes for compressed format

mpp_convert_cb_param_t#

struct mpp_convert_cb_param_t

Parameters passed to the callback after a convert element processes a frame.

Data Fields

type

name

description

uint32_t

id

convert element id

uint32_t

left

crop left coordinate

uint32_t

right

crop right coordinate

uint32_t

top

crop top coordinate

uint32_t

bottom

crop bottom coordinate

float

rotation

custom rotation angle

void *

vg_lite_m

vglite matrix pointer

mpp_filesrc_params_t#

struct mpp_filesrc_params_t

File source parameters.

Data Fields

type

name

description

const char *

filepath

Path to file on SD card.

bool

loop

Flag to enable looping the file.

int

file_buffer_size

size in bytes for compressed format

slice_search_func_t

slice_search_func

Optional: function to search for slices/chunks of data.

mpp_filesink_params_t#

struct mpp_filesink_params_t

File sink parameters.

Data Fields

type

name

description

const char *

filepath

Path to file on SD card.

bool

append_mode

Flag to enable append mode (false = overwrite)

uint64_t

max_file_size

Maximum file size in bytes.

mpp_rtspsrc_params_t#

struct mpp_rtspsrc_params_t

RTSP source parameters.

Data Fields

type

name

description

const char *

rtsp_url

RTSP URL (rtsp://ip:port/path)

uint64_t

rtsp_buffer_size

Maximum buffer size in bytes.

int

width

Source image width in pixels.

int

height

Source image height in pixels.

mpp_pixel_format_t

format

Pixel format of output buffer (use MPP_PIXEL_JPEG for compressed JPEG)

mpp_rtspsink_params_t#

struct mpp_rtspsink_params_t

RTSP sink parameters.

Data Fields

type

name

description

uint16_t

port

RTSP server port (default: 8554)

uint8_t

ip_addr[MPP_IP_ADDR_LEN]

IP address as array of bytes.

uint32_t

frame_width

Frame width in pixels.

uint32_t

frame_height

Frame height in pixels.

rtp_payload_type_t

payload_type

RTP payload type.

rtp_frame_type_t

frame_type

RTP JPEG frame type (YUV422 or YUV420)

mpp_mc_params_t#

struct mpp_mc_params_t

MC element parameters.

Data Fields

type

name

description

void *

rpmsg_inst

pointer to rpmsg instance

uint32_t

remote_core_id

remote core id

uint32_t

local_rpmsg_addr

local rpmsg endpoint address

uint32_t

remote_rpmsg_addr

remote rpmsg endpoint address

uint16_t

event_data

event data for mcmgr

mpp_display_params_t#

struct mpp_display_params_t

Display parameters.

Data Fields

type

name

description

int

height

buffer resolution: setting to 0 will default to panel physical resolution

int

width

buffer resolution: setting to 0 will default to panel physical resolution

int

pitch

buffer resolution: setting to 0 will default to panel physical resolution

int

left

active rect: setting to 0 will default to fullscreen

int

top

active rect: setting to 0 will default to fullscreen

int

right

active rect: setting to 0 will default to fullscreen

int

bottom

active rect: setting to 0 will default to fullscreen

mpp_rotate_degree_t

rotate

rotate degree

mpp_pixel_format_t

format

pixel format

bool

stripe

stripe mode

void *

handle

pointer to an lvgl image widget

mpp_tensor_dims_t#

struct mpp_tensor_dims_t

Inference tensor dimensions.

Data Fields

  • uint32_t size

  • uint32_t data[MAX_TENSOR_DIMS]

mpp_inference_tensor_params_t#

struct mpp_inference_tensor_params_t

tensor parameters

Data Fields

type

name

description

const uint8_t *

data

data address

mpp_tensor_dims_t

dims

tensor data dimensions

mpp_tensor_type_t

type

tensor data type

float

scale

int32_t

zero_point

quantization zero point

mpp_inference_inp_cb_params#

struct mpp_inference_inp_cb_params

Inference input ready callback parameters.

Data Fields

type

name

description

mpp_inference_tensor_params_t *

in_tensors[MPP_INFERENCE_MAX_INPUTS]

input tensors parameters

uint32_t

model_id

model identifier

mpp_inference_cb_param_t#

struct mpp_inference_cb_param_t

Inference callback parameters.

Data Fields

type

name

description

void *

user_data

callback will pass this pointer

mpp_inference_tensor_params_t *

out_tensors[MPP_INFERENCE_MAX_OUTPUTS]

output tensors parameters

uint32_t

inference_time_ms

inference run time measurement - output to user

mpp_inference_type_t

inference_type

type of the inference

uint32_t

model_id

img_quality_metrics_t#

struct img_quality_metrics_t

Image quality metrics.

Data Fields

type

name

description

int

brightness

brightness metric

int

contrast

contrast metric

mpp_color_t#

union mpp_color_t

mpp color encoding

Data Fields

type

name

description

uint32_t

raw

Raw color.

struct mpp_color_t::@5

rgb

RGB color

mpp_labeled_rect_t#

struct mpp_labeled_rect_t

mpp labeled rectangle element structure

Data Fields

type

name

description

uint8_t

label[64]

label to print

uint16_t

clear

clear rectangle

uint16_t

line_width

rectangle line thickness

mpp_color_t

line_color

rectangle line color

int16_t

top

rectangle top position

int16_t

left

rectangle left position

int16_t

bottom

rectangle bottom position

int16_t

right

rectangle right position

uint16_t

tag

labeled rectangle tag

uint16_t

reserved

pad for 32 bits alignment

bool

stripe

stripe mode

mpp_landmark_t#

struct mpp_landmark_t

mpp landmark structure

Data Fields

type

name

description

uint16_t

clear

clear landmark

uint16_t

width

landmark thickness

mpp_color_t

color

landmark color

int16_t

x

landmark x position

int16_t

y

landmark y position

uint16_t

tag

landmark tag

bool

stripe

stripe mode

mpp_area_t#

struct mpp_area_t

Image area coordinates.

Data Fields

  • int top

  • int left

  • int bottom

  • int right

mpp_dims_t#

struct mpp_dims_t

Image dimensions.

Data Fields

  • unsigned int width

  • unsigned int height

mpp_position_t#

struct mpp_position_t

Image position.

Data Fields

  • int top

  • int left

mpp_inference_params_t#

struct mpp_inference_params_t

Model parameters.

Data Fields

type

name

description

uint64_t

constant_weight_MemSize

model constant weights memory size

uint64_t

mutable_weight_MemSize

Defines the amount of memory required both input & output data buffers.

uint64_t

activations_MemSize

Size of scratch memory used for intermediate computations needed by the model.

int

num_inputs

model’s number of inputs

int

num_outputs

model’s number of outputs

uint64_t

inputs_offsets[MPP_INFERENCE_MAX_INPUTS]

offset of each input

uint64_t

outputs_offsets[MPP_INFERENCE_MAX_OUTPUTS]

offset of each output

inference_entry_point_t

model_entry_point

function called to perform the inference

mpp_tensor_type_t

model_input_tensors_type

type of input buffer

mpp_img_compose_param_t#

struct mpp_img_compose_param_t

Image composition parameters.

Data Fields

type

name

description

int

height

original image height

int

width

original image width

mpp_pixel_format_t

format

pixel format

void *

buffer

image buffer address

mpp_area_t

dest_area

area for image in destination

mpp_element_params_t#

struct mpp_element_params_t

Static image and Processing elements parameters.

Data Fields

mpp_stats_t.api#

struct mpp_stats_t.api

Data Fields

type

name

description

unsigned int

rc_cycle

run-to-completion (RC) cycle duration (ms)

unsigned int

rc_cycle_max

run-to-completion work deadline (ms)

unsigned int

pr_slot

available slot for preemptable (PR) work (ms)

unsigned int

pr_rounds

number of RC cycles required to complete one PR cycle (ms)

unsigned int

app_slot

remaining time for application (ms)

unsigned int

cpu_load

CPU load percentage (%)

mpp_stats_t.mpp#

struct mpp_stats_t.mpp

Data Fields

type

name

description

mpp_t

mpp

unsigned int

mpp_exec_time

pipeline execution time (ms)

unsigned int

fps

frames processed per second

mpp_stats_t.elem#

struct mpp_stats_t.elem

Data Fields

type

name

description

mpp_elem_handle_t

hnd

unsigned int

elem_exec_time

element execution time (ms)

mpp_api_params_t.multicore#

struct mpp_api_params_t.multicore

Data Fields

type

name

description

uint32_t

n_remote_cores

number of remote cores

struct mpp_api_params_t::@3::@4

core[MPP_MAX_CORES - 1]

mpp_api_params_t.multicore.core#

struct mpp_api_params_t.multicore.core

Data Fields

type

name

description

uint32_t

remote_core_id

remote core id

void *

rpmsg_inst

pointer to rpmsg instance

mpp_color_t.rgb#

struct mpp_color_t.rgb

rgb color values

Data Fields

type

name

description

uint8_t

R

Red byte.

uint8_t

G

Green byte.

uint8_t

B

Blue byte.

uint8_t

pad

padding byte

mpp_element_params_t.unnamed7#

union mpp_element_params_t.__unnamed7__

Data Fields

type

name

description

mpp_camera_params_t

camera

Camera element’s parameters.

struct mpp_element_params_t::@6::@8

static_image

Static Image element’s parameters.

mpp_mc_params_t

mc_source

Multicore source element’s parameters

struct mpp_element_params_t::@6::@9

compose

Compose element’s parameters.

struct mpp_element_params_t::@6::@10

labels

Labeled Rectangle and Landmarks element’s parameters.

struct mpp_element_params_t::@6::@11

convert

Convert element’s parameters.

struct mpp_element_params_t::@6::@12

resize

Resize element’s parameters.

struct mpp_element_params_t::@6::@13

color_conv

Color convert element’s parameters.

struct mpp_element_params_t::@6::@14

rotate

Rotate element’s parameters.

struct mpp_element_params_t::@6::@15

test

Test element’s parameters.

struct mpp_element_params_t::@6::@16

decode

Decoder element’s parameters.

struct mpp_element_params_t::@6::@17

encode

Encoder element’s parameters.

struct mpp_element_params_t::@6::@18

ml_inference

ML inference element’s parameters.

struct mpp_element_params_t::@6::@19

img_quality_check

Image quality check element’s parameters.

mpp_element_params_t.unnamed7.static_image#

struct mpp_element_params_t.__unnamed7__.static_image

Static Image element’s parameters.

Data Fields

type

name

description

mpp_img_params_t

img_params

static image parameters

void *

img_buffer

static image buffer address

mpp_element_params_t.unnamed7.compose#

struct mpp_element_params_t.__unnamed7__.compose

Compose element’s parameters.

Data Fields

type

name

description

int

nb_images

number of images to compose

mpp_img_compose_param_t *

image_list

pointer to array of images to compose

mpp_area_t

input_area

area of input stream in destination

mpp_rotate_degree_t

out_angle

output rotation angle

mpp_flip_mode_t

out_flip

output flip mode

mpp_pixel_format_t

out_format

output color format

int

out_width

output buffer width

int

out_height

output buffer height

mpp_element_params_t.unnamed7.labels#

struct mpp_element_params_t.__unnamed7__.labels

Labeled Rectangle and Landmarks element’s parameters.

Data Fields

type

name

description

uint32_t

max_rect

maximum number of rectangles

uint32_t

detected_rect

detected rectangles

mpp_labeled_rect_t *

rectangles

array of rectangle data

uint32_t

max_landmk

maximum number of landmarks

uint32_t

detected_landmk

detected landmarks

mpp_landmark_t *

landmarks

array of landmark data

mpp_element_params_t.unnamed7.convert#

struct mpp_element_params_t.__unnamed7__.convert

Convert element’s parameters.

Data Fields

type

name

description

mpp_dims_t

out_buf

output buffer dimensions

mpp_pixel_format_t

pixel_format

new pixel format

mpp_rotate_degree_t

angle

rotation angle

float

custom_angle

custom value of rotation angle

mpp_flip_mode_t

flip

flip mode

mpp_area_t

crop

input crop area

mpp_position_t

out_window

output window position

mpp_dims_t

scale

scaling dimensions

mpp_convert_ops_t

ops

operation selector mask

const char *

dev_name

device name used for graphics

uint32_t

elem_id

element id used for callback parameters

bool

stripe_in

input stripe mode

bool

stripe_out

output stripe mode

mpp_element_params_t.unnamed7.resize#

struct mpp_element_params_t.__unnamed7__.resize

Resize element’s parameters.

Data Fields

  • unsigned int width

  • unsigned int height

mpp_element_params_t.unnamed7.color_conv#

struct mpp_element_params_t.__unnamed7__.color_conv

Color convert element’s parameters.

Data Fields

mpp_element_params_t.unnamed7.rotate#

struct mpp_element_params_t.__unnamed7__.rotate

Rotate element’s parameters.

Data Fields

mpp_element_params_t.unnamed7.test#

struct mpp_element_params_t.__unnamed7__.test

Test element’s parameters.

Data Fields

mpp_element_params_t.unnamed7.decode#

struct mpp_element_params_t.__unnamed7__.decode

Decoder element’s parameters.

Data Fields

type

name

description

const char *

dev_name

device name used for decoder

unsigned int

width

unsigned int

height

mpp_pixel_format_t

out_format

mpp_element_params_t.unnamed7.encode#

struct mpp_element_params_t.__unnamed7__.encode

Encoder element’s parameters.

Data Fields

type

name

description

const char *

dev_name

device name used for encoder

unsigned int

width

frame width

unsigned int

height

frame height

unsigned int

fps

frame rate

mpp_pixel_format_t

format

pixel format

bool

intraframe

only intraframe encoding

uint32_t

intra_period

I-frame period (GOP size)

int32_t

num_ref_frame

Number of reference frames.

int32_t

rc_mode

Rate control mode.

int32_t

target_bitrate

Target bitrate in bps.

int32_t

max_bitrate

Maximum bitrate in bps.

bool

enable_frame_skip

Enable/disable frame skipping.

int32_t

temporal_layer_num

Number of temporal layers.

int32_t

profile_idc

Profile (e.g., baseline, main, high)

int32_t

level_idc

Level (e.g., 3.0, 3.1, 4.0)

int32_t

spatial_bitrate

Spatial layer bitrate.

int32_t

max_spatial_bitrate

Maximum spatial layer bitrate.

int32_t

entropy_coding_mode

0: CAVLC, 1: CABAC

mpp_element_params_t.unnamed7.ml_inference#

struct mpp_element_params_t.__unnamed7__.ml_inference

ML inference element’s parameters.

Data Fields

type

name

description

const void *

model_data

pointer to model binary

mpp_inference_type_t

type

inference type

int

model_size

model binary size

uint32_t

model_id

float

model_input_mean

model ‘mean’ of input values, used for normalization

float

model_input_std

model ‘standard deviation’ of input values, used for normalization

mpp_tensor_order_t

tensor_order

model input tensor component order

mpp_inference_params_t

inference_params

model specific parameters used by the inference

mpp_element_params_t.unnamed7.img_quality_check#

struct mpp_element_params_t.__unnamed7__.img_quality_check

Image quality check element’s parameters.

Data Fields

type

name

description

_Bool

disable

disable quality check

2.1.2 Macro Definition Documentation#

MPP_INFERENCE_MAX_OUTPUTS#

#define MPP_INFERENCE_MAX_OUTPUTS

Maximum number of inference inputs and outputs.

Maximum number of outputs supported by the pipeline

MPP_INFERENCE_MAX_INPUTS#

#define MPP_INFERENCE_MAX_INPUTS

Maximum number of inputs supported by the pipeline.

MPP_IP_ADDR_LEN#

#define MPP_IP_ADDR_LEN

Maximum IP address length (IPv4: 4 octets)

MPP_INVALID#

#define MPP_INVALID

Invalid pipeline handle.

MPP_EVENT_ALL#

#define MPP_EVENT_ALL

Bit mask to receive all Events.

MPP_MAX_CORES#

#define MPP_MAX_CORES

Maximum number of cores supported in a multicore MPP system.

MPP_MAX_RPMSG_EPT_PER_CORE#

#define MPP_MAX_RPMSG_EPT_PER_CORE

Maximum number of RPMsg endpoints per core.

CONFIG_MPP_RPMSG_ADDR_START#

#define CONFIG_MPP_RPMSG_ADDR_START

Base RPMsg endpoint address; override with CONFIG_MPP_RPMSG_ADDR_START.

CONFIG_MPP_MCMGR_DATA_START#

#define CONFIG_MPP_MCMGR_DATA_START

Base MCMGR event data value for MPP; override with CONFIG_MPP_MCMGR_DATA_START.

MPP_RPMSG_ADDR_CORE_START#

#define MPP_RPMSG_ADDR_CORE_START

First RPMsg endpoint address for a given core.

MPP_RPMSG_ADDR_CORE_END#

#define MPP_RPMSG_ADDR_CORE_END

Last RPMsg endpoint address for a given core.

MPP_RPMSG_ADDR_API_TX#

#define MPP_RPMSG_ADDR_API_TX

Remote API transmit endpoint address for a given core.

MPP_RPMSG_ADDR_API_RX#

#define MPP_RPMSG_ADDR_API_RX

Remote API receive endpoint address for a given core.

MAX_TENSOR_DIMS#

#define MAX_TENSOR_DIMS

Maximum number of dimensions for tensors.

2.1.3 Typedef Documentation#

mpp_t#

typedef void * mpp_t

Pipeline handle type.

mpp_elem_handle_t#

typedef uintptr_t mpp_elem_handle_t

Element handle type.

mpp_evt_mask_t#

typedef unsigned int mpp_evt_mask_t

Event mask for pipeline creation.

slice_search_func_t#

typedef int(* slice_search_func_t)(const uint8_t *data, int32_t len)

File slice search function type.

inference_entry_point_t#

typedef int(* inference_entry_point_t)(uint8_t *, uint8_t *, uint8_t *)

Bundle inference function type.

2.1.4 Enumeration Type Documentation#

mpp_evt_t#

enum mpp_evt_t

{ MPP_EVENT_INVALID,

MPP_EVENT_INFERENCE_INPUT_READY,

MPP_EVENT_INFERENCE_OUTPUT_READY,

MPP_EVENT_QUALITY_CHECK_READY,

MPP_EVENT_CONVERT_PARAMS_READY,

MPP_EVENT_INTERNAL_TEST_RESERVED,

MPP_EVENT_MC_REMOTE_DEINIT,

MPP_EVENT_NUM }

Pipeline generated events.

mpp_exec_flag_t#

enum mpp_exec_flag_t

{ MPP_EXEC_INHERIT,

MPP_EXEC_RC,

MPP_EXEC_PREEMPT }

Execution parameters.

These parameters control the execution of the elements of an mpp. The “mpps” created using the flag MPP_EXEC_RC are guaranteed to run up to the completion of all processing elements, while not being preempted by other “mpps”. The “mpps” created using the flag MPP_EXEC_PREEMPT are preempted after a given time interval by “mpps” that will run-to-completion again. The “mpps” created with the MPP_EXEC_INHERIT flag inherit the same execution flag as the parent(s) in case of split operation. Note: It is not possible to request run-to-completion execution when spliting preemptable-execution “mpps”.

mpp_stats_grp_t#

enum mpp_stats_grp_t

{ MPP_STATS_GRP_API,

MPP_STATS_GRP_MPP,

MPP_STATS_GRP_ELEMENT,

MPP_STATS_GRP_NUM }

Statistics group identifier.

mpp_rotate_degree_t#

enum mpp_rotate_degree_t

{ ROTATE_0,

ROTATE_90,

ROTATE_180,

ROTATE_270,

ROTATE_CUSTOM }

Rotation value.

mpp_flip_mode_t#

enum mpp_flip_mode_t

{ FLIP_NONE,

FLIP_HORIZONTAL,

FLIP_VERTICAL,

FLIP_BOTH }

Flip type.

mpp_convert_ops_t#

enum mpp_convert_ops_t

{ MPP_CONVERT_NONE,

MPP_CONVERT_ROTATE,

MPP_CONVERT_SCALE,

MPP_CONVERT_COLOR,

MPP_CONVERT_CROP,

MPP_CONVERT_OUT_WINDOW }

The convert operations selector flags.

mpp_pixel_format_t#

enum mpp_pixel_format_t

{ MPP_PIXEL_ARGB,

MPP_PIXEL_BGRA,

MPP_PIXEL_RGBA,

MPP_PIXEL_BGRX,

MPP_PIXEL_RGBX,

MPP_PIXEL_RGB,

MPP_PIXEL_RGB565,

MPP_PIXEL_BGR,

MPP_PIXEL_GRAY888,

MPP_PIXEL_GRAY888X,

MPP_PIXEL_GRAY,

MPP_PIXEL_GRAY16,

MPP_PIXEL_YUV1P444,

MPP_PIXEL_YUYV1P422,

MPP_PIXEL_VYUY1P422,

MPP_PIXEL_UYVY1P422,

MPP_PIXEL_YUYV,

MPP_PIXEL_DEPTH16,

MPP_PIXEL_DEPTH8,

MPP_PIXEL_YUV420P,

MPP_PIXEL_JPEG,

MPP_PIXEL_INVALID }

Pixel format.

mpp_camera_stream_type#

enum mpp_camera_stream_type

{ RGB_STREAM,

IR_STREAM,

NUM_STREAMS }

Camera stream type - for multiple stream camera.

mpp_rpmsg_endpoint_addr_e#

enum mpp_rpmsg_endpoint_addr_e

{ MPP_RPMSG_ADDR_INVALID,

MPP_RPMSG_ADDR_START,

MPP_RPMSG_ADDR_END,

MPP_RPMSG_ADDR_API_TX_BASE,

MPP_RPMSG_ADDR_API_RX_BASE,

MPP_RPMSG_ADDR_MAX }

Multicore pipeline RPMSG endpoint addresses.

mpp_mcmgr_event_data_e#

enum mpp_mcmgr_event_data_e

{ MPP_MCMGR_DATA_INVALID,

MPP_MCMGR_DATA_START,

MPP_MCMGR_DATA_END,

MPP_MCMGR_DATA_API,

MPP_MCMGR_DATA_MAX }

Multicore pipeline MCMGR remote event data.

rtp_payload_type_t#

enum rtp_payload_type_t

{ RTP_PAYLOAD_TYPE_JPEG,

RTP_PAYLOAD_TYPE_H264 }

RTP payload types.

rtp_frame_type_t#

enum rtp_frame_type_t

{ RTP_JPEG_FRAME_TYPE_YUV422,

RTP_JPEG_FRAME_TYPE_YUV420 }

RTP JPEG frame types.

mpp_element_id_t#

enum mpp_element_id_t

{ MPP_ELEMENT_INVALID,

MPP_ELEMENT_LABELED_RECTANGLE,

MPP_ELEMENT_TEST,

MPP_ELEMENT_INFERENCE,

MPP_ELEMENT_CONVERT,

MPP_ELEMENT_IMG_DECODE,

MPP_ELEMENT_IMG_COMPOSE,

MPP_ELEMENT_IMG_QUALITY_CHECK,

MPP_ELEMENT_VIDEO_DECODE,

MPP_ELEMENT_VIDEO_ENCODE,

MPP_ELEMENT_NUM }

Processing element ids.

mpp_tensor_type_t#

enum mpp_tensor_type_t

{ MPP_TENSOR_TYPE_FLOAT32,

MPP_TENSOR_TYPE_UINT8,

MPP_TENSOR_TYPE_INT8 }

Inference tensor type.

mpp_tensor_order_t#

enum mpp_tensor_order_t

{ MPP_TENSOR_ORDER_UNKNOWN,

MPP_TENSOR_ORDER_NHWC,

MPP_TENSOR_ORDER_NCHW }

Inference input tensor order.

mpp_inference_type_t#

enum mpp_inference_type_t

{ MPP_INFERENCE_TYPE_TFLITE,

MPP_INFERENCE_TYPE_EXECUTORCH }

Inference type.

3. Return Codes#

Macros

3.1 Detailed Description#

MPP APIs return status definitions.

3.1.1 Macro Definition Documentation#

MPP_SUCCESS#

#define MPP_SUCCESS

Success return code.

MPP_ERROR#

#define MPP_ERROR

A generic error occured.

MPP_INVALID_ELEM#

#define MPP_INVALID_ELEM

Invalid element provided.

MPP_INVALID_PARAM#

#define MPP_INVALID_PARAM

Invalid parameter provided.

MPP_ERR_ALLOC_MUTEX#

#define MPP_ERR_ALLOC_MUTEX

Error occured while allocating mutex.

MPP_INVALID_MUTEX#

#define MPP_INVALID_MUTEX

Invalid mutex provided.

MPP_MUTEX_TIMEOUT#

#define MPP_MUTEX_TIMEOUT

Mutex timeout occured.

MPP_MUTEX_ERROR#

#define MPP_MUTEX_ERROR

Mutex error occured.

MPP_MALLOC_ERROR#

#define MPP_MALLOC_ERROR

Memory allocation error occured.

MPP_UNSUPPORTED#

#define MPP_UNSUPPORTED

Operation not supported for this element.