Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
bb968245
Commit
bb968245
authored
Jan 21, 2021
by
Mark Thompson
Committed by
Guo, Yejun
Jan 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dnn: Add ff_ prefix to unnamespaced globals
Reviewed-By:
Guo, Yejun
<
yejun.guo@intel.com
>
parent
2c424d96
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
77 additions
and
77 deletions
+77
-77
dnn_backend_native.c
libavfilter/dnn/dnn_backend_native.c
+5
-5
dnn_backend_native.h
libavfilter/dnn/dnn_backend_native.h
+2
-2
dnn_backend_native_layer_avgpool.c
libavfilter/dnn/dnn_backend_native_layer_avgpool.c
+4
-4
dnn_backend_native_layer_avgpool.h
libavfilter/dnn/dnn_backend_native_layer_avgpool.h
+3
-3
dnn_backend_native_layer_conv2d.c
libavfilter/dnn/dnn_backend_native_layer_conv2d.c
+4
-4
dnn_backend_native_layer_conv2d.h
libavfilter/dnn/dnn_backend_native_layer_conv2d.h
+3
-3
dnn_backend_native_layer_dense.c
libavfilter/dnn/dnn_backend_native_layer_dense.c
+4
-4
dnn_backend_native_layer_dense.h
libavfilter/dnn/dnn_backend_native_layer_dense.h
+3
-3
dnn_backend_native_layer_depth2space.c
libavfilter/dnn/dnn_backend_native_layer_depth2space.c
+4
-4
dnn_backend_native_layer_depth2space.h
libavfilter/dnn/dnn_backend_native_layer_depth2space.h
+3
-3
dnn_backend_native_layer_mathbinary.c
libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
+6
-6
dnn_backend_native_layer_mathbinary.h
libavfilter/dnn/dnn_backend_native_layer_mathbinary.h
+3
-3
dnn_backend_native_layer_mathunary.c
libavfilter/dnn/dnn_backend_native_layer_mathunary.c
+5
-5
dnn_backend_native_layer_mathunary.h
libavfilter/dnn/dnn_backend_native_layer_mathunary.h
+3
-3
dnn_backend_native_layer_maximum.c
libavfilter/dnn/dnn_backend_native_layer_maximum.c
+5
-5
dnn_backend_native_layer_maximum.h
libavfilter/dnn/dnn_backend_native_layer_maximum.h
+3
-3
dnn_backend_native_layer_pad.c
libavfilter/dnn/dnn_backend_native_layer_pad.c
+4
-4
dnn_backend_native_layer_pad.h
libavfilter/dnn/dnn_backend_native_layer_pad.h
+3
-3
dnn_backend_native_layers.c
libavfilter/dnn/dnn_backend_native_layers.c
+9
-9
dnn_backend_native_layers.h
libavfilter/dnn/dnn_backend_native_layers.h
+1
-1
No files found.
libavfilter/dnn/dnn_backend_native.c
View file @
bb968245
...
...
@@ -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
);
...
...
libavfilter/dnn/dnn_backend_native.h
View file @
bb968245
...
...
@@ -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
libavfilter/dnn/dnn_backend_native_layer_avgpool.c
View file @
bb968245
...
...
@@ -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
;
...
...
libavfilter/dnn/dnn_backend_native_layer_avgpool.h
View file @
bb968245
...
...
@@ -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
libavfilter/dnn/dnn_backend_native_layer_conv2d.c
View file @
bb968245
...
...
@@ -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
;
...
...
libavfilter/dnn/dnn_backend_native_layer_conv2d.h
View file @
bb968245
...
...
@@ -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
libavfilter/dnn/dnn_backend_native_layer_dense.c
View file @
bb968245
...
...
@@ -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
;
...
...
libavfilter/dnn/dnn_backend_native_layer_dense.h
View file @
bb968245
...
...
@@ -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
libavfilter/dnn/dnn_backend_native_layer_depth2space.c
View file @
bb968245
...
...
@@ -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
;
...
...
libavfilter/dnn/dnn_backend_native_layer_depth2space.h
View file @
bb968245
...
...
@@ -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
libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
View file @
bb968245
...
...
@@ -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
;
...
...
libavfilter/dnn/dnn_backend_native_layer_mathbinary.h
View file @
bb968245
...
...
@@ -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
libavfilter/dnn/dnn_backend_native_layer_mathunary.c
View file @
bb968245
...
...
@@ -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
;
...
...
libavfilter/dnn/dnn_backend_native_layer_mathunary.h
View file @
bb968245
...
...
@@ -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
libavfilter/dnn/dnn_backend_native_layer_maximum.c
View file @
bb968245
...
...
@@ -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
)
...
...
libavfilter/dnn/dnn_backend_native_layer_maximum.h
View file @
bb968245
...
...
@@ -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
libavfilter/dnn/dnn_backend_native_layer_pad.c
View file @
bb968245
...
...
@@ -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
;
...
...
libavfilter/dnn/dnn_backend_native_layer_pad.h
View file @
bb968245
...
...
@@ -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
libavfilter/dnn/dnn_backend_native_layers.c
View file @
bb968245
...
...
@@ -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
},
};
libavfilter/dnn/dnn_backend_native_layers.h
View file @
bb968245
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment