[FFmpeg-devel,3/7] libavfilter: Fixes warnings for unused variables in dnn_srcnn.h, dnn_espcn.h, dnn_backend_tf.c.

Submitted by Sergey Lavrushkin on Aug. 6, 2018, 9:13 p.m.

Details

Message ID CAAeE=qpSjRb1r1zmLUr3xfMm=OqgfJoTc3LsBBYrcMMPewNmTg@mail.gmail.com
State New
Headers show

Commit Message

Sergey Lavrushkin Aug. 6, 2018, 9:13 p.m.
Made variables static.

2018-08-06 21:19 GMT+03:00 Pedro Arthur <bygrandao@gmail.com>:

> 2018-08-02 15:52 GMT-03:00 Sergey Lavrushkin <dualfal@gmail.com>:
> > ---
> >  libavfilter/dnn_backend_tf.c | 64 ++++++++++++++++++++++++++++++
> +++++++++++++-
> >  libavfilter/dnn_espcn.h      | 37 -------------------------
> >  libavfilter/dnn_srcnn.h      | 35 ------------------------
> >  3 files changed, 63 insertions(+), 73 deletions(-)
> >
> > diff --git a/libavfilter/dnn_backend_tf.c b/libavfilter/dnn_backend_tf.c
> > index 6307c794a5..7a4ad72d27 100644
> > --- a/libavfilter/dnn_backend_tf.c
> > +++ b/libavfilter/dnn_backend_tf.c
> > @@ -374,9 +374,71 @@ DNNModel *ff_dnn_load_default_model_tf(DNNDefaultModel
> model_type)
> >      TFModel *tf_model = NULL;
> >      TF_OperationDescription *op_desc;
> >      TF_Operation *op;
> > -    TF_Operation *const_ops_buffer[6];
> >      TF_Output input;
> >      int64_t input_shape[] = {1, -1, -1, 1};
> > +    const char tanh[] = "Tanh";
> > +    const char sigmoid[] = "Sigmoid";
> > +    const char relu[] = "Relu";
> > +
> > +    const float *srcnn_consts[] = {
> > +        srcnn_conv1_kernel,
> > +        srcnn_conv1_bias,
> > +        srcnn_conv2_kernel,
> > +        srcnn_conv2_bias,
> > +        srcnn_conv3_kernel,
> > +        srcnn_conv3_bias
> > +    };
> > +    const long int *srcnn_consts_dims[] = {
> > +        srcnn_conv1_kernel_dims,
> > +        srcnn_conv1_bias_dims,
> > +        srcnn_conv2_kernel_dims,
> > +        srcnn_conv2_bias_dims,
> > +        srcnn_conv3_kernel_dims,
> > +        srcnn_conv3_bias_dims
> > +    };
> > +    const int srcnn_consts_dims_len[] = {
> > +        4,
> > +        1,
> > +        4,
> > +        1,
> > +        4,
> > +        1
> > +    };
> > +    const char *srcnn_activations[] = {
> > +        relu,
> > +        relu,
> > +        relu
> > +    };
> > +
> > +    const float *espcn_consts[] = {
> > +        espcn_conv1_kernel,
> > +        espcn_conv1_bias,
> > +        espcn_conv2_kernel,
> > +        espcn_conv2_bias,
> > +        espcn_conv3_kernel,
> > +        espcn_conv3_bias
> > +    };
> > +    const long int *espcn_consts_dims[] = {
> > +        espcn_conv1_kernel_dims,
> > +        espcn_conv1_bias_dims,
> > +        espcn_conv2_kernel_dims,
> > +        espcn_conv2_bias_dims,
> > +        espcn_conv3_kernel_dims,
> > +        espcn_conv3_bias_dims
> > +    };
> > +    const int espcn_consts_dims_len[] = {
> > +        4,
> > +        1,
> > +        4,
> > +        1,
> > +        4,
> > +        1
> > +    };
> > +    const char *espcn_activations[] = {
> > +        tanh,
> > +        tanh,
> > +        sigmoid
> > +    };
> >
> >      input.index = 0;
> >
> > diff --git a/libavfilter/dnn_espcn.h b/libavfilter/dnn_espcn.h
> > index a0dd61cd0d..9344aa90fe 100644
> > --- a/libavfilter/dnn_espcn.h
> > +++ b/libavfilter/dnn_espcn.h
> > @@ -5398,41 +5398,4 @@ static const long int espcn_conv3_bias_dims[] = {
> >      4
> >  };
> >
> > -static const float *espcn_consts[] = {
> > -    espcn_conv1_kernel,
> > -    espcn_conv1_bias,
> > -    espcn_conv2_kernel,
> > -    espcn_conv2_bias,
> > -    espcn_conv3_kernel,
> > -    espcn_conv3_bias
> > -};
> > -
> > -static const long int *espcn_consts_dims[] = {
> > -    espcn_conv1_kernel_dims,
> > -    espcn_conv1_bias_dims,
> > -    espcn_conv2_kernel_dims,
> > -    espcn_conv2_bias_dims,
> > -    espcn_conv3_kernel_dims,
> > -    espcn_conv3_bias_dims
> > -};
> > -
> > -static const int espcn_consts_dims_len[] = {
> > -    4,
> > -    1,
> > -    4,
> > -    1,
> > -    4,
> > -    1
> > -};
> > -
> > -static const char espcn_tanh[] = "Tanh";
> > -
> > -static const char espcn_sigmoid[] = "Sigmoid";
> > -
> > -static const char *espcn_activations[] = {
> > -    espcn_tanh,
> > -    espcn_tanh,
> > -    espcn_sigmoid
> > -};
> > -
> >  #endif
> > diff --git a/libavfilter/dnn_srcnn.h b/libavfilter/dnn_srcnn.h
> > index 26143654b8..4f5332ce18 100644
> > --- a/libavfilter/dnn_srcnn.h
> > +++ b/libavfilter/dnn_srcnn.h
> > @@ -2110,39 +2110,4 @@ static const long int srcnn_conv3_bias_dims[] = {
> >      1
> >  };
> >
> > -static const float *srcnn_consts[] = {
> > -    srcnn_conv1_kernel,
> > -    srcnn_conv1_bias,
> > -    srcnn_conv2_kernel,
> > -    srcnn_conv2_bias,
> > -    srcnn_conv3_kernel,
> > -    srcnn_conv3_bias
> > -};
> > -
> > -static const long int *srcnn_consts_dims[] = {
> > -    srcnn_conv1_kernel_dims,
> > -    srcnn_conv1_bias_dims,
> > -    srcnn_conv2_kernel_dims,
> > -    srcnn_conv2_bias_dims,
> > -    srcnn_conv3_kernel_dims,
> > -    srcnn_conv3_bias_dims
> > -};
> > -
> > -static const int srcnn_consts_dims_len[] = {
> > -    4,
> > -    1,
> > -    4,
> > -    1,
> > -    4,
> > -    1
> > -};
> > -
> > -static const char srcnn_relu[] = "Relu";
> > -
> > -static const char *srcnn_activations[] = {
> > -    srcnn_relu,
> > -    srcnn_relu,
> > -    srcnn_relu
> > -};
> > -
> >  #endif
> > --
> > 2.14.1
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
> LGTM.
> I'll push it by tomorrow.
>

