| @@ -35,6 +35,13 @@ typedef enum {DNN_NATIVE, DNN_TF, DNN_OV} DNNBackendType; · 34 unmodified lines |
| 35 | 35 | |
| 36 | 36 | typedef enum {DNN_FLOAT = 1, DNN_UINT8 = 4} DNNDataType; |
| 37 | 37 | |
| 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 | + |
| 38 | 45 | typedef struct DNNData{ |
| 39 | 46 | void *data; |
| 40 | 47 | DNNDataType dt; |
| @@ -69,6 +76,11 @@ typedef struct DNNModule{ · 28 unmodified lines |
| 69 | 76 | // Executes model with specified input and output. Returns DNN_ERROR otherwise. |
| 70 | 77 | DNNReturnType (*execute_model)(const DNNModel *model, const char *input_name, AVFrame *in_frame, |
| 71 | 78 | 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); |
| 72 | 84 | // Frees memory allocated for model. |
| 73 | 85 | void (*free_model)(DNNModel **model); |
| 74 | 86 | } DNNModule; |