[FFmpeg-devel] avfilter/sr: process and output message when load_model is NULL

Submitted by Steven Liu on Sept. 24, 2018, 3:35 a.m.

Details

Message ID 20180924033528.28815-1-lq@chinaffmpeg.org
State New
Headers show

Commit Message

Steven Liu Sept. 24, 2018, 3:35 a.m.
fix ticket: 7455

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavfilter/dnn_interface.c | 4 ++++
 libavfilter/vf_sr.c         | 7 ++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

Comments

Paul B Mahol Sept. 24, 2018, 12:23 p.m.
On 9/24/18, Steven Liu <lq@chinaffmpeg.org> wrote:
> fix ticket: 7455
>
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>  libavfilter/dnn_interface.c | 4 ++++
>  libavfilter/vf_sr.c         | 7 ++++++-
>  2 files changed, 10 insertions(+), 1 deletion(-)
>

probably ok.
Pedro Arthur Sept. 24, 2018, 1:52 p.m.
2018-09-24 0:35 GMT-03:00 Steven Liu <lq@chinaffmpeg.org>:

> fix ticket: 7455
>
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>  libavfilter/dnn_interface.c | 4 ++++
>  libavfilter/vf_sr.c         | 7 ++++++-
>  2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/dnn_interface.c b/libavfilter/dnn_interface.c
> index 78d7c5cf22..792c280c53 100644
> --- a/libavfilter/dnn_interface.c
> +++ b/libavfilter/dnn_interface.c
> @@ -52,6 +52,10 @@ DNNModule *ff_get_dnn_module(DNNBackendType
> backend_type)
>          av_freep(&dnn_module);
>          return NULL;
>      #endif
> +    default:
> +        av_log(NULL, AV_LOG_ERROR, "Module backend_type is not native or
> tensorflow\n");
> +        av_freep(&dnn_module);
> +        return NULL;
>      }
>
 It is missing a break in the DNN_TF case, the rest looks good.

Thanks.
Steven Liu Sept. 24, 2018, 2 p.m.
> On Sep 24, 2018, at 21:52, Pedro Arthur <bygrandao@gmail.com> wrote:
> 
> 2018-09-24 0:35 GMT-03:00 Steven Liu <lq@chinaffmpeg.org>:
> 
>> fix ticket: 7455
>> 
>> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
>> ---
>> libavfilter/dnn_interface.c | 4 ++++
>> libavfilter/vf_sr.c         | 7 ++++++-
>> 2 files changed, 10 insertions(+), 1 deletion(-)
>> 
>> diff --git a/libavfilter/dnn_interface.c b/libavfilter/dnn_interface.c
>> index 78d7c5cf22..792c280c53 100644
>> --- a/libavfilter/dnn_interface.c
>> +++ b/libavfilter/dnn_interface.c
>> @@ -52,6 +52,10 @@ DNNModule *ff_get_dnn_module(DNNBackendType
>> backend_type)
>>         av_freep(&dnn_module);
>>         return NULL;
>>     #endif
>> +    default:
>> +        av_log(NULL, AV_LOG_ERROR, "Module backend_type is not native or
>> tensorflow\n");
>> +        av_freep(&dnn_module);
>> +        return NULL;
>>     }
>> 
> It is missing a break in the DNN_TF case, the rest looks good.
Fixed locally.
> 
> Thanks.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Thanks
Steven
Steven Liu Sept. 25, 2018, 1:58 p.m.
> On Sep 24, 2018, at 22:00, Steven Liu <lq@chinaffmpeg.org> wrote:
> 
> 
> 
>> On Sep 24, 2018, at 21:52, Pedro Arthur <bygrandao@gmail.com> wrote:
>> 
>> 2018-09-24 0:35 GMT-03:00 Steven Liu <lq@chinaffmpeg.org>:
>> 
>>> fix ticket: 7455
>>> 
>>> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
>>> ---
>>> libavfilter/dnn_interface.c | 4 ++++
>>> libavfilter/vf_sr.c         | 7 ++++++-
>>> 2 files changed, 10 insertions(+), 1 deletion(-)
>>> 
>>> diff --git a/libavfilter/dnn_interface.c b/libavfilter/dnn_interface.c
>>> index 78d7c5cf22..792c280c53 100644
>>> --- a/libavfilter/dnn_interface.c
>>> +++ b/libavfilter/dnn_interface.c
>>> @@ -52,6 +52,10 @@ DNNModule *ff_get_dnn_module(DNNBackendType
>>> backend_type)
>>>        av_freep(&dnn_module);
>>>        return NULL;
>>>    #endif
>>> +    default:
>>> +        av_log(NULL, AV_LOG_ERROR, "Module backend_type is not native or
>>> tensorflow\n");
>>> +        av_freep(&dnn_module);
>>> +        return NULL;
>>>    }
>>> 
>> It is missing a break in the DNN_TF case, the rest looks good.
> Fixed locally.
>> 
>> Thanks.
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> Thanks
> Steven

Pushed

Thanks
Steven

Patch hide | download patch | download mbox

diff --git a/libavfilter/dnn_interface.c b/libavfilter/dnn_interface.c
index 78d7c5cf22..792c280c53 100644
--- a/libavfilter/dnn_interface.c
+++ b/libavfilter/dnn_interface.c
@@ -52,6 +52,10 @@  DNNModule *ff_get_dnn_module(DNNBackendType backend_type)
         av_freep(&dnn_module);
         return NULL;
     #endif
+    default:
+        av_log(NULL, AV_LOG_ERROR, "Module backend_type is not native or tensorflow\n");
+        av_freep(&dnn_module);
+        return NULL;
     }
 
     return dnn_module;
diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c
index 077ccc799c..6423d2ea11 100644
--- a/libavfilter/vf_sr.c
+++ b/libavfilter/vf_sr.c
@@ -75,7 +75,12 @@  static av_cold int init(AVFilterContext *context)
         return AVERROR(EIO);
     }
     else{
-        sr_context->model = (sr_context->dnn_module->load_model)(sr_context->model_filename);
+        if (!sr_context->dnn_module->load_model) {
+            av_log(context, AV_LOG_ERROR, "load_model for network was not specified\n");
+            return AVERROR(EIO);
+        } else {
+            sr_context->model = (sr_context->dnn_module->load_model)(sr_context->model_filename);
+        }
     }
     if (!sr_context->model){
         av_log(context, AV_LOG_ERROR, "could not load DNN model\n");