Comments

Pedro Arthur Aug. 7, 2018, 4:31 p.m.
2018-08-06 18:13 GMT-03:00 Sergey Lavrushkin <dualfal@gmail.com>:
> Made variables static.
>
> 2018-08-06 21:19 GMT+03:00 Pedro Arthur <bygrandao@gmail.com>:
>
>> 2018-08-02 15:52 GMT-03:00 Sergey Lavrushkin <dualfal@gmail.com>:
>> > ---
>> >  libavfilter/dnn_backend_tf.c | 64 ++++++++++++++++++++++++++++++
>> +++++++++++++-
>> >  libavfilter/dnn_espcn.h      | 37 -------------------------
>> >  libavfilter/dnn_srcnn.h      | 35 ------------------------
>> >  3 files changed, 63 insertions(+), 73 deletions(-)
>> >
>> > diff --git a/libavfilter/dnn_backend_tf.c b/libavfilter/dnn_backend_tf.c
>> > index 6307c794a5..7a4ad72d27 100644
>> > --- a/libavfilter/dnn_backend_tf.c
>> > +++ b/libavfilter/dnn_backend_tf.c
>> > @@ -374,9 +374,71 @@ DNNModel *ff_dnn_load_default_model_tf(DNNDefaultModel
>> model_type)
>> >      TFModel *tf_model = NULL;
>> >      TF_OperationDescription *op_desc;
>> >      TF_Operation *op;
>> > -    TF_Operation *const_ops_buffer[6];
>> >      TF_Output input;
>> >      int64_t input_shape[] = {1, -1, -1, 1};
>> > +    const char tanh[] = "Tanh";
>> > +    const char sigmoid[] = "Sigmoid";
>> > +    const char relu[] = "Relu";
>> > +
>> > +    const float *srcnn_consts[] = {
>> > +        srcnn_conv1_kernel,
>> > +        srcnn_conv1_bias,
>> > +        srcnn_conv2_kernel,
>> > +        srcnn_conv2_bias,
>> > +        srcnn_conv3_kernel,
>> > +        srcnn_conv3_bias
>> > +    };
>> > +    const long int *srcnn_consts_dims[] = {
>> > +        srcnn_conv1_kernel_dims,
>> > +        srcnn_conv1_bias_dims,
>> > +        srcnn_conv2_kernel_dims,
>> > +        srcnn_conv2_bias_dims,
>> > +        srcnn_conv3_kernel_dims,
>> > +        srcnn_conv3_bias_dims
>> > +    };
>> > +    const int srcnn_consts_dims_len[] = {
>> > +        4,
>> > +        1,
>> > +        4,
>> > +        1,
>> > +        4,
>> > +        1
>> > +    };
>> > +    const char *srcnn_activations[] = {
>> > +        relu,
>> > +        relu,
>> > +        relu
>> > +    };
>> > +
>> > +    const float *espcn_consts[] = {
>> > +        espcn_conv1_kernel,
>> > +        espcn_conv1_bias,
>> > +        espcn_conv2_kernel,
>> > +        espcn_conv2_bias,
>> > +        espcn_conv3_kernel,
>> > +        espcn_conv3_bias
>> > +    };
>> > +    const long int *espcn_consts_dims[] = {
>> > +        espcn_conv1_kernel_dims,
>> > +        espcn_conv1_bias_dims,
>> > +        espcn_conv2_kernel_dims,
>> > +        espcn_conv2_bias_dims,
>> > +        espcn_conv3_kernel_dims,
>> > +        espcn_conv3_bias_dims
>> > +    };
>> > +    const int espcn_consts_dims_len[] = {
>> > +        4,
>> > +        1,
>> > +        4,
>> > +        1,
>> > +        4,
>> > +        1
>> > +    };
>> > +    const char *espcn_activations[] = {
>> > +        tanh,
>> > +        tanh,
>> > +        sigmoid
>> > +    };
>> >
>> >      input.index = 0;
>> >
>> > diff --git a/libavfilter/dnn_espcn.h b/libavfilter/dnn_espcn.h
>> > index a0dd61cd0d..9344aa90fe 100644
>> > --- a/libavfilter/dnn_espcn.h
>> > +++ b/libavfilter/dnn_espcn.h
>> > @@ -5398,41 +5398,4 @@ static const long int espcn_conv3_bias_dims[] = {
>> >      4
>> >  };
>> >
>> > -static const float *espcn_consts[] = {
>> > -    espcn_conv1_kernel,
>> > -    espcn_conv1_bias,
>> > -    espcn_conv2_kernel,
>> > -    espcn_conv2_bias,
>> > -    espcn_conv3_kernel,
>> > -    espcn_conv3_bias
>> > -};
>> > -
>> > -static const long int *espcn_consts_dims[] = {
>> > -    espcn_conv1_kernel_dims,
>> > -    espcn_conv1_bias_dims,
>> > -    espcn_conv2_kernel_dims,
>> > -    espcn_conv2_bias_dims,
>> > -    espcn_conv3_kernel_dims,
>> > -    espcn_conv3_bias_dims
>> > -};
>> > -
>> > -static const int espcn_consts_dims_len[] = {
>> > -    4,
>> > -    1,
>> > -    4,
>> > -    1,
>> > -    4,
>> > -    1
>> > -};
>> > -
>> > -static const char espcn_tanh[] = "Tanh";
>> > -
>> > -static const char espcn_sigmoid[] = "Sigmoid";
>> > -
>> > -static const char *espcn_activations[] = {
>> > -    espcn_tanh,
>> > -    espcn_tanh,
>> > -    espcn_sigmoid
>> > -};
>> > -
>> >  #endif
>> > diff --git a/libavfilter/dnn_srcnn.h b/libavfilter/dnn_srcnn.h
>> > index 26143654b8..4f5332ce18 100644
>> > --- a/libavfilter/dnn_srcnn.h
>> > +++ b/libavfilter/dnn_srcnn.h
>> > @@ -2110,39 +2110,4 @@ static const long int srcnn_conv3_bias_dims[] = {
>> >      1
>> >  };
>> >
>> > -static const float *srcnn_consts[] = {
>> > -    srcnn_conv1_kernel,
>> > -    srcnn_conv1_bias,
>> > -    srcnn_conv2_kernel,
>> > -    srcnn_conv2_bias,
>> > -    srcnn_conv3_kernel,
>> > -    srcnn_conv3_bias
>> > -};
>> > -
>> > -static const long int *srcnn_consts_dims[] = {
>> > -    srcnn_conv1_kernel_dims,
>> > -    srcnn_conv1_bias_dims,
>> > -    srcnn_conv2_kernel_dims,
>> > -    srcnn_conv2_bias_dims,
>> > -    srcnn_conv3_kernel_dims,
>> > -    srcnn_conv3_bias_dims
>> > -};
>> > -
>> > -static const int srcnn_consts_dims_len[] = {
>> > -    4,
>> > -    1,
>> > -    4,
>> > -    1,
>> > -    4,
>> > -    1
>> > -};
>> > -
>> > -static const char srcnn_relu[] = "Relu";
>> > -
>> > -static const char *srcnn_activations[] = {
>> > -    srcnn_relu,
>> > -    srcnn_relu,
>> > -    srcnn_relu
>> > -};
>> > -
>> >  #endif
>> > --
>> > 2.14.1
>> >
>> > _______________________________________________
>> > ffmpeg-devel mailing list
>> > ffmpeg-devel@ffmpeg.org
>> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>>
>> LGTM.
>> I'll push it by tomorrow.
>>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

