58 int32_t input_operand_index = input_operand_indexes[0];
59 int number = operands[input_operand_index].
dims[0];
60 int height = operands[input_operand_index].
dims[1];
61 int width = operands[input_operand_index].
dims[2];
63 const float *
input = operands[input_operand_index].
data;
66 int new_channels = channels / (block_size * block_size);
67 int output_linesize = width *
channels;
68 int by_linesize = output_linesize / block_size;
69 int x_linesize = new_channels * block_size;
71 DnnOperand *output_operand = &operands[output_operand_index];
72 output_operand->
dims[0] = number;
73 output_operand->
dims[1] = height * block_size;
74 output_operand->
dims[2] = width * block_size;
75 output_operand->
dims[3] = new_channels;
78 if (output_operand->
length <= 0) {
83 if (!output_operand->
data) {
87 output = output_operand->
data;
89 for (y = 0; y <
height; ++y){
90 for (x = 0; x <
width; ++x){
91 for (by = 0; by < block_size; ++by){
92 for (bx = 0; bx < block_size; ++bx){
93 for (ch = 0; ch < new_channels; ++ch){
94 output[by * by_linesize + x * x_linesize + bx * new_channels + ch] = input[ch];
96 input += new_channels;
100 output += output_linesize;
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
DNN inference functions interface for native backend.
int32_t input_operand_indexes[4]
a layer can have multiple inputs and one output.
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
DNNDataType data_type
support different kinds of data type such as float, half float, int8 etc, first support float now...
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
unsigned int avio_rl32(AVIOContext *s)
void * data
data pointer with data length in bytes.
simple assert() macros that are a bit more flexible than ISO C assert().
int32_t dims[4]
there are two memory layouts, NHWC or NCHW, so we use dims, dims[0] is Number.
int ff_dnn_load_layer_depth2space(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
DNN inference functions interface for native backend.
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
int ff_dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t *input_operand_indexes, int32_t output_operand_index, const void *parameters, NativeContext *ctx)
int32_t ff_calculate_operand_data_length(const DnnOperand *oprd)
int32_t output_operand_index