Browse Source

dnn: Add ff_ prefix to unnamespaced globals

Reviewed-By: Guo, Yejun <yejun.guo@intel.com>
tags/n4.4
Mark Thompson Guo, Yejun 5 years ago
parent
commit
bb96824510
20 changed files with 77 additions and 77 deletions
  1. +5
    -5
      libavfilter/dnn/dnn_backend_native.c
  2. +2
    -2
      libavfilter/dnn/dnn_backend_native.h
  3. +4
    -4
      libavfilter/dnn/dnn_backend_native_layer_avgpool.c
  4. +3
    -3
      libavfilter/dnn/dnn_backend_native_layer_avgpool.h
  5. +4
    -4
      libavfilter/dnn/dnn_backend_native_layer_conv2d.c
  6. +3
    -3
      libavfilter/dnn/dnn_backend_native_layer_conv2d.h
  7. +4
    -4
      libavfilter/dnn/dnn_backend_native_layer_dense.c
  8. +3
    -3
      libavfilter/dnn/dnn_backend_native_layer_dense.h
  9. +4
    -4
      libavfilter/dnn/dnn_backend_native_layer_depth2space.c
  10. +3
    -3
      libavfilter/dnn/dnn_backend_native_layer_depth2space.h
  11. +6
    -6
      libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
  12. +3
    -3
      libavfilter/dnn/dnn_backend_native_layer_mathbinary.h
  13. +5
    -5
      libavfilter/dnn/dnn_backend_native_layer_mathunary.c
  14. +3
    -3
      libavfilter/dnn/dnn_backend_native_layer_mathunary.h
  15. +5
    -5
      libavfilter/dnn/dnn_backend_native_layer_maximum.c
  16. +3
    -3
      libavfilter/dnn/dnn_backend_native_layer_maximum.h
  17. +4
    -4
      libavfilter/dnn/dnn_backend_native_layer_pad.c
  18. +3
    -3
      libavfilter/dnn/dnn_backend_native_layer_pad.h
  19. +9
    -9
      libavfilter/dnn/dnn_backend_native_layers.c
  20. +1
    -1
      libavfilter/dnn/dnn_backend_native_layers.h

+ 5
- 5
libavfilter/dnn/dnn_backend_native.c View File

@@ -208,7 +208,7 @@ DNNModel *ff_dnn_load_model_native(const char *model_filename, const char *optio
}

