lavfi/dnn: refine code for frame pre/proc processing

This commit is contained in:
Guo, Yejun
2021-03-01 19:23:20 +08:00
parent d2ccbc966b
commit 59021d79a2
6 changed files with 24 additions and 14 deletions

View File

@@ -63,6 +63,8 @@ typedef struct DNNData{
DNNColorOrder order;
} DNNData;
typedef int (*FramePrePostProc)(AVFrame *frame, DNNData *model, AVFilterContext *filter_ctx);
typedef struct DNNModel{
// Stores model that can be different for different backends.
void *model;
@@ -80,10 +82,10 @@ 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;
} DNNModel;
// Stores pointers to functions for loading, executing, freeing DNN models for one of the backends.