History

dnn: Add ff_ prefix to unnamespaced globals

Mark Thompson committed 5 years ago

Commit bb968241 parent 2c424d920 files · +77 −77Browse files

Showing the changes to libavfilter (20 of 20 files). Show all

Unified · Split

20 files
  1. libavfilter/dnn/dnn_backend_native.c +5 −5
  2. libavfilter/dnn/dnn_backend_native.h +2 −2
  3. libavfilter/dnn/dnn_backend_native_layer_avgpool.c +4 −4
  4. libavfilter/dnn/dnn_backend_native_layer_avgpool.h +3 −3
  5. libavfilter/dnn/dnn_backend_native_layer_conv2d.c +4 −4
  6. libavfilter/dnn/dnn_backend_native_layer_conv2d.h +3 −3
  7. libavfilter/dnn/dnn_backend_native_layer_dense.c +4 −4
  8. libavfilter/dnn/dnn_backend_native_layer_dense.h +3 −3
  9. libavfilter/dnn/dnn_backend_native_layer_depth2space.c +4 −4
  10. libavfilter/dnn/dnn_backend_native_layer_depth2space.h +3 −3
  11. libavfilter/dnn/dnn_backend_native_layer_mathbinary.c +6 −6
  12. libavfilter/dnn/dnn_backend_native_layer_mathbinary.h +3 −3
  13. libavfilter/dnn/dnn_backend_native_layer_mathunary.c +5 −5
  14. libavfilter/dnn/dnn_backend_native_layer_mathunary.h +3 −3
  15. libavfilter/dnn/dnn_backend_native_layer_maximum.c +5 −5
  16. libavfilter/dnn/dnn_backend_native_layer_maximum.h +3 −3
  17. libavfilter/dnn/dnn_backend_native_layer_pad.c +4 −4
  18. libavfilter/dnn/dnn_backend_native_layer_pad.h +3 −3
  19. libavfilter/dnn/dnn_backend_native_layers.c +9 −9
  20. libavfilter/dnn/dnn_backend_native_layers.h +1 −1