native_model->layers[layer].type = layer_type;
parsed_size = layer_funcs[layer_type].pf_load(&native_model->layers[layer], model_file_context, file_size, native_model->operands_num);
parsed_size = ff_layer_funcs[layer_type].pf_load(&native_model->layers[layer], model_file_context, file_size, native_model->operands_num);
if (!parsed_size) {
goto fail;
}
@@ -300,7 +300,7 @@ static DNNReturnType execute_model_native(const DNNModel *model, const char *inp
oprd->dims[2] = in_frame->width;

av_freep(&oprd->data);
oprd->length = calculate_operand_data_length(oprd);
oprd->length = ff_calculate_operand_data_length(oprd);
if (oprd->length <= 0) {
av_log(ctx, AV_LOG_ERROR, "The input data length overflow\n");
return DNN_ERROR;
@@ -333,7 +333,7 @@ static DNNReturnType execute_model_native(const DNNModel *model, const char *inp

for (layer = 0; layer < native_model->layers_num; ++layer){
DNNLayerType layer_type = native_model->layers[layer].type;
if (layer_funcs[layer_type].pf_exec(native_model->operands,
if (ff_layer_funcs[layer_type].pf_exec(native_model->operands,
native_model->layers[layer].input_operand_indexes,
native_model->layers[layer].output_operand_index,
native_model->layers[layer].params,
@@ -398,7 +398,7 @@ DNNReturnType ff_dnn_execute_model_native(const DNNModel *model, const char *inp
return execute_model_native(model, input_name, in_frame, output_names, nb_output, out_frame, 1);
}

int32_t calculate_operand_dims_count(const DnnOperand *oprd)
int32_t ff_calculate_operand_dims_count(const DnnOperand *oprd)
{
int32_t result = 1;
for (int i = 0; i < 4; ++i)
@@ -407,7 +407,7 @@ int32_t calculate_operand_dims_count(const DnnOperand *oprd)
return result;
}

int32_t calculate_operand_data_length(const DnnOperand* oprd)
int32_t ff_calculate_operand_data_length(const DnnOperand* oprd)
{
// currently, we just support DNN_FLOAT
uint64_t len = sizeof(float);


+ 2
- 2
libavfilter/dnn/dnn_backend_native.h View File

@@ -137,6 +137,6 @@ void ff_dnn_free_model_native(DNNModel **model);

// NOTE: User must check for error (return value <= 0) to handle
// case like integer overflow.
int32_t calculate_operand_data_length(const DnnOperand *oprd);
int32_t calculate_operand_dims_count(const DnnOperand *oprd);
int32_t ff_calculate_operand_data_length(const DnnOperand *oprd);
int32_t ff_calculate_operand_dims_count(const DnnOperand *oprd);
#endif

+ 4
- 4
libavfilter/dnn/dnn_backend_native_layer_avgpool.c View File

@@ -26,7 +26,7 @@
#include "libavutil/avassert.h"
#include "dnn_backend_native_layer_avgpool.h"

int dnn_load_layer_avg_pool(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
int ff_dnn_load_layer_avg_pool(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
{
AvgPoolParams *avgpool_params;
int dnn_size = 0;
@@ -55,8 +55,8 @@ int dnn_load_layer_avg_pool(Layer *layer, AVIOContext *model_file_context, int f
return dnn_size;
}

int dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx)
int ff_dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx)
{
float *output;
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
// not support pooling in channel dimension now
output_operand->dims[3] = channel;
output_operand->data_type = operands[input_operand_index].data_type;
output_operand->length = calculate_operand_data_length(output_operand);
output_operand->length = ff_calculate_operand_data_length(output_operand);
if (output_operand->length <= 0) {
av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
return DNN_ERROR;


+ 3
- 3
libavfilter/dnn/dnn_backend_native_layer_avgpool.h View File

@@ -33,8 +33,8 @@ typedef struct AvgPoolParams{
DNNPaddingParam padding_method;
} AvgPoolParams;

int dnn_load_layer_avg_pool(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
int dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx);
int ff_dnn_load_layer_avg_pool(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
int ff_dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx);

#endif

+ 4
- 4
libavfilter/dnn/dnn_backend_native_layer_conv2d.c View File

@@ -40,7 +40,7 @@ typedef struct ThreadParam{
int thread_start, thread_end;
} ThreadParam;

int dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
int ff_dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
{
ConvolutionalParams *conv_params;
int kernel_size;
@@ -181,8 +181,8 @@ static void * dnn_execute_layer_conv2d_thread(void *threadarg)
}


int dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx)
int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx)
{
int thread_num = (ctx->options.conv2d_threads <= 0 || ctx->options.conv2d_threads > av_cpu_count())
? (av_cpu_count() + 1) : (ctx->options.conv2d_threads);
@@ -203,7 +203,7 @@ int dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_
output_operand->dims[2] = width - pad_size * 2;
output_operand->dims[3] = conv_params->output_num;
output_operand->data_type = operands[input_operand_indexes[0]].data_type;
output_operand->length = calculate_operand_data_length(output_operand);
output_operand->length = ff_calculate_operand_data_length(output_operand);
if (output_operand->length <= 0) {
av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
return DNN_ERROR;


+ 3
- 3
libavfilter/dnn/dnn_backend_native_layer_conv2d.h View File

@@ -34,7 +34,7 @@ typedef struct ConvolutionalParams{
float *biases;
} ConvolutionalParams;

int dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
int dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx);
int ff_dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx);
#endif

+ 4
- 4
libavfilter/dnn/dnn_backend_native_layer_dense.c View File

@@ -21,7 +21,7 @@
#include "libavutil/avassert.h"
#include "dnn_backend_native_layer_dense.h"

int dnn_load_layer_dense(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
int ff_dnn_load_layer_dense(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
{
DenseParams *dense_params;
int kernel_size;
@@ -82,8 +82,8 @@ int dnn_load_layer_dense(Layer *layer, AVIOContext *model_file_context, int file
return dnn_size;
}

int dnn_execute_layer_dense(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx)
int ff_dnn_execute_layer_dense(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx)
{
float *output;
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
output_operand->dims[2] = width;
output_operand->dims[3] = dense_params->output_num;
output_operand->data_type = operands[input_operand_index].data_type;
output_operand->length = calculate_operand_data_length(output_operand);
output_operand->length = ff_calculate_operand_data_length(output_operand);
if (output_operand->length <= 0) {
av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
return DNN_ERROR;


+ 3
- 3
libavfilter/dnn/dnn_backend_native_layer_dense.h View File

@@ -31,7 +31,7 @@ typedef struct DenseParams{
float *biases;
} DenseParams;

int dnn_load_layer_dense(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
int dnn_execute_layer_dense(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx);
int ff_dnn_load_layer_dense(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
int ff_dnn_execute_layer_dense(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx);
#endif

+ 4
- 4
libavfilter/dnn/dnn_backend_native_layer_depth2space.c View File

@@ -27,7 +27,7 @@
#include "libavutil/avassert.h"
#include "dnn_backend_native_layer_depth2space.h"

int dnn_load_layer_depth2space(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
int ff_dnn_load_layer_depth2space(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
{
DepthToSpaceParams *params;
int dnn_size = 0;
@@ -49,8 +49,8 @@ int dnn_load_layer_depth2space(Layer *layer, AVIOContext *model_file_context, in
return dnn_size;
}

int dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx)
int ff_dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx)
{
float *output;
const DepthToSpaceParams *params = (const DepthToSpaceParams *)parameters;
@@ -74,7 +74,7 @@ int dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t *input_ope
output_operand->dims[2] = width * block_size;
output_operand->dims[3] = new_channels;
output_operand->data_type = operands[input_operand_index].data_type;
output_operand->length = calculate_operand_data_length(output_operand);
output_operand->length = ff_calculate_operand_data_length(output_operand);
if (output_operand->length <= 0) {
av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
return DNN_ERROR;


+ 3
- 3
libavfilter/dnn/dnn_backend_native_layer_depth2space.h View File

@@ -34,8 +34,8 @@ typedef struct DepthToSpaceParams{
int block_size;
} DepthToSpaceParams;

int dnn_load_layer_depth2space(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
int dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx);
int ff_dnn_load_layer_depth2space(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
int ff_dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx);

#endif

+ 6
- 6
libavfilter/dnn/dnn_backend_native_layer_mathbinary.c View File

@@ -59,7 +59,7 @@ static void math_binary_commutative(FunType pfun, const DnnLayerMathBinaryParams
int dims_count;
const float *src;
float *dst;
dims_count = calculate_operand_dims_count(output);
dims_count = ff_calculate_operand_dims_count(output);
src = input->data;
dst = output->data;
if (params->input0_broadcast || params->input1_broadcast) {
@@ -79,7 +79,7 @@ static void math_binary_not_commutative(FunType pfun, const DnnLayerMathBinaryPa
int dims_count;
const float *src;
float *dst;
dims_count = calculate_operand_dims_count(output);
dims_count = ff_calculate_operand_dims_count(output);
src = input->data;
dst = output->data;
if (params->input0_broadcast) {
@@ -98,7 +98,7 @@ static void math_binary_not_commutative(FunType pfun, const DnnLayerMathBinaryPa
}
}
}
int dnn_load_layer_math_binary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
int ff_dnn_load_layer_math_binary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
{
DnnLayerMathBinaryParams *params;
int dnn_size = 0;
@@ -147,8 +147,8 @@ int dnn_load_layer_math_binary(Layer *layer, AVIOContext *model_file_context, in
return dnn_size;
}

int dnn_execute_layer_math_binary(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx)
int ff_dnn_execute_layer_math_binary(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx)
{
const DnnOperand *input = &operands[input_operand_indexes[0]];
DnnOperand *output = &operands[output_operand_index];
@@ -158,7 +158,7 @@ int dnn_execute_layer_math_binary(DnnOperand *operands, const int32_t *input_ope
output->dims[i] = input->dims[i];

output->data_type = input->data_type;
output->length = calculate_operand_data_length(output);
output->length = ff_calculate_operand_data_length(output);
if (output->length <= 0) {
av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
return DNN_ERROR;


+ 3
- 3
libavfilter/dnn/dnn_backend_native_layer_mathbinary.h View File

@@ -47,8 +47,8 @@ typedef struct DnnLayerMathBinaryParams{
float v;
} DnnLayerMathBinaryParams;

int dnn_load_layer_math_binary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
int dnn_execute_layer_math_binary(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx);
int ff_dnn_load_layer_math_binary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
int ff_dnn_execute_layer_math_binary(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx);

#endif

+ 5
- 5
libavfilter/dnn/dnn_backend_native_layer_mathunary.c View File

@@ -29,7 +29,7 @@
#include "libavutil/avassert.h"
#include "dnn_backend_native_layer_mathunary.h"

int dnn_load_layer_math_unary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
int ff_dnn_load_layer_math_unary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
{
DnnLayerMathUnaryParams *params;
int dnn_size = 0;
@@ -52,8 +52,8 @@ int dnn_load_layer_math_unary(Layer *layer, AVIOContext *model_file_context, int

}

int dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx)
int ff_dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx)
{
const DnnOperand *input = &operands[input_operand_indexes[0]];
DnnOperand *output = &operands[output_operand_index];
@@ -66,7 +66,7 @@ int dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_oper
output->dims[i] = input->dims[i];

output->data_type = input->data_type;
output->length = calculate_operand_data_length(output);
output->length = ff_calculate_operand_data_length(output);
if (output->length <= 0) {
av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
return DNN_ERROR;
@@ -77,7 +77,7 @@ int dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_oper
return DNN_ERROR;
}

dims_count = calculate_operand_dims_count(output);
dims_count = ff_calculate_operand_dims_count(output);
src = input->data;
dst = output->data;



+ 3
- 3
libavfilter/dnn/dnn_backend_native_layer_mathunary.h View File

@@ -53,8 +53,8 @@ typedef struct DnnLayerMathUnaryParams{
DNNMathUnaryOperation un_op;
} DnnLayerMathUnaryParams;

int dnn_load_layer_math_unary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
int dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx);
int ff_dnn_load_layer_math_unary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
int ff_dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx);

#endif

+ 5
- 5
libavfilter/dnn/dnn_backend_native_layer_maximum.c View File

@@ -27,7 +27,7 @@
#include "libavutil/avassert.h"
#include "dnn_backend_native_layer_maximum.h"

int dnn_load_layer_maximum(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
int ff_dnn_load_layer_maximum(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
{
DnnLayerMaximumParams *params;
int dnn_size = 0;
@@ -49,8 +49,8 @@ int dnn_load_layer_maximum(Layer *layer, AVIOContext *model_file_context, int fi
return dnn_size;
}

int dnn_execute_layer_maximum(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx)
int ff_dnn_execute_layer_maximum(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx)
{
const DnnOperand *input = &operands[input_operand_indexes[0]];
DnnOperand *output = &operands[output_operand_index];
@@ -63,7 +63,7 @@ int dnn_execute_layer_maximum(DnnOperand *operands, const int32_t *input_operand
output->dims[i] = input->dims[i];

output->data_type = input->data_type;
output->length = calculate_operand_data_length(output);
output->length = ff_calculate_operand_data_length(output);
if (output->length <= 0) {
av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
return DNN_ERROR;
@@ -74,7 +74,7 @@ int dnn_execute_layer_maximum(DnnOperand *operands, const int32_t *input_operand
return DNN_ERROR;
}

dims_count = calculate_operand_dims_count(output);
dims_count = ff_calculate_operand_dims_count(output);
src = input->data;
dst = output->data;
for (int i = 0; i < dims_count; ++i)


+ 3
- 3
libavfilter/dnn/dnn_backend_native_layer_maximum.h View File

@@ -37,8 +37,8 @@ typedef struct DnnLayerMaximumParams{
}val;
} DnnLayerMaximumParams;

int dnn_load_layer_maximum(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
int dnn_execute_layer_maximum(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx);
int ff_dnn_load_layer_maximum(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
int ff_dnn_execute_layer_maximum(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx);

#endif

+ 4
- 4
libavfilter/dnn/dnn_backend_native_layer_pad.c View File

@@ -22,7 +22,7 @@
#include "libavutil/avassert.h"
#include "dnn_backend_native_layer_pad.h"

int dnn_load_layer_pad(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
int ff_dnn_load_layer_pad(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
{
LayerPadParams *params;
int dnn_size = 0;
@@ -75,8 +75,8 @@ static int after_get_buddy(int given, int border, LayerPadModeParam mode)
}
}

int dnn_execute_layer_pad(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx)
int ff_dnn_execute_layer_pad(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx)
{
int32_t before_paddings;
int32_t after_paddings;
@@ -110,7 +110,7 @@ int dnn_execute_layer_pad(DnnOperand *operands, const int32_t *input_operand_ind
output_operand->dims[2] = new_width;
output_operand->dims[3] = new_channel;
output_operand->data_type = operands[input_operand_index].data_type;
output_operand->length = calculate_operand_data_length(output_operand);
output_operand->length = ff_calculate_operand_data_length(output_operand);
if (output_operand->length <= 0) {
av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
return DNN_ERROR;


+ 3
- 3
libavfilter/dnn/dnn_backend_native_layer_pad.h View File

@@ -36,8 +36,8 @@ typedef struct LayerPadParams{
float constant_values;
} LayerPadParams;

int dnn_load_layer_pad(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
int dnn_execute_layer_pad(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx);
int ff_dnn_load_layer_pad(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
int ff_dnn_execute_layer_pad(DnnOperand *operands, const int32_t *input_operand_indexes,
int32_t output_operand_index, const void *parameters, NativeContext *ctx);

#endif

+ 9
- 9
libavfilter/dnn/dnn_backend_native_layers.c View File

@@ -29,14 +29,14 @@
#include "dnn_backend_native_layer_avgpool.h"
#include "dnn_backend_native_layer_dense.h"

const LayerFunc layer_funcs[DLT_COUNT] = {
const LayerFunc ff_layer_funcs[DLT_COUNT] = {
{NULL, NULL},
{dnn_execute_layer_conv2d, dnn_load_layer_conv2d},
{dnn_execute_layer_depth2space, dnn_load_layer_depth2space},
{dnn_execute_layer_pad, dnn_load_layer_pad},
{dnn_execute_layer_maximum, dnn_load_layer_maximum},
{dnn_execute_layer_math_binary, dnn_load_layer_math_binary},
{dnn_execute_layer_math_unary, dnn_load_layer_math_unary},
{dnn_execute_layer_avg_pool, dnn_load_layer_avg_pool},
{dnn_execute_layer_dense, dnn_load_layer_dense},
{ff_dnn_execute_layer_conv2d, ff_dnn_load_layer_conv2d},
{ff_dnn_execute_layer_depth2space, ff_dnn_load_layer_depth2space},
{ff_dnn_execute_layer_pad, ff_dnn_load_layer_pad},
{ff_dnn_execute_layer_maximum, ff_dnn_load_layer_maximum},
{ff_dnn_execute_layer_math_binary, ff_dnn_load_layer_math_binary},
{ff_dnn_execute_layer_math_unary, ff_dnn_load_layer_math_unary},
{ff_dnn_execute_layer_avg_pool, ff_dnn_load_layer_avg_pool},
{ff_dnn_execute_layer_dense, ff_dnn_load_layer_dense},
};

+ 1
- 1
libavfilter/dnn/dnn_backend_native_layers.h View File

@@ -33,6 +33,6 @@ typedef struct LayerFunc {
LAYER_LOAD_FUNC pf_load;
}LayerFunc;

extern const LayerFunc layer_funcs[DLT_COUNT];
extern const LayerFunc ff_layer_funcs[DLT_COUNT];

#endif

Loading…
Cancel
Save