 |
libxcoder
5.2.0
|
Go to the documentation of this file.
35 if (!params || !name || !value)
41 if (!strcmp(
"width", name))
44 }
else if (!strcmp(
"height", name))
47 }
else if (!strcmp(
"format", name))
49 if (!strcmp(value,
"yuv420p"))
52 }
else if (!strcmp(value,
"yuv420p10le"))
55 }
else if (!strcmp(value,
"nv12"))
58 }
else if (!strcmp(value,
"p010le"))
77 if (!params || !name || !value)
83 if (!strcmp(
"width", name))
86 }
else if (!strcmp(
"height", name))
89 }
else if (!strcmp(
"x", name))
92 }
else if (!strcmp(
"y", name))
106 char key[64], value[64];
107 char *curr = filter_params, *colon_pos;
115 if (strncmp(
"ni_quadra_scale", curr, 15) == 0)
120 else if (strncmp(
"ni_quadra_drawbox", curr, 17) == 0)
127 ni_log(
NI_LOG_ERROR,
"Error: invalid filter, must be one of [ni_quadra_scale, ni_quadra_drawbox]");
133 colon_pos = strchr(curr,
':');
140 if (strlen(curr) >
sizeof(key) +
sizeof(value) - 1 ||
143 ni_log(
NI_LOG_ERROR,
"Error: cannot retrieve key/value from filter param: %s\n", curr);
162 curr = colon_pos + 1;
165 curr += strlen(curr);
179 int in_rec_height,
int in_rec_x,
int in_rec_y,
int out_rec_x,
int out_rec_y)
181 p_scaler_params->
op = op;
195 p_scaler_params->
in_rec_x = in_rec_x;
196 p_scaler_params->
in_rec_y = in_rec_y;
249 p_scaler_params->
in_rec_x = in_rec_x;
250 p_scaler_params->
in_rec_y = in_rec_y;
269 p_scaler_ctx->
hw_id = iXcoderGUID;
378 int iXcoderGUID,
int input_format,
int output_format)
388 box_width = ((int)((p_box_params->
box_w + 1) / 2) * 2);
389 box_height = ((int)((p_box_params->
box_h + 1) / 2) * 2);
390 box_x = p_box_params->
box_x;
391 box_y = p_box_params->
box_y;
417 box_height, box_x, box_y, 0, 0);
420 p_frame_in, &crop_data, crop_params);
438 line_width, line_width);
441 &crop_data.
data.
frame, &pad_data, pad_params);
461 int overlay_x = box_x - line_width;
462 int overlay_y = box_y - line_width;
464 overlay_x, overlay_y, 0, 0);
469 p_data_out, overlay_params);
473 &ovly_data, overlay_params);
515 int scale_width,
int scale_height,
int in_format,
int out_format)
531 p_data_out, scale_params);
ni_retcode_t ni_frame_buffer_free(ni_frame_t *p_frame)
Free frame buffer that was previously allocated with either ni_frame_buffer_alloc or ni_encoder_frame...
void ni_hw_frame_ref(const niFrameSurface1_t *p_surface)
void ni_hw_frame_unref(uint16_t hwframe_index)
int retrieve_filter_params(char filter_params[], ni_scale_params_t *scale_params, ni_drawbox_params_t *drawbox_params)
#define NI_INVALID_SESSION_ID
ni_device_handle_t blk_io_handle
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.
#define NI_DEFAULT_KEEP_ALIVE_TIMEOUT
ni_retcode_t ni_scaler_input_frame_alloc(ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params, niFrameSurface1_t *p_src_surface)
allocate device input frame by hw descriptor. This call won't actually allocate a frame but sends the...
int ni_drawbox_params_set_value(ni_drawbox_params_t *params, const char *name, const char *value)
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.
ni_retcode_t ni_scaler_dest_frame_alloc(ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params, niFrameSurface1_t *p_surface)
allocate device destination frame from scaler hwframe pool
@ NI_SCALER_OPCODE_OVERLAY
ni_retcode_t ni_scaler_frame_pool_alloc(ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params)
init output pool of scaler frames
ni_device_handle_t device_handle
int ni_scaler_params_set_value(ni_scale_params_t *params, const char *name, const char *value)
void ni_log(ni_log_level_t level, const char *fmt,...)
print log message using ni_log_callback
uint32_t keep_alive_timeout
uint8_t * p_data[NI_MAX_NUM_DATA_POINTERS]
int ni_param_get_key_value(char *p_str, char *key, char *value)
retrieve key and value from 'key=value' pair
ni_retcode_t ni_frame_buffer_alloc_hwenc(ni_frame_t *p_frame, int video_width, int video_height, int extra_len)
Allocate memory for the hwDescriptor buffer based on provided parameters taking into account pic size...
union _ni_session_data_io::@19 data
ni_retcode_t ni_device_session_open(ni_session_context_t *p_ctx, ni_device_type_t device_type)
Open a new device session depending on the device_type parameter If device_type is NI_DEVICE_TYPE_DEC...
enum _ni_scaler_opcode ni_scaler_opcode_t
uint32_t scaler_operation
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.
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 ni_device_session_read_hwdesc(ni_session_context_t *p_ctx, ni_session_data_io_t *p_data, ni_device_type_t device_type)
Read data from the device If device_type is NI_DEVICE_TYPE_DECODER reads data hwdesc from decoder If ...
int scaler_session_open(ni_session_context_t *p_scaler_ctx, int iXcoderGUID, ni_scaler_opcode_t op)
open scaler session