X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Fdnn_interface.h;h=057005f47e7294d779c2d4716400063b51bd5d0f;hb=2a672a93d248afc2e9199cef50930c598ff34ad5;hp=a69717ae6240efd5bf5534aad43862fe19c4f001;hpb=94d98330ed6c5562341315c26c1af92771a2e6de;p=ffmpeg diff --git a/libavfilter/dnn_interface.h b/libavfilter/dnn_interface.h index a69717ae624..057005f47e7 100644 --- a/libavfilter/dnn_interface.h +++ b/libavfilter/dnn_interface.h @@ -26,11 +26,19 @@ #ifndef AVFILTER_DNN_INTERFACE_H #define AVFILTER_DNN_INTERFACE_H +#include + typedef enum {DNN_SUCCESS, DNN_ERROR} DNNReturnType; typedef enum {DNN_NATIVE, DNN_TF} DNNBackendType; -typedef enum {DNN_SRCNN, DNN_ESPCN} DNNDefaultModel; +typedef enum {DNN_FLOAT = 1, DNN_UINT8 = 4} DNNDataType; + +typedef struct DNNInputData{ + void *data; + DNNDataType dt; + int width, height, channels; +} DNNInputData; typedef struct DNNData{ float *data; @@ -40,19 +48,17 @@ typedef struct DNNData{ typedef struct DNNModel{ // Stores model that can be different for different backends. void *model; - // Sets model input and output, while allocating additional memory for intermediate calculations. + // Sets model input and output. // Should be called at least once before model execution. - DNNReturnType (*set_input_output)(void *model, DNNData *input, DNNData *output); + DNNReturnType (*set_input_output)(void *model, DNNInputData *input, const char *input_name, const char **output_names, uint32_t nb_output); } DNNModel; // Stores pointers to functions for loading, executing, freeing DNN models for one of the backends. typedef struct DNNModule{ // Loads model and parameters from given file. Returns NULL if it is not possible. DNNModel *(*load_model)(const char *model_filename); - // Loads one of the default models - DNNModel *(*load_default_model)(DNNDefaultModel model_type); // Executes model with specified input and output. Returns DNN_ERROR otherwise. - DNNReturnType (*execute_model)(const DNNModel *model); + DNNReturnType (*execute_model)(const DNNModel *model, DNNData *outputs, uint32_t nb_output); // Frees memory allocated for model. void (*free_model)(DNNModel **model); } DNNModule;