libavfilter/dnn/dnn_backend_native.c+5−5
@@ -208,7 +208,7 @@ DNNModel *ff_dnn_load_model_native(const char *model_filename, const char *optio · 207 unmodified lines
208 }208 }
209 209
210 native_model->layers[layer].type = layer_type;210 native_model->layers[layer].type = layer_type;
211 parsed_size = layer_funcs[layer_type].pf_load(&native_model->layers[layer], model_file_context, file_size, native_model->operands_num);211 parsed_size = ff_layer_funcs[layer_type].pf_load(&native_model->layers[layer], model_file_context, file_size, native_model->operands_num);
212 if (!parsed_size) {212 if (!parsed_size) {
213 goto fail;213 goto fail;
214 }214 }
@@ -300,7 +300,7 @@ static DNNReturnType execute_model_native(const DNNModel *model, const char *inp · 85 unmodified lines
300 oprd->dims[2] = in_frame->width;300 oprd->dims[2] = in_frame->width;
301 301
302 av_freep(&oprd->data);302 av_freep(&oprd->data);
303 oprd->length = calculate_operand_data_length(oprd);303 oprd->length = ff_calculate_operand_data_length(oprd);
304 if (oprd->length <= 0) {304 if (oprd->length <= 0) {
305 av_log(ctx, AV_LOG_ERROR, "The input data length overflow\n");305 av_log(ctx, AV_LOG_ERROR, "The input data length overflow\n");
306 return DNN_ERROR;306 return DNN_ERROR;
@@ -333,7 +333,7 @@ static DNNReturnType execute_model_native(const DNNModel *model, const char *inp · 26 unmodified lines
333 333
334 for (layer = 0; layer < native_model->layers_num; ++layer){334 for (layer = 0; layer < native_model->layers_num; ++layer){
335 DNNLayerType layer_type = native_model->layers[layer].type;335 DNNLayerType layer_type = native_model->layers[layer].type;
336 if (layer_funcs[layer_type].pf_exec(native_model->operands,336 if (ff_layer_funcs[layer_type].pf_exec(native_model->operands,
337 native_model->layers[layer].input_operand_indexes,337 native_model->layers[layer].input_operand_indexes,
338 native_model->layers[layer].output_operand_index,338 native_model->layers[layer].output_operand_index,
339 native_model->layers[layer].params,339 native_model->layers[layer].params,
@@ -398,7 +398,7 @@ DNNReturnType ff_dnn_execute_model_native(const DNNModel *model, const char *inp · 58 unmodified lines
398 return execute_model_native(model, input_name, in_frame, output_names, nb_output, out_frame, 1);398 return execute_model_native(model, input_name, in_frame, output_names, nb_output, out_frame, 1);
399}399}
400 400
401int32_t calculate_operand_dims_count(const DnnOperand *oprd)401int32_t ff_calculate_operand_dims_count(const DnnOperand *oprd)
402{402{
403 int32_t result = 1;403 int32_t result = 1;
404 for (int i = 0; i < 4; ++i)404 for (int i = 0; i < 4; ++i)
@@ -407,7 +407,7 @@ int32_t calculate_operand_dims_count(const DnnOperand *oprd) · 2 unmodified lines
407 return result;407 return result;
408}408}
409 409
410int32_t calculate_operand_data_length(const DnnOperand* oprd)410int32_t ff_calculate_operand_data_length(const DnnOperand* oprd)
411{411{
412 // currently, we just support DNN_FLOAT412 // currently, we just support DNN_FLOAT
413 uint64_t len = sizeof(float);413 uint64_t len = sizeof(float);
libavfilter/dnn/dnn_backend_native.h+2−2
@@ -137,6 +137,6 @@ void ff_dnn_free_model_native(DNNModel **model); · 136 unmodified lines
137 137
138// NOTE: User must check for error (return value <= 0) to handle138// NOTE: User must check for error (return value <= 0) to handle
139// case like integer overflow.139// case like integer overflow.
140int32_t calculate_operand_data_length(const DnnOperand *oprd);140int32_t ff_calculate_operand_data_length(const DnnOperand *oprd);
141int32_t calculate_operand_dims_count(const DnnOperand *oprd);141int32_t ff_calculate_operand_dims_count(const DnnOperand *oprd);
142#endif142#endif
libavfilter/dnn/dnn_backend_native_layer_avgpool.c+4−4
@@ -26,7 +26,7 @@ · 25 unmodified lines
26#include "libavutil/avassert.h"26#include "libavutil/avassert.h"
27#include "dnn_backend_native_layer_avgpool.h"27#include "dnn_backend_native_layer_avgpool.h"
28 28
29int dnn_load_layer_avg_pool(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)29int ff_dnn_load_layer_avg_pool(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
30{30{
31 AvgPoolParams *avgpool_params;31 AvgPoolParams *avgpool_params;
32 int dnn_size = 0;32 int dnn_size = 0;
@@ -55,8 +55,8 @@ int dnn_load_layer_avg_pool(Layer *layer, AVIOContext *model_file_context, int f · 22 unmodified lines
55 return dnn_size;55 return dnn_size;
56}56}
57 57
58int dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t *input_operand_indexes,58int ff_dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t *input_operand_indexes,
59 int32_t output_operand_index, const void *parameters, NativeContext *ctx)59 int32_t output_operand_index, const void *parameters, NativeContext *ctx)
60{60{
61 float *output;61 float *output;
62 int height_end, width_end, height_radius, width_radius, output_height, output_width, kernel_area;62 int height_end, width_end, height_radius, width_radius, output_height, output_width, kernel_area;
@@ -106,7 +106,7 @@ int dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t *input_operan · 43 unmodified lines
106 // not support pooling in channel dimension now106 // not support pooling in channel dimension now
107 output_operand->dims[3] = channel;107 output_operand->dims[3] = channel;
108 output_operand->data_type = operands[input_operand_index].data_type;108 output_operand->data_type = operands[input_operand_index].data_type;
109 output_operand->length = calculate_operand_data_length(output_operand);109 output_operand->length = ff_calculate_operand_data_length(output_operand);
110 if (output_operand->length <= 0) {110 if (output_operand->length <= 0) {
111 av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");111 av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
112 return DNN_ERROR;112 return DNN_ERROR;
libavfilter/dnn/dnn_backend_native_layer_avgpool.h+3−3
@@ -33,8 +33,8 @@ typedef struct AvgPoolParams{ · 32 unmodified lines
33 DNNPaddingParam padding_method;33 DNNPaddingParam padding_method;
34} AvgPoolParams;34} AvgPoolParams;
35 35
36int dnn_load_layer_avg_pool(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);36int ff_dnn_load_layer_avg_pool(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
37int dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t *input_operand_indexes,37int ff_dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t *input_operand_indexes,
38 int32_t output_operand_index, const void *parameters, NativeContext *ctx);38 int32_t output_operand_index, const void *parameters, NativeContext *ctx);
39 39
40#endif40#endif
libavfilter/dnn/dnn_backend_native_layer_conv2d.c+4−4
@@ -40,7 +40,7 @@ typedef struct ThreadParam{ · 39 unmodified lines
40 int thread_start, thread_end;40 int thread_start, thread_end;
41} ThreadParam;41} ThreadParam;
42 42
43int dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)43int ff_dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
44{44{
45 ConvolutionalParams *conv_params;45 ConvolutionalParams *conv_params;
46 int kernel_size;46 int kernel_size;
@@ -181,8 +181,8 @@ static void * dnn_execute_layer_conv2d_thread(void *threadarg) · 134 unmodified lines
181}181}
182 182
183 183
184int dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_indexes,184int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_indexes,
185 int32_t output_operand_index, const void *parameters, NativeContext *ctx)185 int32_t output_operand_index, const void *parameters, NativeContext *ctx)
186{186{
187 int thread_num = (ctx->options.conv2d_threads <= 0 || ctx->options.conv2d_threads > av_cpu_count())187 int thread_num = (ctx->options.conv2d_threads <= 0 || ctx->options.conv2d_threads > av_cpu_count())
188 ? (av_cpu_count() + 1) : (ctx->options.conv2d_threads);188 ? (av_cpu_count() + 1) : (ctx->options.conv2d_threads);
@@ -203,7 +203,7 @@ int dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_ · 14 unmodified lines
203 output_operand->dims[2] = width - pad_size * 2;203 output_operand->dims[2] = width - pad_size * 2;
204 output_operand->dims[3] = conv_params->output_num;204 output_operand->dims[3] = conv_params->output_num;
205 output_operand->data_type = operands[input_operand_indexes[0]].data_type;205 output_operand->data_type = operands[input_operand_indexes[0]].data_type;
206 output_operand->length = calculate_operand_data_length(output_operand);206 output_operand->length = ff_calculate_operand_data_length(output_operand);
207 if (output_operand->length <= 0) {207 if (output_operand->length <= 0) {
208 av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");208 av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
209 return DNN_ERROR;209 return DNN_ERROR;
libavfilter/dnn/dnn_backend_native_layer_conv2d.h+3−3
@@ -34,7 +34,7 @@ typedef struct ConvolutionalParams{ · 33 unmodified lines
34 float *biases;34 float *biases;
35} ConvolutionalParams;35} ConvolutionalParams;
36 36
37int dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);37int ff_dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
38int dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_indexes,38int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_indexes,
39 int32_t output_operand_index, const void *parameters, NativeContext *ctx);39 int32_t output_operand_index, const void *parameters, NativeContext *ctx);
40#endif40#endif
libavfilter/dnn/dnn_backend_native_layer_dense.c+4−4
@@ -21,7 +21,7 @@ · 20 unmodified lines
21#include "libavutil/avassert.h"21#include "libavutil/avassert.h"
22#include "dnn_backend_native_layer_dense.h"22#include "dnn_backend_native_layer_dense.h"
23 23
24int dnn_load_layer_dense(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)24int ff_dnn_load_layer_dense(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
25{25{
26 DenseParams *dense_params;26 DenseParams *dense_params;
27 int kernel_size;27 int kernel_size;
@@ -82,8 +82,8 @@ int dnn_load_layer_dense(Layer *layer, AVIOContext *model_file_context, int file · 54 unmodified lines
82 return dnn_size;82 return dnn_size;
83}83}
84 84
85int dnn_execute_layer_dense(DnnOperand *operands, const int32_t *input_operand_indexes,85int ff_dnn_execute_layer_dense(DnnOperand *operands, const int32_t *input_operand_indexes,
86 int32_t output_operand_index, const void *parameters, NativeContext *ctx)86 int32_t output_operand_index, const void *parameters, NativeContext *ctx)
87{87{
88 float *output;88 float *output;
89 int32_t input_operand_index = input_operand_indexes[0];89 int32_t input_operand_index = input_operand_indexes[0];
@@ -101,7 +101,7 @@ int dnn_execute_layer_dense(DnnOperand *operands, const int32_t *input_operand_i · 11 unmodified lines
101 output_operand->dims[2] = width;101 output_operand->dims[2] = width;
102 output_operand->dims[3] = dense_params->output_num;102 output_operand->dims[3] = dense_params->output_num;
103 output_operand->data_type = operands[input_operand_index].data_type;103 output_operand->data_type = operands[input_operand_index].data_type;
104 output_operand->length = calculate_operand_data_length(output_operand);104 output_operand->length = ff_calculate_operand_data_length(output_operand);
105 if (output_operand->length <= 0) {105 if (output_operand->length <= 0) {
106 av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");106 av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
107 return DNN_ERROR;107 return DNN_ERROR;
libavfilter/dnn/dnn_backend_native_layer_dense.h+3−3
@@ -31,7 +31,7 @@ typedef struct DenseParams{ · 30 unmodified lines
31 float *biases;31 float *biases;
32} DenseParams;32} DenseParams;
33 33
34int dnn_load_layer_dense(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);34int ff_dnn_load_layer_dense(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
35int dnn_execute_layer_dense(DnnOperand *operands, const int32_t *input_operand_indexes,35int ff_dnn_execute_layer_dense(DnnOperand *operands, const int32_t *input_operand_indexes,
36 int32_t output_operand_index, const void *parameters, NativeContext *ctx);36 int32_t output_operand_index, const void *parameters, NativeContext *ctx);
37#endif37#endif
libavfilter/dnn/dnn_backend_native_layer_depth2space.c+4−4
@@ -27,7 +27,7 @@ · 26 unmodified lines
27#include "libavutil/avassert.h"27#include "libavutil/avassert.h"
28#include "dnn_backend_native_layer_depth2space.h"28#include "dnn_backend_native_layer_depth2space.h"
29 29
30int dnn_load_layer_depth2space(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)30int ff_dnn_load_layer_depth2space(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
31{31{
32 DepthToSpaceParams *params;32 DepthToSpaceParams *params;
33 int dnn_size = 0;33 int dnn_size = 0;
@@ -49,8 +49,8 @@ int dnn_load_layer_depth2space(Layer *layer, AVIOContext *model_file_context, in · 15 unmodified lines
49 return dnn_size;49 return dnn_size;
50}50}
51 51
52int dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t *input_operand_indexes,52int ff_dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t *input_operand_indexes,
53 int32_t output_operand_index, const void *parameters, NativeContext *ctx)53 int32_t output_operand_index, const void *parameters, NativeContext *ctx)
54{54{
55 float *output;55 float *output;
56 const DepthToSpaceParams *params = (const DepthToSpaceParams *)parameters;56 const DepthToSpaceParams *params = (const DepthToSpaceParams *)parameters;
@@ -74,7 +74,7 @@ int dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t *input_ope · 17 unmodified lines
74 output_operand->dims[2] = width * block_size;74 output_operand->dims[2] = width * block_size;
75 output_operand->dims[3] = new_channels;75 output_operand->dims[3] = new_channels;
76 output_operand->data_type = operands[input_operand_index].data_type;76 output_operand->data_type = operands[input_operand_index].data_type;
77 output_operand->length = calculate_operand_data_length(output_operand);77 output_operand->length = ff_calculate_operand_data_length(output_operand);
78 if (output_operand->length <= 0) {78 if (output_operand->length <= 0) {
79 av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");79 av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
80 return DNN_ERROR;80 return DNN_ERROR;
libavfilter/dnn/dnn_backend_native_layer_depth2space.h+3−3
@@ -34,8 +34,8 @@ typedef struct DepthToSpaceParams{ · 33 unmodified lines
34 int block_size;34 int block_size;
35} DepthToSpaceParams;35} DepthToSpaceParams;
36 36
37int dnn_load_layer_depth2space(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);37int ff_dnn_load_layer_depth2space(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
38int dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t *input_operand_indexes,38int ff_dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t *input_operand_indexes,
39 int32_t output_operand_index, const void *parameters, NativeContext *ctx);39 int32_t output_operand_index, const void *parameters, NativeContext *ctx);
40 40
41#endif41#endif
libavfilter/dnn/dnn_backend_native_layer_mathbinary.c+6−6
@@ -59,7 +59,7 @@ static void math_binary_commutative(FunType pfun, const DnnLayerMathBinaryParams · 58 unmodified lines
59 int dims_count;59 int dims_count;
60 const float *src;60 const float *src;
61 float *dst;61 float *dst;
62 dims_count = calculate_operand_dims_count(output);62 dims_count = ff_calculate_operand_dims_count(output);
63 src = input->data;63 src = input->data;
64 dst = output->data;64 dst = output->data;
65 if (params->input0_broadcast || params->input1_broadcast) {65 if (params->input0_broadcast || params->input1_broadcast) {
@@ -79,7 +79,7 @@ static void math_binary_not_commutative(FunType pfun, const DnnLayerMathBinaryPa · 13 unmodified lines
79 int dims_count;79 int dims_count;
80 const float *src;80 const float *src;
81 float *dst;81 float *dst;
82 dims_count = calculate_operand_dims_count(output);82 dims_count = ff_calculate_operand_dims_count(output);
83 src = input->data;83 src = input->data;
84 dst = output->data;84 dst = output->data;
85 if (params->input0_broadcast) {85 if (params->input0_broadcast) {
@@ -98,7 +98,7 @@ static void math_binary_not_commutative(FunType pfun, const DnnLayerMathBinaryPa · 12 unmodified lines
98 }98 }
99 }99 }
100}100}
101int dnn_load_layer_math_binary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)101int ff_dnn_load_layer_math_binary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
102{102{
103 DnnLayerMathBinaryParams *params;103 DnnLayerMathBinaryParams *params;
104 int dnn_size = 0;104 int dnn_size = 0;
@@ -147,8 +147,8 @@ int dnn_load_layer_math_binary(Layer *layer, AVIOContext *model_file_context, in · 42 unmodified lines
147 return dnn_size;147 return dnn_size;
148}148}
149 149
150int dnn_execute_layer_math_binary(DnnOperand *operands, const int32_t *input_operand_indexes,150int ff_dnn_execute_layer_math_binary(DnnOperand *operands, const int32_t *input_operand_indexes,
151 int32_t output_operand_index, const void *parameters, NativeContext *ctx)151 int32_t output_operand_index, const void *parameters, NativeContext *ctx)
152{152{
153 const DnnOperand *input = &operands[input_operand_indexes[0]];153 const DnnOperand *input = &operands[input_operand_indexes[0]];
154 DnnOperand *output = &operands[output_operand_index];154 DnnOperand *output = &operands[output_operand_index];
@@ -158,7 +158,7 @@ int dnn_execute_layer_math_binary(DnnOperand *operands, const int32_t *input_ope · 3 unmodified lines
158 output->dims[i] = input->dims[i];158 output->dims[i] = input->dims[i];
159 159
160 output->data_type = input->data_type;160 output->data_type = input->data_type;
161 output->length = calculate_operand_data_length(output);161 output->length = ff_calculate_operand_data_length(output);
162 if (output->length <= 0) {162 if (output->length <= 0) {
163 av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");163 av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
164 return DNN_ERROR;164 return DNN_ERROR;
libavfilter/dnn/dnn_backend_native_layer_mathbinary.h+3−3
@@ -47,8 +47,8 @@ typedef struct DnnLayerMathBinaryParams{ · 46 unmodified lines
47 float v;47 float v;
48} DnnLayerMathBinaryParams;48} DnnLayerMathBinaryParams;
49 49
50int dnn_load_layer_math_binary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);50int ff_dnn_load_layer_math_binary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
51int dnn_execute_layer_math_binary(DnnOperand *operands, const int32_t *input_operand_indexes,51int ff_dnn_execute_layer_math_binary(DnnOperand *operands, const int32_t *input_operand_indexes,
52 int32_t output_operand_index, const void *parameters, NativeContext *ctx);52 int32_t output_operand_index, const void *parameters, NativeContext *ctx);
53 53
54#endif54#endif
libavfilter/dnn/dnn_backend_native_layer_mathunary.c+5−5
@@ -29,7 +29,7 @@ · 28 unmodified lines
29#include "libavutil/avassert.h"29#include "libavutil/avassert.h"
30#include "dnn_backend_native_layer_mathunary.h"30#include "dnn_backend_native_layer_mathunary.h"
31 31
32int dnn_load_layer_math_unary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)32int ff_dnn_load_layer_math_unary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
33{33{
34 DnnLayerMathUnaryParams *params;34 DnnLayerMathUnaryParams *params;
35 int dnn_size = 0;35 int dnn_size = 0;
@@ -52,8 +52,8 @@ int dnn_load_layer_math_unary(Layer *layer, AVIOContext *model_file_context, int · 16 unmodified lines
52 52
53}53}
54 54
55int dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_operand_indexes,55int ff_dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_operand_indexes,
56 int32_t output_operand_index, const void *parameters, NativeContext *ctx)56 int32_t output_operand_index, const void *parameters, NativeContext *ctx)
57{57{
58 const DnnOperand *input = &operands[input_operand_indexes[0]];58 const DnnOperand *input = &operands[input_operand_indexes[0]];
59 DnnOperand *output = &operands[output_operand_index];59 DnnOperand *output = &operands[output_operand_index];
@@ -66,7 +66,7 @@ int dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_oper · 6 unmodified lines
66 output->dims[i] = input->dims[i];66 output->dims[i] = input->dims[i];
67 67
68 output->data_type = input->data_type;68 output->data_type = input->data_type;
69 output->length = calculate_operand_data_length(output);69 output->length = ff_calculate_operand_data_length(output);
70 if (output->length <= 0) {70 if (output->length <= 0) {
71 av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");71 av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
72 return DNN_ERROR;72 return DNN_ERROR;
@@ -77,7 +77,7 @@ int dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_oper · 4 unmodified lines
77 return DNN_ERROR;77 return DNN_ERROR;
78 }78 }
79 79
80 dims_count = calculate_operand_dims_count(output);80 dims_count = ff_calculate_operand_dims_count(output);
81 src = input->data;81 src = input->data;
82 dst = output->data;82 dst = output->data;
83 83
libavfilter/dnn/dnn_backend_native_layer_mathunary.h+3−3
@@ -53,8 +53,8 @@ typedef struct DnnLayerMathUnaryParams{ · 52 unmodified lines
53 DNNMathUnaryOperation un_op;53 DNNMathUnaryOperation un_op;
54} DnnLayerMathUnaryParams;54} DnnLayerMathUnaryParams;
55 55
56int dnn_load_layer_math_unary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);56int ff_dnn_load_layer_math_unary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
57int dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_operand_indexes,57int ff_dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_operand_indexes,
58 int32_t output_operand_index, const void *parameters, NativeContext *ctx);58 int32_t output_operand_index, const void *parameters, NativeContext *ctx);
59 59
60#endif60#endif
libavfilter/dnn/dnn_backend_native_layer_maximum.c+5−5
@@ -27,7 +27,7 @@ · 26 unmodified lines
27#include "libavutil/avassert.h"27#include "libavutil/avassert.h"
28#include "dnn_backend_native_layer_maximum.h"28#include "dnn_backend_native_layer_maximum.h"
29 29
30int dnn_load_layer_maximum(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)30int ff_dnn_load_layer_maximum(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
31{31{
32 DnnLayerMaximumParams *params;32 DnnLayerMaximumParams *params;
33 int dnn_size = 0;33 int dnn_size = 0;
@@ -49,8 +49,8 @@ int dnn_load_layer_maximum(Layer *layer, AVIOContext *model_file_context, int fi · 15 unmodified lines
49 return dnn_size;49 return dnn_size;
50}50}
51 51
52int dnn_execute_layer_maximum(DnnOperand *operands, const int32_t *input_operand_indexes,52int ff_dnn_execute_layer_maximum(DnnOperand *operands, const int32_t *input_operand_indexes,
53 int32_t output_operand_index, const void *parameters, NativeContext *ctx)53 int32_t output_operand_index, const void *parameters, NativeContext *ctx)
54{54{
55 const DnnOperand *input = &operands[input_operand_indexes[0]];55 const DnnOperand *input = &operands[input_operand_indexes[0]];
56 DnnOperand *output = &operands[output_operand_index];56 DnnOperand *output = &operands[output_operand_index];
@@ -63,7 +63,7 @@ int dnn_execute_layer_maximum(DnnOperand *operands, const int32_t *input_operand · 6 unmodified lines
63 output->dims[i] = input->dims[i];63 output->dims[i] = input->dims[i];
64 64
65 output->data_type = input->data_type;65 output->data_type = input->data_type;
66 output->length = calculate_operand_data_length(output);66 output->length = ff_calculate_operand_data_length(output);
67 if (output->length <= 0) {67 if (output->length <= 0) {
68 av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");68 av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
69 return DNN_ERROR;69 return DNN_ERROR;
@@ -74,7 +74,7 @@ int dnn_execute_layer_maximum(DnnOperand *operands, const int32_t *input_operand · 4 unmodified lines
74 return DNN_ERROR;74 return DNN_ERROR;
75 }75 }
76 76
77 dims_count = calculate_operand_dims_count(output);77 dims_count = ff_calculate_operand_dims_count(output);
78 src = input->data;78 src = input->data;
79 dst = output->data;79 dst = output->data;
80 for (int i = 0; i < dims_count; ++i)80 for (int i = 0; i < dims_count; ++i)
libavfilter/dnn/dnn_backend_native_layer_maximum.h+3−3
@@ -37,8 +37,8 @@ typedef struct DnnLayerMaximumParams{ · 36 unmodified lines
37 }val;37 }val;
38} DnnLayerMaximumParams;38} DnnLayerMaximumParams;
39 39
40int dnn_load_layer_maximum(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);40int ff_dnn_load_layer_maximum(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
41int dnn_execute_layer_maximum(DnnOperand *operands, const int32_t *input_operand_indexes,41int ff_dnn_execute_layer_maximum(DnnOperand *operands, const int32_t *input_operand_indexes,
42 int32_t output_operand_index, const void *parameters, NativeContext *ctx);42 int32_t output_operand_index, const void *parameters, NativeContext *ctx);
43 43
44#endif44#endif
libavfilter/dnn/dnn_backend_native_layer_pad.c+4−4
@@ -22,7 +22,7 @@ · 21 unmodified lines
22#include "libavutil/avassert.h"22#include "libavutil/avassert.h"
23#include "dnn_backend_native_layer_pad.h"23#include "dnn_backend_native_layer_pad.h"
24 24
25int dnn_load_layer_pad(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)25int ff_dnn_load_layer_pad(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
26{26{
27 LayerPadParams *params;27 LayerPadParams *params;
28 int dnn_size = 0;28 int dnn_size = 0;
@@ -75,8 +75,8 @@ static int after_get_buddy(int given, int border, LayerPadModeParam mode) · 46 unmodified lines
75 }75 }
76}76}
77 77
78int dnn_execute_layer_pad(DnnOperand *operands, const int32_t *input_operand_indexes,78int ff_dnn_execute_layer_pad(DnnOperand *operands, const int32_t *input_operand_indexes,
79 int32_t output_operand_index, const void *parameters, NativeContext *ctx)79 int32_t output_operand_index, const void *parameters, NativeContext *ctx)
80{80{
81 int32_t before_paddings;81 int32_t before_paddings;
82 int32_t after_paddings;82 int32_t after_paddings;
@@ -110,7 +110,7 @@ int dnn_execute_layer_pad(DnnOperand *operands, const int32_t *input_operand_ind · 27 unmodified lines
110 output_operand->dims[2] = new_width;110 output_operand->dims[2] = new_width;
111 output_operand->dims[3] = new_channel;111 output_operand->dims[3] = new_channel;
112 output_operand->data_type = operands[input_operand_index].data_type;112 output_operand->data_type = operands[input_operand_index].data_type;
113 output_operand->length = calculate_operand_data_length(output_operand);113 output_operand->length = ff_calculate_operand_data_length(output_operand);
114 if (output_operand->length <= 0) {114 if (output_operand->length <= 0) {
115 av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");115 av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
116 return DNN_ERROR;116 return DNN_ERROR;
libavfilter/dnn/dnn_backend_native_layer_pad.h+3−3
@@ -36,8 +36,8 @@ typedef struct LayerPadParams{ · 35 unmodified lines
36 float constant_values;36 float constant_values;
37} LayerPadParams;37} LayerPadParams;
38 38
39int dnn_load_layer_pad(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);39int ff_dnn_load_layer_pad(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
40int dnn_execute_layer_pad(DnnOperand *operands, const int32_t *input_operand_indexes,40int ff_dnn_execute_layer_pad(DnnOperand *operands, const int32_t *input_operand_indexes,
41 int32_t output_operand_index, const void *parameters, NativeContext *ctx);41 int32_t output_operand_index, const void *parameters, NativeContext *ctx);
42 42
43#endif43#endif
libavfilter/dnn/dnn_backend_native_layers.c+9−9
@@ -29,14 +29,14 @@ · 28 unmodified lines
29#include "dnn_backend_native_layer_avgpool.h"29#include "dnn_backend_native_layer_avgpool.h"
30#include "dnn_backend_native_layer_dense.h"30#include "dnn_backend_native_layer_dense.h"
31 31
32const LayerFunc layer_funcs[DLT_COUNT] = {32const LayerFunc ff_layer_funcs[DLT_COUNT] = {
33 {NULL, NULL},33 {NULL, NULL},
34 {dnn_execute_layer_conv2d, dnn_load_layer_conv2d},34 {ff_dnn_execute_layer_conv2d, ff_dnn_load_layer_conv2d},
35 {dnn_execute_layer_depth2space, dnn_load_layer_depth2space},35 {ff_dnn_execute_layer_depth2space, ff_dnn_load_layer_depth2space},
36 {dnn_execute_layer_pad, dnn_load_layer_pad},36 {ff_dnn_execute_layer_pad, ff_dnn_load_layer_pad},
37 {dnn_execute_layer_maximum, dnn_load_layer_maximum},37 {ff_dnn_execute_layer_maximum, ff_dnn_load_layer_maximum},
38 {dnn_execute_layer_math_binary, dnn_load_layer_math_binary},38 {ff_dnn_execute_layer_math_binary, ff_dnn_load_layer_math_binary},
39 {dnn_execute_layer_math_unary, dnn_load_layer_math_unary},39 {ff_dnn_execute_layer_math_unary, ff_dnn_load_layer_math_unary},
40 {dnn_execute_layer_avg_pool, dnn_load_layer_avg_pool},40 {ff_dnn_execute_layer_avg_pool, ff_dnn_load_layer_avg_pool},
41 {dnn_execute_layer_dense, dnn_load_layer_dense},41 {ff_dnn_execute_layer_dense, ff_dnn_load_layer_dense},
42};42};
libavfilter/dnn/dnn_backend_native_layers.h+1−1
@@ -33,6 +33,6 @@ typedef struct LayerFunc { · 32 unmodified lines
33 LAYER_LOAD_FUNC pf_load;33 LAYER_LOAD_FUNC pf_load;
34}LayerFunc;34}LayerFunc;
35 35
36extern const LayerFunc layer_funcs[DLT_COUNT];36extern const LayerFunc ff_layer_funcs[DLT_COUNT];
37 37
38#endif38#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t