Patch pushed!

Patch hide | download patch | download mbox

From 88d476956c86f0b55d7610c417b3f6c2f516f70e Mon Sep 17 00:00:00 2001
From: Sergey Lavrushkin <dualfal@gmail.com>
Date: Sat, 28 Jul 2018 12:55:02 +0300
Subject: [PATCH 3/9] libavfilter: Fixes warnings for unused variables in
 dnn_srcnn.h, dnn_espcn.h, dnn_backend_tf.c.

---
 libavfilter/dnn_backend_tf.c | 66 ++++++++++++++++++++++++++++++++++++++++++--
 libavfilter/dnn_espcn.h      | 37 -------------------------
 libavfilter/dnn_srcnn.h      | 35 -----------------------
 3 files changed, 64 insertions(+), 74 deletions(-)

diff --git a/libavfilter/dnn_backend_tf.c b/libavfilter/dnn_backend_tf.c
index 6528a2a390..bd21137a8a 100644
--- a/libavfilter/dnn_backend_tf.c
+++ b/libavfilter/dnn_backend_tf.c
@@ -375,9 +375,71 @@  DNNModel *ff_dnn_load_default_model_tf(DNNDefaultModel model_type)
     TFModel *tf_model = NULL;
     TF_OperationDescription *op_desc;
     TF_Operation *op;
