MxInitFromConfig

Function Usage

Performs global initialization such as allocating device and log resources, and preloading operators using the input preloading configuration file (JSON). Rules for compiling the configuration file are listed below. Example of the Preloading File of the Initialization Operator is an example of the configuration file. After all Vision SDK APIs are executed, call MxDeInit() to deinitialize the initialized global resources. For details, see Initialization and Deinitialization.

This API is not supported by the Atlas 200/300/500 inference product and Atlas 800I A2 inference product.

  • MxInitFromConfig can be called only once per process.
  • The underlying channel resources requested by the DVPP resource pool are shared by processes. In multi-process scenarios, resources may be exhausted. Therefore, exercise caution when using the DVPP resource pool.
  • The DVPP resource pool shares bottom-layer channel resources with VideoEncoder and VideoDecoder. In extreme scenarios, resources may be used up. You are advised to initialize the resource pool size based on the actual situation.
  • This API registers the threads for monitoring the number of logs and log time. The threads are named log_filenum and log_time respectively.

Prototype

1
APP_ERROR MxInitFromConfig(const std::string &configFile);
1
APP_ERROR MxInitFromConfig(const std::string &configFile, const AppGlobalCfg &globalCfg);
1
APP_ERROR MxInitFromConfig(const std::string &configFile, const AppGlobalCfgExtra &globalCfgExtra); 

Parameters

Parameter

Input/Output

Description

configFile

Input

std::string type, indicating the path of the JSON file to be preloaded. The JSON file owner must be the current user, with the 640 or lower permission.

globalCfg

Input

AppGlobalCfg type that applies to global configuration.

globalCfgExtra

Input

AppGlobalCfgExtra type that applies to global configuration.

Response Parameters

Data Structure

Description

APP_ERROR

For details about the returned error codes, see APP_ERROR Description.