]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/dnn_interface.h
avcodec/mjpegdec: fix SOF check in EOI
[ffmpeg] / libavfilter / dnn_interface.h
index 2fb9b15676157570b52e69118af22dccb8d86d4e..ae5a488341b777f387ea058bf2af911e280908ed 100644 (file)
@@ -36,6 +36,11 @@ typedef enum {DNN_NATIVE, DNN_TF, DNN_OV} DNNBackendType;
 
 typedef enum {DNN_FLOAT = 1, DNN_UINT8 = 4} DNNDataType;
 
+typedef enum {
+    DCO_NONE,
+    DCO_BGR,
+} DNNColorOrder;
+
 typedef enum {
     DAST_FAIL,              // something wrong
     DAST_EMPTY_QUEUE,       // no more inference result to get
@@ -52,10 +57,15 @@ typedef enum {
 
 typedef struct DNNData{
     void *data;
-    DNNDataType dt;
     int width, height, channels;
+    // dt and order together decide the color format
+    DNNDataType dt;
+    DNNColorOrder order;
 } DNNData;
 
+typedef int (*FramePrePostProc)(AVFrame *frame, DNNData *model, AVFilterContext *filter_ctx);
+typedef int (*DetectPostProc)(AVFrame *frame, DNNData *output, uint32_t nb, AVFilterContext *filter_ctx);
+
 typedef struct DNNModel{
     // Stores model that can be different for different backends.
     void *model;
@@ -73,10 +83,12 @@ typedef struct DNNModel{
                                 const char *output_name, int *output_width, int *output_height);
     // set the pre process to transfer data from AVFrame to DNNData
     // the default implementation within DNN is used if it is not provided by the filter
-    int (*pre_proc)(AVFrame *frame_in, DNNData *model_input, AVFilterContext *filter_ctx);
+    FramePrePostProc frame_pre_proc;
     // set the post process to transfer data from DNNData to AVFrame
     // the default implementation within DNN is used if it is not provided by the filter
-    int (*post_proc)(AVFrame *frame_out, DNNData *model_output, AVFilterContext *filter_ctx);
+    FramePrePostProc frame_post_proc;
+    // set the post process to interpret detect result from DNNData
+    DetectPostProc detect_post_proc;
 } DNNModel;
 
 // Stores pointers to functions for loading, executing, freeing DNN models for one of the backends.