diff mbox

[FFmpeg-devel,V1,3/5] lavfi/dnn/dnn_backend_native: Refine the coding style

Message ID 1566219667-22805-3-git-send-email-mypopydev@gmail.com
State New
Headers show

Commit Message

Jun Zhao Aug. 19, 2019, 1:01 p.m. UTC
From: Jun Zhao <barryjzhao@tencent.com>

    We perfer the coding style like:

    /* some stuff */
    if (error) {
        /* error handling */
        return -(errorcode);
    }
    /* normal actions */
    do_something()

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
 libavfilter/dnn/dnn_backend_native.c |   24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

Comments

Guo, Yejun Aug. 20, 2019, 1:31 a.m. UTC | #1
> -----Original Message-----

> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf Of

> Jun Zhao

> Sent: Monday, August 19, 2019 9:01 PM

> To: ffmpeg-devel@ffmpeg.org

> Cc: Jun Zhao <barryjzhao@tencent.com>

> Subject: [FFmpeg-devel] [PATCH V1 3/5] lavfi/dnn/dnn_backend_native: Refine

> the coding style

> 

> From: Jun Zhao <barryjzhao@tencent.com>

> 

>     We perfer the coding style like:

> 

>     /* some stuff */

>     if (error) {

>         /* error handling */

>         return -(errorcode);

>     }

>     /* normal actions */

>     do_something()


as mentioned in http://ffmpeg.org/pipermail/ffmpeg-devel/2019-August/247887.html, I've finished
some more patches at https://github.com/guoyejun/ffmpeg/commits/dnn0809 waiting for send out set by set.

The next patch I plan to send is https://github.com/guoyejun/ffmpeg/commit/02567319a640bb3d150917dfc6cf5e047a4bb776,
which includes the changes in this patch, and it includes more changes to support operand concept in native mode.

It would be convenient for me to not split that patch, could this patch be ignored? thanks.

> 

> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>

> ---

>  libavfilter/dnn/dnn_backend_native.c |   24 +++++++++++-------------

>  1 files changed, 11 insertions(+), 13 deletions(-)

> 

> diff --git a/libavfilter/dnn/dnn_backend_native.c

> b/libavfilter/dnn/dnn_backend_native.c

> index 09c583b..7b489d0 100644

> --- a/libavfilter/dnn/dnn_backend_native.c

> +++ b/libavfilter/dnn/dnn_backend_native.c

> @@ -40,19 +40,17 @@ static DNNReturnType set_input_output_native(void

> *model, DNNInputData *input, c

>      if (network->layers_num <= 0 || network->layers[0].type != INPUT){

>          return DNN_ERROR;

>      }

> -    else{

> -        input_params = (InputParams *)network->layers[0].params;

> -        input_params->width = cur_width = input->width;

> -        input_params->height = cur_height = input->height;

> -        input_params->channels = cur_channels = input->channels;

> -        if (input->data){

> -            av_freep(&input->data);

> -        }

> -        av_assert0(input->dt == DNN_FLOAT);

> -        network->layers[0].output = input->data = av_malloc(cur_height *

> cur_width * cur_channels * sizeof(float));

> -        if (!network->layers[0].output){

> -            return DNN_ERROR;

> -        }

> +    input_params = (InputParams *)network->layers[0].params;

> +    input_params->width = cur_width = input->width;

> +    input_params->height = cur_height = input->height;

> +    input_params->channels = cur_channels = input->channels;

> +    if (input->data){

> +        av_freep(&input->data);

> +    }

> +    av_assert0(input->dt == DNN_FLOAT);

> +    network->layers[0].output = input->data = av_malloc(cur_height *

> cur_width * cur_channels * sizeof(float));

> +    if (!network->layers[0].output){

> +        return DNN_ERROR;

>      }

> 

>      for (layer = 1; layer < network->layers_num; ++layer){

> --

> 1.7.1

> 

> _______________________________________________

> ffmpeg-devel mailing list

> ffmpeg-devel@ffmpeg.org

> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

> 

> To unsubscribe, visit link above, or email

> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Jun Zhao Aug. 20, 2019, 2:01 a.m. UTC | #2
On Tue, Aug 20, 2019 at 9:31 AM Guo, Yejun <yejun.guo@intel.com> wrote:
>
>
>
> > -----Original Message-----
> > From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf Of
> > Jun Zhao
> > Sent: Monday, August 19, 2019 9:01 PM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Jun Zhao <barryjzhao@tencent.com>
> > Subject: [FFmpeg-devel] [PATCH V1 3/5] lavfi/dnn/dnn_backend_native: Refine
> > the coding style
> >
> > From: Jun Zhao <barryjzhao@tencent.com>
> >
> >     We perfer the coding style like:
> >
> >     /* some stuff */
> >     if (error) {
> >         /* error handling */
> >         return -(errorcode);
> >     }
> >     /* normal actions */
> >     do_something()
>
> as mentioned in http://ffmpeg.org/pipermail/ffmpeg-devel/2019-August/247887.html, I've finished
> some more patches at https://github.com/guoyejun/ffmpeg/commits/dnn0809 waiting for send out set by set.
>
> The next patch I plan to send is https://github.com/guoyejun/ffmpeg/commit/02567319a640bb3d150917dfc6cf5e047a4bb776,
> which includes the changes in this patch, and it includes more changes to support operand concept in native mode.
>
> It would be convenient for me to not split that patch, could this patch be ignored? thanks.
>
Please continue this patch set, will hold on this patch. Thanks
diff mbox

Patch

diff --git a/libavfilter/dnn/dnn_backend_native.c b/libavfilter/dnn/dnn_backend_native.c
index 09c583b..7b489d0 100644
--- a/libavfilter/dnn/dnn_backend_native.c
+++ b/libavfilter/dnn/dnn_backend_native.c
@@ -40,19 +40,17 @@  static DNNReturnType set_input_output_native(void *model, DNNInputData *input, c
     if (network->layers_num <= 0 || network->layers[0].type != INPUT){
         return DNN_ERROR;
     }
-    else{
-        input_params = (InputParams *)network->layers[0].params;
-        input_params->width = cur_width = input->width;
-        input_params->height = cur_height = input->height;
-        input_params->channels = cur_channels = input->channels;
-        if (input->data){
-            av_freep(&input->data);
-        }
-        av_assert0(input->dt == DNN_FLOAT);
-        network->layers[0].output = input->data = av_malloc(cur_height * cur_width * cur_channels * sizeof(float));
-        if (!network->layers[0].output){
-            return DNN_ERROR;
-        }
+    input_params = (InputParams *)network->layers[0].params;
+    input_params->width = cur_width = input->width;
+    input_params->height = cur_height = input->height;
+    input_params->channels = cur_channels = input->channels;
+    if (input->data){
+        av_freep(&input->data);
+    }
+    av_assert0(input->dt == DNN_FLOAT);
+    network->layers[0].output = input->data = av_malloc(cur_height * cur_width * cur_channels * sizeof(float));
+    if (!network->layers[0].output){
+        return DNN_ERROR;
     }
 
     for (layer = 1; layer < network->layers_num; ++layer){