diff options
author | Guo, Yejun <yejun.guo@intel.com> | 2020-08-13 16:19:48 +0800 |
---|---|---|
committer | Guo, Yejun <yejun.guo@intel.com> | 2020-08-25 09:02:59 +0800 |
commit | 0f7a99e37ae52f9ecdc4c81195c14b03f5be3dfd (patch) | |
tree | 00b5828f4f284ec9e363708ed89d4b2294e62a52 /libavfilter/vf_sr.c | |
parent | b61376bdee61c08732105fa331eb076497eface9 (diff) |
dnn: move output name from DNNModel.set_input_output to DNNModule.execute_model
currently, output is set both at DNNModel.set_input_output and
DNNModule.execute_model, it makes sense that the output name is
provided at model inference time so all the output info is set
at a single place.
and so DNNModel.set_input_output is renamed to DNNModel.set_input
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Diffstat (limited to 'libavfilter/vf_sr.c')
-rw-r--r-- | libavfilter/vf_sr.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c index 1dee317372..37e1107145 100644 --- a/libavfilter/vf_sr.c +++ b/libavfilter/vf_sr.c @@ -124,13 +124,13 @@ static int config_props(AVFilterLink *inlink) sr_context->input.height = inlink->h * sr_context->scale_factor; sr_context->input.channels = 1; - result = (sr_context->model->set_input_output)(sr_context->model->model, &sr_context->input, "x", &model_output_name, 1); + result = (sr_context->model->set_input)(sr_context->model->model, &sr_context->input, "x"); if (result != DNN_SUCCESS){ av_log(context, AV_LOG_ERROR, "could not set input and output for the model\n"); return AVERROR(EIO); } - result = (sr_context->dnn_module->execute_model)(sr_context->model, &sr_context->output, 1); + result = (sr_context->dnn_module->execute_model)(sr_context->model, &sr_context->output, &model_output_name, 1); if (result != DNN_SUCCESS){ av_log(context, AV_LOG_ERROR, "failed to execute loaded model\n"); return AVERROR(EIO); @@ -139,12 +139,12 @@ static int config_props(AVFilterLink *inlink) if (sr_context->input.height != sr_context->output.height || sr_context->input.width != sr_context->output.width){ sr_context->input.width = inlink->w; sr_context->input.height = inlink->h; - result = (sr_context->model->set_input_output)(sr_context->model->model, &sr_context->input, "x", &model_output_name, 1); + result = (sr_context->model->set_input)(sr_context->model->model, &sr_context->input, "x"); if (result != DNN_SUCCESS){ av_log(context, AV_LOG_ERROR, "could not set input and output for the model\n"); return AVERROR(EIO); } - result = (sr_context->dnn_module->execute_model)(sr_context->model, &sr_context->output, 1); + result = (sr_context->dnn_module->execute_model)(sr_context->model, &sr_context->output, &model_output_name, 1); if (result != DNN_SUCCESS){ av_log(context, AV_LOG_ERROR, "failed to execute loaded model\n"); return AVERROR(EIO); @@ -203,6 +203,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) AVFilterLink *outlink = context->outputs[0]; AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h); DNNReturnType dnn_result; + const char *model_output_name = "y"; if (!out){ av_log(context, AV_LOG_ERROR, "could not allocate memory for output frame\n"); @@ -233,7 +234,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } av_frame_free(&in); - dnn_result = (sr_context->dnn_module->execute_model)(sr_context->model, &sr_context->output, 1); + dnn_result = (sr_context->dnn_module->execute_model)(sr_context->model, &sr_context->output, &model_output_name, 1); if (dnn_result != DNN_SUCCESS){ av_log(context, AV_LOG_ERROR, "failed to execute loaded model\n"); return AVERROR(EIO); |