History

dnn_interface: add interface to support async execution

Guo, Yejun committed 5 years ago

Commit 39f5cb41 parent 38089922 files · +13 −1Browse files

Unified · Split

2 files
  1. libavfilter/dnn/dnn_interface.c +1 −1
  2. libavfilter/dnn_interface.h +12 −0
libavfilter/dnn/dnn_interface.c+1−1
@@ -33,7 +33,7 @@ DNNModule *ff_get_dnn_module(DNNBackendType backend_type) · 32 unmodified lines
3333 {
3434 DNNModule *dnn_module;
3535
36− dnn_module = av_malloc(sizeof(DNNModule));
36+ dnn_module = av_mallocz(sizeof(DNNModule));
3737 if(!dnn_module){
3838 return NULL;
3939 }
libavfilter/dnn_interface.h+12−0
@@ -35,6 +35,13 @@ typedef enum {DNN_NATIVE, DNN_TF, DNN_OV} DNNBackendType; · 34 unmodified lines
3535
3636 typedef enum {DNN_FLOAT = 1, DNN_UINT8 = 4} DNNDataType;
3737
38+typedef enum {
39+ DAST_FAIL, // something wrong
40+ DAST_EMPTY_QUEUE, // no more inference result to get
41+ DAST_NOT_READY, // all queued inferences are not finished
42+ DAST_SUCCESS // got a result frame successfully
43+} DNNAsyncStatusType;
44+
3845 typedef struct DNNData{
3946 void *data;
4047 DNNDataType dt;
@@ -69,6 +76,11 @@ typedef struct DNNModule{ · 28 unmodified lines
6976 // Executes model with specified input and output. Returns DNN_ERROR otherwise.
7077 DNNReturnType (*execute_model)(const DNNModel *model, const char *input_name, AVFrame *in_frame,
7178 const char **output_names, uint32_t nb_output, AVFrame *out_frame);
79+ // Executes model with specified input and output asynchronously. Returns DNN_ERROR otherwise.
80+ DNNReturnType (*execute_model_async)(const DNNModel *model, const char *input_name, AVFrame *in_frame,
81+ const char **output_names, uint32_t nb_output, AVFrame *out_frame);
82+ // Retrieve inference result.
83+ DNNAsyncStatusType (*get_async_result)(const DNNModel *model, AVFrame **out);
7284 // Frees memory allocated for model.
7385 void (*free_model)(DNNModel **model);
7486 } DNNModule;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t