-    TF_Operation *const_ops_buffer[6];
     TF_Output input;
-    int64_t input_shape[] = {1, -1, -1, 1};
+    static const int64_t input_shape[] = {1, -1, -1, 1};
+    static const char tanh[] = "Tanh";
+    static const char sigmoid[] = "Sigmoid";
+    static const char relu[] = "Relu";
+
+    static const float *srcnn_consts[] = {
+        srcnn_conv1_kernel,
+        srcnn_conv1_bias,
+        srcnn_conv2_kernel,
+        srcnn_conv2_bias,
+        srcnn_conv3_kernel,
+        srcnn_conv3_bias
+    };
+    static const long int *srcnn_consts_dims[] = {
+        srcnn_conv1_kernel_dims,
+        srcnn_conv1_bias_dims,
+        srcnn_conv2_kernel_dims,
+        srcnn_conv2_bias_dims,
+        srcnn_conv3_kernel_dims,
+        srcnn_conv3_bias_dims
+    };
+    static const int srcnn_consts_dims_len[] = {
+        4,
+        1,
+        4,
+        1,
+        4,
+        1
+    };
+    static const char *srcnn_activations[] = {
+        relu,
+        relu,
+        relu
+    };
+
+    static const float *espcn_consts[] = {
+        espcn_conv1_kernel,
+        espcn_conv1_bias,
+        espcn_conv2_kernel,
+        espcn_conv2_bias,
+        espcn_conv3_kernel,
+        espcn_conv3_bias
+    };
+    static const long int *espcn_consts_dims[] = {
+        espcn_conv1_kernel_dims,
+        espcn_conv1_bias_dims,
+        espcn_conv2_kernel_dims,
+        espcn_conv2_bias_dims,
+        espcn_conv3_kernel_dims,
+        espcn_conv3_bias_dims
+    };
+    static const int espcn_consts_dims_len[] = {
+        4,
+        1,
+        4,
+        1,
+        4,
+        1
+    };
+    static const char *espcn_activations[] = {
+        tanh,
+        tanh,
+        sigmoid
+    };
 
     input.index = 0;
 
