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

Guo, Yejun yejun.guo at intel.com
Tue Aug 20 04:31:22 EEST 2019



> -----Original Message-----
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf Of
> Jun Zhao
> Sent: Monday, August 19, 2019 9:01 PM
> To: ffmpeg-devel at ffmpeg.org
> Cc: Jun Zhao <barryjzhao at tencent.com>
> Subject: [FFmpeg-devel] [PATCH V1 3/5] lavfi/dnn/dnn_backend_native: Refine
> the coding style
> 
> From: Jun Zhao <barryjzhao at 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 at 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 at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list