Go to the documentation of this file.
24 #define MAX_SUPPORTED_OUTPUTS_NB 4
28 char *
val, **parsed_vals =
NULL;
30 if (!expr || !val_sep || !separated_nb) {
42 parsed_vals[val_num] =
val;
50 parsed_vals[val_num] =
NULL;
51 *separated_nb = val_num;
77 if (!
ctx->model_filename) {
83 if (
ctx->model_inputname)
85 "inputname will be ignored.\n");
86 if (
ctx->model_outputnames)
88 "all outputname(s) will be ignored.\n");
90 }
else if (backend ==
DNN_TF) {
91 if (!
ctx->model_inputname) {
96 if (!
ctx->model_outputnames) {
103 if (!
ctx->dnn_module) {
107 if (!
ctx->dnn_module->load_model) {
112 if (
ctx->backend_options) {
116 "backend_configs is deprecated, please set backend options directly\n");
118 if (*(
const AVClass **)child == &
ctx->dnn_module->clazz) {
123 ctx->backend_options);
141 ctx->model->frame_pre_proc = pre_proc;
142 ctx->model->frame_post_proc = post_proc;
148 ctx->model->detect_post_proc = post_proc;
154 ctx->model->classify_post_proc = post_proc;
160 return ctx->model->get_input(
ctx->model,
input,
ctx->model_inputname);
165 char * output_name =
ctx->model_outputnames &&
ctx->backend_type !=
DNN_TH ?
166 ctx->model_outputnames[0] :
NULL;
167 return ctx->model->get_output(
ctx->model,
ctx->model_inputname, input_width, input_height,
168 (
const char *)output_name, output_width, output_height);
175 .output_names = (
const char **)
ctx->model_outputnames,
176 .nb_output =
ctx->nb_outputs,
177 .in_frame = in_frame,
178 .out_frame = out_frame,
180 return (
ctx->dnn_module->execute_model)(
ctx->model, &exec_params);
187 .input_name =
ctx->model_inputname,
188 .output_names = (
const char **)
ctx->model_outputnames,
189 .nb_output =
ctx->nb_outputs,
190 .in_frame = in_frame,
191 .out_frame = out_frame,
195 return (
ctx->dnn_module->execute_model)(
ctx->model, &class_params.
base);
200 return (
ctx->dnn_module->get_result)(
ctx->model, in_frame, out_frame);
205 return (
ctx->dnn_module->flush)(
ctx->model);
210 if (
ctx->dnn_module) {
211 (
ctx->dnn_module->free_model)(&
ctx->model);
213 if (
ctx->model_outputnames) {
214 for (
int i = 0;
i <
ctx->nb_outputs;
i++)
#define AV_LOG_WARNING
Something somehow does not look correct.
#define MAX_SUPPORTED_OUTPUTS_NB
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
This structure describes decoded (raw) audio or video data.
int av_opt_set_from_string(void *ctx, const char *opts, const char *const *shorthand, const char *key_val_sep, const char *pairs_sep)
Parse the key-value pairs list in opts.
int(* DetectPostProc)(AVFrame *frame, DNNData *output, uint32_t nb, AVFilterContext *filter_ctx)
static char ** separate_output_names(const char *expr, const char *val_sep, int *separated_nb)
void(* filter)(uint8_t *src, int stride, int qscale)
static FilteringContext * filter_ctx
int ff_dnn_filter_init_child_class(AVFilterContext *filter)
static double val(void *priv, double ch)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int ff_dnn_set_detect_post_proc(DnnContext *ctx, DetectPostProc post_proc)
DNNAsyncStatusType ff_dnn_get_result(DnnContext *ctx, AVFrame **in_frame, AVFrame **out_frame)
void ff_dnn_init_child_class(DnnContext *ctx)
int ff_dnn_get_input(DnnContext *ctx, DNNData *input)
Describe the class of an AVClass context structure.
void * ff_dnn_filter_child_next(void *obj, void *prev)
int ff_dnn_execute_model_classification(DnnContext *ctx, AVFrame *in_frame, AVFrame *out_frame, const char *target)
int ff_dnn_flush(DnnContext *ctx)
int(* ClassifyPostProc)(AVFrame *frame, DNNData *output, uint32_t bbox_index, AVFilterContext *filter_ctx)
const DNNModule * ff_get_dnn_module(DNNBackendType backend_type, void *log_ctx)
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
void * ff_dnn_child_next(DnnContext *obj, void *prev)
#define i(width, name, range_min, range_max)
int ff_dnn_set_frame_proc(DnnContext *ctx, FramePrePostProc pre_proc, FramePrePostProc post_proc)
void * av_calloc(size_t nmemb, size_t size)
int ff_dnn_get_output(DnnContext *ctx, int input_width, int input_height, int *output_width, int *output_height)
char * av_get_token(const char **buf, const char *term)
Unescape the given string until a non escaped terminating char, and return the token corresponding to...
int(* FramePrePostProc)(AVFrame *frame, DNNData *model, AVFilterContext *filter_ctx)
int ff_dnn_init(DnnContext *ctx, DNNFunctionType func_type, AVFilterContext *filter_ctx)
void ff_dnn_uninit(DnnContext *ctx)
int ff_dnn_execute_model(DnnContext *ctx, AVFrame *in_frame, AVFrame *out_frame)
int ff_dnn_set_classify_post_proc(DnnContext *ctx, ClassifyPostProc post_proc)