diff --git a/libavfilter/dnn_espcn.h b/libavfilter/dnn_espcn.h
index a0dd61cd0d..9344aa90fe 100644
--- a/libavfilter/dnn_espcn.h
+++ b/libavfilter/dnn_espcn.h
@@ -5398,41 +5398,4 @@  static const long int espcn_conv3_bias_dims[] = {
     4
 };
 
-static const float *espcn_consts[] = {
-    espcn_conv1_kernel,
-    espcn_conv1_bias,
-    espcn_conv2_kernel,
-    espcn_conv2_bias,
-    espcn_conv3_kernel,
-    espcn_conv3_bias
-};
-
-static const long int *espcn_consts_dims[] = {
-    espcn_conv1_kernel_dims,
-    espcn_conv1_bias_dims,
-    espcn_conv2_kernel_dims,
-    espcn_conv2_bias_dims,
-    espcn_conv3_kernel_dims,
-    espcn_conv3_bias_dims
-};
-
-static const int espcn_consts_dims_len[] = {
-    4,
-    1,
-    4,
-    1,
-    4,
-    1
-};
-
-static const char espcn_tanh[] = "Tanh";
-
-static const char espcn_sigmoid[] = "Sigmoid";
-
-static const char *espcn_activations[] = {
-    espcn_tanh,
-    espcn_tanh,
-    espcn_sigmoid
-};
-
 #endif
diff --git a/libavfilter/dnn_srcnn.h b/libavfilter/dnn_srcnn.h
index 26143654b8..4f5332ce18 100644
--- a/libavfilter/dnn_srcnn.h
+++ b/libavfilter/dnn_srcnn.h
@@ -2110,39 +2110,4 @@  static const long int srcnn_conv3_bias_dims[] = {
     1
 };
 
-static const float *srcnn_consts[] = {
-    srcnn_conv1_kernel,
-    srcnn_conv1_bias,
-    srcnn_conv2_kernel,
-    srcnn_conv2_bias,
-    srcnn_conv3_kernel,
-    srcnn_conv3_bias
-};
-
-static const long int *srcnn_consts_dims[] = {
-    srcnn_conv1_kernel_dims,
-    srcnn_conv1_bias_dims,
-    srcnn_conv2_kernel_dims,
-    srcnn_conv2_bias_dims,
-    srcnn_conv3_kernel_dims,
-    srcnn_conv3_bias_dims
-};
-
-static const int srcnn_consts_dims_len[] = {
-    4,
-    1,
-    4,
-    1,
-    4,
-    1
-};
-
-static const char srcnn_relu[] = "Relu";
-
-static const char *srcnn_activations[] = {
-    srcnn_relu,
-    srcnn_relu,
-    srcnn_relu
-};
-
 #endif
-- 
2.14.1