libxcoder 5.9.0
Loading...
Searching...
No Matches
ni_filter_utils.h
Go to the documentation of this file.
1/*******************************************************************************
2 *
3 * Copyright (C) 2022 NETINT Technologies
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18 * SOFTWARE.
19 *
20 ******************************************************************************/
21
22/*!*****************************************************************************
23 * \file filter_utils.h
24 *
25 * \brief Video filtering utility functions shared by Libxcoder API examples
26 ******************************************************************************/
27#pragma once
28
29#include "ni_device_api.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
42
51
52typedef struct _ni_ai_pre_params
53{
55 char nb_file[FILE_NAME_LEN]; // path to the AI network binary (.nb) file
56 int out_width; // 0 = same as input width
57 int out_height; // 0 = same as input height
58 int initialized; // set to 1 after the AI session is opened
60
61int ni_scaler_params_set_value(ni_scale_params_t *params, const char *name, const char *value);
62int ni_drawbox_params_set_value(ni_drawbox_params_t *params, const char *name, const char *value);
63int ni_ai_pre_params_set_value(ni_ai_pre_params_t *params, const char *name, const char *value);
64int retrieve_filter_params(char filter_params[], ni_scale_params_t *scale_params,
65 ni_drawbox_params_t *drawbox_params, ni_ai_pre_params_t *ai_pre_params);
66
67/*!*****************************************************************************
68 * \brief Open an AI session, configure the network binary and create the
69 * hardware output frame pool used by the ai_pre filter.
70 *
71 * \return 0 if successful, < 0 otherwise
72 ******************************************************************************/
74 int iXcoderGUID, ni_ai_pre_params_t *params,
75 int in_width, int in_height, int in_gc620_format);
76
77/*!*****************************************************************************
78 * \brief Run one AI preprocess operation on a hardware frame. The output is a
79 * new hardware frame preserving the input pixel format.
80 *
81 * \return 0 if successful, < 0 otherwise
82 ******************************************************************************/
84 ni_frame_t *p_frame_in, ni_session_data_io_t *p_data_out,
85 ni_ai_pre_params_t *params, int in_gc620_format);
86
87void init_scaler_params(ni_scaler_input_params_t *p_scaler_params, ni_scaler_opcode_t op, int in_rec_width,
88 int in_rec_height, int in_rec_x, int in_rec_y, int out_rec_x, int out_rec_y);
89int scaler_session_open(ni_session_context_t *p_scaler_ctx, int iXcoderGUID, ni_scaler_opcode_t op);
90int launch_scaler_operation(ni_session_context_t *p_scaler_ctx, int iXcoderGUID,
91 ni_frame_t *p_frame_in_up, ni_frame_t *p_frame_in_bg,
92 ni_session_data_io_t *p_data_out, ni_scaler_input_params_t scaler_params);
93
95 ni_session_context_t *p_overlay_ctx, ni_session_context_t *p_fmt_ctx,
96 ni_frame_t *p_frame_in, ni_session_data_io_t *p_data_out, ni_drawbox_params_t *p_box_params,
97 int iXcoderGUID, int input_format, int output_format);
98int scale_filter(ni_session_context_t *p_ctx, ni_frame_t *p_frame_in,
99 ni_session_data_io_t *p_data_out, int iXcoderGUID,
100 int scale_width, int scale_height, int in_format, int out_format);
101
102#ifdef __cplusplus
103}
104#endif
enum _ni_scaler_opcode ni_scaler_opcode_t
Public definitions for operating NETINT video processing devices for video processing.
struct _ni_ai_pre_params ni_ai_pre_params_t
void init_scaler_params(ni_scaler_input_params_t *p_scaler_params, ni_scaler_opcode_t op, int in_rec_width, int in_rec_height, int in_rec_x, int in_rec_y, int out_rec_x, int out_rec_y)
Init scaler params here - both user setting params and fixed params.
int scale_filter(ni_session_context_t *p_ctx, ni_frame_t *p_frame_in, ni_session_data_io_t *p_data_out, int iXcoderGUID, int scale_width, int scale_height, int in_format, int out_format)
Do a scale and/or format-change operation.
struct _ni_drawbox_params ni_drawbox_params_t
int ni_scaler_params_set_value(ni_scale_params_t *params, const char *name, const char *value)
int drawbox_filter(ni_session_context_t *p_crop_ctx, ni_session_context_t *p_pad_ctx, ni_session_context_t *p_overlay_ctx, ni_session_context_t *p_fmt_ctx, ni_frame_t *p_frame_in, ni_session_data_io_t *p_data_out, ni_drawbox_params_t *p_box_params, int iXcoderGUID, int input_format, int output_format)
Use crop->pad->overlay to simulate a drawbox filter.
int ni_ai_pre_params_set_value(ni_ai_pre_params_t *params, const char *name, const char *value)
int ai_pre_filter(ni_session_context_t *p_ai_ctx, ni_network_data_t *p_network, ni_frame_t *p_frame_in, ni_session_data_io_t *p_data_out, ni_ai_pre_params_t *params, int in_gc620_format)
Run one AI preprocess operation on a hardware frame. The output is a new hardware frame preserving th...
int launch_scaler_operation(ni_session_context_t *p_scaler_ctx, int iXcoderGUID, ni_frame_t *p_frame_in_up, ni_frame_t *p_frame_in_bg, ni_session_data_io_t *p_data_out, ni_scaler_input_params_t scaler_params)
Launch scaler operation and get the result hw frame.
int retrieve_filter_params(char filter_params[], ni_scale_params_t *scale_params, ni_drawbox_params_t *drawbox_params, ni_ai_pre_params_t *ai_pre_params)
int scaler_session_open(ni_session_context_t *p_scaler_ctx, int iXcoderGUID, ni_scaler_opcode_t op)
open scaler session
int ai_pre_filter_init(ni_session_context_t *p_ai_ctx, ni_network_data_t *p_network, int iXcoderGUID, ni_ai_pre_params_t *params, int in_width, int in_height, int in_gc620_format)
Open an AI session, configure the network binary and create the hardware output frame pool used by th...
struct _ni_scale_params ni_scale_params_t
int ni_drawbox_params_set_value(ni_drawbox_params_t *params, const char *name, const char *value)
#define FILE_NAME_LEN
char nb_file[FILE_NAME_LEN]