static DNNReturnType get_input_native(void *model, DNNData *input, const char *input_name)
{
- NativeModel *native_model = (NativeModel *)model;
+ NativeModel *native_model = model;
NativeContext *ctx = &native_model->ctx;
for (int i = 0; i < native_model->operands_num; ++i) {
const char *output_name, int *output_width, int *output_height)
{
DNNReturnType ret;
- NativeModel *native_model = (NativeModel *)model;
+ NativeModel *native_model = model;
NativeContext *ctx = &native_model->ctx;
AVFrame *in_frame = av_frame_alloc();
AVFrame *out_frame = NULL;
const char **output_names, uint32_t nb_output, AVFrame *out_frame,
int do_ioproc)
{
- NativeModel *native_model = (NativeModel *)model->model;
+ NativeModel *native_model = model->model;
NativeContext *ctx = &native_model->ctx;
int32_t layer;
DNNData input, output;
DNNReturnType ff_dnn_execute_model_native(const DNNModel *model, const char *input_name, AVFrame *in_frame,
const char **output_names, uint32_t nb_output, AVFrame *out_frame)
{
- NativeModel *native_model = (NativeModel *)model->model;
+ NativeModel *native_model = model->model;
NativeContext *ctx = &native_model->ctx;
if (!in_frame) {
if (*model)
{
if ((*model)->model) {
- native_model = (NativeModel *)(*model)->model;
+ native_model = (*model)->model;
if (native_model->layers) {
for (layer = 0; layer < native_model->layers_num; ++layer){
if (native_model->layers[layer].type == DLT_CONV2D){
int width = operands[input_operand_index].dims[2];
int channel = operands[input_operand_index].dims[3];
const float *input = operands[input_operand_index].data;
- const AvgPoolParams *avgpool_params = (const AvgPoolParams *)parameters;
+ const AvgPoolParams *avgpool_params = parameters;
int kernel_strides = avgpool_params->strides;
int src_linesize = width * channel;
int width = operands[input_operand_index].dims[2];
int channel = operands[input_operand_index].dims[3];
const float *input = operands[input_operand_index].data;
- const ConvolutionalParams *conv_params = (const ConvolutionalParams *)(thread_common_param->parameters);
+ const ConvolutionalParams *conv_params = thread_common_param->parameters;
int radius = conv_params->kernel_size >> 1;
int src_linesize = width * conv_params->input_num;
#endif
ThreadParam **thread_param = av_malloc_array(thread_num, sizeof(*thread_param));
ThreadCommonParam thread_common_param;
- const ConvolutionalParams *conv_params = (const ConvolutionalParams *)(parameters);
+ const ConvolutionalParams *conv_params = parameters;
int height = operands[input_operand_indexes[0]].dims[1];
int width = operands[input_operand_indexes[0]].dims[2];
int pad_size = (conv_params->padding_method == VALID) ? (conv_params->kernel_size - 1) / 2 * conv_params->dilation : 0;
int width = operands[input_operand_index].dims[2];
int channel = operands[input_operand_index].dims[3];
const float *input = operands[input_operand_index].data;
- const DenseParams *dense_params = (const DenseParams *)parameters;
+ const DenseParams *dense_params = parameters;
int src_linesize = width * channel;
DnnOperand *output_operand = &operands[output_operand_index];
int32_t output_operand_index, const void *parameters, NativeContext *ctx)
{
float *output;
- const DepthToSpaceParams *params = (const DepthToSpaceParams *)parameters;
+ const DepthToSpaceParams *params = parameters;
int block_size = params->block_size;
int32_t input_operand_index = input_operand_indexes[0];
int number = operands[input_operand_index].dims[0];
{
const DnnOperand *input = &operands[input_operand_indexes[0]];
DnnOperand *output = &operands[output_operand_index];
- const DnnLayerMathBinaryParams *params = (const DnnLayerMathBinaryParams *)parameters;
+ const DnnLayerMathBinaryParams *params = parameters;
for (int i = 0; i < 4; ++i)
output->dims[i] = input->dims[i];
{
const DnnOperand *input = &operands[input_operand_indexes[0]];
DnnOperand *output = &operands[output_operand_index];
- const DnnLayerMathUnaryParams *params = (const DnnLayerMathUnaryParams *)parameters;
+ const DnnLayerMathUnaryParams *params = parameters;
int dims_count;
const float *src;
float *dst;
{
const DnnOperand *input = &operands[input_operand_indexes[0]];
DnnOperand *output = &operands[output_operand_index];
- const DnnLayerMaximumParams *params = (const DnnLayerMaximumParams *)parameters;
+ const DnnLayerMaximumParams *params = parameters;
int dims_count;
const float *src;
float *dst;
int32_t before_paddings;
int32_t after_paddings;
float* output;
- const LayerPadParams *params = (const LayerPadParams *)parameters;
+ const LayerPadParams *params = parameters;
// suppose format is <N, H, W, C>
int32_t input_operand_index = input_operand_indexes[0];
static DNNReturnType get_input_ov(void *model, DNNData *input, const char *input_name)
{
- OVModel *ov_model = (OVModel *)model;
+ OVModel *ov_model = model;
OVContext *ctx = &ov_model->ctx;
char *model_input_name = NULL;
char *all_input_names = NULL;
const char *output_name, int *output_width, int *output_height)
{
DNNReturnType ret;
- OVModel *ov_model = (OVModel *)model;
+ OVModel *ov_model = model;
OVContext *ctx = &ov_model->ctx;
TaskItem task;
RequestItem request;
av_freep(&model);
return NULL;
}
- model->model = (void *)ov_model;
+ model->model = ov_model;
ov_model->model = model;
ov_model->ctx.class = &dnn_openvino_class;
ctx = &ov_model->ctx;
DNNReturnType ff_dnn_execute_model_ov(const DNNModel *model, const char *input_name, AVFrame *in_frame,
const char **output_names, uint32_t nb_output, AVFrame *out_frame)
{
- OVModel *ov_model = (OVModel *)model->model;
+ OVModel *ov_model = model->model;
OVContext *ctx = &ov_model->ctx;
TaskItem task;
RequestItem request;
DNNReturnType ff_dnn_execute_model_async_ov(const DNNModel *model, const char *input_name, AVFrame *in_frame,
const char **output_names, uint32_t nb_output, AVFrame *out_frame)
{
- OVModel *ov_model = (OVModel *)model->model;
+ OVModel *ov_model = model->model;
OVContext *ctx = &ov_model->ctx;
RequestItem *request;
TaskItem *task;
DNNAsyncStatusType ff_dnn_get_async_result_ov(const DNNModel *model, AVFrame **in, AVFrame **out)
{
- OVModel *ov_model = (OVModel *)model->model;
+ OVModel *ov_model = model->model;
TaskItem *task = ff_queue_peek_front(ov_model->task_queue);
if (!task) {
DNNReturnType ff_dnn_flush_ov(const DNNModel *model)
{
- OVModel *ov_model = (OVModel *)model->model;
+ OVModel *ov_model = model->model;
OVContext *ctx = &ov_model->ctx;
RequestItem *request;
IEStatusCode status;
void ff_dnn_free_model_ov(DNNModel **model)
{
if (*model){
- OVModel *ov_model = (OVModel *)(*model)->model;
+ OVModel *ov_model = (*model)->model;
while (ff_safe_queue_size(ov_model->request_queue) != 0) {
RequestItem *item = ff_safe_queue_pop_front(ov_model->request_queue);
if (item && item->infer_request) {
}
graph_buf = TF_NewBuffer();
- graph_buf->data = (void *)graph_data;
+ graph_buf->data = graph_data;
graph_buf->length = size;
graph_buf->data_deallocator = free_buffer;
static DNNReturnType get_input_tf(void *model, DNNData *input, const char *input_name)
{
- TFModel *tf_model = (TFModel *)model;
+ TFModel *tf_model = model;
TFContext *ctx = &tf_model->ctx;
TF_Status *status;
int64_t dims[4];
const char *output_name, int *output_width, int *output_height)
{
DNNReturnType ret;
- TFModel *tf_model = (TFModel *)model;
+ TFModel *tf_model = model;
TFContext *ctx = &tf_model->ctx;
AVFrame *in_frame = av_frame_alloc();
AVFrame *out_frame = NULL;
return DNN_ERROR;
}
- native_model = (NativeModel *)model->model;
+ native_model = model->model;
tf_model->graph = TF_NewGraph();
tf_model->status = TF_NewStatus();
}
}
- model->model = (void *)tf_model;
+ model->model = tf_model;
model->get_input = &get_input_tf;
model->get_output = &get_output_tf;
model->options = options;
int do_ioproc)
{
TF_Output *tf_outputs;
- TFModel *tf_model = (TFModel *)model->model;
+ TFModel *tf_model = model->model;
TFContext *ctx = &tf_model->ctx;
DNNData input, output;
TF_Tensor **output_tensors;
DNNReturnType ff_dnn_execute_model_tf(const DNNModel *model, const char *input_name, AVFrame *in_frame,
const char **output_names, uint32_t nb_output, AVFrame *out_frame)
{
- TFModel *tf_model = (TFModel *)model->model;
+ TFModel *tf_model = model->model;
TFContext *ctx = &tf_model->ctx;
if (!in_frame) {
TFModel *tf_model;
if (*model){
- tf_model = (TFModel *)(*model)->model;
+ tf_model = (*model)->model;
if (tf_model->graph){
TF_DeleteGraph(tf_model->graph);
}