[FFmpeg-devel] [PATCH V1 3/5] lavfi/dnn/dnn_backend_native: Refine the coding style
Jun Zhao
mypopydev at gmail.com
Mon Aug 19 16:01:05 EEST 2019
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()
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
More information about the ffmpeg-devel
mailing list