Showing the changes to libavfilter (2 of 2 files). Show all
Unified · Split
| @@ -33,7 +33,7 @@ DNNModule *ff_get_dnn_module(DNNBackendType backend_type) · 32 unmodified lines | |||
| 33 | { | 33 | { |
| 34 | DNNModule *dnn_module; | 34 | DNNModule *dnn_module; |
| 35 | 35 | ||
| 36 | dnn_module = av_malloc(sizeof(DNNModule)); | 36 | dnn_module = av_mallocz(sizeof(DNNModule)); |
| 37 | if(!dnn_module){ | 37 | if(!dnn_module){ |
| 38 | return NULL; | 38 | return NULL; |
| 39 | } | 39 | } |
| @@ -35,6 +35,13 @@ typedef enum {DNN_NATIVE, DNN_TF, DNN_OV} DNNBackendType; · 34 unmodified lines | |||
| 35 | 35 | ||
| 36 | typedef enum {DNN_FLOAT = 1, DNN_UINT8 = 4} DNNDataType; | 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 | typedef struct DNNData{ | 45 | typedef struct DNNData{ |
| 39 | void *data; | 46 | void *data; |
| 40 | DNNDataType dt; | 47 | DNNDataType dt; |
| @@ -69,6 +76,11 @@ typedef struct DNNModule{ · 28 unmodified lines | |||
| 69 | // Executes model with specified input and output. Returns DNN_ERROR otherwise. | 76 | // Executes model with specified input and output. Returns DNN_ERROR otherwise. |
| 70 | DNNReturnType (*execute_model)(const DNNModel *model, const char *input_name, AVFrame *in_frame, | 77 | DNNReturnType (*execute_model)(const DNNModel *model, const char *input_name, AVFrame *in_frame, |
| 71 | const char **output_names, uint32_t nb_output, AVFrame *out_frame); | 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 | // Frees memory allocated for model. | 84 | // Frees memory allocated for model. |
| 73 | void (*free_model)(DNNModel **model); | 85 | void (*free_model)(DNNModel **model); |
| 74 | } DNNModule; | 86 | } DNNModule; |