libxcoder 5.7.0
Loading...
Searching...
No Matches
ni_device_api.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 ni_device_api.h
24 *
25 * \brief Public definitions for operating NETINT video processing devices for
26 * video processing
27 ******************************************************************************/
28
29#pragma once
30
31
32#ifdef __cplusplus
33extern "C"
34{
35#endif
36
37#include "ni_defs.h"
38#include "ni_rsrc_api.h"
39
40// resource allocation strategy names
41#define NI_BEST_MODEL_LOAD_STR "bestmodelload"
42#define NI_BEST_REAL_LOAD_STR "bestload"
43
44#define NI_DATA_FORMAT_VIDEO_PACKET 0
45#define NI_DATA_FORMAT_YUV_FRAME 1
46#define NI_DATA_FORMAT_Y_FRAME 2
47#define NI_DATA_FORMAT_CB_FRAME 3
48#define NI_DATA_FORMAT_CR_FRAME 4
49
50// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
51// If you change this,you should also change NI_QUADRA_NOPTS_VALUE in ni_quadra_filter_api.h
52#define NI_NOPTS_VALUE ((int64_t)UINT64_C(0x8000000000000000))
53
54// the following are the default values from FFmpeg
55#define AV_CODEC_DEFAULT_BITRATE 200 * 1000
56#define PRESET_DEFAULT_BITRATE 1000 * 1000
57
58#define NI_MAX_GOP_NUM 8
59
60#define NI_MAX_REF_PIC 4
61
62#ifndef DEPRECATION_AS_ERROR
64#define NI_MAX_VUI_SIZE NI_DEPRECATED_MACRO 32
65#endif
66
67#define NI_MAX_TX_RETRIES 1000
68
69#define NI_MAX_ENCODER_QUERY_RETRIES 5000
70
71// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
72// If you change this,you should also change NI_QUADRA_MAX_SUPPORT_DRAWBOX_NUM, NI_MAX_SUPPORT_WATERMARK_NUM
73// in ni_quadra_filter_api.h
74#define NI_MAX_SUPPORT_DRAWBOX_NUM 5
75#define NI_MAX_SUPPORT_WATERMARK_NUM 6
76
77// Number of pixels for main stream resolutions
78#define NI_NUM_OF_PIXELS_360P (640*360)
79#define NI_NUM_OF_PIXELS_720P (1280*720)
80#define NI_NUM_OF_PIXELS_1080P (1920*1080)
81#define NI_NUM_OF_PIXELS_1440P (2560*1440)
82#define NI_NUM_OF_PIXELS_4K (3840*2160)
83#define NI_NUM_OF_PIXELS_4K_2 (4096*2160)
84#define NI_NUM_OF_PIXELS_8K (7680*4320)
85
86#define NI_MIN_RESOLUTION_WIDTH_JPEG 48
87#define NI_MIN_RESOLUTION_HEIGHT_JPEG 48
88
89#define NI_MIN_RESOLUTION_WIDTH 144
90#define NI_MIN_RESOLUTION_HEIGHT 144
91#define NI_ENC_MIN_RESOLUTION_WIDTH 144
92#define NI_ENC_MIN_RESOLUTION_HEIGHT 128
93
94// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
95// If you change this,you should also change NI_MIN_RESOLUTION_WIDTH_SCALER,
96// NI_MIN_RESOLUTION_HEIGHT_SCALER in ni_quadra_filter_api.h
97#define NI_MIN_RESOLUTION_WIDTH_SCALER 16
98#define NI_MIN_RESOLUTION_HEIGHT_SCALER 16
99
100// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
101// If you change this,you should also change NI_QUADRA_MAX_RESOLUTION_WIDTH,
102// NI_QUADRA_MAX_RESOLUTION_HEIGHT in ni_quadra_filter_api.h
103#define NI_MAX_RESOLUTION_WIDTH 8192
104#define NI_MAX_RESOLUTION_HEIGHT 8192
105#define NI_MAX_RESOLUTION_AREA 8192*8192
106#define NI_MAX_RESOLUTION_RGBA_WIDTH 7040
107#define NI_MAX_RESOLUTION_RGBA_HEIGHT 7040
108
109#define NI_MAX_RESOLUTION_LINESIZE (NI_MAX_RESOLUTION_WIDTH*2)
110
111#define NI_FRAME_LITTLE_ENDIAN 0
112#define NI_FRAME_BIG_ENDIAN 1
113
114#define NI_INVALID_SESSION_ID 0xFFFF
115
116#define NI_MAX_BITRATE 800000000
117#define NI_MIN_BITRATE 10000
118
119#define NI_MAX_FRAMERATE 65535
120#define NI_MAX_ASPECTRATIO 65535
121
122/*Values below used for VPU resolution range checking*/
123// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
124// If you change this,you should also change NI_QUADRA_MAX_WIDTH, NI_QUADRA_MIN_WIDTH,
125// NI_QUADRA_MAX_HEIGHT, NI_QUADRA_MIN_HEIGHT in ni_quadra_filter_api.h
126#define NI_MAX_WIDTH 8192
127#define NI_MIN_WIDTH 144
128#define NI_MAX_HEIGHT 8192
129#define NI_MIN_HEIGHT 128
130
131#define NI_2PASS_ENCODE_MIN_WIDTH ((272 + 31) / 32 * 32)
132#define NI_2PASS_ENCODE_MIN_HEIGHT 256
133
134#define NI_MULTICORE_ENCODE_MIN_WIDTH 256
135#define NI_MULTICORE_ENCODE_MIN_HEIGHT 256
136
137/*Values below used for parameter resolution range checking*/
138#define NI_PARAM_MAX_WIDTH 8192
139#define NI_PARAM_MIN_WIDTH 32
140#define NI_PARAM_MAX_HEIGHT 8192
141#define NI_PARAM_MIN_HEIGHT 32
142
143#define NI_PARAM_JPEG_MIN_WIDTH 48
144#define NI_PARAM_JPEG_MIN_HEIGHT 48
145
146#define NI_PARAM_AV1_MIN_WIDTH 144
147#define NI_PARAM_AV1_MIN_HEIGHT 128
148#define NI_PARAM_AV1_MAX_WIDTH 4096
149#define NI_PARAM_AV1_MAX_HEIGHT 4352
150#define NI_PARAM_AV1_MAX_AREA (4096 * 2304)
151#define NI_PARAM_AV1_ALIGN_WIDTH_HEIGHT 8
152
153#define NI_MAX_GOP_SIZE 8
154#define NI_MIN_GOP_SIZE 1
155#define NI_MAX_GOP_PRESET_IDX 15
156#define NI_MIN_GOP_PRESET_IDX -1
157#define NI_MAX_DECODING_REFRESH_TYPE 2
158#define NI_MIN_DECODING_REFRESH_TYPE 0
159#define NI_MAX_CU_SIZE_MODE 2
160#define NI_MIN_CU_SIZE_MODE 0
161#define NI_DEFAULT_CU_SIZE_MODE 7
162#define NI_MAX_DYNAMIC_MERGE 1
163#define NI_MIN_DYNAMIC_MERGE 0
164#define NI_MAX_USE_RECOMMENDED_ENC_PARAMS 3
165#define NI_MIN_USE_RECOMMENDED_ENC_PARAMS 0
166#define NI_MAX_MAX_NUM_MERGE 3
167#define NI_MIN_MAX_NUM_MERGE 0
168#define NI_MAX_INTRA_QP 51
169#define NI_MIN_INTRA_QP -1
170#define NI_MAX_INTRA_QP_DELTA 51
171#define NI_MIN_INTRA_QP_DELTA -51
172#define NI_DEFAULT_INTRA_QP 22
173#define NI_INTRA_QP_RANGE 25
174#define NI_MIN_QP_DELTA (-25)
175#define NI_MAX_QP_DELTA 25
176#define NI_MAX_QP_INFO 63
177#define NI_MAX_BIN 1
178#define NI_MIN_BIN 0
179#define NI_MAX_NUM_SESSIONS 32
180#define NI_MIN_FRAME_SIZE 0
181#define NI_MAX_FRAME_SIZE (7680*4320*3)
182#define NI_AV1_INVALID_BUFFER_INDEX (-1)
183#define NI_MAX_SPATIAL_LAYERS 4
184
185#define RC_SUCCESS true
186#define RC_ERROR false
187
188#define MAX_CHAR_IN_DEVICE_NAME 32
189
190// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
191// If you change this,you should also change MAX_QUADRA_NUM_FRAMEPOOL_HWAVFRAME in ni_quadra_filter_api.h
192#define MAX_NUM_FRAMEPOOL_HWAVFRAME 128
193
194/* These constants are the values used by the GC620 2D engine */
195#define GC620_NV12 0x104
196#define GC620_NV21 0x105
197#define GC620_I420 0x103
198#define GC620_P010_MSB 0x108
199#define GC620_I010 0x10A
200#define GC620_YUYV 0x100
201#define GC620_UYVY 0x101
202#define GC620_NV16 0x106
203#define GC620_RGBA8888 0
204#define GC620_BGRA8888 4
205#define GC620_BGRX8888 5
206#define GC620_ABGR8888 12
207#define GC620_ARGB8888 15
208#define GC620_RGB565 3
209#define GC620_BGR565 11
210#define GC620_B5G5R5X1 8
211#define GC620_RGB888_PLANAR 0x10C
212
213#define NI_ENABLE_AUD_FOR_GLOBAL_HEADER 2
214
215// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
216// If you change this,you should also change NI_QUADRA_MAX_FIFO_CAPACITY in ni_quadra_filter_api.h
217#define NI_MAX_FIFO_CAPACITY 120
218
219/* These are Namespace and QOS configuration related */
220#define NI_NAMESPACE_MAX_NUM 128
221
222/* These are sliceArg configuration related */
223#define NI_MAX_SLICE_SIZE 127
224
225/*!*
226* Operation modes for QOS
227*/
234
235/*!*
236* Operation codes for ni_device_config_ns_qos
237*/
246
247// XCODER STATE
248typedef enum
249{
250 NI_XCODER_IDLE_STATE = 0x00, // Xcoder idle state
251 NI_XCODER_OPEN_STATE = 0x01 << 1, // Xcoder open state
252 NI_XCODER_WRITE_STATE = 0x01 << 2, // Xcoder write state
253 NI_XCODER_READ_STATE = 0x01 << 3, // Xcoder read state
254 NI_XCODER_CLOSE_STATE = 0x01 << 4, // Xcoder close state
255 // Xcoder flush state, flush at the end of stream
257 // Xcoder inter flush state, flush during transcoding stream
259 NI_XCODER_READ_DESC_STATE = 0x01 << 7, // Xcoder Read Desc state
260 NI_XCODER_HWUP_STATE = 0x01 << 8, // Xcoder HW upload state
261 NI_XCODER_HWDL_STATE = 0x01 << 9, // Xcoder HW download state
262 // Other states, like init, alloc, etc.
265
266typedef enum
267{
268 NI_PIX_FMT_YUV420P = 0, /* 8-bit YUV420 planar */
269 NI_PIX_FMT_YUV420P10LE = 1, /* 10-bit YUV420 planar */
270 NI_PIX_FMT_NV12 = 2, /* 8-bit YUV420 semi-planar */
271 NI_PIX_FMT_P010LE = 3, /* 10-bit YUV420 semi-planar */
272 NI_PIX_FMT_RGBA = 4, /* 32-bit RGBA packed */
273 NI_PIX_FMT_BGRA = 5, /* 32-bit BGRA packed */
274 NI_PIX_FMT_ARGB = 6, /* 32-bit ARGB packed */
275 NI_PIX_FMT_ABGR = 7, /* 32-bit ABGR packed */
276 NI_PIX_FMT_BGR0 = 8, /* 32-bit BGRX packed */
277 NI_PIX_FMT_BGRP = 9, /* 24-bit BGR planar */
278 NI_PIX_FMT_NV16 = 10, /* 8-bit YUV422 semi-planar */
279 NI_PIX_FMT_YUYV422 = 11, /* 8-bit YUV422 packed */
280 NI_PIX_FMT_UYVY422 = 12, /* 8-bit YUV422 packed */
281 NI_PIX_FMT_8_TILED4X4 = 13, /* 8 bit tiled4x4 */
282 NI_PIX_FMT_10_TILED4X4 = 14,/* 10 bit tiled4x4 */
283 NI_PIX_FMT_NONE = 15, /* invalid format */
285
294
295typedef enum {
296 NI_CUS_ROI_DISABLE = 0, // disable 2-pass customize roi
297 NI_CUS_ROI_MAPFILE = 1, // select qp in customizeQpMapFile
298 NI_CUS_ROI_REPLACE = 2, // replace the cutree roimap with the customize roimap
299 NI_CUS_ROI_OVERWRITE = 3, // overwrite the cutree roimap with the customize roimap
300 NI_CUS_ROI_MERGE = 4 // add the customize roimap into the cutree roimap
302
303// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
304// If you change this,you should also change NI_QUADRA_SCALER_FLAG_* in ni_quadra_filter_api.h
305#define NI_SCALER_FLAG_IO 0x0001 /* 0 = source frame, 1 = destination frame */
306#define NI_SCALER_FLAG_PC 0x0002 /* 0 = single allocation, 1 = create pool */
307#define NI_SCALER_FLAG_PA 0x0004 /* 0 = straight alpha, 1 = premultiplied alpha */
308#define NI_SCALER_FLAG_P2 0x0008 /* 0 = normal allocation, 1 = P2P allocation */
309#define NI_SCALER_FLAG_FCE 0x0010 /* 0 = no fill color, 1 = fill color enabled */
310#define NI_SCALER_FLAG_CS 0x0020 /* 0 = BT.709, 1 = BT.2020 */
311#define NI_SCALER_FLAG_LM 0x0040 /* 0 == no memory acquisition limit, 1 == limit memory acquisition */
312#define NI_SCALER_FLAG_CMP 0x0800 /* 0 = no compress, 1 = compress*/
313
314#define NI_AI_FLAG_IO 0x0001 /* 0 = source frame, 1 = destination frame */
315#define NI_AI_FLAG_PC 0x0002 /* 0 = single allocation, 1 = create pool */
316#define NI_AI_FLAG_LM 0x0004 /* 0 == no memory acquisition limit; 1 == limit memory acquisition */
317#define NI_AI_FLAG_IOVEC 0x0008
318#define NI_AI_FLAG_SC 0x0010 /* 0 == size got from network info; 1 == size configured by sw */
319
320#define NI_UPLOADER_FLAG_LM 0x0010 /* 0 == no memory acquisition limit, 1 == limit memory acquisition */
321
322// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
323// If you change this,you should also change NI_QUADRA_MAX_KEEP_ALIVE_TIMEOUT,
324// NI_QUADRA_MIN_KEEP_ALIVE_TIMEOUT,NI_QUADRA_DEFAULT_KEEP_ALIVE_TIMEOUT in ni_quadra_filter_api.h
325#define NI_MAX_KEEP_ALIVE_TIMEOUT 100
326#define NI_MIN_KEEP_ALIVE_TIMEOUT 1
327#define NI_DEFAULT_KEEP_ALIVE_TIMEOUT 3
328
329#define NI_MIN_CUSTOM_SEI_PASSTHRU -1
330#define NI_MAX_CUSTOM_SEI_PASSTHRU 254
331#define NI_DISABLE_USR_DATA_SEI_PASSTHRU 0
332#define NI_ENABLE_USR_DATA_SEI_PASSTHRU 1
333#define NI_INVALID_SVCT_DECODING_LAYER -1
334#define NI_EC_POLICY_TOLERANT 1
335#define NI_EC_POLICY_IGNORE 2
336#define NI_EC_POLICY_SKIP 3
337#define NI_EC_POLICY_BEST_EFFORT 4
338#define NI_EC_POLICY_LIMITED_ERROR 5
339#define NI_EC_POLICY_BEST_EFFORT_OUT_DC 6
340#define NI_EC_POLICY_DEFAULT NI_EC_POLICY_BEST_EFFORT
341#define NI_EC_ERR_THRESHOLD_DEFAULT 10
342
343// Picked from the xcoder firmware, commit e3b882e7
344#define NI_VPU_CEIL(_data, _align) (((_data)+((_align)-1))&~((_align)-1))
345#define NI_VPU_ALIGN4(_x) (((_x)+0x03)&~0x03)
346#define NI_VPU_ALIGN8(_x) (((_x)+0x07)&~0x07)
347#define NI_VPU_ALIGN16(_x) (((_x)+0x0f)&~0x0f)
348#define NI_VPU_ALIGN32(_x) (((_x)+0x1f)&~0x1f)
349#define NI_VPU_ALIGN64(_x) (((_x)+0x3f)&~0x3f)
350#define NI_VPU_ALIGN128(_x) (((_x)+0x7f)&~0x7f)
351#define NI_VPU_ALIGN256(_x) (((_x)+0xff)&~0xff)
352#define NI_VPU_ALIGN512(_x) (((_x)+0x1ff)&~0x1ff)
353#define NI_VPU_ALIGN2048(_x) (((_x)+0x7ff)&~0x7ff)
354#define NI_VPU_ALIGN4096(_x) (((_x)+0xfff)&~0xfff)
355#define NI_VPU_ALIGN16384(_x) (((_x)+0x3fff)&~0x3fff)
356
357#if 1 // QUADRA_SEI_FMT
358#pragma pack(1)
359typedef struct _ni_sei_header {
360 uint8_t status;
361 uint16_t size;
362 uint8_t type;
364#pragma pack()
365#else // QUADRA_SEI_FMT
366typedef struct _ni_sei_user_data_entry
367{
368 uint32_t offset;
369 uint32_t size;
370} ni_sei_user_data_entry_t;
371#endif // QUADRA_SEI_FMT
372
373typedef enum
374{
380 NI_H265_USERDATA_FLAG_ITU_T_T35_PRE = 5, /* SEI Prefix: user_data_registered_itu_t_t35 */
381 NI_H265_USERDATA_FLAG_UNREGISTERED_PRE = 6, /* SEI Prefix: user_data_unregistered */
382 NI_H265_USERDATA_FLAG_ITU_T_T35_SUF = 7, /* SEI Suffix: user_data_registered_itu_t_t35 */
383 NI_H265_USERDATA_FLAG_UNREGISTERED_SUF = 8, /* SEI Suffix: user_data_unregistered */
384 NI_H265_USERDATA_FLAG_RESERVED_9 = 9, /* SEI RESERVED */
385 NI_H265_USERDATA_FLAG_MASTERING_COLOR_VOL = 10, /* SEI Prefix: mastering_display_color_volume */
386 NI_H265_USERDATA_FLAG_CHROMA_RESAMPLING_FILTER_HINT = 11, /* SEI Prefix: chroma_resampling_filter_hint */
387 NI_H265_USERDATA_FLAG_KNEE_FUNCTION_INFO = 12, /* SEI Prefix: knee_function_info */
388 NI_H265_USERDATA_FLAG_TONE_MAPPING_INFO = 13, /* SEI Prefix: tone_mapping_info */
389 NI_H265_USER_DATA_FLAG_FILM_GRAIN_CHARACTERISTICS_INFO = 14, /* SEI Prefix: film_grain_characteristics_info */
390 NI_H265_USER_DATA_FLAG_CONTENT_LIGHT_LEVEL_INFO = 15, /* SEI Prefix: content_light_level_info */
391 NI_H265_USER_DATA_FLAG_COLOUR_REMAPPING_INFO = 16, /* SEI Prefix: content_light_level_info */
392 NI_H265_USERDATA_FLAG_ITU_T_T35_PRE_1 = 28, /* SEI Prefix: additional user_data_registered_itu_t_t35 */
393 NI_H265_USERDATA_FLAG_ITU_T_T35_PRE_2 = 29, /* SEI Prefix: additional user_data_registered_itu_t_t35 */
394 NI_H265_USERDATA_FLAG_ITU_T_T35_SUF_1 = 30, /* SEI Suffix: additional user_data_registered_itu_t_t35 */
395 NI_H265_USERDATA_FLAG_ITU_T_T35_SUF_2 = 31, /* SEI Suffix: additional user_data_registered_itu_t_t35 */
397
398typedef enum
399{
400 PIC_TYPE_I = 0, /*!*< I picture */
401 PIC_TYPE_P = 1, /*!*< P picture */
402 PIC_TYPE_B = 2, /*!*< B picture (except VC1) */
403
405 PIC_TYPE_IDR = 3, /*!*< Encoder IDR pic type */
406 DECODER_PIC_TYPE_IDR = 5, /*!*< Decoder-returned IDR pic type */
407 PIC_TYPE_NIDR = 5, /*!*< H.264/H.265 IDR picture */
408 PIC_NOT_CODED = 6, /*!*< Picture dropped in encoder */
409 PIC_TYPE_MAX /*!*< No Meaning */
411
412#if 1 // QUADRA_SEI_FMT
413// user data unreg and custom SEIs have variable length;
414// non-custom SEIs will be dropped if buffer overflow;
415// custom SEIs passthru is via SW and host memory constrained
416#define NI_ENC_MAX_SEI_BUF_SIZE NI_VPU_ALIGN64(1024) // sync with encoder
417
418// PIC_TIMING and BUFFERING_PERIOD apply to encoder only, not needed from decoder
419// For now, only the following will be returned from decoder:
420// - T35 has 3 possible data types: CLOSE_CAPTION, HDR10PLUS, AFD
421// - MASTERING_DISPLAY_COLOUR
422// - CONTENT_LIGHT_LEVEL
423// - USER_DATA_UNREGISTERED
424// - CUSTOM_SEI
425// Note: USER_DATA_UNREGISTERED may have arbitrary size but SEI buffer
426// size is limited. The SEI buffer on decoder has the following format:
427// [byte0: #entries][entry1]..[entryN]
428// up to (1 + sizeof(ni_sei_header_t) + NI_MAX_SEI_DATA) bytes maximum;
429// where [entryX] := [ni_sei_header][payload]
430// [payload] of ni_sei_header.size: present only if ni_sei_header.status == 1
431// X in [1..N] with N <= #entries
432// N == #entries only if NI_MAX_SEI_DATA is large enough to store all #entries
433// ex:
434// entryX header fits in the buffer during SEI extration, but payload can't fit in;
435// so only entryX header is stored but payload is drop with status set 0.
436// entryX header can't fit in the buffer (SEI buffer full); so extryX is not stored
437// in the SEI buffer (neither will any further SEIs)
438//
439// To maintain alignment, current implementation retrieves SEI data buffer from
440// entry 1's payload onwards (skipping byte0, and entry 1's header),
441// while #entries (same value as SEI buffer byte0) and entry 1's header are notified
442// separately via metadata.
443#define NI_MAX_SEI_DATA (NI_ENC_MAX_SEI_BUF_SIZE) // sync with decoder_manager
444// Custom SEI only applies to software delivery
445#define NI_MAX_CUSTOM_SEI_DATA (8192)
446
447#else // QUADRA_SEI_FMT
448#define NI_MAX_SEI_ENTRIES 32
449// 32 user_data_entry_t records + various SEI messages sizes
450#define NI_MAX_SEI_DATA \
451 NI_MAX_SEI_ENTRIES * sizeof(ni_sei_user_data_entry_t) + \
452 NI_MAX_T35_CLOSE_CAPTION_SIZE + \
453 NI_MASTERING_DISPLAY_COLOUR_VOLUME_SIZE + \
454 NI_CONTENT_LIGHT_LEVEL_INFO_SIZE + NI_MAX_T35_HDR10PLUS_SIZE + \
455 NI_MAX_T35_AFD_SIZE
456#endif // QUADRA_SEI_FMT
457
458#define NI_DEC_MAX_CC_BUF_SIZE 93 // max 31 CC entries of 3 bytes each
459
460#define NI_CC_SEI_BYTE0 0xB5 // itu_t_t35_country_code =181 (North America)
461#define NI_CC_SEI_BYTE1 0x00
462#define NI_CC_SEI_BYTE2 0x31 // itu_t_t35_provider_code = 49
463#define NI_CC_SEI_BYTE3 0x47 // ATSC_user_identifier = "GA94"
464#define NI_CC_SEI_BYTE4 0x41
465#define NI_CC_SEI_BYTE5 0x39
466#define NI_CC_SEI_BYTE6 0x34
467#define NI_CC_SEI_BYTE7 0x03 // cc_data = 0x03
468
469#define NI_HDR10P_SEI_BYTE0 0xB5 // itu_t_t35_country_code =181 (North America
470#define NI_HDR10P_SEI_BYTE1 0x00
471#define NI_HDR10P_SEI_BYTE2 0x3c // itu_t_t35_provider_code = 0x003c
472#define NI_HDR10P_SEI_BYTE3 0x00
473#define NI_HDR10P_SEI_BYTE4 0x01 // u16 itu_t_t35_provider_oriented_code = 0x0001
474#define NI_HDR10P_SEI_BYTE5 0x04 // u8 application_identifier = 0x04
475// no longer checking the application version as it was originally 0 but was recently specified as one by AOM.
476#define NI_HDR10P_SEI_BYTE6 0x00 // u8 application version = 0x00
477
478#define NI_CC_SEI_HDR_HEVC_LEN 18
479#define NI_HDR10P_SEI_HDR_HEVC_LEN 9
480#define NI_HDR10P_SEI_HDR_H264_LEN 8
481#define NI_CC_SEI_HDR_H264_LEN 17
482#define NI_CC_SEI_TRAILER_LEN 2
483#define NI_RBSP_TRAILING_BITS_LEN 1
484
485// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
486// If you change this,you should also change NI_QUADRA_MAX_NUM_AUX_DATA_PER_FRAME in ni_quadra_filter_api.h
487#define NI_MAX_NUM_AUX_DATA_PER_FRAME 16
488
490#define NI_BITRATE_RECONFIG_FILE_MAX_LINES 50000
493#define NI_BITRATE_RECONFIG_FILE_MAX_ENTRIES_PER_LINE 10
494
496#define NI_CUSTOMIZE_ROI_QPOFFSET_LEVEL 10
498#define NI_CUSTOMIZE_ROI_QP_NUM 64
499
500#define MOTION_CONSTRAINED_PERFORMANCE_MODE 1
501#define MOTION_CONSTRAINED_QUALITY_MODE 2
502
503/*!*
504* \brief Frame pool type.
505*/
507{
508 NI_POOL_TYPE_NONE = -1, /* frame pool not inited or allocated */
512
513// frame auxiliary data; mostly used for SEI data associated with frame
515{
517
518 // ATSC A53 Part 4 Closed Captions
520
521 // HDR10 mastering display metadata associated with a video frame
523
524 // HDR10 content light level (based on CTA-861.3). This payload contains
525 // data in the form of ni_content_light_level_t struct.
527
528 // HDR10+ dynamic metadata associated with a video frame. The payload is
529 // a ni_dynamic_hdr_plus_t struct that contains information for color volume
530 // transform - application 4 of SMPTE 2094-40:2016 standard.
532
533 // Regions of Interest, the payload is an array of ni_region_of_interest_t,
534 // the number of array element is implied by:
535 // ni_frame_aux_data.size / sizeof(ni_region_of_interest_t)
537
538 // NETINT: user data unregistered SEI data, which takes SEI payload type
539 // USER_DATA_UNREGISTERED.
540 // There will be no byte reordering.
541 // Usually this payload would be: 16B UUID + other payload Bytes.
543
544 // NETINT: custom SEI data, which takes SEI payload custom types.
545 // There will be no byte reordering.
546 // Usually this payload would be: 1B Custom SEI type + 16B UUID + other
547 // payload Bytes.
549
550 // NETINT: bitrate adjustment, which takes int32_t type data as
551 // payload that indicates the new target bitrate value.
553
554 // NETINT: custom INTRAPRD adjustment, which takes int32_t type data
555 // as payload that specifies the new intra period
557
558 // NETINT: custom VUI adjustment, which is a struct of
559 // ni_vui_hrd_t that specifies a frame's support of vui
561
562 // NETINT: long term reference frame support, which is a struct of
563 // ni_long_term_ref_t that specifies a frame's support of long term
564 // reference frame.
566
567 // NETINT: long term reference interval adjustment, which takes int32_t
568 // type data as payload that indicates the new long term reference interval
569 // value.
571
572 // NETINT: frame reference invalidation, which takes int32_t type data
573 // as payload that indicates the frame number after which all references
574 // shall be invalidated.
576
577 // NETINT: framerate adjustment, which takes int32_t type data as
578 // payload that indicates the new target framerate numerator and denominator values.
580
581 // NETINT: maxFrameSize adjustment, which takes int16_t type data as
582 // payload that indicates the new maxFrameSize value
584
585 // NETINT: max&min QP adjustment, which is a struct of
586 // payload that indicate the new max&min QP values
588
589 // NETINT: crf adjustment, which takes int32_t type data
590 // as payload that indicates the new crf value.
592
593 // NETINT: crf adjustment, which takes float type data
594 // as payload that indicates the new crf value.
596
597 // NETINT: VbvMaxRate adjust, which takes int32_t type
598 // as payload that indicates the VbvMaxRate value.
600
601 // NETINT: VbvBufferSize adjust, which takes int32_t type
602 // as payload that indicates the vbvBufferSize value.
604
605 // NETINT: sliceArg adjust, which takes int16_t type
606 // as payload that indicates the sliceArg value.
608
609 // NETINT: sliceArg adjust, which takes ni_category_classify_t
610 // type as payload that indicates the class and prob.
613
614// rational number (pair of numerator and denominator)
615typedef struct _ni_rational
616{
617 int num; // numerator
618 int den; // denominator
620
621// create an ni_rational_t
622static inline ni_rational_t ni_make_q(int num, int den)
623{
624 ni_rational_t ret = {num, den};
625 return ret;
626}
627
628// convert an ni_rational_t to a double
629static inline double ni_q2d(ni_rational_t a)
630{
631 return a.num / (double)a.den;
632}
633
634// struct to hold auxiliary data for ni_frame_t
641
642// struct describing a Region Of Interest (ROI)
644{
645 // self size: must be set to: sizeof(ni_region_of_interest_t)
646 uint32_t self_size;
647
648 // ROI rectangle: pixels from the frame's top edge to the top and bottom
649 // edges of the rectangle, from the frame's left edge to the left and right
650 // edges of the rectangle.
651 int top;
653 int left;
654 int right;
655
656 // quantisation offset: [-1, +1], 0 means no quality change; < 0 value asks
657 // for better quality (less quantisation), > 0 value asks for worse quality
658 // (greater quantisation).
661
662// struct describing category class and prob
669
670// struct describing VUI HRD support.
671typedef struct _ni_vui_hrd
672{
673 // Indicates the presence of color info such as primaries, trc etc.
675
676 // Indicates the chromaticity of RGB and white components of the
677 // displayed image (See Table E.3 of H.265 spec)
679
680 // The opto-electronic transfer characteristic of the source picture
681 // (See Table E.4 of H.265 spec)
682 int32_t colorTrc;
683
684 // Method to represent brightness, luminance or luma and colour (e.g. RGB)
685 int32_t colorSpace;
686
687 // Luma sample aspect ratio width. With aspectRatioHeight, translates
688 // into specific display ratios such as 16:9, 4:3, etc.
690
691 // Luma sample aspect ratio height
693
694 // Input video signal sample range [0,1].
695 // 0 = Y range in [16..235] Cb,Cr in [16..240]. 1 = Y,Cb,Cr in [0..255]
698
699// struct describing long term reference frame support.
700typedef struct _ni_long_term_ref
701{
702 // A flag for the current picture to be used as a long term reference
703 // picture later at other pictures' encoding
705
706 // A flag to use a long term reference picture in DPB when encoding the
707 // current picture
710
711// struct describing framerate.
712typedef struct _ni_framerate
713{
714 // framerate numerator
716
717 // framerate denominator
720
721typedef struct _ni_rc_min_max_qp
722{
723 int32_t minQpI;
724 int32_t maxQpI;
725 int32_t maxDeltaQp;
726 int32_t minQpPB;
727 int32_t maxQpPB;
729
730typedef struct _ni_dec_win
731{
732 int16_t left;
733 int16_t right;
734 int16_t top;
735 int16_t bottom;
737
739{
741 uint32_t time_scale;
743 uint8_t color_trc;
744 uint8_t color_space;
746 // 48 bytes reserved for receiving more header info
747 uint64_t rsvd0;
748 uint64_t rsvd1;
749 uint64_t rsvd2;
750 uint64_t rsvd3;
751 uint64_t rsvd4;
752 uint64_t rsvd5;
754
755/*!*
756* \brief decoded payload format of H.265 VUI
757*
758*/
760{
765
768
771
772 uint16_t sar_width;
773 uint16_t sar_height;
774
778
782
784
786
791
794
797
804
808
810
812
813/*!*
814* \brief decoded payload format of H.264 VUI
815*
816*/
861
862/*!*
863* \brief encoder HEVC ROI custom map (1 CTU = 64bits)
864*/
866{
867 struct
868 {
869 uint32_t ctu_force_mode : 2; //[ 1: 0]
870 uint32_t ctu_coeff_drop : 1; //[ 2]
871 uint32_t reserved : 5; //[ 7: 3]
872 uint32_t sub_ctu_qp_0 : 6; //[13: 8]
873 uint32_t sub_ctu_qp_1 : 6; //[19:14]
874 uint32_t sub_ctu_qp_2 : 6; //[25:20]
875 uint32_t sub_ctu_qp_3 : 6; //[31:26]
876
877 uint32_t lambda_sad_0 : 8; //[39:32]
878 uint32_t lambda_sad_1 : 8; //[47:40]
879 uint32_t lambda_sad_2 : 8; //[55:48]
880 uint32_t lambda_sad_3 : 8; //[63:56]
883
884/*!*
885* \brief encoder AVC ROI custom map (1 MB = 8bits)
886*/
888{
889 struct
890 {
891 uint8_t mb_force_mode : 2; // [ 1: 0]
892 uint8_t mb_qp : 6; // [ 7: 2]
895
896/*!*
897* \brief encoder AVC ROI custom map (1 MB = 8bits)
898*/
899// QP/CU Control Information Format 1
901{
902 struct
903 {
904 uint8_t roiAbsQp_flag : 1; // [ 0] (0: QP_delta, 1: abs_QP)
905 uint8_t
906 qp_info : 6; // [ 6: 1] (QP_delta: -32 <= qp_info <= 31, QP_info =- QP_delta, abs_QP: 0 <= Qp_info <= 51, Qp_info = abs_QP)
907 uint8_t
908 ipcm_flag : 1; // [ 7] (0: do not force IPCM mode, 1: force IPCM mode)
911// QP/CU Control Information Format 2
912/*
913typedef union _ni_enc_quad_roi_custom_map
914{
915 struct
916 {
917 uint8_t qp_info : 6; // [ 5: 0] (QP_delta: -32 <= qp_info <= 31, QP_info =- QP_delta, abs_QP: 0 <= Qp_info <= 51, Qp_info = abs_QP)
918 uint8_t roiAbsQp_flag : 1; // [ 6] (0: QP_delta, 1: abs_QP)
919 uint8_t skip_flag : 1; // [ 7] (0: do not force skip mode, 1: force skip)
920 } field;
921} ni_enc_quad_roi_custom_map;
922*/
923/*!*
924* \brief This is an enumeration for supported codec formats.
925*/
934
942
949
950
951/*!*
952* \brief This is an enumeration for hw actions
953*/
963
964/*!*
965* \brief This is an enumeration for encoder parameter change.
966*/
968{
969 // COMMON parameters which can be changed frame by frame.
971 //NI_SET_CHANGE_PARAM_INTRA_PARAM = (1 << 1), // not required by customers
973 //NI_SET_CHANGE_PARAM_RC = (1 << 9), // not required by customers
992 NI_SET_CHANGE_PARAM_INTRA_PERIOD = ((unsigned int)1 << 31),
993 //bit [2,7] and [13,15] is still unused
995
1000{
1002
1003 // NI_SET_CHANGE_PARAM_RC_TARGET_RATE
1004 int32_t bitRate;
1007 // NI_SET_CHANGE_PARAM_RC
1008// (rcEnable, cuLevelRc, bitAllocMode, RoiEnable, RcInitQp can't be changed while encoding)
1009 int32_t hvsQPEnable;
1010 int32_t hvsQpScale;
1014 // NI_SET_CHANGE_PARAM_RC_MIN_MAX_QP
1015 int32_t minQpI;
1016 int32_t maxQpI;
1018 int32_t maxDeltaQp;
1019#ifdef QUADRA
1020 int32_t minQpPB;
1021 int32_t maxQpPB;
1022#else
1023 int32_t minQpP;
1024 int32_t minQpB;
1025 int32_t maxQpP;
1026 int32_t maxQpB;
1027#endif
1028
1029 // NI_SET_CHANGE_PARAM_INTRA_PARAM
1030 int32_t intraQP;
1031 int32_t intraPeriod;
1034#ifdef QUADRA
1035 // NI_SET_CHANGE_PARAM_VUI_HRD_PARAM
1038 uint8_t colorTrc;
1039 uint8_t colorSpace;
1044 // RESERVED FOR FUTURE USE
1045 uint8_t reserved[5];
1046
1047 // NI_SET_CHANGE_PARAM_SLICE_ARG
1048 int16_t sliceArg;
1049 //NI_SET_CHANGE_PARAM_VBV also reconfig for ni_vbvBufferSize
1050 int32_t vbvMaxRate;
1051
1052 // NI_SET_CHANGE_PARAM_CRF
1053 // crf reconfig (range in [0.00 .. 51.00])
1054 uint8_t crfDecimal; // crf decimal fraction * 100 (range in [0 .. 99])
1055 uint8_t crf; // crf integer (range in [0 .. 51])
1056
1057 // NI_SET_CHANGE_PARAM_MAX_FRAME_SIZE
1058 uint16_t maxFrameSize; // maxFrameSize reconfig (in unit of 2000 bytes)
1059
1060 // NI_SET_CHANGE_PARAM_INVALID_REF_FRAME
1062
1063 // NI_SET_CHANGE_PARAM_LTR_INTERVAL
1065
1066 // NI_SET_CHANGE_PARAM_RC_FRAMERATE
1069#else
1070 int32_t reserved[8];
1071#endif
1073
1074/*!*
1075* \brief decoded payload format of HDR SEI mastering display colour volume
1076*
1077*/
1086
1087/*!*
1088* \brief payload format of HDR SEI content light level info
1089*
1090*/
1096
1097/*!*
1098* \brief encoded payload format of HDR SEI mastering display colour volume
1099*
1100*/
1109
1110typedef struct _ni_pkt_info
1111{
1112 double psnr_y;
1113 double psnr_u;
1114 double psnr_v;
1116 double ssim_y;
1117 double ssim_u;
1118 double ssim_v;
1119 double reserved[1];
1121
1122/*!*
1123 * \brief This is an enumeration for illustrating the custom SEI locations.
1124 */
1130
1131/*!*
1132 * \brief custom sei payload passthrough
1133 */
1141
1147
1148/*!*
1149* \brief hardware capability type
1150*/
1151typedef struct _ni_hw_capability
1152{
1153 uint8_t hw_id;
1155 uint8_t max_4k_fps;
1157 uint8_t codec_type;
1164 uint8_t reserved; // 16B alignment. Unnecessary?
1166
1167/*!*
1168* \brief device capability type
1169*/
1190
1191/*!*
1192* \brief Session running state type.
1193*/
1202
1203typedef struct _ni_context_query
1204{
1205 uint32_t context_id : 8; //07:00 SW Instance ID (0 to Max number of instances)
1206 uint32_t context_status : 8; //15:08 Instance Status (0-Idle, 1-Active)
1207 uint32_t
1208 codec_format : 8; //23:16 Codec Format (0-H264, 1-H265, 2-VP9, 3-JPEG, 4-AV1)
1209 uint32_t video_width : 16; //39:24 Video Width (0 to Max Width)
1210 uint32_t video_height : 16; //55:40 Video Height (0 to Max Height)
1211 uint32_t fps : 8; //63:56 FPS (0 to 255)
1212 uint32_t reserved : 8; //Alignment
1214
1215typedef struct _ni_load_query
1216{
1219 uint32_t fw_load;
1221 union{
1223 uint32_t pcie_throughput; //PCIe throughput - ni_query_nvme_status
1224 };
1225 union {
1227 uint32_t pcie_load; //PCIe load - ni_query_nvme_status
1228 };
1231 union {
1233 uint32_t tp_fw_load; //TP FW load - ni_query_nvme_status
1234 };
1235
1237
1240
1248
1260
1270
1275
1277{
1278 int hw_id; // Codec ID
1279 uint32_t session_id; // session id
1280 uint64_t session_timestamp; // Session Start Timestamp
1281 bool close_thread; // a flag that the keep alive thread is closed or need to be closed
1282 uint32_t device_type; // Device Type, Either NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
1283 ni_device_handle_t device_handle; // block device handler
1284 ni_event_handle_t thread_event_handle; // only for Windows asynchronous read and write
1285 void *p_buffer; // only be used when regular-io.
1286 ni_pthread_mutex_t *p_mutex; // referring to mutex of session context.
1287 uint32_t keep_alive_timeout; // keep alive timeout setting
1288 volatile uint64_t *plast_access_time; // shared variable for main thread to verify timeout. Keep alive thread will update last_access_time
1290
1300
1311
1322
1331
1339
1344
1346{
1347 uint32_t num_of_dims; /* The number of dimensions specified in *sizes */
1348 uint32_t sizes[6]; /* The pointer to an array of dimension */
1349 int32_t
1350 data_format; /* Data format for the tensor, see ni_ai_buffer_format_e */
1351 int32_t
1352 quant_format; /* Quantized format see ni_ai_buffer_quantize_format_e */
1353 union
1354 {
1355 struct
1356 {
1357 int32_t
1358 fixed_point_pos; /* Specifies the fixed point position when the input element type is int16, if 0 calculations are performed in integer math */
1360
1361 struct
1362 {
1363 float scale; /* Scale value for the quantized value */
1364 int32_t zeroPoint; /* A 32 bit integer, in range [0, 255] */
1366 } quant_data; /* The union of quantization information */
1367 /* The type of this buffer memory. */
1368 uint32_t memory_type;
1370
1376
1381
1382typedef struct _ni_network_data
1383{
1384 uint32_t input_num;
1385 uint32_t output_num;
1388 *inset; /* point to each input layer start offset from p_frame */
1390 *outset; /* point to each output layer start offset from p_packet */
1392
1393// if change this structure, you need to change ni_quadra_filter_api.h ni_quadra_frameclone_desc_t
1395{
1396 uint16_t ui16SrcIdx;
1397 uint16_t ui16DstIdx;
1398 uint32_t ui32Offset;
1399 uint32_t ui32Size;
1400 uint32_t reserved;
1402
1414
1415typedef struct _ni_input_frame
1416{
1418
1419 uint32_t video_width;
1421
1422 int64_t pts;
1423
1424 int8_t usable;
1426
1427// This is for decoder to reset the ppu value
1428// ppu_set_enable & (0x1 << idx) is which ppu[idx] enabled
1429// for examle, ppu_set_enable is 3, so ppu0 amd ppu1 is enabled
1430// 0x03 & (0x01 << 0) is not 0 and 0x03 &(0x01 << 1) is not 0
1431// 0: all ppu disabled. 1: ppu0 enabled. 2: ppu1 enabled
1432// 3: ppu0 ppu1 enabled. 4: ppu2 enabled. 5: ppu0 ppu2 enabled
1433// 6: ppu1 ppu enabled. 7: all ppu enabled others: disabled
1439
1441{
1443 /* frame_time_q is pointer to ni_lat_meas_q_t but reserved as void pointer
1444 here as ni_lat_meas_q_t is part of private API */
1446#ifndef DEPRECATION_AS_ERROR
1448#endif
1449
1455
1457
1468
1471 int64_t last_pts;
1472 int64_t last_dts;
1480#ifndef DEPRECATION_AS_ERROR
1482#endif
1483
1484 /* store pts values to create an accurate pts offset */
1493
1496
1498 ni_device_handle_t device_handle;
1499
1501 ni_device_handle_t blk_io_handle;
1502
1504 ni_device_handle_t sender_handle;
1505 ni_device_handle_t auto_dl_handle;
1506 uint8_t is_auto_dl;
1507
1510
1516 uint32_t session_id;
1520 uint32_t device_type;
1527
1528 int src_bit_depth; // 8 or 10 bits/pixel formats, default 8
1529 int src_endian; // encoding 0: little endian (default) 1: big
1530 int bit_depth_factor; // for YUV buffer allocation
1531 // for encoder roi metadata
1532 uint32_t roi_len;
1533 uint32_t roi_avg_qp;
1534
1537
1538 /* Overall resource use among namespaces */
1540
1542 uint8_t *p_leftover;
1544 uint32_t sent_size;
1545
1547 uint8_t *p_hdr_buf;
1549
1552
1555
1558
1562
1563 void *p_dump[2];
1564 char param_err_msg[512];
1565
1566 int keyframe_factor; // Unused
1567 uint64_t frame_num;
1568 uint64_t pkt_num;
1569 int rc_error_count; // Unused
1570
1572 uint32_t hwd_src_cpu;
1575 uint32_t hwd_Inst_ID;
1576
1577 // frame forcing: for encoding
1579
1580 uint32_t ready_to_close; //flag to indicate we are ready to close session
1581
1582 // session running state
1584 //Current video width. this is used to do sequence change
1586 //Current video height ,this is used to do sequence change
1588 //Actual video width (without stride + cropped)
1590 // Used to track sequence changes that require bigger bitstream buffers
1592 ni_pthread_t keep_alive_thread;
1596
1597 // original resolution this stream started with, this is used by encoder sequence change
1599
1600 // a mutex for Xcoder API, to keep the thread-safety.
1601 ni_pthread_mutex_t mutex;
1602
1603 // Xcoder running state
1605
1606 // only be used when regular-io
1607 void *p_all_zero_buf; //This is for sos, eos, flush and keep alive request
1608
1609 // these two event handle are only for Windows asynchronous read and write now
1610 ni_event_handle_t event_handle;
1611 ni_event_handle_t thread_event_handle;
1612
1613 // ROI data
1615 // last passed in ni_region_of_interest_t
1618 ni_enc_quad_roi_custom_map *roi_map; // actual AVC/HEVC QP map
1619
1620 // only for H.264 test roi buffer for up to 8k resolution H.264 - 32 x 32 sub CTUs
1622 // only for H.265 custom map buffer for up to 8k resolution - 64x64 CTU Regions
1624 // only for hevc actual ROI map is stored in individual session context !
1626
1627 // encoder reconfig parameters
1629 // decoder lowDelay mode for All I packets or IPPP packets
1632
1633 // wrapper API request data, to be sent out once with the next input frame
1634 // to encoder
1635 int32_t target_bitrate; // A target bitrate to reconfig, -1 if inactive
1636 int force_idr_frame; // force IDR frame type
1638 int32_t ltr_interval; // LTR interval to set
1639 int32_t ltr_frame_ref_invalid; // frame after which all ref to be invalid
1640 ni_framerate_t framerate; // framerate to reconfig, 0 if inactive
1641 ni_vui_hrd_t vui; // vui to reconfig
1642
1643 // path of decoder input pkt saving folder
1647
1648 // some parameters for decoder session
1649 // int hw_frame_extra_buffer; e.g. 3
1653 int32_t isP2P;
1655 unsigned short domain;
1656 unsigned short bus;
1657 unsigned short dev;
1658 unsigned short fn;
1659
1660 // the FW API version of device that opened
1661 uint8_t fw_rev[8];
1662 uint8_t ddr_config;
1663
1665
1667 uint32_t prev_fps;
1669 uint64_t prev_pts;
1673
1674 uint32_t meta_size;
1678
1679 // flags_array to save packet flags
1681
1682 // for decoder: store currently returned decoded frame's pkt offset
1685
1687
1688 uint32_t count_frame_num_in_sec; //used in the vfr mode, indicate the frame count in seconds
1689 uint32_t passed_time_in_timebase_unit; //used in the vfr mode, indicate how long it has passed
1690
1691 int32_t max_frame_size; // maxFrameSize (in bytes) to reconfig, 0 if inactive
1692
1693 // block device name requested by caller to open: when specified this block
1694 // device has priority over hw_id which is device specified by index.
1696
1697 // decoder low delay send/recv sync; async_mode = 0 by default, i.e.
1698 // codec send-to/recv-from FW is in synchrounous mode by default.
1701 ni_pthread_mutex_t low_delay_sync_mutex;
1702 ni_pthread_cond_t low_delay_sync_cond;
1703
1704 // muxtex default from source session
1705 // required pointer to external if used by hwdl
1706 ni_pthread_mutex_t* pext_mutex;
1708
1709 // required parameters for slow sequence change
1712
1713 // AI embedded network parameters data
1715
1718 //shared variable for main thread to read and keepalive thread to update
1719 volatile uint64_t last_access_time;
1720
1721 int reconfig_crf; // crf value to reconfig (range in [0..51]), -1 if inactive
1722 int reconfig_crf_decimal; // crf decimal fration value to reconfig
1723 // (range in [0..99]), -1 if inactive
1724 int reconfig_vbv_buffer_size; // vbv buffer size value to reconfig
1725 int reconfig_vbv_max_rate; // vbv max rate value to reconfig
1726
1731 uint64_t av1_pkt_num;
1732
1739 char E2EID[128];
1741 int pixel_format_changed; // only for decoder now
1743
1746 double psnr_y;
1747 double psnr_u;
1748 double psnr_v;
1753
1755
1756 // write packet/frame required buf size
1758
1759 // record the drop num
1761
1762 //for AI aio
1763 ni_aio_context_t aio_context;
1764 ni_iocb_t **iocbs;
1765 ni_io_event_t *io_event;
1767
1772
1774{
1776 int w[3];
1777 int h[3];
1778 int f[3]; //planar format
1779 int f8b[3]; //forced 8bit
1780 //int crop_meta_data_rltb[3][4]; //crop rectangle
1782
1783/*!*
1784* \brief This is an enumeration for encoder reconfiguration test settings
1785*/
1786typedef enum _ni_reconfig
1787{
1793//XCODER_TEST_RECONF_RC = 5, // not required by customers
1794 XCODER_TEST_RECONF_RC_MIN_MAX_QP = 6, // reconfig min&max QP
1795#ifdef QUADRA
1800 XCODER_TEST_RECONF_RC_MIN_MAX_QP_REDUNDANT = 11, // reconfig min&max QP through libxcoder API (redundant demo mode index)
1806 XCODER_TEST_FORCE_IDR_FRAME = 100, // force IDR through libxcoder API
1807 XCODER_TEST_RECONF_BR_API = 101, // reconfig BR through libxcoder API
1808 XCODER_TEST_RECONF_INTRAPRD_API = 102, // reconfig intraperiod through libxcoder API
1809 XCODER_TEST_RECONF_VUI_HRD_API = 103, // reconfig VUI through libxcoder API
1810 XCODER_TEST_RECONF_LTR_API = 104, // reconfig LTR through libxcoder API
1811 XCODER_TEST_RECONF_RC_MIN_MAX_QP_API_REDUNDANT = 106, // reconfig min&max QP through libxcoder API (redundant demo mode index)
1812 XCODER_TEST_RECONF_LTR_INTERVAL_API = 107, // reconf LTR interval thru API
1813 XCODER_TEST_INVALID_REF_FRAME_API = 108, // invalidate ref frame thru API
1814 XCODER_TEST_RECONF_FRAMERATE_API = 109, // reconfig framerate through libxcoder API
1815 XCODER_TEST_RECONF_MAX_FRAME_SIZE_API = 110, // reconfig maxFrameSize through libxcoder API
1816 XCODER_TEST_RECONF_RC_MIN_MAX_QP_API = 111, // reconfig min&max QP through libxcoder API
1817 XCODER_TEST_CRF_API = 114, // reconfig crf through libxcoder API
1818 XCODER_TEST_CRF_FLOAT_API = 115, // reconfig crf float type through libxcoder API
1819 XCODER_TEST_RECONF_VBV_API = 116, // reconfig vbv buffer size and vbv max rate through libxcoder API
1820 XCODER_TEST_RECONF_MAX_FRAME_SIZE_RATIO_API = 117, // reconfig maxFrameSize ratio through libxcoder API
1821 XCODER_TEST_RECONF_SLICE_ARG_API = 118, // reconfig sliceArg through libxcoder API
1823#endif
1825
1827{
1828 /* A float type of buffer data */
1830 /* A half float type of buffer data */
1832 /* A 8 bit unsigned integer type of buffer data */
1834 /* A 8 bit signed integer type of buffer data */
1836 /* A 16 bit unsigned integer type of buffer data */
1838 /* A 16 signed integer type of buffer data */
1840 /* A char type of data */
1842 /* A bfloat 16 type of data */
1844 /* A 32 bit integer type of data */
1846 /* A 32 bit unsigned signed integer type of buffer */
1848 /* A 64 bit signed integer type of data */
1850 /* A 64 bit unsigned integer type of data */
1852 /* A 64 bit float type of buffer data */
1855
1857{
1858 /* Not quantized format */
1860 /* A quantization data type which specifies the fixed point position for whole tensor. */
1862 /* A quantization data type which has scale value and zero point to match with TF and
1863 Android NN API for whole tensor. */
1865 /* A max vaule support quantize format */
1868
1870{
1871 NI_DDR_PRIORITY_NONE = -1, // Do not change DDR priorities
1872 NI_DDR_PRIORITY_RESET, // Reset DDR priorities to default
1873 NI_DDR_PRIORITY_DECENC, // DDR prioritize decoder and encoder
1874 NI_DDR_PRIORITY_FILT, // DDR prioritize filter
1875 NI_DDR_PRIORITY_AI, // DDR prioritize AI
1878
1891
1892#ifdef QUADRA
1893#define NI_ENC_GOP_PARAMS_G0_POC_OFFSET "g0pocOffset"
1894#define NI_ENC_GOP_PARAMS_G0_QP_OFFSET "g0QpOffset"
1895//#define NI_ENC_GOP_PARAMS_G0_QP_FACTOR "g0QpFactor"
1896#define NI_ENC_GOP_PARAMS_G0_TEMPORAL_ID "g0temporalId"
1897#define NI_ENC_GOP_PARAMS_G0_PIC_TYPE "g0picType"
1898#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PICS "g0numRefPics"
1899#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC0 "g0refPic0"
1900#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC0_USED "g0refPic0Used"
1901#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC1 "g0refPic1"
1902#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC1_USED "g0refPic1Used"
1903#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC2 "g0refPic2"
1904#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC2_USED "g0refPic2Used"
1905#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC3 "g0refPic3"
1906#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC3_USED "g0refPic3Used"
1907
1908#define NI_ENC_GOP_PARAMS_G1_POC_OFFSET "g1pocOffset"
1909#define NI_ENC_GOP_PARAMS_G1_QP_OFFSET "g1QpOffset"
1910//#define NI_ENC_GOP_PARAMS_G1_QP_FACTOR "g1QpFactor"
1911#define NI_ENC_GOP_PARAMS_G1_TEMPORAL_ID "g1temporalId"
1912#define NI_ENC_GOP_PARAMS_G1_PIC_TYPE "g1picType"
1913#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PICS "g1numRefPics"
1914#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC0 "g1refPic0"
1915#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC0_USED "g1refPic0Used"
1916#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC1 "g1refPic1"
1917#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC1_USED "g1refPic1Used"
1918#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC2 "g1refPic2"
1919#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC2_USED "g1refPic2Used"
1920#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC3 "g1refPic3"
1921#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC3_USED "g1refPic3Used"
1922
1923#define NI_ENC_GOP_PARAMS_G2_POC_OFFSET "g2pocOffset"
1924#define NI_ENC_GOP_PARAMS_G2_QP_OFFSET "g2QpOffset"
1925//#define NI_ENC_GOP_PARAMS_G2_QP_FACTOR "g2QpFactor"
1926#define NI_ENC_GOP_PARAMS_G2_TEMPORAL_ID "g2temporalId"
1927#define NI_ENC_GOP_PARAMS_G2_PIC_TYPE "g2picType"
1928#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PICS "g2numRefPics"
1929#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC0 "g2refPic0"
1930#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC0_USED "g2refPic0Used"
1931#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC1 "g2refPic1"
1932#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC1_USED "g2refPic1Used"
1933#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC2 "g2refPic2"
1934#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC2_USED "g2refPic2Used"
1935#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC3 "g2refPic3"
1936#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC3_USED "g2refPic3Used"
1937
1938#define NI_ENC_GOP_PARAMS_G3_POC_OFFSET "g3pocOffset"
1939#define NI_ENC_GOP_PARAMS_G3_QP_OFFSET "g3QpOffset"
1940//#define NI_ENC_GOP_PARAMS_G3_QP_FACTOR "g3QpFactor"
1941#define NI_ENC_GOP_PARAMS_G3_TEMPORAL_ID "g3temporalId"
1942#define NI_ENC_GOP_PARAMS_G3_PIC_TYPE "g3picType"
1943#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PICS "g3numRefPics"
1944#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC0 "g3refPic0"
1945#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC0_USED "g3refPic0Used"
1946#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC1 "g3refPic1"
1947#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC1_USED "g3refPic1Used"
1948#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC2 "g3refPic2"
1949#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC2_USED "g3refPic2Used"
1950#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC3 "g3refPic3"
1951#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC3_USED "g3refPic3Used"
1952
1953#define NI_ENC_GOP_PARAMS_G4_POC_OFFSET "g4pocOffset"
1954#define NI_ENC_GOP_PARAMS_G4_QP_OFFSET "g4QpOffset"
1955//#define NI_ENC_GOP_PARAMS_G4_QP_FACTOR "g4QpFactor"
1956#define NI_ENC_GOP_PARAMS_G4_TEMPORAL_ID "g4temporalId"
1957#define NI_ENC_GOP_PARAMS_G4_PIC_TYPE "g4picType"
1958#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PICS "g4numRefPics"
1959#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC0 "g4refPic0"
1960#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC0_USED "g4refPic0Used"
1961#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC1 "g4refPic1"
1962#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC1_USED "g4refPic1Used"
1963#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC2 "g4refPic2"
1964#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC2_USED "g4refPic2Used"
1965#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC3 "g4refPic3"
1966#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC3_USED "g4refPic3Used"
1967
1968#define NI_ENC_GOP_PARAMS_G5_POC_OFFSET "g5pocOffset"
1969#define NI_ENC_GOP_PARAMS_G5_QP_OFFSET "g5QpOffset"
1970//#define NI_ENC_GOP_PARAMS_G5_QP_FACTOR "g5QpFactor"
1971#define NI_ENC_GOP_PARAMS_G5_TEMPORAL_ID "g5temporalId"
1972#define NI_ENC_GOP_PARAMS_G5_PIC_TYPE "g5picType"
1973#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PICS "g5numRefPics"
1974#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC0 "g5refPic0"
1975#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC0_USED "g5refPic0Used"
1976#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC1 "g5refPic1"
1977#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC1_USED "g5refPic1Used"
1978#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC2 "g5refPic2"
1979#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC2_USED "g5refPic2Used"
1980#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC3 "g5refPic3"
1981#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC3_USED "g5refPic3Used"
1982
1983#define NI_ENC_GOP_PARAMS_G6_POC_OFFSET "g6pocOffset"
1984#define NI_ENC_GOP_PARAMS_G6_QP_OFFSET "g6QpOffset"
1985//#define NI_ENC_GOP_PARAMS_G6_QP_FACTOR "g6QpFactor"
1986#define NI_ENC_GOP_PARAMS_G6_TEMPORAL_ID "g6temporalId"
1987#define NI_ENC_GOP_PARAMS_G6_PIC_TYPE "g6picType"
1988#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PICS "g6numRefPics"
1989#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC0 "g6refPic0"
1990#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC0_USED "g6refPic0Used"
1991#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC1 "g6refPic1"
1992#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC1_USED "g6refPic1Used"
1993#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC2 "g6refPic2"
1994#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC2_USED "g6refPic2Used"
1995#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC3 "g6refPic3"
1996#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC3_USED "g6refPic3Used"
1997
1998#define NI_ENC_GOP_PARAMS_G7_POC_OFFSET "g7pocOffset"
1999#define NI_ENC_GOP_PARAMS_G7_QP_OFFSET "g7QpOffset"
2000//#define NI_ENC_GOP_PARAMS_G7_QP_FACTOR "g7QpFactor"
2001#define NI_ENC_GOP_PARAMS_G7_TEMPORAL_ID "g7temporalId"
2002#define NI_ENC_GOP_PARAMS_G7_PIC_TYPE "g7picType"
2003#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PICS "g7numRefPics"
2004#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC0 "g7refPic0"
2005#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC0_USED "g7refPic0Used"
2006#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC1 "g7refPic1"
2007#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC1_USED "g7refPic1Used"
2008#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC2 "g7refPic2"
2009#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC2_USED "g7refPic2Used"
2010#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC3 "g7refPic3"
2011#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC3_USED "g7refPic3Used"
2012
2013typedef struct _ni_gop_rps
2014{
2015 int ref_pic; /*!*< delta_poc of this short reference picture relative to the poc of current picture or index of LTR */
2016 int ref_pic_used; /*!*< whether this reference picture used by current picture */
2018
2019typedef struct _ni_gop_params
2020{
2021 int poc_offset; /*!*< A POC of Nth picture in the custom GOP */
2022 int qp_offset; /*!*< QP offset of Nth picture in the custom GOP */
2023 float qp_factor; /*!*< QP factor of Nth picture in the custom GOP */
2024 int temporal_id; /*!*< A temporal ID of Nth picture in the custom GOP */
2025 int pic_type; /*!*< A picture type of Nth picture in the custom GOP */
2026 int num_ref_pics; /*!*< the number of reference pictures kept for this picture, the value should be within [0, 4] */
2029#else
2030#define NI_ENC_GOP_PARAMS_G0_PIC_TYPE "g0picType"
2031#define NI_ENC_GOP_PARAMS_G0_POC_OFFSET "g0pocOffset"
2032#define NI_ENC_GOP_PARAMS_G0_PIC_QP "g0picQp"
2033#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC_L0 "g0numRefPicL0"
2034#define NI_ENC_GOP_PARAMS_G0_NUM_REF_POC_L0 "g0refPocL0"
2035#define NI_ENC_GOP_PARAMS_G0_NUM_REF_POC_L1 "g0refPocL1"
2036#define NI_ENC_GOP_PARAMS_G0_TEMPORAL_ID "g0temporalId"
2037
2038#define NI_ENC_GOP_PARAMS_G1_PIC_TYPE "g1picType"
2039#define NI_ENC_GOP_PARAMS_G1_POC_OFFSET "g1pocOffset"
2040#define NI_ENC_GOP_PARAMS_G1_PIC_QP "g1picQp"
2041#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC_L0 "g1numRefPicL0"
2042#define NI_ENC_GOP_PARAMS_G1_NUM_REF_POC_L0 "g1refPocL0"
2043#define NI_ENC_GOP_PARAMS_G1_NUM_REF_POC_L1 "g1refPocL1"
2044#define NI_ENC_GOP_PARAMS_G1_TEMPORAL_ID "g1temporalId"
2045
2046#define NI_ENC_GOP_PARAMS_G2_PIC_TYPE "g2picType"
2047#define NI_ENC_GOP_PARAMS_G2_POC_OFFSET "g2pocOffset"
2048#define NI_ENC_GOP_PARAMS_G2_PIC_QP "g2picQp"
2049#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC_L0 "g2numRefPicL0"
2050#define NI_ENC_GOP_PARAMS_G2_NUM_REF_POC_L0 "g2refPocL0"
2051#define NI_ENC_GOP_PARAMS_G2_NUM_REF_POC_L1 "g2refPocL1"
2052#define NI_ENC_GOP_PARAMS_G2_TEMPORAL_ID "g2temporalId"
2053
2054#define NI_ENC_GOP_PARAMS_G3_PIC_TYPE "g3picType"
2055#define NI_ENC_GOP_PARAMS_G3_POC_OFFSET "g3pocOffset"
2056#define NI_ENC_GOP_PARAMS_G3_PIC_QP "g3picQp"
2057#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC_L0 "g3numRefPicL0"
2058#define NI_ENC_GOP_PARAMS_G3_NUM_REF_POC_L0 "g3refPocL0"
2059#define NI_ENC_GOP_PARAMS_G3_NUM_REF_POC_L1 "g3refPocL1"
2060#define NI_ENC_GOP_PARAMS_G3_TEMPORAL_ID "g3temporalId"
2061
2062#define NI_ENC_GOP_PARAMS_G4_PIC_TYPE "g4picType"
2063#define NI_ENC_GOP_PARAMS_G4_POC_OFFSET "g4pocOffset"
2064#define NI_ENC_GOP_PARAMS_G4_PIC_QP "g4picQp"
2065#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC_L0 "g4numRefPicL0"
2066#define NI_ENC_GOP_PARAMS_G4_NUM_REF_POC_L0 "g4refPocL0"
2067#define NI_ENC_GOP_PARAMS_G4_NUM_REF_POC_L1 "g4refPocL1"
2068#define NI_ENC_GOP_PARAMS_G4_TEMPORAL_ID "g4temporalId"
2069
2070#define NI_ENC_GOP_PARAMS_G5_PIC_TYPE "g5picType"
2071#define NI_ENC_GOP_PARAMS_G5_POC_OFFSET "g5pocOffset"
2072#define NI_ENC_GOP_PARAMS_G5_PIC_QP "g5picQp"
2073#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC_L0 "g5numRefPicL0"
2074#define NI_ENC_GOP_PARAMS_G5_NUM_REF_POC_L0 "g5refPocL0"
2075#define NI_ENC_GOP_PARAMS_G5_NUM_REF_POC_L1 "g5refPocL1"
2076#define NI_ENC_GOP_PARAMS_G5_TEMPORAL_ID "g5temporalId"
2077
2078#define NI_ENC_GOP_PARAMS_G6_PIC_TYPE "g6picType"
2079#define NI_ENC_GOP_PARAMS_G6_POC_OFFSET "g6pocOffset"
2080#define NI_ENC_GOP_PARAMS_G6_PIC_QP "g6picQp"
2081#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC_L0 "g6numRefPicL0"
2082#define NI_ENC_GOP_PARAMS_G6_NUM_REF_POC_L0 "g6refPocL0"
2083#define NI_ENC_GOP_PARAMS_G6_NUM_REF_POC_L1 "g6refPocL1"
2084#define NI_ENC_GOP_PARAMS_G6_TEMPORAL_ID "g6temporalId"
2085
2086#define NI_ENC_GOP_PARAMS_G7_PIC_TYPE "g7picType"
2087#define NI_ENC_GOP_PARAMS_G7_POC_OFFSET "g7pocOffset"
2088#define NI_ENC_GOP_PARAMS_G7_PIC_QP "g7picQp"
2089#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC_L0 "g7numRefPicL0"
2090#define NI_ENC_GOP_PARAMS_G7_NUM_REF_POC_L0 "g7refPocL0"
2091#define NI_ENC_GOP_PARAMS_G7_NUM_REF_POC_L1 "g7refPocL1"
2092#define NI_ENC_GOP_PARAMS_G7_TEMPORAL_ID "g7temporalId"
2093
2094typedef struct _ni_gop_params
2095{
2096 int pic_type; /*!*< A picture type of Nth picture in the custom GOP */
2097 int poc_offset; /*!*< A POC of Nth picture in the custom GOP */
2098 int pic_qp; /*!*< A quantization parameter of Nth picture in the custom GOP */
2099 int num_ref_pic_L0; /*!*< The number of reference L0 of Nth picture in the custom GOP */
2100 int ref_poc_L0; /*!*< A POC of reference L0 of Nth picture in the custom GOP */
2101 int ref_poc_L1; /*!*< A POC of reference L1 of Nth picture in the custom GOP */
2102 int temporal_id; /*!*< A temporal ID of Nth picture in the custom GOP */
2104#endif
2105
2106
2107
2108#define NI_ENC_GOP_PARAMS_CUSTOM_GOP_SIZE "customGopSize"
2109
2111{
2112 int custom_gop_size; /*!*< The size of custom GOP (0~8) */
2113 ni_gop_params_t pic_param[NI_MAX_GOP_NUM]; /*!*< Picture parameters of Nth picture in custom GOP */
2115
2116#define NI_ENC_REPEAT_HEADERS_FIRST_IDR 0
2117#define NI_ENC_REPEAT_HEADERS_ALL_I_FRAMES 1
2118#define NI_KEEP_ALIVE_TIMEOUT "keepAliveTimeout"
2119
2121{
2122#define NI_ENC_PARAM_BITRATE "bitrate"
2123#define NI_ENC_PARAM_RECONF_DEMO_MODE "ReconfDemoMode"
2124#define NI_ENC_PARAM_RECONF_FILE "ReconfFile"
2125#define NI_ENC_PARAM_ROI_DEMO_MODE "RoiDemoMode"
2126#define NI_ENC_PARAM_CACHE_ROI "cacheRoi"
2127#define NI_ENC_PARAM_FORCE_PIC_QP_DEMO_MODE "ForcePicQpDemoMode"
2128
2129#ifndef DEPRECATION_AS_ERROR
2131#define NI_ENC_PARAM_GEN_HDRS NI_DEPRECATED_MACRO "GenHdrs"
2132#endif
2133#define NI_ENC_PARAM_PADDING "padding"
2134#define NI_ENC_PARAM_FORCE_FRAME_TYPE "forceFrameType"
2135#define NI_ENC_PARAM_PROFILE "profile"
2136#define NI_ENC_PARAM_LEVEL "level"
2137#define NI_ENC_PARAM_HIGH_TIER "high-tier"
2138#define NI_ENC_PARAM_LOG_LEVEL "log-level"
2139#define NI_ENC_PARAM_LOG "log"
2140#define NI_ENC_PARAM_GOP_PRESET_IDX "gopPresetIdx"
2141#define NI_ENC_PARAM_LOW_DELAY "lowDelay"
2142#define NI_ENC_PARAM_MIN_FRAMES_DELAY "minFramesDelay"
2143#define NI_ENC_PARAM_USE_RECOMMENDED_ENC_PARAMS "useRecommendEncParam"
2144#define NI_ENC_PARAM_USE_LOW_DELAY_POC_TYPE "useLowDelayPocType"
2145#define NI_ENC_PARAM_CU_SIZE_MODE "cuSizeMode"
2146#define NI_ENC_PARAM_MAX_NUM_MERGE "maxNumMerge"
2147#define NI_ENC_PARAM_ENABLE_DYNAMIC_8X8_MERGE "dynamicMerge8x8Enable"
2148#define NI_ENC_PARAM_ENABLE_DYNAMIC_16X16_MERGE "dynamicMerge16x16Enable"
2149#define NI_ENC_PARAM_ENABLE_DYNAMIC_32X32_MERGE "dynamicMerge32x32Enable"
2150#define NI_ENC_PARAM_ENABLE_RATE_CONTROL "RcEnable"
2151#define NI_ENC_PARAM_ENABLE_CU_LEVEL_RATE_CONTROL "cuLevelRCEnable"
2152#define NI_ENC_PARAM_ENABLE_HVS_QP "hvsQPEnable"
2153#define NI_ENC_PARAM_ENABLE_HVS_QP_SCALE "hvsQpScaleEnable"
2154#define NI_ENC_PARAM_HVS_QP_SCALE "hvsQpScale"
2155#define NI_ENC_PARAM_MIN_QP "minQp"
2156#define NI_ENC_PARAM_MAX_QP "maxQp"
2157#define NI_ENC_PARAM_MAX_DELTA_QP "maxDeltaQp"
2158#define NI_ENC_PARAM_FORCED_HEADER_ENABLE "repeatHeaders"
2159#define NI_ENC_PARAM_ROI_ENABLE "roiEnable"
2160#define NI_ENC_PARAM_CONF_WIN_TOP "confWinTop"
2161#define NI_ENC_PARAM_CONF_WIN_BOTTOM "confWinBot"
2162#define NI_ENC_PARAM_CONF_WIN_LEFT "confWinLeft"
2163#define NI_ENC_PARAM_CONF_WIN_RIGHT "confWinRight"
2164#define NI_ENC_PARAM_INTRA_PERIOD "intraPeriod"
2165#define NI_ENC_PARAM_TRANS_RATE "transRate"
2166#define NI_ENC_PARAM_FRAME_RATE "frameRate"
2167#define NI_ENC_PARAM_FRAME_RATE_DENOM "frameRateDenom"
2168#define NI_ENC_PARAM_INTRA_QP "intraQP"
2169#define NI_ENC_PARAM_DECODING_REFRESH_TYPE "decodingRefreshType"
2170#define NI_ENC_PARAM_INTRA_REFRESH_RESET "intraRefreshResetOnForceIDR"
2171// Rev. B: H.264 only parameters.
2172#define NI_ENC_PARAM_ENABLE_8X8_TRANSFORM "transform8x8Enable"
2173#define NI_ENC_PARAM_ENTROPY_CODING_MODE "entropyCodingMode"
2174// Rev. B: shared between HEVC and H.264
2175#define NI_ENC_PARAM_SLICE_MODE "sliceMode"
2176#define NI_ENC_PARAM_SLICE_ARG "sliceArg"
2177#define NI_ENC_PARAM_INTRA_MB_REFRESH_MODE "intraMbRefreshMode"
2178#define NI_ENC_PARAM_INTRA_MB_REFRESH_ARG "intraMbRefreshArg"
2179#define NI_ENC_PARAM_INTRA_REFRESH_MODE "intraRefreshMode"
2180#define NI_ENC_PARAM_INTRA_REFRESH_ARG "intraRefreshArg"
2181#define NI_ENC_PARAM_ENABLE_MB_LEVEL_RC "mbLevelRcEnable"
2182#define NI_ENC_PARAM_PREFERRED_TRANSFER_CHARACTERISTICS "prefTRC"
2183
2184// To be deprecated: RcInitDelay -> vbvBufferSize, cbr -> fillerEnable
2185#define NI_ENC_PARAM_RC_INIT_DELAY "RcInitDelay"
2186#define NI_ENC_PARAM_CBR "cbr"
2187#define NI_ENC_PARAM_INTRA_REFRESH_MIN_PERIOD "intraRefreshMinPeriod"
2188
2189//QUADRA
2190#ifndef DEPRECATION_AS_ERROR
2192#define NI_ENC_PARAM_CONSTANT_RATE_FACTOR NI_DEPRECATED_MACRO "crf"
2193#endif
2194#define NI_ENC_PARAM_CONSTANT_RATE_FACTOR_FLOAT "crfFloat"
2195#define NI_ENC_PARAM_RDO_LEVEL "rdoLevel"
2196#define NI_ENC_PARAM_RDO_QUANT "EnableRdoQuant"
2197#define NI_ENC_PARAM_MAX_CLL "maxCLL"
2198#define NI_ENC_PARAM_MASTER_DISPLAY "masterDisplay"
2199#define NI_ENC_PARAM_LOOK_AHEAD_DEPTH "lookAheadDepth"
2200#define NI_ENC_PARAM_ENABLE_AUD "enableAUD"
2201#define NI_ENC_PARAM_CTB_RC_MODE "ctbRcMode"
2202#define NI_ENC_PARAM_GOP_SIZE "gopSize"
2203#define NI_ENC_PARAM_GOP_LOW_DELAY "gopLowdelay"
2204#define NI_ENC_PARAM_GDR_DURATION "intraRefreshDuration"
2205#define NI_ENC_PARAM_HRD_ENABLE "hrdEnable"
2206#define NI_ENC_PARAM_DOLBY_VISION_PROFILE "dolbyVisionProfile"
2207#define NI_ENC_PARAM_VBV_BUFFER_SIZE "vbvBufferSize"
2208#define NI_ENC_PARAM_VBV_MAXRAE "vbvMaxRate"
2209#define NI_ENC_PARAM_ENABLE_FILLER "fillerEnable"
2210#define NI_ENC_PARAM_ENABLE_PIC_SKIP "picSkip"
2211#ifndef DEPRECATION_AS_ERROR
2213#define NI_ENC_PARAM_MAX_FRAME_SIZE_LOW_DELAY NI_DEPRECATED_MACRO "maxFrameSize"
2214#endif
2215#define NI_ENC_PARAM_MAX_FRAME_SIZE_BITS_LOW_DELAY "maxFrameSize-Bits"
2216#define NI_ENC_PARAM_MAX_FRAME_SIZE_BYTES_LOW_DELAY "maxFrameSize-Bytes"
2217#define NI_ENC_PARAM_LTR_REF_INTERVAL "ltrRefInterval"
2218#define NI_ENC_PARAM_LTR_REF_QPOFFSET "ltrRefQpOffset"
2219#define NI_ENC_PARAM_LTR_FIRST_GAP "ltrFirstGap"
2220#define NI_ENC_PARAM_LTR_NEXT_INTERVAL "ltrNextInterval"
2221#define NI_ENC_PARAM_MULTICORE_JOINT_MODE "multicoreJointMode"
2222#define NI_ENC_PARAM_JPEG_QLEVEL "qlevel"
2223#define NI_ENC_PARAM_CHROMA_QP_OFFSET "chromaQpOffset"
2224#define NI_ENC_PARAM_TOL_RC_INTER "tolCtbRcInter"
2225#define NI_ENC_PARAM_TOL_RC_INTRA "tolCtbRcIntra"
2226#define NI_ENC_PARAM_BITRATE_WINDOW "bitrateWindow"
2227#define NI_ENC_INLOOP_DS_RATIO "inLoopDSRatio"
2228#define NI_ENC_BLOCK_RC_SIZE "blockRCSize"
2229#define NI_ENC_RC_QP_DELTA_RANGE "rcQpDeltaRange"
2230#define NI_ENC_CTB_ROW_QP_STEP "ctbRowQpStep"
2231#define NI_ENC_NEW_RC_ENABLE "newRcEnable"
2232#define NI_ENC_PARAM_INTRA_QP_DELTA "intraQpDelta"
2233#define NI_ENC_PARAM_LONG_TERM_REFERENCE_ENABLE "longTermReferenceEnable"
2234#define NI_ENC_PARAM_LONG_TERM_REFERENCE_COUNT "longTermReferenceCount"
2235#define NI_ENC_PARAM_LONG_TERM_REFERENCE_INTERVAL "longTermReferenceInterval"
2236#define NI_ENC_PARAM_SKIP_FRAME_ENABLE "skipFrameEnable"
2237#define NI_ENC_PARAM_MAX_CONSUTIVE_SKIP_FRAME_NUMBER "maxConsecutiveSkipFrameNum"
2238#define NI_ENC_PARAM_SKIP_FRAME_INTERVAL "skipFrameInterVal"
2239#define NI_ENC_PARAM_IFRAME_SIZE_RATIO "iFrameSizeRatio"
2240#define NI_ENC_PARAM_STILL_IMAGE_DETECT_LEVEL "stillImageDetectLevel"
2241#define NI_ENC_PARAM_SCENE_CHANG_DETECT_LEVEL "sceneChangeDetectLevel"
2242#define NI_ENC_PARAM_ENABLE_SMOOTH_CRF "enableSmoothCRF"
2243#define NI_ENC_PARAM_ENABLE_COMPENSATE_QP "enableCompensateQp"
2244#define NI_ENC_PARAM_ADAPTIVE_LAMDA_MODE "adaptiveLamdaMode"
2245#define NI_ENC_PARAM_ADAPTIVE_CRF_MODE "adaptiveCrfMode"
2246#define NI_ENC_PARAM_INTRA_COMPENSATE_MODE "intraCompensateMode"
2247#define NI_ENC_PARAM_CUSTOM_MIN_COEFF_DIV "customMinCoeffDiv"
2248// stream color info
2249#define NI_ENC_PARAM_COLOR_PRIMARY "colorPri"
2250#define NI_ENC_PARAM_COLOR_TRANSFER_CHARACTERISTIC "colorTrc"
2251#define NI_ENC_PARAM_COLOR_SPACE "colorSpc"
2252// sample aspect ratio specified in numerator/denominator
2253#define NI_ENC_PARAM_SAR_NUM "sarNum"
2254#define NI_ENC_PARAM_SAR_DENOM "sarDenom"
2255// video_full_range_flag
2256#define NI_ENC_PARAM_VIDEO_FULL_RANGE_FLAG "videoFullRangeFlag"
2257// VFR related
2258#define NI_ENC_PARAM_ENABLE_VFR "enableVFR"
2259#define NI_ENC_ENABLE_SSIM "enableSSIM"
2260#define NI_ENC_PARAM_AVCC_HVCC "avccHvcc"
2261#define NI_ENC_PARAM_AV1_ERROR_RESILIENT_MODE "av1ErrorResilientMode"
2262// set memory allocation parameters, M_MMAP_THRESHOLD and M_TRIM_THRESHOLD
2263#define NI_ENC_PARAM_STATIC_MMAP_THRESHOLD "staticMmapThreshold"
2264#define NI_ENC_PARAM_TEMPORAL_LAYERS_ENABLE "temporalLayersEnable"
2265#define NI_ENC_PARAM_ENABLE_AI_ENHANCE "enableAIEnhance"
2266#define NI_ENC_PARAM_ENABLE_AI_HVSPLUS "enableHVSPlus"
2267#define NI_ENC_PARAM_ENABLE_2PASS_GOP "enable2PassGop"
2268#define NI_ENC_PARAM_ZEROCOPY_MODE "zeroCopyMode"
2269#define NI_ENC_PARAM_AI_ENHANCE_LEVEL "AIEnhanceLevel"
2270#define NI_ENC_PARAM_HVSPLUS_LEVEL "HVSPlusLevel"
2271#define NI_ENC_PARAM_CROP_WIDTH "cropWidth"
2272#define NI_ENC_PARAM_CROP_HEIGHT "cropHeight"
2273#define NI_ENC_PARAM_HORIZONTAL_OFFSET "horOffset"
2274#define NI_ENC_PARAM_VERTICAL_OFFSET "verOffset"
2275#define NI_ENC_PARAM_CONSTANT_RATE_FACTOR_MAX "crfMax"
2276#define NI_ENC_PARAM_QCOMP "qcomp"
2277#define NI_ENC_PARAM_NO_MBTREE "noMbtree"
2278#define NI_ENC_PARAM_NO_HW_MULTIPASS_SUPPORT "noHWMultiPassSupport"
2279#define NI_ENC_PARAM_CU_TREE_FACTOR "cuTreeFactor"
2280#define NI_ENC_PARAM_IP_RATIO "ipRatio"
2281#define NI_ENC_PARAM_ENABLE_IP_RATIO "enableipRatio"
2282#define NI_ENC_PARAM_PB_RATIO "pbRatio"
2283#define NI_ENC_PARAM_CPLX_DECAY "cplxDecay"
2284#define NI_ENC_PARAM_PPS_INIT_QP "ppsInitQp"
2285#define NI_ENC_PARAM_DDR_PRIORITY_MODE "ddrPriorityMode"
2286#define NI_ENC_PARAM_BITRATE_MODE "bitrateMode"
2287#define NI_ENC_PARAM_PASS1_QP "pass1Qp"
2288#define NI_ENC_PARAM_HVS_BASE_MB_COMPLEXITY "hvsBaseMbComplexity"
2289#define NI_ENC_PARAM_STATISTIC_OUTPUT_LEVEL "statisticOutputLevel"
2290#define NI_ENC_PARAM_ENABLE_ALL_SEI_PASSTHRU "enableAllSeiPassthru"
2291#define NI_ENC_PARAM_CRF_MAX_IFRAME_ENABLE "crfMaxIframeEnable"
2292#define NI_ENC_PARAM_VBV_MINRATE "vbvMinRate"
2293#define NI_ENC_PARAM_DISABLE_ADAPTIVE_BUFFERS "disableAdaptiveBuffers"
2294#define NI_ENC_PARAM_DISABLE_BFRAME_RDOQ "disableBframeRDOQ"
2295#define NI_ENC_PARAM_FORCE_BFRAME_QPFACTOR "forceBframeQpfactor"
2296#define NI_ENC_PARAM_TUNE_BFRAME_VISUAL "tuneBframeVisual"
2297#define NI_ENC_PARAM_ENABLE_ACQUIRE_LIMIT "enableAcqLimit"
2298#define NI_ENC_PARAM_GET_PSNR_MODE "getPsnrMode"
2299#define NI_ENC_PARAM_PSNR_INTERVAL "intervalOfPsnr"
2300#define NI_ENC_PARAM_CUSTOMIZE_ROI_QP_LEVEL "customizeQpLevel"
2301#define NI_ENC_PARAM_CUSTOMIZE_ROI_QP_MAP "customizeQpMapFile"
2302#define NI_ENC_PARAM_MOTION_CONSTRAINED_MODE "motionConstrainedMode"
2303#define NI_ENC_PARAM_ALLOCATE_STRAEGY "encMemAllocateStrategy"
2304#define NI_ENC_PARAM_SPATIAL_LAYERS "spatialLayers"
2305#define NI_ENC_PARAM_ENABLE_TIMECODE "enableTimecode"
2306#define NI_ENC_PARAM_SPATIAL_LAYERS_REF_BASE_LAYER "spatialLayersRefBaseLayer"
2307#define NI_ENC_PARAM_GET_RECONSTRUCTED_MODE "getReconstructedMode"
2308#define NI_ENC_PARAM_VBV_BUFFER_REENCODE "vbvBufferReencode"
2309#define NI_ENC_PARAM_TOTAL_CUTREE_DEPTH "totalCuTreeDepth"
2310#define NI_ENC_PARAM_ADAPTIVE_CUTREE "adaptiveCuTree"
2311#define NI_ENC_PARAM_PRE_INTRA_HANDLING "preIntraHandling"
2312#define NI_ENC_PARAM_BASE_LAYER_ONLY "baseLayerOnly"
2313#define NI_ENC_PARAM_PAST_FRAME_MAX_INTRA_RATIO "pastFrameMaxIntraRatio"
2314#define NI_ENC_PARAM_LINK_FRAME_MAX_INTRA_RATIO "linkFrameMaxIntraRatio"
2315#define NI_ENC_PARAM_SPATIAL_LAYER_BITRATE "spatialLayerBitrate"
2316#define NI_ENC_PARAM_DISABLE_AV1_TIMING_INFO "disableAv1TimingInfo"
2317#define NI_ENC_PARAM_AV1_OP_LEVEL "av1OpLevel"
2318#define NI_ENC_PARAM_ENABLE_CPU_AFFINITY "enableCpuAffinity"
2319#define NI_ENC_PARAM_PRESET "preset"
2320#define NI_ENC_PARAM_QP_SCALE_ENABLE "qpScaleEnable"
2321#define NI_ENC_PARAM_GET_BITSTREAM_FEATURES "getBitstreamFeatures"
2322
2323 //----- Start supported by all codecs -----
2330 //----- End supported by all codecs -----
2331
2332 //----- Start supported by AV1, AVC, HEVC only -----
2335 //GOP Pattern
2337 /*!*< A GOP structure preset option (IPP, IBP, IBBP, IbBbP, use Custom GOP, etc) */ // 0-custom 1-I-only 2-IPPP 3-IBBB 4-IBP .....
2338
2339 // CUSTOM_GOP
2341
2348
2349 // HLG preferred transfer characteristics
2351
2354 int crf;
2378 //----- End supported by AV1, AVC, HEVC only -----
2379
2380 //----- Start supported by AVC, HEVC only -----
2381 //ConformanceWindowOffsets
2382 int conf_win_top; /*!*< A conformance window size of TOP */
2383 int conf_win_bottom; /*!*< A conformance window size of BOTTOM */
2384 int conf_win_left; /*!*< A conformance window size of LEFT */
2385 int conf_win_right; /*!*< A conformance window size of RIGHT */
2389 //----- End supported by AVC, HEVC only -----
2390
2391 //----- Start supported by AVC only -----
2393 //----- End supported by AVC only -----
2394
2395 //----- Start supported by HEVC only -----
2400 //----- End supported by HEVC only -----
2401
2402 //----- Start supported by JPEG only -----
2404 //----- End supported by JPEG only -----
2405
2406 //----- Start test use only -----
2410 //----- End test use only -----
2411
2412 //----- Start supported by AV1, AVC, HEVC only -----
2417 //----- End supported by AV1, AVC, HEVC only -----
2418
2419 //----- Start test use only -----
2422 //----- End test use only -----
2423
2424 //----- Start supported by AV1, AVC, HEVC only -----
2426 //----- End supported by AV1, AVC, HEVC only -----
2427
2428 //----- start DEPRECATED or for T408 -----
2430 //Preset Mode
2431 int use_recommend_enc_params; /*!*< 0: Custom, 1: Slow speed and best quality, 2: Normal Speed and quality, 3: Fast Speed and Low Quality */
2432 //Encode Options
2433 int cu_size_mode; /*!*< bit 0: enable 8x8 CU, bit 1: enable 16x16 CU, bit 2: enable 32x32 CU */
2434 int max_num_merge; /*!*< Maximum number of merge candidates (0~2) */
2435 int enable_dynamic_8x8_merge; /*!*< It enables dynamic merge 8x8 candidates. */
2436 int enable_dynamic_16x16_merge; /*!*< It enables dynamic merge 16x16 candidates. */
2437 int enable_dynamic_32x32_merge; /*!*< It enables dynamic merge 32x32 candidates. */
2438
2439 // Rev. B: H.264 only parameters, in ni_t408_config_t
2440 // - for H.264 on T408:
2444
2446 //----- end DEPRECATED or for T408 -----
2447
2448 struct //Rate control parameters
2449 {
2450 int enable_rate_control; /*!*< It enable rate control */
2451 int min_qp; /*!*< A minimum QP for rate control */ //8
2452 int max_qp; /*!*< A maximum QP for rate control */ //51
2456
2457 //no JPEG
2458 int enable_cu_level_rate_control; /*!*< It enable CU level rate control */
2459 int enable_hvs_qp; /*!*< It enable CU QP adjustment for subjective quality enhancement */
2460 int hvs_qp_scale; /*!*< A QP scaling factor for CU QP adjustment when hvcQpenable = 1 */
2464
2465 //deprecated
2466 int enable_hvs_qp_scale; /*!*< It enable QP scaling factor for CU QP adjustment when enable_hvs_qp = 1 */
2467 int max_delta_qp; /*!*< A maximum delta QP for rate control */ //10
2471 int keep_alive_timeout; /* keep alive timeout setting */
2485 float qcomp;
2489 float ipRatio;
2490 float pbRatio;
2497 // 0: no extra output encoder information
2498 // 1: Frame Level output encoder information
2499 // 2: Cu Level Output encoder information
2500 // 3: Frame&Cu Level encoder information
2501 // 6: 1-pass satd cost
2548
2550{
2551#define NI_DEC_PARAM_OUT "out"
2552#define NI_DEC_PARAM_ENABLE_OUT_1 "enableOut1"
2553#define NI_DEC_PARAM_ENABLE_OUT_2 "enableOut2"
2554#define NI_DEC_PARAM_FORCE_8BIT_0 "force8Bit0"
2555#define NI_DEC_PARAM_FORCE_8BIT_1 "force8Bit1"
2556#define NI_DEC_PARAM_FORCE_8BIT_2 "force8Bit2"
2557#define NI_DEC_PARAM_SEMI_PLANAR_0 "semiplanar0"
2558#define NI_DEC_PARAM_SEMI_PLANAR_1 "semiplanar1"
2559#define NI_DEC_PARAM_SEMI_PLANAR_2 "semiplanar2"
2560#define NI_DEC_PARAM_CROP_MODE_0 "cropMode0"
2561#define NI_DEC_PARAM_CROP_MODE_1 "cropMode1"
2562#define NI_DEC_PARAM_CROP_MODE_2 "cropMode2"
2563#define NI_DEC_PARAM_CROP_PARAM_0 "crop0"
2564#define NI_DEC_PARAM_CROP_PARAM_1 "crop1"
2565#define NI_DEC_PARAM_CROP_PARAM_2 "crop2"
2566#define NI_DEC_PARAM_SCALE_0 "scale0"
2567#define NI_DEC_PARAM_SCALE_1 "scale1"
2568#define NI_DEC_PARAM_SCALE_2 "scale2"
2569#define NI_DEC_PARAM_SCALE_0_W "scale0w"
2570#define NI_DEC_PARAM_SCALE_0_H "scale0h"
2571#define NI_DEC_PARAM_SCALE_1_W "scale1w"
2572#define NI_DEC_PARAM_SCALE_1_H "scale1h"
2573#define NI_DEC_PARAM_SCALE_2_W "scale2w"
2574#define NI_DEC_PARAM_SCALE_2_H "scale2h"
2575#define NI_DEC_PARAM_SCALE_0_LONG_SHORT_ADAPT "scale0LongShortAdapt"
2576#define NI_DEC_PARAM_SCALE_1_LONG_SHORT_ADAPT "scale1LongShortAdapt"
2577#define NI_DEC_PARAM_SCALE_2_LONG_SHORT_ADAPT "scale2LongShortAdapt"
2578#define NI_DEC_PARAM_SCALE_0_RES_CEIL "scale0ResCeil"
2579#define NI_DEC_PARAM_SCALE_1_RES_CEIL "scale1ResCeil"
2580#define NI_DEC_PARAM_SCALE_2_RES_CEIL "scale2ResCeil"
2581#define NI_DEC_PARAM_SCALE_0_ROUND "scale0Round"
2582#define NI_DEC_PARAM_SCALE_1_ROUND "scale1Round"
2583#define NI_DEC_PARAM_SCALE_2_ROUND "scale2Round"
2584#define NI_DEC_PARAM_MULTICORE_JOINT_MODE "multicoreJointMode"
2585#define NI_DEC_PARAM_SAVE_PKT "savePkt"
2586#define NI_DEC_PARAM_LOW_DELAY "lowDelay"
2587#define NI_DEC_PARAM_FORCE_LOW_DELAY "forceLowDelay"
2588#define NI_DEC_PARAM_MIN_PACKETS_DELAY "minPacketsDelay"
2589#define NI_DEC_PARAM_ENABLE_LOW_DELAY_CHECK "enableLowDelayCheck"
2590#define NI_DEC_PARAM_DISABLE_REORDER "disableReorder"
2591#define NI_DEC_PARAM_ENABLE_USR_DATA_SEI_PASSTHRU "enableUserDataSeiPassthru"
2592#define NI_DEC_PARAM_ENABLE_CUSTOM_SEI_PASSTHRU "customSeiPassthru"
2593#define NI_DEC_PARAM_SVC_T_DECODING_LAYER "svctDecodingLayer"
2594#define NI_DEC_PARAM_DDR_PRIORITY_MODE "ddrPriorityMode"
2595#define NI_DEC_PARAM_EC_POLICY "ecPolicy"
2596#define NI_DEC_PARAM_ENABLE_ADVANCED_EC "enableAdvancedEc"
2597#define NI_DEC_PARAM_ERROR_THRESHOLD "ecErrThreshold"
2598#define NI_DEC_PARAM_ENABLE_PPU_SCALE_ADAPT "enablePpuScaleAdapt"
2599#define NI_DEC_PARAM_ENABLE_PPU_SCALE_LIMIT "enablePpuScaleLimit"
2600#define NI_DEC_PARAM_MAX_EXTRA_HW_FRAME_CNT "maxExtraHwFrameCnt"
2601#define NI_DEC_PARAM_SKIP_PTS_GUESS "skipPtsGuess"
2602#define NI_DEC_PARAM_PKT_PTS_UNCHANGE "pktPtsUnchange"
2603#define NI_DEC_PARAM_ENABLE_ALL_SEI_PASSTHRU "enableAllSeiPassthru"
2604#define NI_DEC_PARAM_ENABLE_FOLLOW_IFRAME "enableFollowIFrame"
2605#define NI_DEC_PARAM_DISABLE_ADAPTIVE_BUFFERS "disableAdaptiveBuffers"
2606#define NI_DEC_PARAM_SURVIVE_STREAM_ERR "surviveStreamErr"
2607#define NI_DEC_PARAM_REDUCE_DPB_DELAY "reduceDpbDelay"
2608#define NI_DEC_PARAM_SKIP_EXTRA_HEADERS "skipExtraHeaders"
2609#define NI_DEC_PARAM_ENABLE_CPU_AFFINITY "enableCpuAffinity"
2610
2615 int nb_save_pkt; // number of decoder input packets to be saved
2622 1]; /*cut-out of expression to be parsed*/
2626 1]; /*cut-out of expression to be parsed*/
2627 int keep_alive_timeout; /* keep alive timeout setting */
2628 // decoder lowDelay mode for All I packets or IPPP packets
2637 int enable_ppu_scale_adapt; // 0: disabled; 1: adapt to long edge; 2: adapt to short edge.
2644 // 0: disabled; 1: adapt to long edge; 2: adapt to short edge.
2647 int scale_round[NI_MAX_NUM_OF_DECODER_OUTPUTS]; // 0 up align 1 dowm align
2656
2678
2687
2689{
2690 uint32_t start_x;
2691 uint32_t start_y;
2692 uint32_t end_x;
2693 uint32_t end_y;
2694 uint32_t rgba_c;
2696
2704
2709
2713
2714typedef struct _ni_iovec {
2715 uint32_t size;
2716 void *ptr;
2718
2719typedef struct _ni_frame
2720{
2721 // codec of the source from which this frame is decoded
2723
2724 long long dts;
2725 long long pts;
2728 uint32_t video_width;
2730
2731 uint32_t crop_top;
2732 uint32_t crop_bottom;
2733 uint32_t crop_left;
2734 uint32_t crop_right;
2735
2736 // for encoder: force headers on this frame
2738 // for encoder: control long term reference picture feature
2741
2743 // for encoding: frame picture type sent to encoder
2744 // for decoding: frame picture type returned from decoder
2746 // total SEI size: used by encoder
2747 unsigned int sei_total_len;
2748
2749 // SEI info of closed caption: returned by decoder or set by encoder
2750 unsigned int sei_cc_offset;
2751 unsigned int sei_cc_len;
2752 // SEI info of HDR: returned by decoder
2757 // SEI info of HDR10+: returned by decoder
2759 unsigned int sei_hdr_plus_len;
2760 // SEI info of User Data Unregistered SEI: returned by decoder
2763 // SEI info of alternative transfer characteristics: returned by decoder
2766 // VUI info: returned by decoder
2767 unsigned int vui_offset;
2768 unsigned int vui_len;
2769
2770 // ROI data length: for encoder
2771 unsigned int roi_len;
2772 // reconfig data length: for encoder
2773 unsigned int reconf_len;
2774 // total extra data data length: for encoder
2775 unsigned int extra_data_len;
2776 // force pic qp value
2778 // frame chunk index
2780
2783
2784 uint8_t *p_buffer;
2785 uint32_t buffer_size;
2786
2787 ni_buf_t
2788 *dec_buf; // buffer pool entry (has memory pointed to by p_buffer)
2791
2793
2794 // frame auxiliary data
2797
2798 // the following info is of the source stream that is returned by decoder:
2799 // color info, sample aspect ratio, timing etc that are useful at encoding.
2801 uint8_t color_trc;
2805 uint16_t sar_width;
2806 uint16_t sar_height;
2809
2810 int flags; // flags of demuxed packet
2811
2812 // for encoder: metadata buffer info if not contiguous with YUV
2815 // for encoder: whether metadata should be sent separately for frame
2817 uint64_t pkt_pos;
2818
2819 // for encoder: non-4k-aligned part at the start of YUV data
2824 // for encoder: whether the start of non-4k-aligned YUV data should be sent separately for frame
2827 long long orignal_pts;
2828 uint32_t error_ratio;
2829
2830 //for AI non-4k-aligned memory buffer
2831 uint32_t iovec_num;
2833
2834 // offset to be adjusted in FW for zero copy - obtain from ni_encoder_frame_zerocopy_adjust
2837
2838typedef struct _ni_xcoder_params
2839{
2840 int log;
2842 /* Numerator and denominator of frame rate */
2843 uint32_t fps_number;
2845 /* Width (in pixels) of the source pictures. If this width is not an even
2846 * multiple of 4, the encoder will pad the pictures internally to meet this
2847 * minimum requirement. All valid HEVC widths are supported */
2849
2850 /* Height (in pixels) of the source pictures. If this height is not an even
2851 * multiple of 4, the encoder will pad the pictures internally to meet this
2852 * minimum requirement. All valid HEVC heights are supported */
2855 int roi_demo_mode; // for encoder ROI testing
2856 int reconf_demo_mode; // for encoder reconfiguration testing
2857 int force_pic_qp_demo_mode; // for force pic qp mode testing
2858 int low_delay_mode; // encoder low latency mode
2859 int padding; // encoder input padding setting
2860 int generate_enc_hdrs; // in libavcodec, open a dummy session to generate codec headers during init
2861 int use_low_delay_poc_type; // specifies the encoder to set
2862 // picture_order_count_type=2 in the H.264 SPS
2863
2865
2866 // 1: force on every frame with same input type; 0: no (except for I-frame)
2868
2871
2872 int cacheRoi; // enables caching of ROIs applied to subsequent frames
2873
2874#ifndef DEPRECATION_AS_ERROR
2876 NI_DEPRECATED uint32_t
2881#endif
2882
2889
2890 union
2891 {
2894 };
2895
2896 // for encoder reconfiguration testing, saving key:val1,val2,val3,...val9
2897 // (max 9 values) in the demo reconfig data file this supports max 50000
2898 // lines in reconfig file, max 10 key/values per line
2904
2905 int enable_vfr; //enable the vfr
2906
2920
2921typedef struct _niFrameSurface1
2922{
2923 uint16_t ui16FrameIdx; //frame location on device
2924 uint16_t ui16session_ID; //for instance tracking
2925 uint16_t ui16width; // width on device
2926 uint16_t ui16height; // height on device
2927 uint32_t ui32nodeAddress; //currently not in use, formerly offset
2928 int32_t device_handle; //handle to access device
2929 int8_t bit_depth; //1 == 8bit per pixel, 2 == 10bit
2930 int8_t encoding_type; //0 = semiplanar, 1 = planar, 2 = tiled4x4
2931 int8_t output_idx; // 0-2 for decoder output index
2932 int8_t src_cpu; // frame origin location
2933 int32_t dma_buf_fd; // P2P dma buffer file descriptor
2935
2936typedef struct _ni_frame_config
2937{
2941 uint16_t options;
2946 uint32_t rgba_color;
2947 uint16_t frame_index;
2948 uint16_t session_id;
2950 uint8_t orientation; // 0 <= n <= 3, (n * 90°) clockwise rotation
2952
2953
2954// bitstream features related definitions
2955typedef enum
2956{
2961 //NI_QUADRA_NOTCODED_FRAME = 3, /* Used just as a return value */
2963
2971
2979
2987
2995
3001
3007
3012
3013typedef enum
3014{
3017
3019{
3026 int analyzed_mbs; // intra 16x16, intra 8x8, intra 4x4 and inter blocks
3027 int num_intra_block_blocks; // intra 4x4 and 8x8 blocks (counted in 4x4)
3028 int num_intra_plane_blocks; // intra 16x16 blocks (counted in 4x4)
3029 int num_skip_blocks; // skip blocks (counted in 4x4)
3030 int num_forward_pred_blocks; // forward prediction blocks (counted in 4x4)
3032
3033
3034typedef struct _ni_packet
3035{
3036 long long dts;
3037 long long pts;
3038 long long pos;
3039 uint64_t pkt_pos;
3042 uint32_t video_width;
3044 uint32_t frame_type; // encoding only 0=I, 1=P, 2=B
3046 void* p_data;
3047 uint32_t data_len;
3049
3051 uint32_t buffer_size;
3052 uint32_t avg_frame_qp; // average frame QP reported by VPU
3059
3060 int flags; // flags of demuxed packet
3061
3063
3064 double psnr_y;
3065 double psnr_u;
3066 double psnr_v;
3068 double ssim_y;
3069 double ssim_u;
3070 double ssim_v;
3075
3085
3092typedef enum _ni_device_mode{
3093 NI_DEVICE_READ_ONLY = 0x0001, /* Read-only access */
3094 NI_DEVICE_WRITE_ONLY = 0x0002, /* Write-only access */
3095 NI_DEVICE_READ_WRITE = 0x0003 /* Read-write access */
3097
3098#define NI_XCODER_PRESET_NAMES_ARRAY_LEN 7
3099#define NI_XCODER_LOG_NAMES_ARRAY_LEN 7
3100
3101#define NI_XCODER_PRESET_NAME_NONE "none"
3102#define NI_XCODER_PRESET_NAME_VERYFAST "veryfast"
3103#define NI_XCODER_PRESET_NAME_FASTER "faster"
3104#define NI_XCODER_PRESET_NAME_FAST "fast"
3105#define NI_XCODER_PRESET_NAME_MEDIUM "medium"
3106#define NI_XCODER_PRESET_NAME_SLOW "slow"
3107#define NI_XCODER_PRESET_NAME_SLOWER "slower"
3108#define NI_XCODER_PRESET_NAME_VERYSLOW "veryslow"
3109
3110#define NI_XCODER_LOG_NAME_NONE "none"
3111#define NI_XCODER_LOG_NAME_ERROR "error"
3112#define NI_XCODER_LOG_NAME_WARN "warning"
3113#define NI_XCODER_LOG_NAME_INFO "info"
3114#define NI_XCODER_LOG_NAME_DEBUG "debug"
3115#define NI_XCODER_LOG_NAME_FULL "full"
3116
3119
3120/*!*****************************************************************************
3121 * \brief Allocate and initialize a new ni_session_context_t struct
3122 *
3123 *
3124 * \return On success returns a valid pointer to newly allocated context
3125 * On failure returns NULL
3126 ******************************************************************************/
3128
3129/*!*****************************************************************************
3130 * \brief Initialize already allocated session context to a known state
3131 *
3132 * \param[in] p_ctx Pointer to an already allocated ni_session_context_t
3133 * struct
3134 *
3135 * \return On success
3136 * NI_RETCODE_SUCCESS
3137 * On failure
3138 * NI_RETCODE_INVALID_PARAM
3139 * NI_RETCODE_FAILURE
3140 ******************************************************************************/
3143
3144/*!*****************************************************************************
3145 * \brief Clear already allocated session context
3146 *
3147 * \param[in] p_ctx Pointer to an already allocated ni_session_context_t
3148 *
3149 *
3150 ******************************************************************************/
3152
3153/*!*****************************************************************************
3154 * \brief Free previously allocated session context
3155 *
3156 * \param[in] p_ctx Pointer to an already allocated ni_session_context_t
3157 * struct
3158 *
3159 ******************************************************************************/
3161
3162/*!*****************************************************************************
3163 * \brief Create event and return event handle if successful (Windows only)
3164 *
3165 * \return On success returns a event handle
3166 * On failure returns NI_INVALID_EVENT_HANDLE
3167 ******************************************************************************/
3168LIB_API ni_event_handle_t ni_create_event(void);
3169
3170/*!*****************************************************************************
3171 * \brief Close event and release resources (Windows only)
3172 *
3173 * \return NONE
3174 *
3175 ******************************************************************************/
3176LIB_API void ni_close_event(ni_event_handle_t event_handle);
3177
3178#ifndef DEPRECATION_AS_ERROR
3179/*!*****************************************************************************
3180 * \brief Open device and return device device_handle if successful
3181 *
3182 * \param[in] p_dev Device name represented as c string. ex: "/dev/nvme0"
3183 * \param[out] p_max_io_size_out Maximum IO Transfer size supported
3184 *
3185 * \return On success returns a device device_handle
3186 * On failure returns NI_INVALID_DEVICE_HANDLE
3187 ******************************************************************************/
3188LIB_API NI_DEPRECATED ni_device_handle_t ni_device_open(const char *dev,
3189 uint32_t *p_max_io_size_out);
3190#endif
3191
3192/*!*****************************************************************************
3193 * \brief Open device and return device device_handle if successful
3194 *
3195 * \param[in] p_dev Device name represented as c string. ex: "/dev/nvme0"
3196 * \param[in] mode Device configuration parameters
3197 *
3198 * \return On success returns a device device_handle
3199 * On failure returns NI_INVALID_DEVICE_HANDLE
3200 ******************************************************************************/
3201LIB_API ni_device_handle_t ni_device_open2(const char *dev,
3202 ni_device_mode_t mode);
3203
3204/*!*****************************************************************************
3205 * \brief Close device and release resources
3206 *
3207 * \param[in] device_handle Device handle obtained by calling ni_device_open()
3208 *
3209 * \return NONE
3210 *
3211 ******************************************************************************/
3212LIB_API void ni_device_close(ni_device_handle_t dev);
3213
3214#ifndef DEPRECATION_AS_ERROR
3215/*!*****************************************************************************
3216 * \brief Query device and return device capability structure
3217 * This function had been replaced by ni_device_capability_query2
3218 * This function can't be callback in multi thread
3219 *
3220 * \param[in] device_handle Device handle obtained by calling ni_device_open
3221 * \param[in] p_cap Pointer to a caller allocated ni_device_capability_t
3222 * struct
3223 * \return On success
3224 * NI_RETCODE_SUCCESS
3225 * On failure
3226 * NI_RETCODE_INVALID_PARAM
3227 * NI_RETCODE_ERROR_MEM_ALOC
3228 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3229 ******************************************************************************/
3231 ni_device_handle_t device_handle, ni_device_capability_t *p_cap);
3232#endif
3233
3234/*!*****************************************************************************
3235 * \brief Query device and return device capability structure
3236 * This function had replaced ni_device_capability_query
3237 * This function can be callback with multi thread
3238 *
3239 * \param[in] device_handle Device handle obtained by calling ni_device_open
3240 * \param[in] p_cap Pointer to a caller allocated ni_device_capability_t
3241 * struct
3242 * \param[in] device_in_ctxt If device is in ctx
3243 * \return On success
3244 * NI_RETCODE_SUCCESS
3245 * On failure
3246 * NI_RETCODE_INVALID_PARAM
3247 * NI_RETCODE_ERROR_MEM_ALOC
3248 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3249 ******************************************************************************/
3250LIB_API ni_retcode_t ni_device_capability_query2(ni_device_handle_t device_handle,
3251 ni_device_capability_t *p_cap, bool device_in_ctxt);
3252
3253/*!*****************************************************************************
3254 * \brief Open a new device session depending on the device_type parameter
3255 * If device_type is NI_DEVICE_TYPE_DECODER opens decoding session
3256 * If device_type is NI_DEVICE_TYPE_ENCODER opens encoding session
3257 * If device_type is NI_DEVICE_TYPE_SCALER opens scaling session
3258 *
3259 * \param[in] p_ctx Pointer to a caller allocated
3260 * ni_session_context_t struct
3261 * \param[in] device_type NI_DEVICE_TYPE_DECODER, NI_DEVICE_TYPE_ENCODER,
3262 * or NI_DEVICE_TYPE_SCALER
3263 * \return On success
3264 * NI_RETCODE_SUCCESS
3265 * On failure
3266 * NI_RETCODE_INVALID_PARAM
3267 * NI_RETCODE_ERROR_MEM_ALOC
3268 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3269 * NI_RETCODE_ERROR_INVALID_SESSION
3270 ******************************************************************************/
3272 ni_device_type_t device_type);
3273
3274/*!*****************************************************************************
3275 * \brief Close device session that was previously opened by calling
3276 * ni_device_session_open()
3277 * If device_type is NI_DEVICE_TYPE_DECODER closes decoding session
3278 * If device_type is NI_DEVICE_TYPE_ENCODER closes encoding session
3279 * If device_type is NI_DEVICE_TYPE_SCALER closes scaling session
3280 *
3281 * \param[in] p_ctx Pointer to a caller allocated
3282 * ni_session_context_t struct
3283 * \param[in] eos_received Flag indicating if End Of Stream indicator was
3284 * received
3285 * \param[in] device_type NI_DEVICE_TYPE_DECODER, NI_DEVICE_TYPE_ENCODER,
3286 * or NI_DEVICE_TYPE_SCALER
3287 * \return On success
3288 * NI_RETCODE_SUCCESS
3289 * On failure
3290 * NI_RETCODE_INVALID_PARAM
3291 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3292 * NI_RETCODE_ERROR_INVALID_SESSION
3293 ******************************************************************************/
3295 int eos_received,
3296 ni_device_type_t device_type);
3297
3298/*!*****************************************************************************
3299 * \brief Send a flush command to the device
3300 * If device_type is NI_DEVICE_TYPE_DECODER sends EOS command to
3301 * decoder
3302 * If device_type is NI_DEVICE_TYPE_ENCODER sends EOS command to
3303 * encoder
3304 *
3305 * \param[in] p_ctx Pointer to a caller allocated
3306 * ni_session_context_t struct
3307 * \param[in] device_type NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
3308 * \return On success
3309 * NI_RETCODE_SUCCESS
3310 * On failure
3311 * NI_RETCODE_INVALID_PARAM
3312 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3313 * NI_RETCODE_ERROR_INVALID_SESSION
3314 ******************************************************************************/
3316 ni_device_type_t device_type);
3317
3318/*!*****************************************************************************
3319 * \brief Save a stream's headers in a decoder session that can be used later
3320 * for continuous decoding from the same source.
3321 *
3322 * \param[in] p_ctx Pointer to a caller allocated
3323 * ni_session_context_t struct
3324 * \param[in] hdr_data Pointer to header data
3325 * \param[in] hdr_size Size of header data in bytes
3326 * \return On success
3327 * NI_RETCODE_SUCCESS
3328 * On failure
3329 * NI_RETCODE_INVALID_PARAM
3330 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3331 * NI_RETCODE_ERROR_INVALID_SESSION
3332 ******************************************************************************/
3334 ni_session_context_t *p_ctx, uint8_t *hdr_data, uint8_t hdr_size);
3335
3336/*!*****************************************************************************
3337 * \brief Flush a decoder session to get ready to continue decoding.
3338 * Note: this is different from ni_device_session_flush in that it closes the
3339 * current decode session and opens a new one for continuous decoding.
3340 *
3341 * \param[in] p_ctx Pointer to a caller allocated
3342 * ni_session_context_t struct
3343 * \return On success
3344 * NI_RETCODE_SUCCESS
3345 * On failure
3346 * NI_RETCODE_INVALID_PARAM
3347 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3348 * NI_RETCODE_ERROR_INVALID_SESSION
3349 ******************************************************************************/
3351
3352/*!*****************************************************************************
3353 * \brief Send data to the device
3354 * If device_type is NI_DEVICE_TYPE_DECODER sends data packet to
3355 * decoder
3356 * If device_type is NI_DEVICE_TYPE_ENCODER sends data frame to encoder
3357 * If device_type is NI_DEVICE_TYPE_AI sends data frame to AI engine
3358 *
3359 * \param[in] p_ctx Pointer to a caller allocated
3360 * ni_session_context_t struct
3361 * \param[in] p_data Pointer to a caller allocated
3362 * ni_session_data_io_t struct which contains either a
3363 * ni_frame_t data frame or ni_packet_t data packet to
3364 * send
3365 * \param[in] device_type NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER or
3366 * NI_DEVICE_TYPE_AI
3367 * If NI_DEVICE_TYPE_DECODER is specified, it is
3368 * expected that the ni_packet_t struct inside the
3369 * p_data pointer contains data to send.
3370 * If NI_DEVICE_TYPE_ENCODER or NI_DEVICE_TYPE_AI is
3371 * specified, it is expected that the ni_frame_t
3372 * struct inside the p_data pointer contains data to
3373 * send.
3374 * \return On success
3375 * Total number of bytes written
3376 * On failure
3377 * NI_RETCODE_INVALID_PARAM
3378 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3379 * NI_RETCODE_ERROR_INVALID_SESSION
3380 ******************************************************************************/
3382 ni_session_data_io_t *p_data,
3383 ni_device_type_t device_type);
3384
3385/*!*****************************************************************************
3386 * \brief Read data from the device
3387 * If device_type is NI_DEVICE_TYPE_DECODER reads data packet from
3388 * decoder
3389 * If device_type is NI_DEVICE_TYPE_ENCODER reads data frame from
3390 * encoder
3391 * If device_type is NI_DEVICE_TYPE_AI reads data frame from AI engine
3392 *
3393 * \param[in] p_ctx Pointer to a caller allocated
3394 * ni_session_context_t struct
3395 * \param[in] p_data Pointer to a caller allocated ni_session_data_io_t
3396 * struct which contains either a ni_frame_t data frame
3397 * or ni_packet_t data packet to send
3398 * \param[in] device_type NI_DEVICE_TYPE_DECODER, NI_DEVICE_TYPE_ENCODER, or
3399 * NI_DEVICE_TYPE_SCALER
3400 * If NI_DEVICE_TYPE_DECODER is specified, data that
3401 * was read will be placed into ni_frame_t struct
3402 * inside the p_data pointer
3403 * If NI_DEVICE_TYPE_ENCODER is specified, data that
3404 * was read will be placed into ni_packet_t struct
3405 * inside the p_data pointer
3406 * If NI_DEVICE_TYPE_AI is specified, data that was
3407 * read will be placed into ni_frame_t struct inside
3408 * the p_data pointer
3409 * \return On success
3410 * Total number of bytes read
3411 * On failure
3412 * NI_RETCODE_INVALID_PARAM
3413 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3414 * NI_RETCODE_ERROR_INVALID_SESSION
3415 ******************************************************************************/
3417 ni_session_data_io_t *p_data,
3418 ni_device_type_t device_type);
3419
3420/*!*****************************************************************************
3421 * \brief Query session data from the device -
3422 * If device_type is valid, will query session data
3423 * from specified device type
3424 *
3425 * \param[in] p_ctx Pointer to a caller allocated
3426 * ni_session_context_t struct
3427 * \param[in] device_type NI_DEVICE_TYPE_DECODER or
3428 * NI_DEVICE_TYPE_ENCODER or
3429 * NI_DEVICE_TYPE_SCALER or
3430 * NI_DEVICE_TYPE_AI or
3431 * NI_DEVICE_TYPE_UPLOADER
3432 *
3433 * \return On success
3434 * NI_RETCODE_SUCCESS
3435 * On failure
3436 * NI_RETCODE_INVALID_PARAM
3437 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3438 * NI_RETCODE_ERROR_INVALID_SESSION
3439 ******************************************************************************/
3441 ni_device_type_t device_type);
3442/*!*****************************************************************************
3443 * \brief Query detail session data from the device -
3444 * If device_type is valid, will query session data
3445 * from specified device type
3446 *
3447 * \param[in] p_ctx Pointer to a caller allocated
3448 * ni_session_context_t struct
3449 * \param[in] device_type NI_DEVICE_TYPE_DECODER or
3450 * NI_DEVICE_TYPE_ENCODER or
3451 *
3452 * \return On success
3453 * NI_RETCODE_SUCCESS
3454 * On failure
3455 * NI_RETCODE_INVALID_PARAM
3456 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3457 * NI_RETCODE_ERROR_INVALID_SESSION
3458 ******************************************************************************/
3460 ni_device_type_t device_type, ni_instance_mgr_detail_status_t *detail_data);
3461
3462/*!*****************************************************************************
3463 * \brief Query detail session data from the device -
3464 * If device_type is valid, will query session data
3465 * from specified device type
3466 *
3467 * \param[in] p_ctx Pointer to a caller allocated
3468 * ni_session_context_t struct
3469 * \param[in] device_type NI_DEVICE_TYPE_DECODER or
3470 * NI_DEVICE_TYPE_ENCODER or
3471 *
3472 * \return On success
3473 * NI_RETCODE_SUCCESS
3474 * On failure
3475 * NI_RETCODE_INVALID_PARAM
3476 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3477 * NI_RETCODE_ERROR_INVALID_SESSION
3478 ******************************************************************************/
3480
3481/*!*****************************************************************************
3482 * \brief Send namespace num and SRIOv index to the device with specified logic block
3483 * address.
3484 *
3485 * \param[in] device_handle Device handle obtained by calling ni_device_open
3486 * \param[in] namespace_num Set the namespace number with designated sriov
3487 * \param[in] sriov_index Identify which sriov need to be set
3488 *
3489 * \return On success
3490 * NI_RETCODE_SUCCESS
3491 * On failure
3492 * NI_RETCODE_ERROR_MEM_ALOC
3493 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3494 ******************************************************************************/
3495LIB_API ni_retcode_t ni_device_config_namespace_num(ni_device_handle_t device_handle,
3496 uint32_t namespace_num, uint32_t sriov_index);
3497
3498/*!*****************************************************************************
3499 * \brief Send qos mode to the device with specified logic block
3500 * address.
3501 *
3502 * \param[in] device_handle Device handle obtained by calling ni_device_open
3503 * \param[in] mode The requested qos mode
3504 *
3505 * \return On success
3506 * NI_RETCODE_SUCCESS
3507 * On failure
3508 * NI_RETCODE_ERROR_MEM_ALOC
3509 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3510 ******************************************************************************/
3511LIB_API ni_retcode_t ni_device_config_qos(ni_device_handle_t device_handle,
3512 uint32_t mode);
3513
3514 /*!*****************************************************************************
3515 * \brief Send qos over provisioning mode to target namespace with specified logic
3516 * block address.
3517 *
3518 * \param[in] device_handle Device handle obtained by calling ni_device_open
3519 * \param[in] device_handle_t Target device handle of namespace required for OP
3520 * \param[in] over_provision The request overprovision percent
3521 *
3522 * \return On success
3523 * NI_RETCODE_SUCCESS
3524 * On failure
3525 * NI_RETCODE_ERROR_MEM_ALOC
3526 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3527 ******************************************************************************/
3528LIB_API ni_retcode_t ni_device_config_qos_op(ni_device_handle_t device_handle,
3529 ni_device_handle_t device_handle_t,
3530 uint32_t over_provision);
3531/*!*****************************************************************************
3532 * \brief Set QoS allowance for a specific namespace
3533 *
3534 * \param[in] device_handle Device handle obtained by calling ni_device_open
3535 * \param[in] device_handle_t Target device handle of namespace required
3536 * \param[in] allowance Allowance percentage (0.0-100.0)
3537 *
3538 * \return On success
3539 * NI_RETCODE_SUCCESS
3540 * On failure
3541 * NI_RETCODE_ERROR_MEM_ALOC
3542 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3543 ******************************************************************************/
3544LIB_API ni_retcode_t ni_device_config_qos_allowance(ni_device_handle_t device_handle,
3545 ni_device_handle_t device_handle_t,
3546 uint32_t allowance);
3547
3548
3549/*!*****************************************************************************
3550 * \brief Allocate preliminary memory for the frame buffer based on provided
3551 * parameters. Applicable to YUV420 Planar pixel (8 or 10 bit/pixel)
3552 * format or 32-bit RGBA.
3553 *
3554 * \param[in] p_frame Pointer to a caller allocated
3555 * ni_frame_t struct
3556 * \param[in] video_width Width of the video frame
3557 * \param[in] video_height Height of the video frame
3558 * \param[in] alignment Allignment requirement
3559 * \param[in] metadata_flag Flag indicating if space for additional metadata
3560 * should be allocated
3561 * \param[in] factor 1 for 8 bits/pixel format, 2 for 10 bits/pixel,
3562 * 4 for 32 bits/pixel (RGBA)
3563 * \param[in] hw_frame_count Number of hw descriptors stored in lieu of raw YUV
3564 * \param[in] is_planar 0 if semiplanar else planar
3565 *
3566 * \return On success
3567 * NI_RETCODE_SUCCESS
3568 * On failure
3569 * NI_RETCODE_INVALID_PARAM
3570 * NI_RETCODE_ERROR_MEM_ALOC
3571 ******************************************************************************/
3572LIB_API ni_retcode_t ni_frame_buffer_alloc(ni_frame_t *p_frame, int video_width,
3573 int video_height, int alignment,
3574 int metadata_flag, int factor,
3575 int hw_frame_count, int is_planar);
3576
3577/*!*****************************************************************************
3578 * \brief Wrapper function for ni_frame_buffer_alloc. Meant to handle RGBA min.
3579 * resoulution considerations for encoder.
3580 *
3581 * \param[in] p_frame Pointer to a caller allocated
3582 * ni_frame_t struct
3583 * \param[in] video_width Width of the video frame
3584 * \param[in] video_height Height of the video frame
3585 * \param[in] alignment Allignment requirement
3586 * \param[in] metadata_flag Flag indicating if space for additional metadata
3587 * should be allocated
3588 * \param[in] factor 1 for 8 bits/pixel format, 2 for 10 bits/pixel,
3589 * 4 for 32 bits/pixel (RGBA)
3590 * \param[in] hw_frame_count Number of hw descriptors stored
3591 * \param[in] is_planar 0 if semiplanar else planar
3592 * \param[in] pix_fmt pixel format to distinguish between planar types
3593 * and/or components
3594 *
3595 * \return On success
3596 * NI_RETCODE_SUCCESS
3597 * On failure
3598 * NI_RETCODE_INVALID_PARAM
3599 * NI_RETCODE_ERROR_MEM_ALOC
3600 ******************************************************************************/
3602 int video_height, int alignment,
3603 int metadata_flag, int factor,
3604 int hw_frame_count, int is_planar,
3605 ni_pix_fmt_t pix_fmt);
3606
3608 int video_width, int video_height,
3609 int pixel_format);
3610
3611/*!*****************************************************************************
3612 * \brief Allocate memory for decoder frame buffer based on provided
3613 * parameters; the memory is retrieved from a buffer pool and will be
3614 * returned to the same buffer pool by ni_decoder_frame_buffer_free.
3615 * Note: all attributes of ni_frame_t will be set up except for memory and
3616 * buffer, which rely on the pool being allocated; the pool will be
3617 * allocated only after the frame resolution is known.
3618 *
3619 * \param[in] p_pool Buffer pool to get the memory from
3620 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
3621 * \param[in] alloc_mem Whether to get memory from buffer pool
3622 * \param[in] video_width Width of the video frame
3623 * \param[in] video_height Height of the video frame
3624 * \param[in] alignment Alignment requirement
3625 * \param[in] factor 1 for 8 bits/pixel format, 2 for 10 bits/pixel
3626 * \param[in] is_planar 0 if semiplanar else planar
3627 *
3628 * \return On success
3629 * NI_RETCODE_SUCCESS
3630 * On failure
3631 * NI_RETCODE_INVALID_PARAM
3632 * NI_RETCODE_ERROR_MEM_ALOC
3633 ******************************************************************************/
3635 ni_buf_pool_t *p_pool, ni_frame_t *pframe, int alloc_mem, int video_width,
3636 int video_height, int alignment, int factor, int is_planar);
3637
3638/*!*****************************************************************************
3639 * \brief Allocate memory for the frame buffer for encoding based on given
3640 * parameters, taking into account pic line size and extra data.
3641 * Applicable to YUV420p AVFrame only. 8 or 10 bit/pixel.
3642 * Cb/Cr size matches that of Y.
3643 *
3644 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
3645 *
3646 * \param[in] video_width Width of the video frame
3647 * \param[in] video_height Height of the video frame
3648 * \param[in] linesize Picture line size
3649 * \param[in] alignment Allignment requirement
3650 * \param[in] extra_len Extra data size (incl. meta data). < 0 means not
3651 * to allocate any buffer (zero-copy from existing)
3652 * \param[in] alignment_2pass_wa set alignment to work with 2pass encode
3653 *
3654 * \return On success
3655 * NI_RETCODE_SUCCESS
3656 * On failure
3657 * NI_RETCODE_INVALID_PARAM
3658 * NI_RETCODE_ERROR_MEM_ALOC
3659 *****************************************************************************/
3661 ni_frame_t *pframe, int video_width, int video_height, int linesize[],
3662 int alignment, int extra_len, bool alignment_2pass_wa);
3663
3665 ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params,
3666 niFrameSurface1_t *p_surface);
3667
3669 ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params,
3670 niFrameSurface1_t *p_src_surface);
3671
3673 ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params);
3674
3675/*!*****************************************************************************
3676* \brief Allocate memory for the frame buffer based on provided parameters
3677* taking into account pic line size and extra data.
3678* Applicable to nv12 AVFrame only. Cb/Cr size matches that of Y.
3679*
3680* \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
3681*
3682* \param[in] video_width Width of the video frame
3683* \param[in] video_height Height of the video frame
3684* \param[in] linesize Picture line size
3685* \param[in] extra_len Extra data size (incl. meta data). < 0 means not
3686* to allocate any buffer (zero-copy from existing)
3687* \param[in] alignment_2pass_wa set alignment to work with 2pass encode
3688*
3689* \return On success
3690* NI_RETCODE_SUCCESS
3691* On failure
3692* NI_RETCODE_INVALID_PARAM
3693* NI_RETCODE_ERROR_MEM_ALOC
3694*****************************************************************************/
3696 int video_width, int video_height,
3697 int linesize[], int extra_len,
3698 bool alignment_2pass_wa);
3699
3700/*!*****************************************************************************
3701 * \brief This API is a wrapper for ni_encoder_frame_buffer_alloc(), used
3702 * for planar pixel formats, and ni_frame_buffer_alloc_nv(), used for
3703 * semi-planar pixel formats. This API is meant to combine the
3704 * functionality for both formats.
3705 * Allocate memory for the frame buffer for encoding based on given
3706 * parameters, taking into account pic line size and extra data.
3707 * Applicable to YUV420p(8 or 10 bit/pixel) or nv12 AVFrame.
3708 * Cb/Cr size matches that of Y.
3709 *
3710 * \param[in] planar true: if planar:
3711 * pixel_format == (NI_PIX_FMT_YUV420P ||
3712 * NI_PIX_FMT_YUV420P10LE ||NI_PIX_FMT_RGBA).
3713 * false: semi-planar:
3714 * pixel_format == (NI_PIX_FMT_NV12 ||
3715 * NI_PIX_FMT_P010LE).
3716 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
3717 * \param[in] video_width Width of the video frame
3718 * \param[in] video_height Height of the video frame
3719 * \param[in] linesize Picture line size
3720 * \param[in] alignment Allignment requirement. Only used for planar format.
3721 * \param[in] extra_len Extra data size (incl. meta data). < 0 means not
3722 * to allocate any buffer (zero-copy from existing)
3723 * \param[in] alignment_2pass_wa set alignment to work with 2pass encode
3724 *
3725 * \return On success
3726 * NI_RETCODE_SUCCESS
3727 * On failure
3728 * NI_RETCODE_INVALID_PARAM
3729 * NI_RETCODE_ERROR_MEM_ALOC
3730 *****************************************************************************/
3732 int video_width, int video_height,
3733 int linesize[], int alignment,
3734 int extra_len,
3735 bool alignment_2pass_wa);
3736
3737/*!*****************************************************************************
3738 * \brief Free frame buffer that was previously allocated with either
3739 * ni_frame_buffer_alloc or ni_encoder_frame_buffer_alloc or
3740 * ni_frame_buffer_alloc_nv
3741 *
3742 * \param[in] p_frame Pointer to a previously allocated ni_frame_t struct
3743 *
3744 * \return On success NI_RETCODE_SUCCESS
3745 * On failure NI_RETCODE_INVALID_PARAM
3746 ******************************************************************************/
3748
3749/*!*****************************************************************************
3750 * \brief Free decoder frame buffer that was previously allocated with
3751 * ni_decoder_frame_buffer_alloc, returning memory to a buffer pool.
3752 *
3753 * \param[in] p_frame Pointer to a previously allocated ni_frame_t struct
3754 *
3755 * \return On success NI_RETCODE_SUCCESS
3756 * On failure NI_RETCODE_INVALID_PARAM
3757 ******************************************************************************/
3759
3760/*!*****************************************************************************
3761 * \brief Return a memory buffer to memory buffer pool, for a decoder frame.
3762 *
3763 * \param[in] buf Buffer to be returned.
3764 * \param[in] p_buffer_pool Buffer pool to return buffer to.
3765 *
3766 * \return None
3767 ******************************************************************************/
3768LIB_API void
3770 ni_buf_pool_t *p_buffer_pool);
3771
3772/*!*****************************************************************************
3773 * \brief Allocate memory for the packet buffer based on provided packet size
3774 *
3775 * \param[in] p_packet Pointer to a caller allocated
3776 * ni_packet_t struct
3777 * \param[in] packet_size Required allocation size
3778 *
3779 * \return On success
3780 * NI_RETCODE_SUCCESS
3781 * On failure
3782 * NI_RETCODE_INVALID_PARAM
3783 * NI_RETCODE_ERROR_MEM_ALOC
3784 ******************************************************************************/
3786 int packet_size);
3787
3788/*!*****************************************************************************
3789 * \brief Allocate packet buffer using a user provided pointer, the memory
3790 * is expected to have already been allocated.
3791 *
3792 * For ideal performance memory should be 4k aligned. If it is not 4K aligned
3793 * then a temporary 4k aligned memory will be used to copy data to and from
3794 * when writing and reading. This will negatively impact performance.
3795 *
3796 * This API will overwrite p_packet->buffer_size, p_packet->p_buffer and
3797 * p_packet->p_data fields in p_packet.
3798 *
3799 * This API will not free any memory associated with p_packet->p_buffer and
3800 * p_packet->p_data fields in p_packet.
3801 * Common use case could be,
3802 * 1. Allocate memory to pointer
3803 * 2. Call ni_custom_packet_buffer_alloc() with allocated pointer.
3804 * 3. Use p_packet as required.
3805 * 4. Call ni_packet_buffer_free() to free up the memory.
3806 *
3807 * \param[in] p_buffer User provided pointer to be used for buffer
3808 * \param[in] p_packet Pointer to a caller allocated
3809 * ni_packet_t struct
3810 * \param[in] buffer_size Buffer size
3811 *
3812 * \return On success
3813 * NI_RETCODE_SUCCESS
3814 * On failure
3815 * NI_RETCODE_INVALID_PARAM
3816 * NI_RETCODE_ERROR_MEM_ALOC
3817 ******************************************************************************/
3819 ni_packet_t *p_packet,
3820 int buffer_size);
3821
3822/*!*****************************************************************************
3823 * \brief Free packet buffer that was previously allocated with
3824 * ni_packet_buffer_alloc
3825 *
3826 * \param[in] p_packet Pointer to a previously allocated ni_packet_t struct
3827 *
3828 * \return On success NI_RETCODE_SUCCESS
3829 * On failure NI_RETCODE_INVALID_PARAM
3830 ******************************************************************************/
3832
3833/*!*****************************************************************************
3834 * \brief Free packet buffer that was previously allocated with
3835 * ni_packet_buffer_alloc for AV1 packets merge
3836 *
3837 * \param[in] p_packet Pointer to a previously allocated ni_packet_t struct
3838 *
3839 * \return On success NI_RETCODE_SUCCESS
3840 * On failure NI_RETCODE_INVALID_PARAM
3841 ******************************************************************************/
3843
3844/*!*****************************************************************************
3845 * \brief Copy video packet accounting for alignment
3846 *
3847 * \param[in] p_destination Destination to where to copy to
3848 * \param[in] p_source Source from where to copy from
3849 * \param[in] cur_size current size
3850 * \param[out] p_leftover Pointer to the data that was left over
3851 * \param[out] p_prev_size Size of the data leftover
3852 *
3853 * \return On success Total number of bytes that were copied
3854 * On failure NI_RETCODE_FAILURE
3855 ******************************************************************************/
3856LIB_API int ni_packet_copy(void *p_destination, const void *const p_source,
3857 int cur_size, void *p_leftover, int *p_prev_size);
3858
3859/*!*****************************************************************************
3860 * \brief Add a new auxiliary data to a frame
3861 *
3862 * \param[in/out] frame a frame to which the auxiliary data should be added
3863 * \param[in] type type of the added auxiliary data
3864 * \param[in] data_size size of the added auxiliary data
3865 *
3866 * \return a pointer to the newly added aux data on success, NULL otherwise
3867 ******************************************************************************/
3869 ni_aux_data_type_t type,
3870 int data_size);
3871
3872/*!*****************************************************************************
3873 * \brief Add a new auxiliary data to a frame and copy in the raw data
3874 *
3875 * \param[in/out] frame a frame to which the auxiliary data should be added
3876 * \param[in] type type of the added auxiliary data
3877 * \param[in] raw_data the raw data of the aux data
3878 * \param[in] data_size size of the added auxiliary data
3879 *
3880 * \return a pointer to the newly added aux data on success, NULL otherwise
3881 ******************************************************************************/
3884 const uint8_t *raw_data, int data_size);
3885
3886/*!*****************************************************************************
3887 * \brief Retrieve from the frame auxiliary data of a given type if exists
3888 *
3889 * \param[in] frame a frame from which the auxiliary data should be retrieved
3890 * \param[in] type type of the auxiliary data to be retrieved
3891 *
3892 * \return a pointer to the aux data of a given type on success, NULL otherwise
3893 ******************************************************************************/
3895 ni_aux_data_type_t type);
3896
3897/*!*****************************************************************************
3898 * \brief If auxiliary data of the given type exists in the frame, free it
3899 * and remove it from the frame.
3900 *
3901 * \param[in/out] frame a frame from which the auxiliary data should be removed
3902 * \param[in] type type of the auxiliary data to be removed
3903 *
3904 * \return None
3905 ******************************************************************************/
3907
3908/*!*****************************************************************************
3909 * \brief Free and remove all auxiliary data from the frame.
3910 *
3911 * \param[in/out] frame a frame from which the auxiliary data should be removed
3912 *
3913 * \return None
3914 ******************************************************************************/
3916
3917/*!*****************************************************************************
3918 * \brief Initialize default encoder parameters
3919 *
3920 * \param[out] param Pointer to a user allocated ni_xcoder_params_t
3921 * to initialize to default parameters
3922 * \param[in] fps_num Frames per second
3923 * \param[in] fps_denom FPS denomination
3924 * \param[in] bit_rate bit rate
3925 * \param[in] width frame width
3926 * \param[in] height frame height
3927 * \param[in] codec_format codec from ni_codec_format_t
3928 *
3929 * \return On success
3930 * NI_RETCODE_SUCCESS
3931 * On failure
3932 * NI_RETCODE_FAILURE
3933 * NI_RETCODE_INVALID_PARAM
3934 ******************************************************************************/
3936 ni_xcoder_params_t *p_param, int fps_num, int fps_denom, long bit_rate,
3937 int width, int height, ni_codec_format_t codec_format);
3938
3939/*!*****************************************************************************
3940 * \brief Initialize default decoder parameters
3941 *
3942 * \param[out] param Pointer to a user allocated ni_xcoder_params_t
3943 * to initialize to default parameters
3944 * \param[in] fps_num Frames per second
3945 * \param[in] fps_denom FPS denomination
3946 * \param[in] bit_rate bit rate
3947 * \param[in] width frame width
3948 * \param[in] height frame height
3949 *
3950 * \return On success
3951 * NI_RETCODE_SUCCESS
3952 * On failure
3953 * NI_RETCODE_FAILURE
3954 * NI_RETCODE_INVALID_PARAM
3955 ******************************************************************************/
3957 int fps_num, int fps_denom,
3958 long bit_rate, int width,
3959 int height);
3960
3961/*!*****************************************************************************
3962 * \brief Set value referenced by name in encoder parameters structure
3963 *
3964 * \param[in] p_params Pointer to a user allocated ni_xcoder_params_t
3965 * to find and set a particular parameter
3966 * \param[in] name String represented parameter name to search
3967 * \param[in] value Parameter value to set
3968*
3969 * \return On success
3970 * NI_RETCODE_SUCCESS
3971 * On failure
3972 * NI_RETCODE_FAILURE
3973 * NI_RETCODE_INVALID_PARAM
3974 ******************************************************************************/
3976 const char *name,
3977 const char *value);
3978
3979/*!*****************************************************************************
3980* \brief Set value referenced by name in decoder parameters structure
3981*
3982* \param[in] p_params Pointer to a user allocated ni_xcoder_params_t (used
3983* for decoder too for now ) to find and set a particular
3984* parameter
3985* \param[in] name String represented parameter name to search
3986* \param[in] value Parameter value to set
3987*
3988* \return On success
3989* NI_RETCODE_SUCCESS
3990* On failure
3991* NI_RETCODE_FAILURE
3992* NI_RETCODE_INVALID_PARAM
3993******************************************************************************/
3995 const char *name, char *value);
3996
3997/*!*****************************************************************************
3998 * \brief Set GOP parameter value referenced by name in encoder parameters
3999 * structure
4000 *
4001 * \param[in] p_params Pointer to a user allocated ni_xcoder_params_t
4002 * to find and set a particular parameter
4003 * \param[in] name String represented parameter name to search
4004 * \param[in] value Parameter value to set
4005*
4006 * \return On success
4007 * NI_RETCODE_SUCCESS
4008 * On failure
4009 * NI_RETCODE_FAILURE
4010 * NI_RETCODE_INVALID_PARAM
4011 ******************************************************************************/
4013 ni_xcoder_params_t *p_params, const char *name, const char *value);
4014
4015/*!*****************************************************************************
4016* \brief Copy existing decoding session params for hw frame usage
4017*
4018* \param[in] src_p_ctx Pointer to a caller allocated source session context
4019* \param[in] dst_p_ctx Pointer to a caller allocated destination session
4020* context
4021* \return On success
4022* NI_RETCODE_SUCCESS
4023* On failure
4024* NI_RETCODE_INVALID_PARAM
4025******************************************************************************/
4027 ni_session_context_t *dst_p_ctx);
4028
4029/*!*****************************************************************************
4030* \brief Send frame pool setup info to device
4031*
4032* \param[in] p_ctx Pointer to a caller allocated
4033* ni_session_context_t struct
4034* \param[in] pool_size Upload session initial allocated frames count
4035* must be > 0,
4036* \param[in] pool 0 use the normal pool
4037* 1 use a dedicated P2P pool
4038*
4039* \return On success Return code
4040* On failure
4041* NI_RETCODE_INVALID_PARAM
4042* NI_RETCODE_ERROR_NVME_CMD_FAILED
4043* NI_RETCODE_ERROR_INVALID_SESSION
4044* NI_RETCODE_ERROR_MEM_ALOC
4045******************************************************************************/
4047 uint32_t pool_size, uint32_t pool);
4048
4049/*!*****************************************************************************
4050* \brief Sends frame pool change info to device
4051*
4052* \param[in] p_ctx Pointer to a caller allocated
4053* ni_session_context_t struct
4054* \param[in] pool_size if pool_size = 0, free allocated device memory buffers
4055* if pool_size > 0, expand device frame buffer pool of
4056* current instance with pool_size more frame buffers
4057*
4058* \return On success Return code
4059* On failure
4060* NI_RETCODE_FAILURE
4061* NI_RETCODE_INVALID_PARAM
4062* NI_RETCODE_ERROR_NVME_CMD_FAILED
4063* NI_RETCODE_ERROR_INVALID_SESSION
4064* NI_RETCODE_ERROR_MEM_ALOC
4065* NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4066*******************************************************************************/
4068 uint32_t pool_size);
4069
4070/*!*****************************************************************************
4071* \brief Read data from the device
4072* If device_type is NI_DEVICE_TYPE_DECODER reads data hwdesc from
4073* decoder
4074* If device_type is NI_DEVICE_TYPE_SCALER reads data hwdesc from
4075* scaler
4076*
4077* \param[in] p_ctx Pointer to a caller allocated
4078* ni_session_context_t struct
4079* \param[in] p_data Pointer to a caller allocated
4080* ni_session_data_io_t struct which contains either a
4081* ni_frame_t data frame or ni_packet_t data packet to
4082* send
4083* \param[in] device_type NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_SCALER
4084* If NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_SCALER is specified,
4085* hw descriptor info will be stored in p_data ni_frame
4086* \return On success
4087* Total number of bytes read
4088* On failure
4089* NI_RETCODE_INVALID_PARAM
4090* NI_RETCODE_ERROR_NVME_CMD_FAILED
4091* NI_RETCODE_ERROR_INVALID_SESSION
4092******************************************************************************/
4094 ni_session_data_io_t *p_data,
4095 ni_device_type_t device_type);
4096
4097/*!*****************************************************************************
4098* \brief Read YUV data from hw descriptor stored location on device
4099*
4100* \param[in] p_ctx Pointer to a caller allocated
4101* ni_session_context_t struct
4102* \param[in] p_data Pointer to a caller allocated
4103* ni_session_data_io_t struct which contains either a
4104* ni_frame_t data frame or ni_packet_t data packet to
4105* send
4106* \param[in] hwdesc HW descriptor to find frame in XCODER
4107* \return On success
4108* Total number of bytes read
4109* On failure
4110* NI_RETCODE_INVALID_PARAM
4111* NI_RETCODE_ERROR_NVME_CMD_FAILED
4112* NI_RETCODE_ERROR_INVALID_SESSION
4113******************************************************************************/
4115 ni_session_data_io_t *p_data,
4116 niFrameSurface1_t *hwdesc);
4117
4118/*!*****************************************************************************
4119* \brief Query the session if a buffer is available
4120*
4121* \param[in] p_ctx Pointer to a caller allocated
4122* ni_session_context_t struct
4123* \param[in] device_type Quadra device type
4124*
4125* \return On success
4126* NI_RETCODE_SUCCESS
4127* On failure
4128* NI_RETCODE_INVALID_PARAM
4129* NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4130* NI_RETCODE_ERROR_NVME_CMD_FAILED
4131* NI_RETCODE_ERROR_INVALID_SESSION
4132*******************************************************************************/
4134 ni_device_type_t device_type);
4135
4136
4137/*!*****************************************************************************
4138* \brief Send raw YUV input to uploader instance and retrieve a HW descriptor
4139* to represent it
4140*
4141* \param[in] p_ctx Pointer to a caller allocated
4142* ni_session_context_t struct
4143* \param[in] p_src_data Pointer to a caller allocated
4144* ni_session_data_io_t struct which contains a
4145* ni_frame_t data frame to send to uploader
4146* \param[out] hwdesc HW descriptor to find frame in XCODER
4147* \return On success
4148* Total number of bytes read
4149* On failure
4150* NI_RETCODE_INVALID_PARAM
4151* NI_RETCODE_ERROR_NVME_CMD_FAILED
4152* NI_RETCODE_ERROR_INVALID_SESSION
4153*******************************************************************************/
4155
4156/*!*****************************************************************************
4157* \brief Allocate memory for the hwDescriptor buffer based on provided
4158* parameters taking into account pic size and extra data.
4159*
4160* \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
4161*
4162* \param[in] video_width Width of the video frame
4163* \param[in] video_height Height of the video frame
4164* \param[in] extra_len Extra data size (incl. meta data)
4165*
4166* \return On success
4167* NI_RETCODE_SUCCESS
4168* On failure
4169* NI_RETCODE_INVALID_PARAM
4170* NI_RETCODE_ERROR_MEM_ALOC
4171*****************************************************************************/
4173 int video_width,
4174 int video_height,
4175 int extra_len);
4176
4177/*!*****************************************************************************
4178* \brief Recycle a hwframe buffer on card
4179*
4180* \param[in] surface Struct containing device and frame location to clear out
4181* \param[in] device_handle handle to access device memory buffer is stored in
4182*
4183* \return On success NI_RETCODE_SUCCESS
4184* On failure NI_RETCODE_INVALID_PARAM
4185*******************************************************************************/
4187 int32_t device_handle);
4188
4189
4190/*!*****************************************************************************
4191* \brief Recycle a hwframe buffer on card
4192*
4193* \param[in] surface Struct containing device and frame location to clear out
4194*
4195* \return On success NI_RETCODE_SUCCESS
4196* On failure NI_RETCODE_INVALID_PARAM
4197*******************************************************************************/
4199
4200/*!*****************************************************************************
4201 * \brief Set parameters on the device for the 2D engine
4202 *
4203 * \param[in] p_ctx pointer to session context
4204 * \param[in] p_params pointer to the scaler parameters
4205 *
4206 * \return NI_RETCODE_INVALID_PARAM
4207 * NI_RETCODE_ERROR_INVALID_SESSION
4208 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4209
4210 ******************************************************************************/
4212 ni_scaler_params_t *p_params);
4213
4214/*!*****************************************************************************
4215 * \brief Allocate a frame on the device for 2D engine or AI engine
4216 * to work on based on provided parameters
4217 *
4218 * \param[in] p_ctx pointer to session context
4219 * \param[in] width width, in pixels
4220 * \param[in] height height, in pixels
4221 * \param[in] format pixel format
4222 * \param[in] options options bitmap flags, bit 0 (NI_SCALER_FLAG_IO) is
4223 * 0=input frame or 1=output frame. Bit 1 (NI_SCALER_FLAG_PC) is
4224 * 0=single allocation, 1=create pool. Bit 2 (NI_SCALER_FLAG_PA) is
4225 * 0=straight alpha, 1=premultiplied alpha
4226 * \param[in] rectangle_width clipping rectangle width
4227 * \param[in] rectangle_height clipping rectangle height
4228 * \param[in] rectangle_x horizontal position of clipping rectangle
4229 * \param[in] rectangle_y vertical position of clipping rectangle
4230 * \param[in] rgba_color RGBA fill colour (for padding only)
4231 * \param[in] frame_index input hwdesc index
4232 * \param[in] device_type only NI_DEVICE_TYPE_SCALER
4233 * and NI_DEVICE_TYPE_AI (only needs p_ctx and frame_index)
4234 *
4235 * \return NI_RETCODE_INVALID_PARAM
4236 * NI_RETCODE_ERROR_INVALID_SESSION
4237 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4238 * NI_RETCODE_ERROR_MEM_ALOC
4239 ******************************************************************************/
4241 int width,
4242 int height,
4243 int format,
4244 int options,
4245 int rectangle_width,
4246 int rectangle_height,
4247 int rectangle_x,
4248 int rectangle_y,
4249 int rgba_color,
4250 int frame_index,
4251 ni_device_type_t device_type);
4252
4253/*!*****************************************************************************
4254 * \brief Allocate a frame on the device and return the frame index
4255 *
4256 * \param[in] p_ctx pointer to session context
4257 * \param[in] p_out_surface pointer to output frame surface
4258 * \param[in] device_type currently only NI_DEVICE_TYPE_AI
4259 *
4260 * \return NI_RETCODE_INVALID_PARAM
4261 * NI_RETCODE_ERROR_INVALID_SESSION
4262 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4263 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4264 * NI_RETCODE_ERROR_MEM_ALOC
4265 ******************************************************************************/
4267 niFrameSurface1_t *p_out_surface,
4268 ni_device_type_t device_type);
4269
4270/*!*****************************************************************************
4271 * \brief Copy the data of src hwframe to dst hwframe
4272 *
4273 * \param[in] p_ctx pointer to session context
4274 * \param[in] p_frameclone_desc pointer to the frameclone descriptor
4275 *
4276 * \return NI_RETCODE_INVALID_PARAM
4277 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4278 * NI_RETCODE_ERROR_INVALID_SESSION
4279 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4280 * NI_RETCODE_ERROR_MEM_ALOC
4281 ******************************************************************************/
4283 ni_frameclone_desc_t *p_frameclone_desc);
4284
4285/*!*****************************************************************************
4286 * \brief Config a frame on the device for 2D engined
4287 * to work on based on provided parameters
4288 *
4289 * \param[in] p_ctx pointer to session context
4290 * \param[in] p_cfg pointer to frame config
4291 *
4292 * \return NI_RETCODE_INVALID_PARAM
4293 * NI_RETCODE_ERROR_INVALID_SESSION
4294 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4295 * NI_RETCODE_ERROR_MEM_ALOC
4296 ******************************************************************************/
4298 ni_frame_config_t *p_cfg);
4299
4301 ni_scaler_drawbox_params_t *p_params);
4302
4305
4306/*!*****************************************************************************
4307 * \brief Config multiple frame on the device for 2D engined
4308 * to work on based on provided parameters
4309 *
4310 * \param[in] p_ctx pointer to session context
4311 * \param[in] p_cfg_in input frame config array
4312 * \param[in] numInCfgs number of frame config entries in the p_cfg_in array
4313 * \param[in] p_cfg_out output frame config
4314 *
4315 * \return NI_RETCODE_INVALID_PARAM
4316 * NI_RETCODE_ERROR_INVALID_SESSION
4317 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4318 * NI_RETCODE_ERROR_MEM_ALOC
4319 ******************************************************************************/
4321 ni_frame_config_t p_cfg_in[],
4322 int numInCfgs,
4323 ni_frame_config_t *p_cfg_out);
4324
4325/*!*****************************************************************************
4326 * \brief Allocate memory for the frame buffer based on provided parameters
4327 * taking into account the pixel format, width, height, stride,
4328 * alignment, and extra data
4329 * \param[in] p_frame Pointer to caller allocated ni_frame_t
4330 * \param[in] pixel_format a pixel format in ni_pix_fmt_t enum
4331 * \param[in] video_width width, in pixels
4332 * \param[in] video_height height, in pixels
4333 * \param[in] linesize horizontal stride
4334 * \param[in] alignment apply a 16 pixel height alignment (T408 only)
4335 * \param[in] extra_len meta data size
4336 *
4337 * \return NI_RETCODE_SUCCESS
4338 * NI_RETCODE_INVALID_PARAM
4339 * NI_RETCODE_ERROR_MEM_ALOC
4340 *
4341 ******************************************************************************/
4343 ni_frame_t *pframe, int pixel_format, int video_width, int video_height,
4344 int linesize[], int alignment, int extra_len);
4345
4346/*!*****************************************************************************
4347 * \brief configure a network context based with the network binary
4348 *
4349 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4350 * \param[in] file Pointer to caller network binary file path
4351 *
4352 * \return NI_RETCODE_SUCCESS
4353 * NI_RETCODE_INVALID_PARAM
4354 * NI_RETCODE_ERROR_MEM_ALOC
4355 * NI_RETCODE_ERROR_INVALID_SESSION
4356 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4357 * NI_RETCODE_FAILURE
4358 *
4359 ******************************************************************************/
4361 ni_network_data_t *p_network,
4362 const char *file);
4363
4364/*!*****************************************************************************
4365 * \brief configure a hvsplus filter
4366 *
4367 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4368 *
4369 * \return NI_RETCODE_SUCCESS
4370 * NI_RETCODE_FAILURE
4371 *
4372 ******************************************************************************/
4374 ni_network_data_t *p_network);
4375
4376/*!*****************************************************************************
4377 * \brief Allocate input layers memory for AI frame buffer based on provided parameters
4378 * taking into account width, height, format defined by network.
4379 *
4380 * \param[out] p_frame Pointer to caller allocated ni_frame_t
4381 * \param[in] p_network Pointer to caller allocated ni_network_data_t
4382 *
4383 * \return NI_RETCODE_SUCCESS
4384 * NI_RETCODE_INVALID_PARAM
4385 * NI_RETCODE_ERROR_MEM_ALOC
4386 *
4387 ******************************************************************************/
4389 ni_network_data_t *p_network);
4390
4391/*!*****************************************************************************
4392 * \brief Allocate output layers memory for the packet buffer based on provided network
4393 *
4394 * \param[out] p_packet Pointer to a caller allocated
4395 * ni_packet_t struct
4396 * \param[in] p_network Pointer to a caller allocated
4397 * ni_network_data_t struct
4398 *
4399 * \return On success
4400 * NI_RETCODE_SUCCESS
4401 * On failure
4402 * NI_RETCODE_INVALID_PARAM
4403 * NI_RETCODE_ERROR_MEM_ALOC
4404 ******************************************************************************/
4406 ni_network_data_t *p_network);
4407
4408// wrapper API request, dynamic encode configuration setting to be sent to the
4409// encoder with the next frame
4410
4411/*!*****************************************************************************
4412 * \brief Reconfigure bitrate dynamically during encoding.
4413 *
4414 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4415 * \param[in] bitrate Target bitrate to set
4416 *
4417 * \return On success NI_RETCODE_SUCCESS
4418 * On failure NI_RETCODE_INVALID_PARAM
4419 ******************************************************************************/
4421 int32_t bitrate);
4422
4423/*!*****************************************************************************
4424 * \brief Reconfigure intraPeriod dynamically during encoding.
4425 *
4426 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4427 * \param[in] intra_period Target intra period to set
4428 *
4429 * \return On success NI_RETCODE_SUCCESS
4430 * On failure NI_RETCODE_INVALID_PARAM
4431 *
4432 * NOTE - the frame upon which intra period is reconfigured is encoded as IDR frame
4433 * NOTE - reconfigure intra period is not allowed if intraRefreshMode is enabled or if gopPresetIdx is 1
4434 *
4435 ******************************************************************************/
4437 int32_t intra_period);
4438
4439/*!*****************************************************************************
4440 * \brief Reconfigure VUI dynamically during encoding.
4441 *
4442 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4443 * \param[in] bitrate Target bitrate to set
4444 *
4445 * \return On success NI_RETCODE_SUCCESS
4446 * On failure NI_RETCODE_INVALID_PARAM
4447 ******************************************************************************/
4449 ni_vui_hrd_t *vui);
4450
4451/*!*****************************************************************************
4452 * \brief Force next frame to be IDR frame during encoding.
4453 *
4454 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4455 *
4456 * \return On success NI_RETCODE_SUCCESS
4457 ******************************************************************************/
4459
4460/*!*****************************************************************************
4461 * \brief Set a frame's support of Long Term Reference frame during encoding.
4462 *
4463 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4464 * \param[in] ltr Pointer to struct specifying LTR support
4465 *
4466 * \return On success NI_RETCODE_SUCCESS
4467 * On failure NI_RETCODE_INVALID_PARAM
4468 ******************************************************************************/
4470 ni_long_term_ref_t *ltr);
4471
4472/*!*****************************************************************************
4473 * \brief Set Long Term Reference interval
4474 *
4475 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4476 * \param[in] ltr_interval the new long term reference inteval value
4477 *
4478 * \return On success NI_RETCODE_SUCCESS
4479 * On failure NI_RETCODE_INVALID_PARAM
4480 ******************************************************************************/
4482 int32_t ltr_interval);
4483
4484/*!*****************************************************************************
4485 * \brief Set frame reference invalidation
4486 *
4487 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4488 * \param[in] frame_num frame number after which all references shall be
4489 * invalidated
4490 *
4491 * \return On success NI_RETCODE_SUCCESS
4492 * On failure NI_RETCODE_INVALID_PARAM
4493 ******************************************************************************/
4495 int32_t frame_num);
4496
4497/*!*****************************************************************************
4498 * \brief Reconfigure framerate dynamically during encoding.
4499 *
4500 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4501 * \param[in] framerate Pointer to struct specifying framerate to set
4502 *
4503 * \return On success NI_RETCODE_SUCCESS
4504 * On failure NI_RETCODE_INVALID_PARAM
4505 ******************************************************************************/
4507 ni_framerate_t *framerate);
4508
4509/*!*****************************************************************************
4510 * \brief Reconfigure maxFrameSize dynamically during encoding.
4511 *
4512 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4513 * \param[in] max_frame_size the new maxFrameSize value
4514 *
4515 * \return On success NI_RETCODE_SUCCESS
4516 * On failure NI_RETCODE_INVALID_PARAM
4517 *
4518 * NOTE - maxFrameSize_Bytes value less than ((bitrate / 8) / framerate) will be rejected
4519 *
4520 ******************************************************************************/
4522 int32_t max_frame_size);
4523
4524/*!*****************************************************************************
4525 * \brief Reconfigure min&max qp dynamically during encoding.
4526 *
4527 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4528 * \param[in] ni_rc_min_max_qp Target min&max qp to set
4529 *
4530 * \return On success NI_RETCODE_SUCCESS
4531 * On failure NI_RETCODE_INVALID_PARAM
4532 ******************************************************************************/
4534 ni_rc_min_max_qp *p_min_max_qp);
4535
4536
4537/*!*****************************************************************************
4538 * \brief Reconfigure crf value dynamically during encoding.
4539 *
4540 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4541 * \param[in] crf crf value to reconfigure
4542 *
4543 * \return On success NI_RETCODE_SUCCESS
4544 * On failure NI_RETCODE_INVALID_PARAM
4545 ******************************************************************************/
4547 int32_t crf);
4548
4549/*!*****************************************************************************
4550 * \brief Reconfigure crf float point value dynamically during encoding.
4551 *
4552 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4553 * \param[in] crf crf float point value to reconfigure
4554 *
4555 * \return On success NI_RETCODE_SUCCESS
4556 * On failure NI_RETCODE_INVALID_PARAM
4557 ******************************************************************************/
4559 float crf);
4560
4561
4562/*!*****************************************************************************
4563 * \brief Reconfigure vbv buffer size and vbv max rate dynamically during encoding.
4564 *
4565 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4566 * \param[in] vbvBufferSize Target vbvBufferSize to set
4567 * \param[in] vbvMaxRate Target vbvMaxRate to set
4568 *
4569 * \return On success NI_RETCODE_SUCCESS
4570 * On failure NI_RETCODE_INVALID_PARAM
4571 ******************************************************************************/
4573 int32_t vbvMaxRate, int32_t vbvBufferSize);
4574
4575/*!*****************************************************************************
4576 * \brief Reconfigure maxFrameSizeRatio dynamically during encoding.
4577 *
4578 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4579 * \param[in] max_frame_size_ratio the new maxFrameSizeRatio value
4580 *
4581 * \return On success NI_RETCODE_SUCCESS
4582 * On failure NI_RETCODE_INVALID_PARAM
4583 ******************************************************************************/
4585 int32_t max_frame_size_ratio);
4586
4587/*!*****************************************************************************
4588 * \brief Reconfigure sliceArg dynamically during encoding.
4589 *
4590 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4591 * \param[in] sliceArg the new sliceArg value
4592 *
4593 * \return On success NI_RETCODE_SUCCESS
4594 * On failure NI_RETCODE_INVALID_PARAM
4595 ******************************************************************************/
4597 int16_t sliceArg);
4598
4599#ifndef _WIN32
4600/*!*****************************************************************************
4601* \brief Acquire a P2P frame buffer from the hwupload session
4602*
4603* \param[in] p_upl_ctx Pointer to a caller allocated
4604* ni_session_context_t struct
4605* \param[out] p_frame Pointer to a caller allocated hw frame
4606*
4607* \return On success
4608* NI_RETCODE_SUCCESS
4609* On failure
4610* NI_RETCODE_INVALID_PARAM
4611* NI_RETCODE_ERROR_NVME_CMD_FAILED
4612* NI_RETCODE_ERROR_INVALID_SESSION
4613*******************************************************************************/
4615 ni_frame_t *p_frame);
4616
4617/*!*****************************************************************************
4618* \brief Acquire a P2P frame buffer from the hwupload session for P2P read
4619*
4620* \param[in] p_upl_ctx Pointer to a caller allocated
4621* ni_session_context_t struct
4622* \param[out] p_frame Pointer to a caller allocated hw frame
4623*
4624* \return On success
4625* NI_RETCODE_SUCCESS
4626* On failure
4627* NI_RETCODE_INVALID_PARAM
4628* NI_RETCODE_ERROR_NVME_CMD_FAILED
4629* NI_RETCODE_ERROR_INVALID_SESSION
4630*******************************************************************************/
4632 ni_frame_t *p_frame);
4633
4634/*!*****************************************************************************
4635 * \brief Lock a hardware P2P frame prior to encoding
4636 *
4637 * \param[in] p_upl_ctx pointer to caller allocated upload context
4638 * [in] p_frame pointer to caller allocated hardware P2P frame
4639 *
4640 * \return On success
4641 * NI_RETCODE_SUCCESS
4642 * On failure NI_RETCODE_FAILURE
4643 * NI_RETCODE_INVALID_PARAM
4644*******************************************************************************/
4646 ni_session_context_t *p_upl_ctx, ni_frame_t *p_frame);
4647
4648/*!*****************************************************************************
4649 * \brief Unlock a hardware P2P frame after encoding
4650 *
4651 * \param[in] p_upl_ctx pointer to caller allocated upload context
4652 * [in] p_frame pointer to caller allocated hardware P2P frame
4653 *
4654 * \return On success
4655 * NI_RETCODE_SUCCESS
4656 * On failure NI_RETCODE_FAILURE
4657 * NI_RETCODE_INVALID_PARAM
4658*******************************************************************************/
4660 ni_session_context_t *p_upl_ctx, ni_frame_t *p_frame);
4661
4662/*!*****************************************************************************
4663 * \brief Special P2P test API call. Copies YUV data from the software
4664 * frame to the hardware P2P frame on the Quadra device
4665 *
4666 * \param[in] p_upl_ctx pointer to caller allocated uploader session
4667 * context
4668 * [in] p_swframe pointer to a caller allocated software frame
4669 * [in] p_hwframe pointer to a caller allocated hardware frame
4670 *
4671 * \return On success
4672 * NI_RETCODE_SUCCESS
4673 * On failure
4674 * NI_RETCODE_FAILURE
4675 * NI_RETCODE_INVALID_PARAM
4676*******************************************************************************/
4678 uint8_t *p_data, uint32_t len,
4679 ni_frame_t *p_hwframe);
4680
4681
4683 uint8_t *p_data, uint32_t len,
4684 ni_frame_t *p_hwframe);
4685
4686/*!*****************************************************************************
4687 * \brief Set the incoming frame format for the encoder
4688 *
4689 * \param[in] p_enc_ctx pointer to encoder context
4690 * [in] p_enc_params pointer to encoder parameters
4691 * [in] width input width
4692 * [in] height input height
4693 * [in] bit_depth 8 for 8-bit YUV, 10 for 10-bit YUV
4694 * [in] src_endian NI_FRAME_LITTLE_ENDIAN or NI_FRAME_BIG_ENDIAN
4695 * [in] planar 0 for semi-planar YUV, 1 for planar YUV
4696 *
4697 * \return on success
4698 * NI_RETCODE_SUCCESS
4699 *
4700 * on failure
4701 * NI_RETCODE_INVALID_PARAM
4702*******************************************************************************/
4704 ni_session_context_t *p_enc_ctx, ni_xcoder_params_t *p_enc_params,
4705 int width, int height, int bit_depth, int src_endian, int planar);
4706
4707/*!*****************************************************************************
4708 * \brief Acquire the scaler P2P DMA buffer for read/write
4709 *
4710 * \param [in] p_ctx pointer to caller allocated upload context
4711 * [in] p_surface pointer to a caller allocated hardware frame
4712 * [in] data_len scaler frame buffer data length
4713 *
4714 * \return on success
4715 * NI_RETCODE_SUCCESS
4716 *
4717 * on failure
4718 * NI_RETCODE_FAILURE
4719*******************************************************************************/
4721 niFrameSurface1_t *p_surface,
4722 int data_len);
4723
4724/*!*****************************************************************************
4725 * \brief Recycle hw P2P frames
4726 *
4727 * \param [in] p_frame pointer to an acquired P2P hw frame
4728 *
4729 * \return on success
4730 * NI_RETCODE_SUCCESS
4731 *
4732 * on failure
4733 * NI_RETCODE_INVALID_PARAM
4734*******************************************************************************/
4736#endif
4737
4738/*!*****************************************************************************
4739 * \brief Set the frame format for the uploader
4740 *
4741 * \param[in] p_upl_ctx pointer to uploader context
4742 * [in] width width
4743 * [in] height height
4744 * [in] pixel_format pixel format
4745 * [in] isP2P 0 = normal, 1 = P2P
4746 *
4747 * \return on success
4748 * NI_RETCODE_SUCCESS
4749 *
4750 * on failure
4751 * NI_RETCODE_INVALID_PARAM
4752*******************************************************************************/
4755 int height, ni_pix_fmt_t pixel_format, int isP2P);
4756
4757/*!*****************************************************************************
4758 * \brief Read encoder stream header from the device
4759 *
4760 * \param[in] p_ctx Pointer to a caller allocated
4761 * ni_session_context_t struct from encoder
4762 * \param[in] p_data Pointer to a caller allocated ni_session_data_io_t
4763 * struct which contains a ni_packet_t data packet to
4764 * receive
4765 * \return On success
4766 * Total number of bytes read
4767 * On failure
4768 * NI_RETCODE_INVALID_PARAM
4769 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4770 * NI_RETCODE_ERROR_INVALID_SESSION
4771*******************************************************************************/
4773 ni_session_data_io_t *p_data);
4774
4775
4776/*!*****************************************************************************
4777 * \brief Get the DMA buffer file descriptor from the P2P frame
4778 *
4779 * \param[in] p_frame pointer to a P2P frame
4780 *
4781 * \return On success
4782 * DMA buffer file descriptor
4783 * On failure
4784 * NI_RETCODE_FAILURE
4785*******************************************************************************/
4786LIB_API int32_t ni_get_dma_buf_file_descriptor(const ni_frame_t* p_frame);
4787
4788
4789/*!*****************************************************************************
4790 * \brief Send sequence change information to device
4791 *
4792 * \param[in] p_ctx Pointer to a caller allocated
4793 * ni_session_context_t struct
4794 * \param[in] width input width
4795 * \param[in] height input height
4796 * \param[in] bit_depth_factor 1 for 8-bit YUV, 2 for 10-bit YUV
4797 * \param[in] device_type device type (must be encoder)
4798 * \return On success
4799 * NI_RETCODE_SUCCESS
4800 * On failure
4801 * NI_RETCODE_INVALID_PARAM
4802 * NI_RETCODE_ERROR_MEM_ALOC
4803 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4804 * NI_RETCODE_ERROR_INVALID_SESSION
4805 ******************************************************************************/
4807 int width, int height, int bit_depth_factor, ni_device_type_t device_type);
4808
4809/*!*****************************************************************************
4810 * \brief Fetch perf metrics of inferences from device
4811 *
4812 * \param[in] p_ctx Pointer to a caller allocated
4813 * ni_session_context_t struct
4814 * \param[in] p_metrics Pointer to network metrics
4815 * \return On success
4816 * NI_RETCODE_SUCCESS
4817 * On failure
4818 * NI_RETCODE_INVALID_PARAM
4819 * NI_RETCODE_ERROR_MEM_ALOC
4820 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4821 ******************************************************************************/
4824
4825/*!*****************************************************************************
4826 * \brief Query firmware loader and firmware versions from the device
4827 *
4828 * \param[in] device_handle Device handle obtained by calling ni_device_open()
4829 * \param[in] device_info
4830 *
4831 * \return On success
4832 * NI_RETCODE_SUCCESS
4833 * On failure
4834 * NI_RETCODE_INVALID_PARAM
4835 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4836 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4837 * NI_RETCODE_ERROR_MEM_ALOC
4838 ******************************************************************************/
4839LIB_API ni_retcode_t ni_query_fl_fw_versions(ni_device_handle_t device_handle,
4840 ni_device_info_t *p_dev_info);
4841
4842/*!*****************************************************************************
4843 * \brief Query NVMe load from the device
4844 *
4845 * \param[in] p_ctx Pointer to a caller allocated
4846 * ni_session_context_t struct
4847 * \param[in] p_load_query Pointer to a caller allocated
4848 * ni_load_query_t struct
4849 *
4850 * \return On success
4851 * NI_RETCODE_SUCCESS
4852 * On failure
4853 * NI_RETCODE_INVALID_PARAM
4854 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4855 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4856 * NI_RETCODE_ERROR_MEM_ALOC
4857 ******************************************************************************/
4859 ni_session_context_t *p_ctx, ni_load_query_t *p_load_query);
4860
4861/*!*****************************************************************************
4862 * \brief Query VF and NS id from device
4863 *
4864 * \param[in] device_handle Device handle obtained by calling ni_device_open()
4865 * \param[in] p_dev_ns_vf Pointer to a ni_device_vf_ns_id_t struct
4866 * \param[in] fw_rev[] Fw version to check if this function is supported
4867 *
4868 * \return On success
4869 * NI_RETCODE_SUCCESS
4870 * On failure
4871 * NI_RETCODE_INVALID_PARAM
4872 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4873 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4874 * NI_RETCODE_ERROR_MEM_ALOC
4875 ******************************************************************************/
4876LIB_API ni_retcode_t ni_query_vf_ns_id(ni_device_handle_t device_handle,
4877 ni_device_vf_ns_id_t *p_dev_ns_vf,
4878 uint8_t fw_rev[]);
4879
4880/*!*****************************************************************************
4881 * \brief Query CompositeTemp from device
4882 *
4883 * \param[in] device_handle Device handle obtained by calling ni_device_open()
4884 * \param[in] p_dev_temp Pointer to device temperature
4885 * \param[in] fw_rev[] Fw version to check if this function is supported
4886 *
4887 * \return On success
4888 * NI_RETCODE_SUCCESS
4889 * On failure
4890 * NI_RETCODE_INVALID_PARAM
4891 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4892 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4893 * NI_RETCODE_ERROR_MEM_ALOC
4894 ******************************************************************************/
4895LIB_API ni_retcode_t ni_query_temperature(ni_device_handle_t device_handle,
4896 ni_device_temp_t *p_dev_temp,
4897 uint8_t fw_rev[]);
4898
4899/*!*****************************************************************************
4900 * \brief Query CompositeTemp from device
4901 *
4902 * \param[in] device_handle Device handle obtained by calling ni_device_open()
4903 * \param[in] p_dev_extra_info Pointer to device extra info
4904 * \param[in] fw_rev[] Fw version to check if this function is supported
4905 *
4906 * \return On success
4907 * NI_RETCODE_SUCCESS
4908 * On failure
4909 * NI_RETCODE_INVALID_PARAM
4910 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4911 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4912 * NI_RETCODE_ERROR_MEM_ALOC
4913 ******************************************************************************/
4914LIB_API ni_retcode_t ni_query_extra_info(ni_device_handle_t device_handle,
4915 ni_device_extra_info_t *p_dev_extra_info,
4916 uint8_t fw_rev[]);
4917
4918/*!*****************************************************************************
4919 * \brief Query QoS information for the device
4920 *
4921 * \param[in] device_handle Device handle for the target namespace
4922 * \param[out] p_qos_ns_info Pointer to namespace QoS header info structure
4923 * \param[in] fw_rev[] Firmware version array
4924 *
4925 * \return On success
4926 * NI_RETCODE_SUCCESS
4927 * On failure
4928 * NI_RETCODE_INVALID_PARAM
4929 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4930 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4931 * NI_RETCODE_ERROR_MEM_ALOC
4932*******************************************************************************/
4933LIB_API ni_retcode_t ni_query_qos_info(ni_device_handle_t device_handle,
4934 ni_qos_header_info_log_page_t *p_dev_qos_header,
4935 uint8_t fw_rev[]);
4936
4937/*!*****************************************************************************
4938 * \brief Query QoS information for a specific namespace
4939 *
4940 * \param[in] device_handle Device handle for the target namespace
4941 * \param[out] p_qos_ns_info Pointer to namespace QoS namespace info structure
4942 * \param[in] fw_rev[] Firmware version array
4943 *
4944 * \return On success
4945 * NI_RETCODE_SUCCESS
4946 * On failure
4947 * NI_RETCODE_INVALID_PARAM
4948 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4949 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4950 * NI_RETCODE_ERROR_MEM_ALOC
4951*******************************************************************************/
4952LIB_API ni_retcode_t ni_query_qos_namespace_info(ni_device_handle_t device_handle,
4954 uint8_t fw_rev[]);
4955
4956/*!*****************************************************************************
4957 * \brief Check if incoming frame is encoder zero copy compatible or not
4958 *
4959 * \param[in] p_enc_ctx pointer to encoder context
4960 * [in] p_enc_params pointer to encoder parameters
4961 * [in] width input width
4962 * [in] height input height
4963 * [in] linesize input linesizes (pointer to array)
4964 * [in] set_linesize setup linesizes 0 means not setup linesizes, 1 means setup linesizes (before encoder open)
4965 *
4966 * \return on success and can do zero copy
4967 * NI_RETCODE_SUCCESS
4968 *
4969 * cannot do zero copy
4970 * NI_RETCODE_ERROR_UNSUPPORTED_FEATURE
4971 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4972 * NI_RETCODE_INVALID_PARAM
4973 *
4974*******************************************************************************/
4976 ni_xcoder_params_t *p_enc_params,
4977 int width, int height,
4978 const int linesize[],
4979 bool set_linesize);
4980
4981/*!*****************************************************************************
4982 * \brief Check if the frame data transferred is within a frame boundary and
4983 * adjust with offset if it doesn't. EP will re-adjust the data pointer
4984 * to the correct start address.
4985 *
4986 * \param[in] video_height Height of the video frame
4987 * [in] linesize Picture line size after filtering (i.e. cropping)
4988 * [in] data Picture data pointers after filtering (for each of YUV planes)
4989 * [in] buf_size0 Y frame size before any filtering (original size)
4990 * [in] buf_size1 U frame size before any filtering (original)
4991 * [in] buf_size2 V frame size before any filtering (original)
4992 * [in] buf_data0 Y picture data pointer before any filtering (original)
4993 * [in] buf_data1 U picture data pointer before any filtering (original)
4994 * [in] buf_data2 V picture data pointer before any filtering (original)
4995 *
4996 * \return On success
4997 * NI_RETCODE_SUCCESS
4998 * On failure
4999 * NI_RETCODE_INVALID_PARAM
5000 *****************************************************************************/
5002 ni_frame_t *p_frame, int video_height,
5003 const int linesize[], const uint8_t *data[],
5004 int buf_size0, int buf_size1, int buf_size2,
5005 uint8_t *buf_data0, uint8_t *buf_data1, uint8_t *buf_data2);
5006
5007/*!*****************************************************************************
5008 * \brief Allocate memory for encoder zero copy (metadata, etc.)
5009 * for encoding based on given
5010 * parameters, taking into account pic linesize and extra data.
5011 * Applicable to YUV planr / semi-planar 8 or 10 bit and RGBA pixel formats.
5012 *
5013 *
5014 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
5015 * \param[in] video_width Width of the video frame
5016 * \param[in] video_height Height of the video frame
5017 * \param[in] linesize Picture line size
5018 * \param[in] data Picture data pointers (for each of YUV planes)
5019 * \param[in] extra_len Extra data size (incl. meta data)
5020 *
5021 * \return On success
5022 * NI_RETCODE_SUCCESS
5023 * On failure
5024 * NI_RETCODE_INVALID_PARAM
5025 * NI_RETCODE_ERROR_MEM_ALOC
5026 *****************************************************************************/
5028 int video_width, int video_height,
5029 const int linesize[], const uint8_t *data[],
5030 int extra_len);
5031
5032/*!*****************************************************************************
5033 * \brief Check if incoming frame is hwupload zero copy compatible or not
5034 *
5035 * \param[in] p_upl_ctx pointer to uploader context
5036 * [in] width input width
5037 * [in] height input height
5038 * [in] linesize input linesizes (pointer to array)
5039 * [in] pixel_format input pixel format
5040 *
5041 * \return on success and can do zero copy
5042 * NI_RETCODE_SUCCESS
5043 *
5044 * cannot do zero copy
5045 * NI_RETCODE_ERROR_UNSUPPORTED_FEATURE
5046 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
5047 * NI_RETCODE_INVALID_PARAM
5048 *
5049*******************************************************************************/
5051 int width, int height,
5052 const int linesize[], int pixel_format);
5053
5054/*!*****************************************************************************
5055 * \brief Allocate log buffer if needed and retrieve firmware logs from device
5056 *
5057 * \param[in] p_ctx Pointer to a caller allocated
5058 * ni_session_context_t struct
5059 * \param[in] p_log_buffer Reference to pointer to a log buffer
5060 * If log buffer pointer is NULL, this function will allocate log buffer
5061 * NOTE caller is responsible for freeing log buffer after calling this function
5062 * \param[in] gen_log_file Indicating whether it is required to generate log files
5063 *
5064 *
5065 * \return on success
5066 * NI_RETCODE_SUCCESS
5067 *
5068 * on failure
5069 * NI_RETCODE_ERROR_MEM_ALOC
5070 * NI_RETCODE_INVALID_PARAM
5071*******************************************************************************/
5072LIB_API ni_retcode_t ni_device_alloc_and_get_firmware_logs(ni_session_context_t *p_ctx, void** p_log_buffer, bool gen_log_file);
5073
5074/*!*****************************************************************************
5075 * \brief Set up hard coded demo ROI map
5076 *
5077 * \param[in] p_enc_ctx Pointer to a caller allocated
5078 *
5079 * \return on success
5080 * NI_RETCODE_SUCCESS
5081 *
5082 * on failure
5083 * NI_RETCODE_ERROR_MEM_ALOC
5084*******************************************************************************/
5086
5087/*!*****************************************************************************
5088 * \brief Convert various reconfig and demo modes (stored in encoder configuration) to
5089 * aux data and store them in frame
5090 *
5091 * \param[in] p_enc_ctx Pointer to a caller allocated
5092 * ni_session_context_t struct
5093 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
5094 *
5095 *
5096 * \return on success
5097 * NI_RETCODE_SUCCESS
5098 *
5099 * on failure
5100 * NI_RETCODE_ERROR_MEM_ALOC
5101*******************************************************************************/
5103 ni_frame_t *p_frame);
5104
5105/*!*****************************************************************************
5106 * \brief Set custom gop and prepare to check if success
5107 *
5108 * \param[in] p_param Pointer to a caller allocated ni_xcoder_params_t struct
5109 * \param[in] value Pointer to a caller allocated custom gop name
5110 *
5111 * \return none
5112 *
5113*******************************************************************************/
5114LIB_API void ni_gop_params_check_set(ni_xcoder_params_t *p_param, char *value);
5115
5116/*!*****************************************************************************
5117 * \brief Check custom gop params set.
5118 *
5119 * \param[in] p_param Pointer to a caller allocated ni_xcoder_params_t struct
5120 *
5121 *
5122 * \return on success
5123 * true
5124 *
5125 * on failure
5126 * false
5127*******************************************************************************/
5129
5130#ifndef DEPRECATION_AS_ERROR
5131/*!*****************************************************************************
5132 * \brief Initiate P2P transfer (P2P write) (deprecated)
5133 *
5134 * \param[in] pSession Pointer to source card destination
5135 * \param[in] source Pointer to source frame to transmit
5136 * \param[in] ui64DestAddr Destination address on target device
5137 * \param[in] ui32FrameSize Size of frame to transfer
5138 *
5139 * \return always returns
5140 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
5141*******************************************************************************/
5143 niFrameSurface1_t *source,
5144 uint64_t ui64DestAddr,
5145 uint32_t ui32FrameSize);
5146#endif
5147
5148#ifndef DEPRECATION_AS_ERROR
5149/*!*****************************************************************************
5150 * \brief Initiate P2P transfer to another device (P2P write)
5151 *
5152 * \param[in] pSession Pointer to source card destination
5153 * \param[in] source Pointer to source frame to transmit
5154 * \param[in] ui64DestAddr Destination address on target device
5155 * \param[in] ui32FrameSize Size of frame to transfer
5156 *
5157 * \return on success
5158 * NI_RETCODE_SUCCESS
5159 * on failure
5160 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
5161 * NI_RETCODE_INVALID_PARAM
5162 * NI_RETCODE_ERROR_INVALID_SESSION
5163 * NI_RETCODE_ERROR_MEM_ALOC
5164 * NI_RETCODE_ERROR_NVME_CMD_FAILED
5165*******************************************************************************/
5167 niFrameSurface1_t *source,
5168 uint64_t ui64DestAddr,
5169 uint32_t ui32FrameSize);
5170#endif
5171
5172/*!*****************************************************************************
5173 * \brief Initiate P2P transfer to another device (P2P write) with sgl list
5174 *
5175 * \param[in] pSession Pointer to source card upload session
5176 * \param[in] pSrcFrame Pointer to source P2P frame
5177 * \param[in] dmaAddrs Pointer to destination DMA addresses - sgl_list
5178 *
5179 * \return on success
5180 * NI_RETCODE_SUCCESS
5181 * on failure
5182 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
5183 * NI_RETCODE_INVALID_PARAM
5184 * NI_RETCODE_ERROR_INVALID_SESSION
5185 * NI_RETCODE_ERROR_MEM_ALOC
5186 * NI_RETCODE_ERROR_NVME_CMD_FAILED
5187*******************************************************************************/
5189 ni_frame_t *pSrcFrame,
5190 const ni_p2p_sgl_t *dmaAddrs);
5191
5192/*!*****************************************************************************
5193 * \brief Calculate the total size of a frame based on the upload
5194 * context attributes and includes rounding up to the page size
5195 *
5196 * \param[in] p_upl_ctx pointer to an uploader session context
5197 * \param[in] linesize array of line stride
5198 *
5199 * \return size
5200 * NI_RETCODE_INVALID_PARAM
5201 *
5202 ******************************************************************************/
5204 const int linesize[]);
5205
5206
5207/*!*****************************************************************************
5208 * \brief Initiate a P2P transfer (P2P read)
5209 *
5210 * \param[in] pSession Pointer to destination upload session
5211 * \param[in] dmaAddrs Pointer to source DMA addresses
5212 * \param[in] pDstFrame Pointer to destination P2P frame
5213 *
5214 * \return on success
5215 * NI_RETCODE_SUCCESS
5216 * on failure
5217 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
5218 * NI_RETCODE_INVALID_PARAM
5219 * NI_RETCODE_ERROR_INVALID_SESSION
5220 * NI_RETCODE_ERROR_MEM_ALOC
5221 * NI_RETCODE_ERROR_NVME_CMD_FAILED
5222*******************************************************************************/
5224 const ni_p2p_sgl_t *dmaAddrs,
5225 ni_frame_t *pDstFrame);
5226
5227/*!*****************************************************************************
5228 * \brief Send a restart command after flush command
5229 * Only support Encoder now
5230 *
5231 * \param[in] p_ctx Pointer to a caller allocated
5232 * ni_session_context_t struct
5233 * \param[in] width width, in pixels
5234 * \param[in] height height, in pixels
5235 * \param[in] device_type NI_DEVICE_TYPE_ENCODER
5236 * \return On success
5237 * NI_RETCODE_SUCCESS
5238 * On failure
5239 * NI_RETCODE_INVALID_PARAM
5240 * NI_RETCODE_ERROR_NVME_CMD_FAILED
5241 * NI_RETCODE_ERROR_INVALID_SESSION
5242 ******************************************************************************/
5244 int video_width,
5245 int video_height,
5246 ni_device_type_t device_type);
5247
5248/*!******************************************************************************
5249* \brief Send a p_config command to reconfigure decoding ppu params.
5250*
5251* \param ni_session_context_t p_session_ctx - xcoder Context
5252* \param ni_xcoder_params_t p_param - xcoder Params
5253* \param ni_ppu_config_t p_ppu_config - Struct ni_ppu_config
5254*
5255* \return - NI_RETCODE_SUCCESS on success, NI_RETCODE_ERROR_INVALID_SESSION, NI_RETCODE_ERROR_NVME_CMD_FAILED on failure
5256*******************************************************************************/
5258 ni_xcoder_params_t *p_param,
5259 ni_ppu_config_t *p_ppu_config);
5260#ifdef __cplusplus
5261}
5262#endif
Common NETINT definitions used by all modules.
#define NI_DEPRECATED
Definition ni_defs.h:80
#define NI_MAX_NUM_DATA_POINTERS
Definition ni_defs.h:244
#define NI_FIFO_SZ
Definition ni_defs.h:305
#define NI_MAX_DEVICE_NAME_LEN
Definition ni_defs.h:236
#define MAX_AV1_ENCODER_GOP_NUM
Definition ni_defs.h:327
#define NI_MAX_CUSTOM_SEI_CNT
Definition ni_defs.h:317
#define NI_MAX_CONTEXTS_PER_HW_INSTANCE
Definition ni_defs.h:248
#define NI_MAX_DEVICES_PER_HW_INSTANCE
Definition ni_defs.h:251
#define NI_MAX_NUM_OF_DECODER_OUTPUTS
Definition ni_defs.h:255
ni_device_type_t
Definition ni_defs.h:356
@ NI_DEVICE_TYPE_XCODER_MAX
Definition ni_defs.h:364
#define NI_DEPRECATE_MACRO(X)
Definition ni_defs.h:82
enum _ni_scaler_opcode ni_scaler_opcode_t
ni_retcode_t
Definition ni_defs.h:445
#define NI_MAX_PPU_PARAM_EXPR_CHAR
Definition ni_defs.h:259
LIB_API ni_retcode_t ni_query_nvme_status(ni_session_context_t *p_ctx, ni_load_query_t *p_load_query)
Query NVMe load from the device.
enum _ni_ddr_priority_mode_t ni_ddr_priority_mode_t
LIB_API ni_retcode_t ni_frame_buffer_alloc_dl(ni_frame_t *p_frame, int video_width, int video_height, int pixel_format)
Allocate preliminary memory for the frame buffer based on provided parameters.
struct _ni_iovec ni_iovec_t
LIB_API ni_retcode_t ni_device_config_namespace_num(ni_device_handle_t device_handle, uint32_t namespace_num, uint32_t sriov_index)
Send namespace num and SRIOv index to the device with specified logic block address.
enum _ni_frame_pool_type ni_frame_pool_type_t
Frame pool type.
_ni_session_run_state
Session running state type.
@ SESSION_RUN_STATE_NORMAL
@ SESSION_RUN_STATE_SEQ_CHANGE_OPENING
@ SESSION_RUN_STATE_SEQ_CHANGE_DRAINING
@ SESSION_RUN_STATE_FLUSHING
@ SESSION_RUN_STATE_RESETTING
struct _ni_scaler_multi_drawbox_params_t ni_scaler_multi_drawbox_params_t
LIB_API void ni_close_event(ni_event_handle_t event_handle)
Close event and release resources (Windows only)
LIB_API int ni_encoder_session_read_stream_header(ni_session_context_t *p_ctx, ni_session_data_io_t *p_data)
Read encoder stream header from the device.
LIB_API ni_retcode_t ni_query_extra_info(ni_device_handle_t device_handle, ni_device_extra_info_t *p_dev_extra_info, uint8_t fw_rev[])
Query CompositeTemp from device.
LIB_API ni_retcode_t ni_encoder_params_set_value(ni_xcoder_params_t *p_params, const char *name, const char *value)
Set value referenced by name in encoder parameters structure.
enum _ni_param_change_flags ni_param_change_flags_t
This is an enumeration for encoder parameter change.
LIB_API ni_retcode_t ni_ai_frame_buffer_alloc(ni_frame_t *p_frame, ni_network_data_t *p_network)
Allocate input layers memory for AI frame buffer based on provided parameters taking into account wid...
LIB_API void ni_frame_free_aux_data(ni_frame_t *frame, ni_aux_data_type_t type)
If auxiliary data of the given type exists in the frame, free it and remove it from the frame.
av1_codec_profile
@ AV1_CODEC_PROFILE_MAIN
LIB_API ni_retcode_t ni_set_ltr_interval(ni_session_context_t *p_ctx, int32_t ltr_interval)
Set Long Term Reference interval.
LIB_API ni_retcode_t ni_reconfig_vui(ni_session_context_t *p_ctx, ni_vui_hrd_t *vui)
Reconfigure VUI dynamically during encoding.
LIB_API ni_retcode_t ni_device_session_query_detail(ni_session_context_t *p_ctx, ni_device_type_t device_type, ni_instance_mgr_detail_status_t *detail_data)
Query detail session data from the device - If device_type is valid, will query session data from spe...
struct _ni_device_capability ni_device_capability_t
device capability type
struct _ni_enc_mastering_display_colour_volume ni_enc_mastering_display_colour_volume_t
encoded payload format of HDR SEI mastering display colour volume
LIB_API void ni_device_session_context_clear(ni_session_context_t *p_ctx)
Clear already allocated session context.
_ni_reconfig
This is an enumeration for encoder reconfiguration test settings.
@ XCODER_TEST_RECONF_MAX_FRAME_SIZE_RATIO
@ XCODER_TEST_RECONF_VBV_API
@ XCODER_TEST_RECONF_FRAMERATE_API
@ XCODER_TEST_RECONF_RC_MIN_MAX_QP_API
@ XCODER_TEST_RECONF_FRAMERATE
@ XCODER_TEST_RECONF_MAX_FRAME_SIZE
@ XCODER_TEST_RECONF_CRF_FLOAT
@ XCODER_TEST_RECONF_LTR_INTERVAL_API
@ XCODER_TEST_RECONF_SLICE_ARG
@ XCODER_TEST_RECONF_VUI_HRD
@ XCODER_TEST_CRF_API
@ XCODER_TEST_RECONF_LTR_INTERVAL
@ XCODER_TEST_RECONF_LTR_API
@ XCODER_TEST_RECONF_INTRAPRD
@ XCODER_TEST_RECONF_SLICE_ARG_API
@ XCODER_TEST_RECONF_RC_MIN_MAX_QP
@ XCODER_TEST_CRF_FLOAT_API
@ XCODER_TEST_RECONF_VUI_HRD_API
@ XCODER_TEST_FORCE_IDR_FRAME
@ XCODER_TEST_RECONF_BR_API
@ XCODER_TEST_RECONF_MAX_FRAME_SIZE_API
@ XCODER_TEST_RECONF_LONG_TERM_REF
@ XCODER_TEST_RECONF_MAX_FRAME_SIZE_RATIO_API
@ XCODER_TEST_RECONF_END
@ XCODER_TEST_RECONF_BR
@ XCODER_TEST_RECONF_RC_MIN_MAX_QP_REDUNDANT
@ XCODER_TEST_RECONF_CRF
@ XCODER_TEST_INVALID_REF_FRAME_API
@ XCODER_TEST_INVALID_REF_FRAME
@ XCODER_TEST_RECONF_VBV
@ XCODER_TEST_RECONF_INTRAPRD_API
@ XCODER_TEST_RECONF_RC_MIN_MAX_QP_API_REDUNDANT
@ XCODER_TEST_RECONF_OFF
ni_qos_modes
@ QOS_MODE_DISABLED
@ QOS_MODE_ENABLED_SHARE
@ QOS_MODE_ENABLED_NO_SHARE
struct _ni_aux_data ni_aux_data_t
_ni_frame_pool_type
Frame pool type.
@ NI_POOL_TYPE_NONE
@ NI_POOL_TYPE_NORMAL
@ NI_POOL_TYPE_P2P
struct _ni_buf_pool_t ni_buf_pool_t
union _ni_enc_avc_roi_custom_map ni_enc_avc_roi_custom_map_t
encoder AVC ROI custom map (1 MB = 8bits)
#define NI_BITRATE_RECONFIG_FILE_MAX_LINES
Max number of lines supported for the bitrate reconfig file.
_ni_custom_sei_location
This is an enumeration for illustrating the custom SEI locations.
@ NI_CUSTOM_SEI_LOC_AFTER_VCL
@ NI_CUSTOM_SEI_LOC_BEFORE_VCL
struct _ni_bitsream_features ni_bitstream_features_t
struct _ni_split_context_t ni_split_context_t
LIB_API ni_retcode_t ni_device_session_sequence_change(ni_session_context_t *p_ctx, int width, int height, int bit_depth_factor, ni_device_type_t device_type)
Send sequence change information to device.
LIB_API ni_retcode_t ni_uploader_frame_buffer_lock(ni_session_context_t *p_upl_ctx, ni_frame_t *p_frame)
Lock a hardware P2P frame prior to encoding.
struct _ni_frame_config ni_frame_config_t
#define NI_XCODER_LOG_NAMES_ARRAY_LEN
LIB_API const char *const g_xcoder_preset_names[NI_XCODER_PRESET_NAMES_ARRAY_LEN]
LIB_API ni_retcode_t ni_encoder_frame_buffer_alloc(ni_frame_t *pframe, int video_width, int video_height, int linesize[], int alignment, int extra_len, bool alignment_2pass_wa)
Allocate memory for the frame buffer for encoding based on given parameters, taking into account pic ...
#define NI_CC_SEI_TRAILER_LEN
LIB_API 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...
struct _ni_framerate ni_framerate_t
ni_quadra_frame_type
@ NI_QUADRA_PREDICTED_FRAME
@ NI_QUADRA_PIC_TYPE_IDR
@ NI_QUADRA_BIDIR_PREDICTED_FRAME
@ NI_QUADRA_INTRA_FRAME
LIB_API ni_retcode_t ni_device_config_qos_op(ni_device_handle_t device_handle, ni_device_handle_t device_handle_t, uint32_t over_provision)
Send qos over provisioning mode to target namespace with specified logic block address.
struct _ni_custom_sei ni_custom_sei_t
custom sei payload passthrough
LIB_API void ni_decoder_frame_buffer_pool_return_buf(ni_buf_t *buf, ni_buf_pool_t *p_buffer_pool)
Return a memory buffer to memory buffer pool, for a decoder frame.
LIB_API int ni_device_session_read(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 packet from decoder If ...
LIB_API int ni_device_session_acquire_for_read(ni_session_context_t *p_upl_ctx, ni_frame_t *p_frame)
Acquire a P2P frame buffer from the hwupload session for P2P read.
enum _ni_session_run_state ni_session_run_state_t
Session running state type.
struct _ni_network_layer_offset ni_network_layer_offset_t
struct _niFrameSurface1 niFrameSurface1_t
struct _ni_session_context ni_session_context_t
struct _ni_dec_h265_vui_param ni_dec_h265_vui_param_t
decoded payload format of H.265 VUI
LIB_API ni_retcode_t ni_device_session_query_buffer_avail(ni_session_context_t *p_ctx, ni_device_type_t device_type)
Query the session if a buffer is available.
LIB_API ni_retcode_t ni_device_config_qos(ni_device_handle_t device_handle, uint32_t mode)
Send qos mode to the device with specified logic block address.
LIB_API ni_retcode_t ni_reconfig_bitrate(ni_session_context_t *p_ctx, int32_t bitrate)
Reconfigure bitrate dynamically during encoding.
_ni_pixel_planar_format
@ NI_PIXEL_PLANAR_FORMAT_SEMIPLANAR
@ NI_PIXEL_PLANAR_MAX
@ NI_PIXEL_PLANAR_FORMAT_TILED4X4
@ NI_PIXEL_PLANAR_FORMAT_PLANAR
struct _ni_queue_buffer_pool_t ni_queue_buffer_pool_t
struct _ni_network_layer_params_t ni_network_layer_params_t
LIB_API ni_retcode_t ni_device_session_query(ni_session_context_t *p_ctx, ni_device_type_t device_type)
Query session data from the device - If device_type is valid, will query session data from specified ...
LIB_API ni_retcode_t ni_encoder_frame_zerocopy_check(ni_session_context_t *p_enc_ctx, ni_xcoder_params_t *p_enc_params, int width, int height, const int linesize[], bool set_linesize)
Check if incoming frame is encoder zero copy compatible or not.
enum _ni_dec_crop_mode ni_dec_crop_mode
LIB_API ni_retcode_t ni_encoder_init_default_params(ni_xcoder_params_t *p_param, int fps_num, int fps_denom, long bit_rate, int width, int height, ni_codec_format_t codec_format)
Initialize default encoder parameters.
LIB_API int ni_device_session_hwup(ni_session_context_t *p_ctx, ni_session_data_io_t *p_src_data, niFrameSurface1_t *hwdesc)
Send raw YUV input to uploader instance and retrieve a HW descriptor to represent it.
LIB_API 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
LIB_API ni_retcode_t ni_reconfig_max_frame_size_ratio(ni_session_context_t *p_ctx, int32_t max_frame_size_ratio)
Reconfigure maxFrameSizeRatio dynamically during encoding.
LIB_API ni_retcode_t ni_ai_config_hvsplus(ni_session_context_t *p_ctx, ni_network_data_t *p_network)
configure a hvsplus filter
struct _ni_scaler_input_params_t ni_scaler_input_params_t
LIB_API NI_DEPRECATED ni_device_handle_t ni_device_open(const char *dev, uint32_t *p_max_io_size_out)
Open device and return device device_handle if successful.
LIB_API ni_retcode_t ni_uploader_p2p_test_send(ni_session_context_t *p_upl_ctx, uint8_t *p_data, uint32_t len, ni_frame_t *p_hwframe)
Special P2P test API call. Copies YUV data from the software frame to the hardware P2P frame on the Q...
LIB_API ni_retcode_t ni_packet_buffer_free(ni_packet_t *ppacket)
Free packet buffer that was previously allocated with ni_packet_buffer_alloc.
struct _ni_category_classify ni_category_classify_t
LIB_API ni_retcode_t ni_device_alloc_frame(ni_session_context_t *p_ctx, int width, int height, int format, int options, int rectangle_width, int rectangle_height, int rectangle_x, int rectangle_y, int rgba_color, int frame_index, ni_device_type_t device_type)
Allocate a frame on the device for 2D engine or AI engine to work on based on provided parameters.
struct _ni_encoder_cfg_params ni_encoder_cfg_params_t
LIB_API ni_session_context_t * ni_device_session_context_alloc_init(void)
Allocate and initialize a new ni_session_context_t struct.
enum ni_qos_modes ni_qos_modes_t
struct _ni_decoder_input_params_t ni_decoder_input_params_t
LIB_API ni_retcode_t ni_enc_prep_reconf_demo_data(ni_session_context_t *p_enc_ctx, ni_frame_t *p_frame)
Convert various reconfig and demo modes (stored in encoder configuration) to aux data and store them ...
#define NI_CC_SEI_HDR_H264_LEN
LIB_API void ni_gop_params_check_set(ni_xcoder_params_t *p_param, char *value)
Set custom gop and prepare to check if success.
_ni_device_mode
Device access mode enumeration.
@ NI_DEVICE_READ_ONLY
@ NI_DEVICE_WRITE_ONLY
@ NI_DEVICE_READ_WRITE
_ni_ai_buffer_quantize_format_e
@ NI_AI_BUFFER_QUANTIZE_DYNAMIC_FIXED_POINT
@ NI_AI_BUFFER_QUANTIZE_MAX
@ NI_AI_BUFFER_QUANTIZE_NONE
@ NI_AI_BUFFER_QUANTIZE_TF_ASYMM
#define NI_MAX_GOP_NUM
LIB_API 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
LIB_API ni_retcode_t ni_device_dec_session_save_hdrs(ni_session_context_t *p_ctx, uint8_t *hdr_data, uint8_t hdr_size)
Save a stream's headers in a decoder session that can be used later for continuous decoding from the ...
struct _ni_instance_mgr_detail_status_v1 ni_instance_mgr_detail_status_v1_t
#define NI_CUSTOMIZE_ROI_QP_NUM
Max number of entries per line supported for the qp number.
LIB_API ni_retcode_t ni_scaler_set_drawbox_params(ni_session_context_t *p_ctx, ni_scaler_drawbox_params_t *p_params)
Send a p_config command to configure scaling drawbox parameters.
LIB_API 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 ...
#define NI_MAX_CUSTOM_SEI_DATA
struct _ni_dec_h264_vui_param ni_dec_h264_vui_param_t
decoded payload format of H.264 VUI
LIB_API int ni_calculate_total_frame_size(const ni_session_context_t *p_upl_ctx, const int linesize[])
Calculate the total size of a frame based on the upload context attributes and includes rounding up t...
union _ni_enc_quad_roi_custom_map ni_enc_quad_roi_custom_map
encoder AVC ROI custom map (1 MB = 8bits)
struct _ni_thread_arg_struct_t ni_thread_arg_struct_t
LIB_API ni_retcode_t ni_p2p_recv(ni_session_context_t *pSession, const ni_p2p_sgl_t *dmaAddrs, ni_frame_t *pDstFrame)
Initiate a P2P transfer (P2P read)
struct _ni_instance_mgr_detail_status_append ni_instance_mgr_detail_status_append_t
LIB_API ni_retcode_t ni_encoder_set_input_frame_format(ni_session_context_t *p_enc_ctx, ni_xcoder_params_t *p_enc_params, int width, int height, int bit_depth, int src_endian, int planar)
Set the incoming frame format for the encoder.
struct _ni_long_term_ref ni_long_term_ref_t
LIB_API ni_retcode_t ni_encoder_frame_zerocopy_adjust(ni_session_context_t *p_enc_ctx, ni_frame_t *p_frame, int video_height, const int linesize[], const uint8_t *data[], int buf_size0, int buf_size1, int buf_size2, uint8_t *buf_data0, uint8_t *buf_data1, uint8_t *buf_data2)
Check if the frame data transferred is within a frame boundary and adjust with offset if it doesn't....
LIB_API ni_retcode_t ni_set_frame_ref_invalid(ni_session_context_t *p_ctx, int32_t frame_num)
Set frame reference invalidation.
struct _ni_content_light_level_info_bytes ni_content_light_level_info_bytes_t
payload format of HDR SEI content light level info
LIB_API int ni_device_session_hwdl(ni_session_context_t *p_ctx, ni_session_data_io_t *p_data, niFrameSurface1_t *hwdesc)
Read YUV data from hw descriptor stored location on device.
struct _ni_encoder_change_params_t ni_encoder_change_params_t
This is a data structure for encoding parameters that have changed.
_ni_dec_crop_mode
@ NI_DEC_CROP_MODE_AUTO
@ NI_DEC_CROP_MODE_MANUAL
@ NI_DEC_CROP_MODE_DISABLE
LIB_API ni_retcode_t ni_scaler_set_watermark_params(ni_session_context_t *p_ctx, ni_scaler_watermark_params_t *p_params)
Send a p_config command to configure scaling watermark parameters.
struct _ni_hw_capability ni_hw_capability_t
hardware capability type
LIB_API ni_retcode_t ni_device_session_close(ni_session_context_t *p_ctx, int eos_received, ni_device_type_t device_type)
Close device session that was previously opened by calling ni_device_session_open() If device_type is...
struct _ni_packet ni_packet_t
LIB_API ni_retcode_t ni_encoder_frame_zerocopy_buffer_alloc(ni_frame_t *p_frame, int video_width, int video_height, const int linesize[], const uint8_t *data[], int extra_len)
Allocate memory for encoder zero copy (metadata, etc.) for encoding based on given parameters,...
ni_xcoder_state_t
@ NI_XCODER_HWDL_STATE
@ NI_XCODER_IDLE_STATE
@ NI_XCODER_READ_DESC_STATE
@ NI_XCODER_FLUSH_STATE
@ NI_XCODER_GENERAL_STATE
@ NI_XCODER_READ_STATE
@ NI_XCODER_INTER_FLUSH_STATE
@ NI_XCODER_CLOSE_STATE
@ NI_XCODER_HWUP_STATE
@ NI_XCODER_OPEN_STATE
@ NI_XCODER_WRITE_STATE
LIB_API ni_retcode_t ni_decoder_params_set_value(ni_xcoder_params_t *p_params, const char *name, char *value)
Set value referenced by name in decoder parameters structure.
_ni_frame_aux_data_type
@ NI_FRAME_AUX_DATA_MASTERING_DISPLAY_METADATA
@ NI_FRAME_AUX_DATA_BITRATE
@ NI_FRAME_AUX_DATA_SLICE_ARG
@ NI_FRAME_AUX_DATA_CRF_FLOAT
@ NI_FRAME_AUX_DATA_UDU_SEI
@ NI_FRAME_AUX_DATA_MAX_MIN_QP
@ NI_FRAME_AUX_DATA_CATEGORY_CLASSIFY
@ NI_FRAME_AUX_DATA_FRAMERATE
@ NI_FRAME_AUX_DATA_LTR_INTERVAL
@ NI_FRAME_AUX_DATA_HDR_PLUS
@ NI_FRAME_AUX_DATA_VBV_MAX_RATE
@ NI_FRAME_AUX_DATA_INTRAPRD
@ NI_FRAME_AUX_DATA_CUSTOM_SEI
@ NI_FRAME_AUX_DATA_CRF
@ NI_FRAME_AUX_DATA_MAX_FRAME_SIZE
@ NI_FRAME_AUX_DATA_VUI
@ NI_FRAME_AUX_DATA_NONE
@ NI_FRAME_AUX_DATA_INVALID_REF_FRAME
@ NI_FRAME_AUX_DATA_A53_CC
@ NI_FRAME_AUX_DATA_CONTENT_LIGHT_LEVEL
@ NI_FRAME_AUX_DATA_REGIONS_OF_INTEREST
@ NI_FRAME_AUX_DATA_LONG_TERM_REF
@ NI_FRAME_AUX_DATA_VBV_BUFFER_SIZE
struct _ni_load_query ni_load_query_t
LIB_API ni_retcode_t ni_packet_buffer_free_av1(ni_packet_t *ppacket)
Free packet buffer that was previously allocated with ni_packet_buffer_alloc for AV1 packets merge.
struct _ni_context_query ni_context_query_t
LIB_API NI_DEPRECATED ni_retcode_t ni_device_capability_query(ni_device_handle_t device_handle, ni_device_capability_t *p_cap)
Query device and return device capability structure This function had been replaced by ni_device_capa...
LIB_API ni_retcode_t ni_device_multi_config_frame(ni_session_context_t *p_ctx, ni_frame_config_t p_cfg_in[], int numInCfgs, ni_frame_config_t *p_cfg_out)
Config multiple frame on the device for 2D engined to work on based on provided parameters.
LIB_API ni_aux_data_t * ni_frame_new_aux_data(ni_frame_t *frame, ni_aux_data_type_t type, int data_size)
Add a new auxiliary data to a frame.
ni_h265_sei_user_data_type_t
@ NI_H265_USERDATA_FLAG_RESERVED_3
@ NI_H265_USERDATA_FLAG_UNREGISTERED_PRE
@ NI_H265_USERDATA_FLAG_ITU_T_T35_PRE
@ NI_H265_USERDATA_FLAG_ITU_T_T35_PRE_1
@ NI_H265_USERDATA_FLAG_ITU_T_T35_SUF
@ NI_H265_USERDATA_FLAG_RESERVED_1
@ NI_H265_USERDATA_FLAG_VUI
@ NI_H265_USERDATA_FLAG_ITU_T_T35_PRE_2
@ NI_H265_USERDATA_FLAG_RESERVED_9
@ NI_H265_USERDATA_FLAG_TONE_MAPPING_INFO
@ NI_H265_USERDATA_FLAG_PIC_TIMING
@ NI_H265_USERDATA_FLAG_RESERVED_0
@ NI_H265_USERDATA_FLAG_MASTERING_COLOR_VOL
@ NI_H265_USERDATA_FLAG_CHROMA_RESAMPLING_FILTER_HINT
@ NI_H265_USER_DATA_FLAG_COLOUR_REMAPPING_INFO
@ NI_H265_USERDATA_FLAG_ITU_T_T35_SUF_2
@ NI_H265_USER_DATA_FLAG_CONTENT_LIGHT_LEVEL_INFO
@ NI_H265_USERDATA_FLAG_ITU_T_T35_SUF_1
@ NI_H265_USERDATA_FLAG_KNEE_FUNCTION_INFO
@ NI_H265_USER_DATA_FLAG_FILM_GRAIN_CHARACTERISTICS_INFO
@ NI_H265_USERDATA_FLAG_UNREGISTERED_SUF
LIB_API ni_retcode_t ni_reconfig_min_max_qp(ni_session_context_t *p_ctx, ni_rc_min_max_qp *p_min_max_qp)
Reconfigure min&max qp dynamically during encoding.
LIB_API ni_retcode_t ni_ai_packet_buffer_alloc(ni_packet_t *p_packet, ni_network_data_t *p_network)
Allocate output layers memory for the packet buffer based on provided network.
LIB_API ni_retcode_t ni_query_qos_namespace_info(ni_device_handle_t device_handle, ni_qos_namespace_info_log_page_t *p_dev_qos_ns, uint8_t fw_rev[])
Query QoS information for a specific namespace.
LIB_API ni_retcode_t ni_p2p_send_v2(ni_session_context_t *pSession, ni_frame_t *pSrcFrame, const ni_p2p_sgl_t *dmaAddrs)
Initiate P2P transfer to another device (P2P write) with sgl list.
LIB_API ni_retcode_t ni_reconfig_intraprd(ni_session_context_t *p_ctx, int32_t intra_period)
Reconfigure intraPeriod dynamically during encoding.
#define NI_ENC_PARAM_CONSTANT_RATE_FACTOR
LIB_API ni_event_handle_t ni_create_event(void)
Create event and return event handle if successful (Windows only)
LIB_API ni_retcode_t ni_hwframe_buffer_recycle2(niFrameSurface1_t *surface)
Recycle a hwframe buffer on card.
struct _ni_network_perf_metrics ni_network_perf_metrics_t
ni_qos_codes
@ QOS_ALLOW_CONFIG_CODE
@ QOS_OP_CONFIG_CODE
@ QOS_ALLOW_CONFIG_REC_ALLOW_CODE
@ QOS_OP_CONFIG_REC_OP_CODE
@ QOS_NAMESPACE_CODE
LIB_API ni_retcode_t ni_reconfig_vbv_value(ni_session_context_t *p_ctx, int32_t vbvMaxRate, int32_t vbvBufferSize)
Reconfigure vbv buffer size and vbv max rate dynamically during encoding.
LIB_API ni_retcode_t ni_frame_buffer_alloc_pixfmt(ni_frame_t *pframe, int pixel_format, int video_width, int video_height, int linesize[], int alignment, int extra_len)
Allocate memory for the frame buffer based on provided parameters taking into account the pixel forma...
LIB_API ni_retcode_t ni_ai_session_read_metrics(ni_session_context_t *p_ctx, ni_network_perf_metrics_t *p_metrics)
Fetch perf metrics of inferences from device.
union _ni_enc_hevc_roi_custom_map ni_enc_hevc_roi_custom_map_t
encoder HEVC ROI custom map (1 CTU = 64bits)
struct _ni_ppu_config ni_ppu_config_t
LIB_API void ni_device_close(ni_device_handle_t dev)
Close device and release resources.
LIB_API ni_retcode_t ni_hwframe_p2p_buffer_recycle(ni_frame_t *p_frame)
Recycle hw P2P frames.
#define NI_HDR10P_SEI_HDR_H264_LEN
LIB_API int32_t ni_get_dma_buf_file_descriptor(const ni_frame_t *p_frame)
Get the DMA buffer file descriptor from the P2P frame.
LIB_API ni_retcode_t ni_ai_config_network_binary(ni_session_context_t *p_ctx, ni_network_data_t *p_network, const char *file)
configure a network context based with the network binary
h264_codec_profile
@ H264_CODEC_PROFILE_EXTENDED
@ H264_CODEC_PROFILE_HIGH
@ H264_CODEC_PROFILE_BASELINE
@ H264_CODEC_PROFILE_MAIN
LIB_API ni_retcode_t ni_hwframe_buffer_recycle(niFrameSurface1_t *surface, int32_t device_handle)
Recycle a hwframe buffer on card.
LIB_API ni_retcode_t ni_force_idr_frame_type(ni_session_context_t *p_ctx)
Force next frame to be IDR frame during encoding.
LIB_API ni_retcode_t ni_uploader_frame_buffer_unlock(ni_session_context_t *p_upl_ctx, ni_frame_t *p_frame)
Unlock a hardware P2P frame after encoding.
enum _ni_vq_presets_e ni_vq_presets_e
LIB_API int ni_device_session_write(ni_session_context_t *p_ctx, ni_session_data_io_t *p_data, ni_device_type_t device_type)
Send data to the device If device_type is NI_DEVICE_TYPE_DECODER sends data packet to decoder If devi...
LIB_API ni_retcode_t ni_reconfig_crf(ni_session_context_t *p_ctx, int32_t crf)
Reconfigure crf value dynamically during encoding.
struct _ni_vui_hrd ni_vui_hrd_t
struct _ni_session_data_io ni_session_data_io_t
LIB_API ni_retcode_t ni_device_session_update_framepool(ni_session_context_t *p_ctx, uint32_t pool_size)
Sends frame pool change info to device.
LIB_API ni_retcode_t ni_device_capability_query2(ni_device_handle_t device_handle, ni_device_capability_t *p_cap, bool device_in_ctxt)
Query device and return device capability structure This function had replaced ni_device_capability_q...
struct _ni_rc_min_max_qp ni_rc_min_max_qp
LIB_API ni_retcode_t ni_reconfig_slice_arg(ni_session_context_t *p_ctx, int16_t sliceArg)
Reconfigure sliceArg dynamically during encoding.
LIB_API ni_retcode_t ni_device_alloc_and_get_firmware_logs(ni_session_context_t *p_ctx, void **p_log_buffer, bool gen_log_file)
Allocate log buffer if needed and retrieve firmware logs from device.
LIB_API ni_retcode_t ni_decoder_frame_buffer_alloc(ni_buf_pool_t *p_pool, ni_frame_t *pframe, int alloc_mem, int video_width, int video_height, int alignment, int factor, int is_planar)
Allocate memory for decoder frame buffer based on provided parameters; the memory is retrieved from a...
LIB_API bool ni_gop_params_check(ni_xcoder_params_t *p_param)
Check custom gop params set.
LIB_API ni_retcode_t ni_encoder_gop_params_set_value(ni_xcoder_params_t *p_params, const char *name, const char *value)
Set GOP parameter value referenced by name in encoder parameters structure.
LIB_API ni_retcode_t ni_scaler_p2p_frame_acquire(ni_session_context_t *p_ctx, niFrameSurface1_t *p_surface, int data_len)
Acquire the scaler P2P DMA buffer for read/write.
LIB_API ni_retcode_t ni_frame_buffer_alloc_hwenc(ni_frame_t *pframe, int video_width, int video_height, int extra_len)
Allocate memory for the hwDescriptor buffer based on provided parameters taking into account pic size...
LIB_API ni_retcode_t ni_decoder_init_default_params(ni_xcoder_params_t *p_param, int fps_num, int fps_denom, long bit_rate, int width, int height)
Initialize default decoder parameters.
enum _ni_custom_sei_location ni_custom_sei_location_t
This is an enumeration for illustrating the custom SEI locations.
LIB_API ni_retcode_t ni_device_clone_hwframe(ni_session_context_t *p_ctx, ni_frameclone_desc_t *p_frameclone_desc)
Copy the data of src hwframe to dst hwframe.
#define NI_CUSTOMIZE_ROI_QPOFFSET_LEVEL
Max number of lines supported for qpoffset level.
enum _ni_frame_aux_data_type ni_aux_data_type_t
struct _ni_gop_rps ni_gop_rps_t
hevc_codec_profile
@ HEVC_CODEC_PROFILE_MAIN10
@ HEVC_CODEC_PROFILE_MAIN
struct _ni_scaler_multi_watermark_params_t ni_scaler_multi_watermark_params_t
LIB_API ni_retcode_t ni_scaler_set_params(ni_session_context_t *p_ctx, ni_scaler_params_t *p_params)
Set parameters on the device for the 2D engine.
enum _ni_ai_buffer_format_e ni_ai_buffer_format_e
video_codec_identifier
@ VODEO_CODEC_ID_HEVC
@ VODEO_CODEC_ID_H264
@ VODEO_CODEC_ID_AV1
@ VODEO_CODEC_ID_VP9
LIB_API NI_DEPRECATED ni_retcode_t ni_p2p_send(ni_session_context_t *pSession, niFrameSurface1_t *source, uint64_t ui64DestAddr, uint32_t ui32FrameSize)
Initiate P2P transfer to another device (P2P write)
enum _ni_codec_format ni_codec_format_t
This is an enumeration for supported codec formats.
struct _ni_scaler_params_t ni_scaler_params_t
LIB_API int ni_packet_copy(void *p_destination, const void *const p_source, int cur_size, void *p_leftover, int *p_prev_size)
Copy video packet accounting for alignment.
struct _ni_overall_load_query ni_overall_load_query_t
LIB_API ni_retcode_t ni_device_session_context_init(ni_session_context_t *p_ctx)
Initialize already allocated session context to a known state.
#define NI_ENC_PARAM_MAX_FRAME_SIZE_LOW_DELAY
LIB_API ni_retcode_t ni_device_session_query_detail_v1(ni_session_context_t *p_ctx, ni_device_type_t device_type, ni_instance_mgr_detail_status_v1_t *detail_data)
Query detail session data from the device - If device_type is valid, will query session data from spe...
LIB_API ni_retcode_t ni_set_ltr(ni_session_context_t *p_ctx, ni_long_term_ref_t *ltr)
Set a frame's support of Long Term Reference frame during encoding.
ni_quadra_av1_profile
@ NI_QUADRA_AV1_PROFILE_MAIN
struct _ni_frame ni_frame_t
LIB_API void ni_frame_wipe_aux_data(ni_frame_t *frame)
Free and remove all auxiliary data from the frame.
LIB_API ni_retcode_t ni_device_alloc_dst_frame(ni_session_context_t *p_ctx, niFrameSurface1_t *p_out_surface, ni_device_type_t device_type)
Allocate a frame on the device and return the frame index.
_ni_ddr_priority_mode_t
@ NI_DDR_PRIORITY_AI
@ NI_DDR_PRIORITY_FILT
@ NI_DDR_PRIORITY_DECENC
@ NI_DDR_PRIORITY_NONE
@ NI_DDR_PRIORITY_RESET
@ NI_DDR_PRIORITY_MAX
LIB_API void ni_device_session_context_free(ni_session_context_t *p_ctx)
Free previously allocated session context.
LIB_API ni_retcode_t ni_frame_buffer_alloc(ni_frame_t *p_frame, int video_width, int video_height, int alignment, int metadata_flag, int factor, int hw_frame_count, int is_planar)
Allocate preliminary memory for the frame buffer based on provided parameters. Applicable to YUV420 P...
struct _ni_input_frame ni_input_frame
LIB_API ni_retcode_t ni_uploader_p2p_test_load(ni_session_context_t *p_upl_ctx, uint8_t *p_data, uint32_t len, ni_frame_t *p_hwframe)
Special P2P test API function. Copies video data from the software frame to the hardware P2P frame on...
#define MAX_CHAR_IN_DEVICE_NAME
struct _ni_timestamp_table_t ni_timestamp_table_t
LIB_API NI_DEPRECATED ni_retcode_t ni_p2p_xfer(ni_session_context_t *pSession, niFrameSurface1_t *source, uint64_t ui64DestAddr, uint32_t ui32FrameSize)
Initiate P2P transfer (P2P write) (deprecated)
LIB_API ni_retcode_t ni_device_session_restart(ni_session_context_t *p_ctx, int video_width, int video_height, ni_device_type_t device_type)
Send a restart command after flush command Only support Encoder now.
#define NI_MAX_SUPPORT_DRAWBOX_NUM
LIB_API ni_retcode_t ni_encoder_sw_frame_buffer_alloc(bool planar, ni_frame_t *p_frame, int video_width, int video_height, int linesize[], int alignment, int extra_len, bool alignment_2pass_wa)
This API is a wrapper for ni_encoder_frame_buffer_alloc(), used for planar pixel formats,...
struct _ni_network_data ni_network_data_t
LIB_API ni_retcode_t ni_set_demo_roi_map(ni_session_context_t *p_enc_ctx)
Set up hard coded demo ROI map.
LIB_API ni_retcode_t ni_device_session_copy(ni_session_context_t *src_p_ctx, ni_session_context_t *dst_p_ctx)
Copy existing decoding session params for hw frame usage.
LIB_API ni_retcode_t ni_query_fl_fw_versions(ni_device_handle_t device_handle, ni_device_info_t *p_dev_info)
Query firmware loader and firmware versions from the device.
struct _ni_custom_sei_set ni_custom_sei_set_t
#define NI_MAX_SPATIAL_LAYERS
LIB_API int ni_device_session_acquire(ni_session_context_t *p_upl_ctx, ni_frame_t *p_frame)
Acquire a P2P frame buffer from the hwupload session.
#define NI_HDR10P_SEI_HDR_HEVC_LEN
#define NI_NAMESPACE_MAX_NUM
LIB_API ni_retcode_t ni_device_dec_session_flush(ni_session_context_t *p_ctx)
Flush a decoder session to get ready to continue decoding. Note: this is different from ni_device_ses...
LIB_API ni_retcode_t ni_query_vf_ns_id(ni_device_handle_t device_handle, ni_device_vf_ns_id_t *p_dev_ns_vf, uint8_t fw_rev[])
Query VF and NS id from device.
ni_codec_hw_actions
This is an enumeration for hw actions.
@ NI_CODEC_HW_UPLOAD
@ NI_CODEC_HW_NONE
@ NI_CODEC_HW_DOWNLOAD
@ NI_CODEC_HW_ENABLE
@ NI_CODEC_HW_PAYLOAD_OFFSET
@ NI_CODEC_HW_RSVD
_ni_codec_format
This is an enumeration for supported codec formats.
@ NI_CODEC_FORMAT_H265
@ NI_CODEC_FORMAT_AV1
@ NI_CODEC_FORMAT_H264
@ NI_CODEC_FORMAT_JPEG
@ NI_CODEC_FORMAT_VP9
LIB_API 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...
ni_pix_fmt_t
@ NI_PIX_FMT_ARGB
@ NI_PIX_FMT_P010LE
@ NI_PIX_FMT_YUV420P
@ NI_PIX_FMT_ABGR
@ NI_PIX_FMT_NONE
@ NI_PIX_FMT_10_TILED4X4
@ NI_PIX_FMT_BGRP
@ NI_PIX_FMT_BGR0
@ NI_PIX_FMT_YUYV422
@ NI_PIX_FMT_RGBA
@ NI_PIX_FMT_NV12
@ NI_PIX_FMT_8_TILED4X4
@ NI_PIX_FMT_BGRA
@ NI_PIX_FMT_NV16
@ NI_PIX_FMT_UYVY422
@ NI_PIX_FMT_YUV420P10LE
LIB_API ni_retcode_t ni_device_config_qos_allowance(ni_device_handle_t device_handle, ni_device_handle_t device_handle_t, uint32_t allowance)
Set QoS allowance for a specific namespace.
enum _ni_reconfig ni_reconfig_t
This is an enumeration for encoder reconfiguration test settings.
LIB_API ni_retcode_t ni_reconfig_framerate(ni_session_context_t *p_ctx, ni_framerate_t *framerate)
Reconfigure framerate dynamically during encoding.
struct _ni_scaler_drawbox_params_t ni_scaler_drawbox_params_t
LIB_API int ni_device_session_init_framepool(ni_session_context_t *p_ctx, uint32_t pool_size, uint32_t pool)
Send frame pool setup info to device.
struct _ni_extended_dec_metadata ni_extended_dec_metadata_t
_ni_ai_buffer_format_e
@ NI_AI_BUFFER_FORMAT_INT8
@ NI_AI_BUFFER_FORMAT_FP64
@ NI_AI_BUFFER_FORMAT_FP32
@ NI_AI_BUFFER_FORMAT_CHAR
@ NI_AI_BUFFER_FORMAT_UINT16
@ NI_AI_BUFFER_FORMAT_UINT8
@ NI_AI_BUFFER_FORMAT_BFP16
@ NI_AI_BUFFER_FORMAT_FP16
@ NI_AI_BUFFER_FORMAT_INT64
@ NI_AI_BUFFER_FORMAT_UINT32
@ NI_AI_BUFFER_FORMAT_INT32
@ NI_AI_BUFFER_FORMAT_INT16
@ NI_AI_BUFFER_FORMAT_UINT64
struct _ni_rational ni_rational_t
#define NI_ENC_PARAM_GEN_HDRS
LIB_API ni_retcode_t ni_frame_buffer_alloc_nv(ni_frame_t *p_frame, int video_width, int video_height, int linesize[], int extra_len, bool alignment_2pass_wa)
Allocate memory for the frame buffer based on provided parameters taking into account pic line size a...
LIB_API ni_retcode_t ni_packet_buffer_alloc(ni_packet_t *ppacket, int packet_size)
Allocate memory for the packet buffer based on provided packet size.
struct _ni_dec_mastering_display_colour_volume_bytes ni_dec_mastering_display_colour_volume_bytes_t
decoded payload format of HDR SEI mastering display colour volume
LIB_API ni_retcode_t ni_frame_buffer_free(ni_frame_t *pframe)
Free frame buffer that was previously allocated with either ni_frame_buffer_alloc or ni_encoder_frame...
#define NI_MAX_SUPPORT_WATERMARK_NUM
struct _ni_queue_t ni_queue_t
enum ni_codec_hw_actions ni_codec_hw_actions_t
This is an enumeration for hw actions.
#define NI_BITRATE_RECONFIG_FILE_MAX_ENTRIES_PER_LINE
ni_pic_type_t
@ PIC_TYPE_B
@ PIC_TYPE_NIDR
@ PIC_TYPE_IDR
@ DECODER_PIC_TYPE_IDR
@ PIC_TYPE_P
@ PIC_NOT_CODED
@ PIC_TYPE_MAX
@ PIC_TYPE_CRA
@ PIC_TYPE_I
LIB_API ni_retcode_t ni_decoder_frame_buffer_free(ni_frame_t *pframe)
Free decoder frame buffer that was previously allocated with ni_decoder_frame_buffer_alloc,...
struct _ni_network_layer_info ni_network_layer_info_t
struct _ni_pkt_info ni_pkt_info
itu_frame_type
@ ITU_FRAME_TYPE_NONE
@ ITU_FRAME_TYPE_B
@ ITU_FRAME_TYPE_P
@ ITU_FRAME_TYPE_I
struct _ni_sei_header ni_sei_header_t
LIB_API ni_retcode_t ni_reconfig_crf2(ni_session_context_t *p_ctx, float crf)
Reconfigure crf float point value dynamically during encoding.
LIB_API ni_retcode_t ni_device_session_flush(ni_session_context_t *p_ctx, ni_device_type_t device_type)
Send a flush command to the device If device_type is NI_DEVICE_TYPE_DECODER sends EOS command to deco...
LIB_API ni_device_handle_t ni_device_open2(const char *dev, ni_device_mode_t mode)
Open device and return device device_handle if successful.
ni_enc_allocate_strategy_t
@ NI_ENC_MEM_ALLOCATE_STRATEGY_INVALID_MAX
@ NI_ENC_MEM_ALLOCATE_STRATEGY_REGION_1_FIRST
@ NI_ENC_MEM_ALLOCATE_STRATEGY_REGION_0_FIRST
@ NI_ENC_MEM_ALLOCATE_STRATEGY_DEFAULT
@ NI_ENC_MEM_ALLOCATE_STRATEGY_INVALID_MIN
#define NI_XCODER_PRESET_NAMES_ARRAY_LEN
_ni_vq_presets_e
@ NI_PRESETS_NONE
@ NI_NUM_PRESETS_MAX
@ NI_VQ_FASTER
@ NI_VQ_SLOWER
@ NI_VQ_FAST
@ NI_VQ_SLOW
@ NI_VQ_MEDIUM
@ NI_VQ_VERYSLOW
@ NI_VQ_VERYFAST
#define NI_MAX_NUM_AUX_DATA_PER_FRAME
enum _ni_ai_buffer_quantize_format_e ni_ai_buffer_quantize_format_e
ni_customize_roi_level_t
@ NI_CUS_ROI_OVERWRITE
@ NI_CUS_ROI_MERGE
@ NI_CUS_ROI_DISABLE
@ NI_CUS_ROI_MAPFILE
@ NI_CUS_ROI_REPLACE
enum _ni_device_mode ni_device_mode_t
Device access mode enumeration.
struct _ni_gop_params ni_gop_params_t
struct _ni_region_of_interest ni_region_of_interest_t
ni_quadra_hevc_profile
@ NI_QUADRA_HEVC_PROFILE_MAIN
@ NI_QUADRA_HEVC_PROFILE_MAIN10
LIB_API ni_retcode_t ni_custom_packet_buffer_alloc(void *p_buffer, ni_packet_t *p_packet, int buffer_size)
Allocate packet buffer using a user provided pointer, the memory is expected to have already been all...
#define NI_MAX_REF_PIC
#define NI_MAX_VUI_SIZE
LIB_API ni_retcode_t ni_uploader_set_frame_format(ni_session_context_t *p_upl_ctx, int width, int height, ni_pix_fmt_t pixel_format, int isP2P)
Set the frame format for the uploader.
LIB_API ni_retcode_t ni_query_temperature(ni_device_handle_t device_handle, ni_device_temp_t *p_dev_temp, uint8_t fw_rev[])
Query CompositeTemp from device.
struct _ni_buf_t ni_buf_t
enum _ni_pixel_planar_format ni_pixel_planar_format
_ni_param_change_flags
This is an enumeration for encoder parameter change.
@ NI_SET_CHANGE_PARAM_INVALID_REF_FRAME
@ NI_SET_CHANGE_PARAM_RC_TARGET_RATE
@ NI_SET_CHANGE_PARAM_RC_FRAMERATE
@ NI_SET_CHANGE_PARAM_CRF
@ NI_SET_CHANGE_PARAM_LTR_INTERVAL
@ NI_SET_CHANGE_PARAM_RC_BIT_RATIO_LAYER
@ NI_SET_CHANGE_PARAM_CUSTOM_LAMBDA
@ NI_SET_CHANGE_PARAM_VBV
@ NI_SET_CHANGE_PARAM_RC2
@ NI_SET_CHANGE_PARAM_VUI_HRD_PARAM
@ NI_SET_CHANGE_PARAM_RC_MIN_MAX_QP
@ NI_SET_CHANGE_PARAM_NR
@ NI_SET_CHANGE_PARAM_DEPEND_SLICE
@ NI_SET_CHANGE_PARAM_SLICE_ARG
@ NI_SET_CHANGE_PARAM_INTRA_PERIOD
@ NI_SET_CHANGE_PARAM_BG
@ NI_SET_CHANGE_PARAM_PPS
@ NI_SET_CHANGE_PARAM_CUSTOM_MD
@ NI_SET_CHANGE_PARAM_MAX_FRAME_SIZE
@ NI_SET_CHANGE_PARAM_RDO
@ NI_SET_CHANGE_PARAM_INDEPEND_SLICE
LIB_API const char *const g_xcoder_log_names[NI_XCODER_LOG_NAMES_ARRAY_LEN]
LIB_API ni_retcode_t ni_reconfig_max_frame_size(ni_session_context_t *p_ctx, int32_t max_frame_size)
Reconfigure maxFrameSize dynamically during encoding.
enum ni_qos_codes ni_qos_codes_t
LIB_API ni_retcode_t ni_dec_reconfig_ppu_params(ni_session_context_t *p_session_ctx, ni_xcoder_params_t *p_param, ni_ppu_config_t *p_ppu_config)
Send a p_config command to reconfigure decoding ppu params.
LIB_API ni_retcode_t ni_uploader_frame_zerocopy_check(ni_session_context_t *p_upl_ctx, int width, int height, const int linesize[], int pixel_format)
Check if incoming frame is hwupload zero copy compatible or not.
ni_quadra_h264_profile
@ NI_QUADRA_H264_PROFILE_BASELINE
@ NI_QUADRA_H264_PROFILE_HIGH
@ NI_QUADRA_H264_PROFILE_MAIN
@ NI_QUADRA_H264_PROFILE_EXTENDED
struct _ni_queue_node_t ni_queue_node_t
struct _ni_xcoder_params ni_xcoder_params_t
LIB_API ni_retcode_t ni_query_qos_info(ni_device_handle_t device_handle, ni_qos_header_info_log_page_t *p_dev_qos_header, uint8_t fw_rev[])
Query QoS information for the device.
struct _ni_instance_mgr_detail_status ni_instance_mgr_detail_status_t
#define NI_CC_SEI_HDR_HEVC_LEN
struct _ni_custom_gop_params ni_custom_gop_params_t
LIB_API ni_aux_data_t * ni_frame_get_aux_data(const ni_frame_t *frame, ni_aux_data_type_t type)
Retrieve from the frame auxiliary data of a given type if exists.
LIB_API ni_retcode_t ni_enc_frame_buffer_alloc(ni_frame_t *p_frame, int video_width, int video_height, int alignment, int metadata_flag, int factor, int hw_frame_count, int is_planar, ni_pix_fmt_t pix_fmt)
Wrapper function for ni_frame_buffer_alloc. Meant to handle RGBA min. resoulution considerations for ...
LIB_API ni_retcode_t ni_device_config_frame(ni_session_context_t *p_ctx, ni_frame_config_t *p_cfg)
Config a frame on the device for 2D engined to work on based on provided parameters.
struct _ni_scaler_watermark_params_t ni_scaler_watermark_params_t
struct _ni_frameclone_desc ni_frameclone_desc_t
struct _ni_dec_win ni_dec_win_t
LIB_API ni_aux_data_t * ni_frame_new_aux_data_from_raw_data(ni_frame_t *frame, ni_aux_data_type_t type, const uint8_t *raw_data, int data_size)
Add a new auxiliary data to a frame and copy in the raw data.
Public definitions for managing NETINT video processing devices.
ni_aux_data_type_t type
ni_pthread_mutex_t mutex
ni_buf_t * p_free_tail
ni_buf_t * p_used_head
ni_buf_t * p_used_tail
uint32_t number_of_buffers
ni_buf_t * p_free_head
struct _ni_buf_t * p_previous_buffer
struct _ni_buf_pool_t * pool
struct _ni_buf_t * p_next
struct _ni_buf_t * p_prev
struct _ni_buf_t * p_next_buffer
payload format of HDR SEI content light level info
ni_gop_params_t pic_param[NI_MAX_GOP_NUM]
ni_custom_sei_t custom_sei[NI_MAX_CUSTOM_SEI_CNT]
custom sei payload passthrough
uint8_t data[NI_MAX_CUSTOM_SEI_DATA]
ni_custom_sei_location_t location
decoded payload format of H.264 VUI
int8_t chroma_sample_loc_type_bottom_field
uint8_t vcl_hrd_parameters_present_flag
uint8_t motion_vectors_over_pic_boundaries_flag
uint8_t aspect_ratio_info_present_flag
int8_t chroma_sample_loc_type_top_field
uint8_t colour_description_present_flag
uint8_t nal_hrd_parameters_present_flag
uint8_t video_signal_type_present_flag
decoded payload format of H.265 VUI
uint8_t vui_poc_proportional_to_timing_flag
uint8_t restricted_ref_pic_lists_flag
int8_t chroma_sample_loc_type_bottom_field
uint8_t motion_vectors_over_pic_boundaries_flag
uint8_t aspect_ratio_info_present_flag
uint8_t vui_hrd_parameters_present_flag
int8_t chroma_sample_loc_type_top_field
uint8_t neutral_chroma_indication_flag
int16_t vui_num_ticks_poc_diff_one_minus1
uint8_t colour_description_present_flag
uint8_t frame_field_info_present_flag
uint8_t video_signal_type_present_flag
decoded payload format of HDR SEI mastering display colour volume
char cr_expr[NI_MAX_NUM_OF_DECODER_OUTPUTS][4][NI_MAX_PPU_PARAM_EXPR_CHAR+1]
int scale_wh[NI_MAX_NUM_OF_DECODER_OUTPUTS][2]
int scale_resolution_ceil[NI_MAX_NUM_OF_DECODER_OUTPUTS]
int semi_planar[NI_MAX_NUM_OF_DECODER_OUTPUTS]
int scale_round[NI_MAX_NUM_OF_DECODER_OUTPUTS]
int scale_long_short_edge[NI_MAX_NUM_OF_DECODER_OUTPUTS]
int force_8_bit[NI_MAX_NUM_OF_DECODER_OUTPUTS]
int crop_mode[NI_MAX_NUM_OF_DECODER_OUTPUTS]
int crop_whxy[NI_MAX_NUM_OF_DECODER_OUTPUTS][4]
char sc_expr[NI_MAX_NUM_OF_DECODER_OUTPUTS][2][NI_MAX_PPU_PARAM_EXPR_CHAR+1]
device capability type
uint8_t xcoder_cnt[NI_DEVICE_TYPE_XCODER_MAX]
ni_hw_capability_t xcoder_devices[NI_MAX_DEVICES_PER_HW_INSTANCE]
uint8_t fw_branch_name[256]
encoded payload format of HDR SEI mastering display colour volume
ni_custom_gop_params_t custom_gop_params
struct _ni_encoder_cfg_params::@16 rc
int spatialLayerBitrate[NI_MAX_SPATIAL_LAYERS]
int av1OpLevel[NI_MAX_SPATIAL_LAYERS]
This is a data structure for encoding parameters that have changed.
uint16_t rectangle_height
uint16_t force_pic_qp
uint8_t color_trc
uint8_t inconsecutive_transfer
uint32_t data_len[NI_MAX_NUM_DATA_POINTERS]
unsigned int sei_hdr_mastering_display_color_vol_offset
uint8_t * p_buffer
uint32_t crop_top
uint32_t error_ratio
uint32_t vui_time_scale
uint32_t start_of_stream
unsigned int sei_hdr_content_light_level_info_offset
uint16_t sar_width
ni_codec_format_t src_codec
uint8_t color_primaries
unsigned int vui_len
ni_iovec_t * iovec
unsigned int reconf_len
uint8_t preferred_characteristics_data_len
long long dts
uint32_t vui_num_units_in_tick
uint32_t start_len[NI_MAX_NUM_DATA_POINTERS]
uint32_t start_buffer_size
uint8_t aspect_ratio_idc
uint32_t end_of_stream
uint16_t sar_height
uint8_t separate_metadata
unsigned int sei_hdr_plus_len
ni_buf_t * dec_buf
uint64_t pkt_pos
uint32_t metadata_buffer_size
uint32_t crop_right
unsigned int vui_offset
uint32_t crop_bottom
uint32_t video_width
unsigned int sei_hdr_plus_offset
long long pts
uint8_t * p_data[NI_MAX_NUM_DATA_POINTERS]
uint32_t total_start_len
uint8_t color_space
uint32_t frame_chunk_idx
unsigned int extra_data_len
uint8_t * p_start_buffer
uint32_t buffer_size
unsigned int sei_total_len
uint8_t separate_start
unsigned int sei_cc_len
unsigned int sei_cc_offset
unsigned int sei_user_data_unreg_len
uint32_t crop_left
ni_pic_type_t ni_pict_type
long long orignal_pts
uint16_t force_headers
uint8_t use_cur_src_as_long_term_pic
ni_custom_sei_set_t * p_custom_sei_set
uint16_t hor_adjust_offset
unsigned int sei_hdr_content_light_level_info_len
uint32_t iovec_num
ni_aux_data_t * aux_data[NI_MAX_NUM_AUX_DATA_PER_FRAME]
uint8_t * p_metadata_buffer
unsigned int sei_hdr_mastering_display_color_vol_len
int video_full_range_flag
unsigned int sei_user_data_unreg_offset
uint8_t use_long_term_ref
uint32_t video_height
unsigned int roi_len
unsigned int sei_alt_transfer_characteristics_len
unsigned int sei_alt_transfer_characteristics_offset
int32_t framerate_denom
int32_t framerate_num
ni_gop_rps_t rps[NI_MAX_REF_PIC]
hardware capability type
uint8_t max_number_of_contexts
uint8_t * p_input_buffer
ni_instance_mgr_detail_status_append_t sInstDetailStatusAppend[NI_MAX_CONTEXTS_PER_HW_INSTANCE]
ni_instance_mgr_detail_status_t sInstDetailStatus[NI_MAX_CONTEXTS_PER_HW_INSTANCE]
uint32_t size
uint32_t fw_share_mem_usage
uint32_t total_pixel_load
ni_context_query_t context_status[NI_MAX_CONTEXTS_PER_HW_INSTANCE]
uint32_t fw_model_load
uint32_t fw_p2p_mem_usage
uint32_t fw_video_shared_mem_usage
uint32_t pcie_throughput
uint32_t current_load
uint32_t total_contexts
uint32_t active_hwuploaders
uint32_t fw_video_mem_usage
uint8_t use_cur_src_as_long_term_pic
ni_network_layer_offset_t * inset
ni_network_layer_info_t linfo
ni_network_layer_offset_t * outset
ni_network_layer_params_t * in_param
ni_network_layer_params_t * out_param
union _ni_network_layer_params_t::@13 quant_data
struct _ni_network_layer_params_t::@13::@15 affine
struct _ni_network_layer_params_t::@13::@14 dfp
uint32_t data_len
uint32_t start_of_stream
long long dts
uint32_t av1_data_len[MAX_AV1_ENCODER_GOP_NUM]
uint32_t end_of_stream
uint64_t pkt_pos
uint8_t scene_change_detected
uint32_t video_width
uint8_t still_image_detected
long long pts
ni_bitstream_features_t bitstream_features
uint8_t * av1_p_buffer[MAX_AV1_ENCODER_GOP_NUM]
uint32_t buffer_size
double average_psnr
uint32_t avg_frame_qp
uint32_t frame_type
ni_custom_sei_set_t * p_custom_sei_set
long long pos
uint8_t * av1_p_data[MAX_AV1_ENCODER_GOP_NUM]
uint32_t video_height
uint32_t av1_buffer_size[MAX_AV1_ENCODER_GOP_NUM]
double reserved[1]
uint16_t ppu_h[NI_MAX_NUM_OF_DECODER_OUTPUTS]
uint16_t ppu_w[NI_MAX_NUM_OF_DECODER_OUTPUTS]
ni_queue_node_t * p_used_tail
ni_queue_node_t * p_free_head
ni_queue_node_t * p_used_head
ni_queue_node_t * p_free_tail
struct _ni_queue_node_t * p_previous_buffer
struct _ni_queue_node_t * p_next_buffer
struct _ni_queue_node_t * p_next
struct _ni_queue_node_t * p_prev
ni_queue_node_t * p_last
ni_queue_node_t * p_first
ni_scaler_drawbox_params_t multi_drawbox_params[NI_MAX_SUPPORT_DRAWBOX_NUM]
ni_scaler_watermark_params_t multi_watermark_params[NI_MAX_SUPPORT_WATERMARK_NUM]
ni_io_event_t * io_event
uint64_t pkt_offsets_index_min[NI_FIFO_SZ]
char blk_xcoder_name[MAX_CHAR_IN_DEVICE_NAME]
uint8_t itu_t_t35_hdr10p_sei_hdr_hevc[NI_HDR10P_SEI_HDR_HEVC_LEN]
ni_pthread_mutex_t mutex
uint32_t count_frame_num_in_sec
NI_DEPRECATED uint64_t prev_read_frame_time
ni_pthread_cond_t low_delay_sync_cond
ni_event_handle_t thread_event_handle
ni_queue_buffer_pool_t * buffer_pool
ni_thread_arg_struct_t * keep_alive_thread_args
ni_session_statistic_t session_statistic
uint8_t preferred_characteristics_data
uint8_t ui8_light_level_data[5]
char blk_dev_name[NI_MAX_DEVICE_NAME_LEN]
ni_device_handle_t sender_handle
ni_device_handle_t device_handle
uint32_t fps_change_detect_count
int flags_array[NI_FIFO_SZ]
ni_load_query_t load_query
ni_pthread_mutex_t * pext_mutex
ni_custom_sei_set_t * pkt_custom_sei_set[NI_FIFO_SZ]
int sei_hdr_mastering_display_color_vol_len
ni_device_handle_t auto_dl_handle
uint8_t sei_trailer[NI_CC_SEI_TRAILER_LEN]
ni_aio_context_t aio_context
ni_network_data_t * network_data
ni_framerate_t framerate
uint64_t pkt_offsets_index[NI_FIFO_SZ]
uint32_t prev_fps
Params used in VFR mode Start///.
uint8_t ui8_mdcv_max_min_lum_data[9]
uint8_t itu_t_t35_cc_sei_hdr_hevc[NI_CC_SEI_HDR_HEVC_LEN]
volatile uint64_t last_access_time
ni_enc_avc_roi_custom_map_t * avc_roi_map
char dev_xcoder_name[MAX_CHAR_IN_DEVICE_NAME]
ni_pthread_t keep_alive_thread
uint8_t itu_t_t35_cc_sei_hdr_h264[NI_CC_SEI_HDR_H264_LEN]
unsigned short domain
ni_event_handle_t event_handle
ni_input_frame input_frame_fifo[120]
encoder:calculate PSNR start
ni_framerate_t last_framerate
uint32_t meta_size
Params used in VFR mode Done///.
uint8_t pending_bitstream_buffer_realloc
ni_device_handle_t blk_io_handle
uint32_t force_idr_intra_offset
uint32_t biggest_bitstream_buffer_allocated
int hvsplus_level
encoder:calculate PSNR end
ni_overall_load_query_t overall_load_query
uint64_t pkt_pos[NI_FIFO_SZ]
ni_enc_hevc_roi_custom_map_t * hevc_roi_map
int64_t enc_pts_list[NI_FIFO_SZ]
ni_long_term_ref_t ltr_to_set
ni_timestamp_table_t * pts_table
ni_session_run_state_t session_run_state
ni_encoder_change_params_t * enc_change_params
ni_pthread_mutex_t low_delay_sync_mutex
uint8_t itu_t_t35_hdr10p_sei_hdr_h264[NI_HDR10P_SEI_HDR_H264_LEN]
ni_enc_quad_roi_custom_map * roi_map
int64_t pts_offsets[NI_FIFO_SZ]
ni_timestamp_table_t * dts_queue
ni_region_of_interest_t * av_rois
NI_DEPRECATED int64_t start_dts_offset
uint32_t decoder_last_drop_frame_num
uint8_t * hevc_sub_ctu_roi_buf
ni_frame_pool_type_t pool_type
uint32_t passed_time_in_timebase_unit
ni_buf_pool_t * dec_fme_buf_pool
union _ni_session_data_io::@19 data
ni_event_handle_t thread_event_handle
ni_pthread_mutex_t * p_mutex
ni_device_handle_t device_handle
volatile uint64_t * plast_access_time
int32_t videoFullRange
int32_t colorDescPresent
int32_t colorPrimaries
int32_t aspectRatioHeight
int32_t colorSpace
int32_t colorTrc
int32_t aspectRatioWidth
ni_encoder_cfg_params_t cfg_enc_params
int8_t customize_roi_qp_map[NI_CUSTOMIZE_ROI_QPOFFSET_LEVEL][NI_CUSTOMIZE_ROI_QP_NUM]
ni_ddr_priority_mode_t ddr_priority_mode
ni_frame_t * p_first_frame
NI_DEPRECATED uint32_t pos_time_scale
ni_decoder_input_params_t dec_input_params
NI_DEPRECATED uint8_t ui8VuiRbsp[NI_MAX_VUI_SIZE]
NI_DEPRECATED uint32_t pos_num_units_in_tick
NI_DEPRECATED uint32_t ui32VuiDataSizeBytes
NI_DEPRECATED uint32_t ui32VuiDataSizeBits
int reconf_hash[NI_BITRATE_RECONFIG_FILE_MAX_LINES][NI_BITRATE_RECONFIG_FILE_MAX_ENTRIES_PER_LINE]
encoder AVC ROI custom map (1 MB = 8bits)
struct _ni_enc_avc_roi_custom_map::@5 field
encoder HEVC ROI custom map (1 CTU = 64bits)
struct _ni_enc_hevc_roi_custom_map::@4 field
encoder AVC ROI custom map (1 MB = 8bits)
struct _ni_enc_quad_roi_custom_map::@6 field