FFmpeg
dnn_backend_native_layer_conv2d.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Sergey Lavrushkin
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "libavutil/avassert.h"
22 #include "libavutil/thread.h"
23 #include "libavutil/cpu.h"
25 
26 #define CLAMP_TO_EDGE(x, w) ((x) < 0 ? 0 : ((x) >= (w) ? (w - 1) : (x)))
27 
28 //struct to pass parameters
29 typedef struct thread_common_param{
33  const void *parameters;
35  float *output_data;
37 
38 typedef struct thread_param{
40  int thread_start, thread_end;
41 } thread_param;
42 
43 int dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
44 {
45  ConvolutionalParams *conv_params;
46  int kernel_size;
47  int dnn_size = 0;
48  conv_params = av_malloc(sizeof(*conv_params));
49  if (!conv_params)
50  return 0;
51 
52  conv_params->dilation = (int32_t)avio_rl32(model_file_context);
53  conv_params->padding_method = (int32_t)avio_rl32(model_file_context);
54  conv_params->activation = (int32_t)avio_rl32(model_file_context);
55  conv_params->input_num = (int32_t)avio_rl32(model_file_context);
56  conv_params->output_num = (int32_t)avio_rl32(model_file_context);
57  conv_params->kernel_size = (int32_t)avio_rl32(model_file_context);
58  conv_params->has_bias = (int32_t)avio_rl32(model_file_context);
59  dnn_size += 28;
60 
61  kernel_size = conv_params->input_num * conv_params->output_num *
62  conv_params->kernel_size * conv_params->kernel_size;
63  dnn_size += kernel_size * 4;
64  if (conv_params->has_bias)
65  dnn_size += conv_params->output_num * 4;
66 
67  if (dnn_size > file_size || conv_params->input_num <= 0 ||
68  conv_params->output_num <= 0 || conv_params->kernel_size <= 0){
69  av_freep(&conv_params);
70  return 0;
71  }
72 
73  conv_params->kernel = av_malloc(kernel_size * sizeof(float));
74  if (!conv_params->kernel) {
75  av_freep(&conv_params);
76  return 0;
77  }
78  for (int i = 0; i < kernel_size; ++i) {
79  conv_params->kernel[i] = av_int2float(avio_rl32(model_file_context));
80  }
81 
82  conv_params->biases = NULL;
83  if (conv_params->has_bias) {
84  conv_params->biases = av_malloc(conv_params->output_num * sizeof(float));
85  if (!conv_params->biases){
86  av_freep(&conv_params->kernel);
87  av_freep(&conv_params);
88  return 0;
89  }
90  for (int i = 0; i < conv_params->output_num; ++i){
91  conv_params->biases[i] = av_int2float(avio_rl32(model_file_context));
92  }
93  }
94 
95  layer->params = conv_params;
96 
97  layer->input_operand_indexes[0] = (int32_t)avio_rl32(model_file_context);
98  layer->output_operand_index = (int32_t)avio_rl32(model_file_context);
99  dnn_size += 8;
100 
101  if (layer->input_operand_indexes[0] >= operands_num || layer->output_operand_index >= operands_num) {
102  return 0;
103  }
104 
105  return dnn_size;
106 }
107 
108 static void * dnn_execute_layer_conv2d_thread(void *threadarg)
109 {
110  //pass parameters
111  thread_param *thread_param = (struct thread_param *)threadarg;
113  DnnOperand *operands = thread_common_param->operands;
114  int32_t input_operand_index = thread_common_param->input_operand_indexes[0];
115  int height = operands[input_operand_index].dims[1];
116  int width = operands[input_operand_index].dims[2];
117  int channel = operands[input_operand_index].dims[3];
118  const float *input = operands[input_operand_index].data;
119  const ConvolutionalParams *conv_params = (const ConvolutionalParams *)(thread_common_param->parameters);
120 
121  int radius = conv_params->kernel_size >> 1;
122  int src_linesize = width * conv_params->input_num;
123  int filter_linesize = conv_params->kernel_size * conv_params->input_num;
124  int filter_size = conv_params->kernel_size * filter_linesize;
125  int pad_size = (conv_params->padding_method == VALID) ? (conv_params->kernel_size - 1) / 2 * conv_params->dilation : 0;
126 
127  float *output = thread_common_param->output_data;
128  output += (conv_params->output_num) * (width - 2 * pad_size) * (thread_param->thread_start - pad_size);
129 
130  av_assert0(channel == conv_params->input_num);
131 
132  for (int y = thread_param->thread_start; y < thread_param->thread_end; ++y) {
133  for (int x = pad_size; x < width - pad_size; ++x) {
134  for (int n_filter = 0; n_filter < conv_params->output_num; ++n_filter) {
135  if (conv_params->has_bias)
136  output[n_filter] = conv_params->biases[n_filter];
137  else
138  output[n_filter] = 0.f;
139 
140  for (int ch = 0; ch < conv_params->input_num; ++ch) {
141  for (int kernel_y = 0; kernel_y < conv_params->kernel_size; ++kernel_y) {
142  for (int kernel_x = 0; kernel_x < conv_params->kernel_size; ++kernel_x) {
143  float input_pel;
144  if (conv_params->padding_method == SAME_CLAMP_TO_EDGE) {
145  int y_pos = CLAMP_TO_EDGE(y + (kernel_y - radius) * conv_params->dilation, height);
146  int x_pos = CLAMP_TO_EDGE(x + (kernel_x - radius) * conv_params->dilation, width);
147  input_pel = input[y_pos * src_linesize + x_pos * conv_params->input_num + ch];
148  } else {
149  int y_pos = y + (kernel_y - radius) * conv_params->dilation;
150  int x_pos = x + (kernel_x - radius) * conv_params->dilation;
151  input_pel = (x_pos < 0 || x_pos >= width || y_pos < 0 || y_pos >= height) ? 0.0 :
152  input[y_pos * src_linesize + x_pos * conv_params->input_num + ch];
153  }
154 
155 
156  output[n_filter] += input_pel * conv_params->kernel[n_filter * filter_size + kernel_y * filter_linesize +
157  kernel_x * conv_params->input_num + ch];
158  }
159  }
160  }
161  switch (conv_params->activation){
162  case RELU:
163  output[n_filter] = FFMAX(output[n_filter], 0.0);
164  break;
165  case TANH:
166  output[n_filter] = 2.0f / (1.0f + exp(-2.0f * output[n_filter])) - 1.0f;
167  break;
168  case SIGMOID:
169  output[n_filter] = 1.0f / (1.0f + exp(-output[n_filter]));
170  break;
171  case NONE:
172  break;
173  case LEAKY_RELU:
174  output[n_filter] = FFMAX(output[n_filter], 0.0) + 0.2 * FFMIN(output[n_filter], 0.0);
175  }
176  }
177  output += conv_params->output_num;
178  }
179  }
180  return (void *)DNN_SUCCESS;
181 }
182 
183 
186 {
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);
189 #if HAVE_PTHREAD_CANCEL
190  pthread_t *thread_id = av_malloc(thread_num * sizeof(pthread_t));
191  int thread_stride;
192 #endif
193  thread_param **thread_param = av_malloc(thread_num * sizeof(*thread_param));
195  const ConvolutionalParams *conv_params = (const ConvolutionalParams *)(parameters);
196  int height = operands[input_operand_indexes[0]].dims[1];
197  int width = operands[input_operand_indexes[0]].dims[2];
198  int pad_size = (conv_params->padding_method == VALID) ? (conv_params->kernel_size - 1) / 2 * conv_params->dilation : 0;
199  DnnOperand *output_operand = &operands[output_operand_index];
200 
201  output_operand->dims[0] = operands[input_operand_indexes[0]].dims[0];
202  output_operand->dims[1] = height - pad_size * 2;
203  output_operand->dims[2] = width - pad_size * 2;
204  output_operand->dims[3] = conv_params->output_num;
205  output_operand->data_type = operands[input_operand_indexes[0]].data_type;
206  output_operand->length = calculate_operand_data_length(output_operand);
207  if (output_operand->length <= 0) {
208  av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
209  return DNN_ERROR;
210  }
211  output_operand->data = av_realloc(output_operand->data, output_operand->length);
212  if (!output_operand->data) {
213  av_log(ctx, AV_LOG_ERROR, "Failed to reallocate memory for output\n");
214  return DNN_ERROR;
215  }
216  thread_common_param.output_data = output_operand->data;
217  thread_common_param.operands = operands;
218  thread_common_param.input_operand_indexes = input_operand_indexes;
219  thread_common_param.output_operand_index = output_operand_index;
220  thread_common_param.parameters = parameters;
221  thread_common_param.ctx = ctx;
222 
223 #if HAVE_PTHREAD_CANCEL
224  thread_stride = (height - pad_size * 2) / thread_num;
225  //create threads
226  for (int i = 0; i < thread_num; i++){
227  thread_param[i] = av_malloc(sizeof(**thread_param));
228  thread_param[i]->thread_common_param = &thread_common_param;
229  thread_param[i]->thread_start = thread_stride * i + pad_size;
230  thread_param[i]->thread_end = (i == thread_num - 1) ? (height - pad_size) : (thread_param[i]->thread_start + thread_stride);
231  pthread_create(&thread_id[i], NULL, dnn_execute_layer_conv2d_thread, (void *)thread_param[i]);
232  }
233 
234  //join threads, res gets function return
235  for (int i = 0; i < thread_num; i++){
236  pthread_join(thread_id[i], NULL);
237  }
238 
239  //release memory
240  av_free(thread_id);
241 
242  for (int i = 0; i < thread_num; i++){
243  av_free(thread_param[i]);
244  }
245 #else
246  thread_param[0] = av_malloc(sizeof(**thread_param));
247  thread_param[0]->thread_common_param = &thread_common_param;
248  thread_param[0]->thread_start = pad_size;
249  thread_param[0]->thread_end = height - pad_size;
250  dnn_execute_layer_conv2d_thread((void *)thread_param[0]);
251  av_free(thread_param[0]);
252 #endif
253 
254  av_free(thread_param);
255  return DNN_SUCCESS;
256 }
#define NULL
Definition: coverity.c:32
Bytestream IO Context.
Definition: avio.h:161
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
Definition: mem.c:134
int av_cpu_count(void)
Definition: cpu.c:275
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
Definition: intfloat.h:40
int32_t input_operand_indexes[4]
a layer can have multiple inputs and one output.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
#define av_malloc(s)
#define f(width, name)
Definition: cbs_vp9.c:255
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
#define height
DNNDataType data_type
support different kinds of data type such as float, half float, int8 etc, first support float now...
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:194
unsigned int avio_rl32(AVIOContext *s)
Definition: aviobuf.c:759
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.
#define FFMAX(a, b)
Definition: common.h:94
int8_t exp
Definition: eval.c:72
#define FFMIN(a, b)
Definition: common.h:96
#define width
Definition: af_afade.c:54
int32_t
static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
Definition: os2threads.h:94
int dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
static av_always_inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
Definition: os2threads.h:80
#define CLAMP_TO_EDGE(x, w)
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
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(const uint8_t *) pi-0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(const int16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(const int16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16,*(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16,*(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(const int32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(const int32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32,*(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32,*(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(const int64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64,*(const int64_t *) pi *(1.0f/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64,*(const int64_t *) pi *(1.0/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(const float *) pi *(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(const double *) pi *(UINT64_C(1)<< 63)))#define FMT_PAIR_FUNC(out, in) static conv_func_type *const fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64),};static void cpy1(uint8_t **dst, const uint8_t **src, int len){memcpy(*dst,*src, len);}static void cpy2(uint8_t **dst, const uint8_t **src, int len){memcpy(*dst,*src, 2 *len);}static void cpy4(uint8_t **dst, const uint8_t **src, int len){memcpy(*dst,*src, 4 *len);}static void cpy8(uint8_t **dst, const uint8_t **src, int len){memcpy(*dst,*src, 8 *len);}AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags){AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) return NULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) return NULL;if(channels==1){in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);}ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map){switch(av_get_bytes_per_sample(in_fmt)){case 1:ctx->simd_f=cpy1;break;case 2:ctx->simd_f=cpy2;break;case 4:ctx->simd_f=cpy4;break;case 8:ctx->simd_f=cpy8;break;}}if(HAVE_X86ASM &&1) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);return ctx;}void swri_audio_convert_free(AudioConvert **ctx){av_freep(ctx);}int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len){int ch;int off=0;const int os=(out->planar?1:out->ch_count)*out->bps;unsigned misaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask){int planes=in->planar?in->ch_count:1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;}if(ctx->out_simd_align_mask){int planes=out->planar?out->ch_count:1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;}if(ctx->simd_f &&!ctx->ch_map &&!misaligned){off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){if(out->planar==in->planar){int planes=out->planar?out->ch_count:1;for(ch=0;ch< planes;ch++){ctx->simd_f(out-> ch ch
Definition: audioconvert.c:56
static void * dnn_execute_layer_conv2d_thread(void *threadarg)
channel
Use these values when setting the channel map with ebur128_set_channel().
Definition: ebur128.h:39
NativeOptions options
int dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_indexes, int32_t output_operand_index, const void *parameters, NativeContext *ctx)
int32_t calculate_operand_data_length(const DnnOperand *oprd)
#define av_free(p)
void * params
#define av_freep(p)
thread_common_param * thread_common_param
int i
Definition: input.c:407
int32_t output_operand_index