libxcoder 5.6.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*/
244
245// XCODER STATE
246typedef enum
247{
248 NI_XCODER_IDLE_STATE = 0x00, // Xcoder idle state
249 NI_XCODER_OPEN_STATE = 0x01 << 1, // Xcoder open state
250 NI_XCODER_WRITE_STATE = 0x01 << 2, // Xcoder write state
251 NI_XCODER_READ_STATE = 0x01 << 3, // Xcoder read state
252 NI_XCODER_CLOSE_STATE = 0x01 << 4, // Xcoder close state
253 // Xcoder flush state, flush at the end of stream
255 // Xcoder inter flush state, flush during transcoding stream
257 NI_XCODER_READ_DESC_STATE = 0x01 << 7, // Xcoder Read Desc state
258 NI_XCODER_HWUP_STATE = 0x01 << 8, // Xcoder HW upload state
259 NI_XCODER_HWDL_STATE = 0x01 << 9, // Xcoder HW download state
260 // Other states, like init, alloc, etc.
263
264typedef enum
265{
266 NI_PIX_FMT_YUV420P = 0, /* 8-bit YUV420 planar */
267 NI_PIX_FMT_YUV420P10LE = 1, /* 10-bit YUV420 planar */
268 NI_PIX_FMT_NV12 = 2, /* 8-bit YUV420 semi-planar */
269 NI_PIX_FMT_P010LE = 3, /* 10-bit YUV420 semi-planar */
270 NI_PIX_FMT_RGBA = 4, /* 32-bit RGBA packed */
271 NI_PIX_FMT_BGRA = 5, /* 32-bit BGRA packed */
272 NI_PIX_FMT_ARGB = 6, /* 32-bit ARGB packed */
273 NI_PIX_FMT_ABGR = 7, /* 32-bit ABGR packed */
274 NI_PIX_FMT_BGR0 = 8, /* 32-bit BGRX packed */
275 NI_PIX_FMT_BGRP = 9, /* 24-bit BGR planar */
276 NI_PIX_FMT_NV16 = 10, /* 8-bit YUV422 semi-planar */
277 NI_PIX_FMT_YUYV422 = 11, /* 8-bit YUV422 packed */
278 NI_PIX_FMT_UYVY422 = 12, /* 8-bit YUV422 packed */
279 NI_PIX_FMT_8_TILED4X4 = 13, /* 8 bit tiled4x4 */
280 NI_PIX_FMT_10_TILED4X4 = 14,/* 10 bit tiled4x4 */
281 NI_PIX_FMT_NONE = 15, /* invalid format */
283
292
293typedef enum {
294 NI_CUS_ROI_DISABLE = 0, // disable 2-pass customize roi
295 NI_CUS_ROI_MAPFILE = 1, // select qp in customizeQpMapFile
296 NI_CUS_ROI_REPLACE = 2, // replace the cutree roimap with the customize roimap
297 NI_CUS_ROI_OVERWRITE = 3, // overwrite the cutree roimap with the customize roimap
298 NI_CUS_ROI_MERGE = 4 // add the customize roimap into the cutree roimap
300
301// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
302// If you change this,you should also change NI_QUADRA_SCALER_FLAG_* in ni_quadra_filter_api.h
303#define NI_SCALER_FLAG_IO 0x0001 /* 0 = source frame, 1 = destination frame */
304#define NI_SCALER_FLAG_PC 0x0002 /* 0 = single allocation, 1 = create pool */
305#define NI_SCALER_FLAG_PA 0x0004 /* 0 = straight alpha, 1 = premultiplied alpha */
306#define NI_SCALER_FLAG_P2 0x0008 /* 0 = normal allocation, 1 = P2P allocation */
307#define NI_SCALER_FLAG_FCE 0x0010 /* 0 = no fill color, 1 = fill color enabled */
308#define NI_SCALER_FLAG_CS 0x0020 /* 0 = BT.709, 1 = BT.2020 */
309#define NI_SCALER_FLAG_LM 0x0040 /* 0 == no memory acquisition limit, 1 == limit memory acquisition */
310#define NI_SCALER_FLAG_CMP 0x0800 /* 0 = no compress, 1 = compress*/
311
312#define NI_AI_FLAG_IO 0x0001 /* 0 = source frame, 1 = destination frame */
313#define NI_AI_FLAG_PC 0x0002 /* 0 = single allocation, 1 = create pool */
314#define NI_AI_FLAG_LM 0x0004 /* 0 == no memory acquisition limit; 1 == limit memory acquisition */
315#define NI_AI_FLAG_IOVEC 0x0008
316#define NI_AI_FLAG_SC 0x0010 /* 0 == size got from network info; 1 == size configured by sw */
317
318#define NI_UPLOADER_FLAG_LM 0x0010 /* 0 == no memory acquisition limit, 1 == limit memory acquisition */
319
320// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
321// If you change this,you should also change NI_QUADRA_MAX_KEEP_ALIVE_TIMEOUT,
322// NI_QUADRA_MIN_KEEP_ALIVE_TIMEOUT,NI_QUADRA_DEFAULT_KEEP_ALIVE_TIMEOUT in ni_quadra_filter_api.h
323#define NI_MAX_KEEP_ALIVE_TIMEOUT 100
324#define NI_MIN_KEEP_ALIVE_TIMEOUT 1
325#define NI_DEFAULT_KEEP_ALIVE_TIMEOUT 3
326
327#define NI_MIN_CUSTOM_SEI_PASSTHRU -1
328#define NI_MAX_CUSTOM_SEI_PASSTHRU 254
329#define NI_DISABLE_USR_DATA_SEI_PASSTHRU 0
330#define NI_ENABLE_USR_DATA_SEI_PASSTHRU 1
331#define NI_INVALID_SVCT_DECODING_LAYER -1
332#define NI_EC_POLICY_TOLERANT 1
333#define NI_EC_POLICY_IGNORE 2
334#define NI_EC_POLICY_SKIP 3
335#define NI_EC_POLICY_BEST_EFFORT 4
336#define NI_EC_POLICY_LIMITED_ERROR 5
337#define NI_EC_POLICY_BEST_EFFORT_OUT_DC 6
338#define NI_EC_POLICY_DEFAULT NI_EC_POLICY_BEST_EFFORT
339#define NI_EC_ERR_THRESHOLD_DEFAULT 10
340
341// Picked from the xcoder firmware, commit e3b882e7
342#define NI_VPU_CEIL(_data, _align) (((_data)+((_align)-1))&~((_align)-1))
343#define NI_VPU_ALIGN4(_x) (((_x)+0x03)&~0x03)
344#define NI_VPU_ALIGN8(_x) (((_x)+0x07)&~0x07)
345#define NI_VPU_ALIGN16(_x) (((_x)+0x0f)&~0x0f)
346#define NI_VPU_ALIGN32(_x) (((_x)+0x1f)&~0x1f)
347#define NI_VPU_ALIGN64(_x) (((_x)+0x3f)&~0x3f)
348#define NI_VPU_ALIGN128(_x) (((_x)+0x7f)&~0x7f)
349#define NI_VPU_ALIGN256(_x) (((_x)+0xff)&~0xff)
350#define NI_VPU_ALIGN512(_x) (((_x)+0x1ff)&~0x1ff)
351#define NI_VPU_ALIGN2048(_x) (((_x)+0x7ff)&~0x7ff)
352#define NI_VPU_ALIGN4096(_x) (((_x)+0xfff)&~0xfff)
353#define NI_VPU_ALIGN16384(_x) (((_x)+0x3fff)&~0x3fff)
354
355#if 1 // QUADRA_SEI_FMT
356#pragma pack(1)
357typedef struct _ni_sei_header {
358 uint8_t status;
359 uint16_t size;
360 uint8_t type;
362#pragma pack()
363#else // QUADRA_SEI_FMT
364typedef struct _ni_sei_user_data_entry
365{
366 uint32_t offset;
367 uint32_t size;
368} ni_sei_user_data_entry_t;
369#endif // QUADRA_SEI_FMT
370
371typedef enum
372{
378 NI_H265_USERDATA_FLAG_ITU_T_T35_PRE = 5, /* SEI Prefix: user_data_registered_itu_t_t35 */
379 NI_H265_USERDATA_FLAG_UNREGISTERED_PRE = 6, /* SEI Prefix: user_data_unregistered */
380 NI_H265_USERDATA_FLAG_ITU_T_T35_SUF = 7, /* SEI Suffix: user_data_registered_itu_t_t35 */
381 NI_H265_USERDATA_FLAG_UNREGISTERED_SUF = 8, /* SEI Suffix: user_data_unregistered */
382 NI_H265_USERDATA_FLAG_RESERVED_9 = 9, /* SEI RESERVED */
383 NI_H265_USERDATA_FLAG_MASTERING_COLOR_VOL = 10, /* SEI Prefix: mastering_display_color_volume */
384 NI_H265_USERDATA_FLAG_CHROMA_RESAMPLING_FILTER_HINT = 11, /* SEI Prefix: chroma_resampling_filter_hint */
385 NI_H265_USERDATA_FLAG_KNEE_FUNCTION_INFO = 12, /* SEI Prefix: knee_function_info */
386 NI_H265_USERDATA_FLAG_TONE_MAPPING_INFO = 13, /* SEI Prefix: tone_mapping_info */
387 NI_H265_USER_DATA_FLAG_FILM_GRAIN_CHARACTERISTICS_INFO = 14, /* SEI Prefix: film_grain_characteristics_info */
388 NI_H265_USER_DATA_FLAG_CONTENT_LIGHT_LEVEL_INFO = 15, /* SEI Prefix: content_light_level_info */
389 NI_H265_USER_DATA_FLAG_COLOUR_REMAPPING_INFO = 16, /* SEI Prefix: content_light_level_info */
390 NI_H265_USERDATA_FLAG_ITU_T_T35_PRE_1 = 28, /* SEI Prefix: additional user_data_registered_itu_t_t35 */
391 NI_H265_USERDATA_FLAG_ITU_T_T35_PRE_2 = 29, /* SEI Prefix: additional user_data_registered_itu_t_t35 */
392 NI_H265_USERDATA_FLAG_ITU_T_T35_SUF_1 = 30, /* SEI Suffix: additional user_data_registered_itu_t_t35 */
393 NI_H265_USERDATA_FLAG_ITU_T_T35_SUF_2 = 31, /* SEI Suffix: additional user_data_registered_itu_t_t35 */
395
396typedef enum
397{
398 PIC_TYPE_I = 0, /*!*< I picture */
399 PIC_TYPE_P = 1, /*!*< P picture */
400 PIC_TYPE_B = 2, /*!*< B picture (except VC1) */
401
403 PIC_TYPE_IDR = 3, /*!*< Encoder IDR pic type */
404 DECODER_PIC_TYPE_IDR = 5, /*!*< Decoder-returned IDR pic type */
405 PIC_TYPE_NIDR = 5, /*!*< H.264/H.265 IDR picture */
406 PIC_NOT_CODED = 6, /*!*< Picture dropped in encoder */
407 PIC_TYPE_MAX /*!*< No Meaning */
409
410#if 1 // QUADRA_SEI_FMT
411// user data unreg and custom SEIs have variable length;
412// non-custom SEIs will be dropped if buffer overflow;
413// custom SEIs passthru is via SW and host memory constrained
414#define NI_ENC_MAX_SEI_BUF_SIZE NI_VPU_ALIGN64(1024) // sync with encoder
415
416// PIC_TIMING and BUFFERING_PERIOD apply to encoder only, not needed from decoder
417// For now, only the following will be returned from decoder:
418// - T35 has 3 possible data types: CLOSE_CAPTION, HDR10PLUS, AFD
419// - MASTERING_DISPLAY_COLOUR
420// - CONTENT_LIGHT_LEVEL
421// - USER_DATA_UNREGISTERED
422// - CUSTOM_SEI
423// Note: USER_DATA_UNREGISTERED may have arbitrary size but SEI buffer
424// size is limited. The SEI buffer on decoder has the following format:
425// [byte0: #entries][entry1]..[entryN]
426// up to (1 + sizeof(ni_sei_header_t) + NI_MAX_SEI_DATA) bytes maximum;
427// where [entryX] := [ni_sei_header][payload]
428// [payload] of ni_sei_header.size: present only if ni_sei_header.status == 1
429// X in [1..N] with N <= #entries
430// N == #entries only if NI_MAX_SEI_DATA is large enough to store all #entries
431// ex:
432// entryX header fits in the buffer during SEI extration, but payload can't fit in;
433// so only entryX header is stored but payload is drop with status set 0.
434// entryX header can't fit in the buffer (SEI buffer full); so extryX is not stored
435// in the SEI buffer (neither will any further SEIs)
436//
437// To maintain alignment, current implementation retrieves SEI data buffer from
438// entry 1's payload onwards (skipping byte0, and entry 1's header),
439// while #entries (same value as SEI buffer byte0) and entry 1's header are notified
440// separately via metadata.
441#define NI_MAX_SEI_DATA (NI_ENC_MAX_SEI_BUF_SIZE) // sync with decoder_manager
442// Custom SEI only applies to software delivery
443#define NI_MAX_CUSTOM_SEI_DATA (8192)
444
445#else // QUADRA_SEI_FMT
446#define NI_MAX_SEI_ENTRIES 32
447// 32 user_data_entry_t records + various SEI messages sizes
448#define NI_MAX_SEI_DATA \
449 NI_MAX_SEI_ENTRIES * sizeof(ni_sei_user_data_entry_t) + \
450 NI_MAX_T35_CLOSE_CAPTION_SIZE + \
451 NI_MASTERING_DISPLAY_COLOUR_VOLUME_SIZE + \
452 NI_CONTENT_LIGHT_LEVEL_INFO_SIZE + NI_MAX_T35_HDR10PLUS_SIZE + \
453 NI_MAX_T35_AFD_SIZE
454#endif // QUADRA_SEI_FMT
455
456#define NI_DEC_MAX_CC_BUF_SIZE 93 // max 31 CC entries of 3 bytes each
457
458#define NI_CC_SEI_BYTE0 0xB5 // itu_t_t35_country_code =181 (North America)
459#define NI_CC_SEI_BYTE1 0x00
460#define NI_CC_SEI_BYTE2 0x31 // itu_t_t35_provider_code = 49
461#define NI_CC_SEI_BYTE3 0x47 // ATSC_user_identifier = "GA94"
462#define NI_CC_SEI_BYTE4 0x41
463#define NI_CC_SEI_BYTE5 0x39
464#define NI_CC_SEI_BYTE6 0x34
465#define NI_CC_SEI_BYTE7 0x03 // cc_data = 0x03
466
467#define NI_HDR10P_SEI_BYTE0 0xB5 // itu_t_t35_country_code =181 (North America
468#define NI_HDR10P_SEI_BYTE1 0x00
469#define NI_HDR10P_SEI_BYTE2 0x3c // itu_t_t35_provider_code = 0x003c
470#define NI_HDR10P_SEI_BYTE3 0x00
471#define NI_HDR10P_SEI_BYTE4 0x01 // u16 itu_t_t35_provider_oriented_code = 0x0001
472#define NI_HDR10P_SEI_BYTE5 0x04 // u8 application_identifier = 0x04
473// no longer checking the application version as it was originally 0 but was recently specified as one by AOM.
474#define NI_HDR10P_SEI_BYTE6 0x00 // u8 application version = 0x00
475
476#define NI_CC_SEI_HDR_HEVC_LEN 18
477#define NI_HDR10P_SEI_HDR_HEVC_LEN 9
478#define NI_HDR10P_SEI_HDR_H264_LEN 8
479#define NI_CC_SEI_HDR_H264_LEN 17
480#define NI_CC_SEI_TRAILER_LEN 2
481#define NI_RBSP_TRAILING_BITS_LEN 1
482
483// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
484// If you change this,you should also change NI_QUADRA_MAX_NUM_AUX_DATA_PER_FRAME in ni_quadra_filter_api.h
485#define NI_MAX_NUM_AUX_DATA_PER_FRAME 16
486
488#define NI_BITRATE_RECONFIG_FILE_MAX_LINES 50000
491#define NI_BITRATE_RECONFIG_FILE_MAX_ENTRIES_PER_LINE 10
492
494#define NI_CUSTOMIZE_ROI_QPOFFSET_LEVEL 10
496#define NI_CUSTOMIZE_ROI_QP_NUM 64
497
498#define MOTION_CONSTRAINED_PERFORMANCE_MODE 1
499#define MOTION_CONSTRAINED_QUALITY_MODE 2
500
501/*!*
502* \brief Frame pool type.
503*/
505{
506 NI_POOL_TYPE_NONE = -1, /* frame pool not inited or allocated */
510
511// frame auxiliary data; mostly used for SEI data associated with frame
513{
515
516 // ATSC A53 Part 4 Closed Captions
518
519 // HDR10 mastering display metadata associated with a video frame
521
522 // HDR10 content light level (based on CTA-861.3). This payload contains
523 // data in the form of ni_content_light_level_t struct.
525
526 // HDR10+ dynamic metadata associated with a video frame. The payload is
527 // a ni_dynamic_hdr_plus_t struct that contains information for color volume
528 // transform - application 4 of SMPTE 2094-40:2016 standard.
530
531 // Regions of Interest, the payload is an array of ni_region_of_interest_t,
532 // the number of array element is implied by:
533 // ni_frame_aux_data.size / sizeof(ni_region_of_interest_t)
535
536 // NETINT: user data unregistered SEI data, which takes SEI payload type
537 // USER_DATA_UNREGISTERED.
538 // There will be no byte reordering.
539 // Usually this payload would be: 16B UUID + other payload Bytes.
541
542 // NETINT: custom SEI data, which takes SEI payload custom types.
543 // There will be no byte reordering.
544 // Usually this payload would be: 1B Custom SEI type + 16B UUID + other
545 // payload Bytes.
547
548 // NETINT: bitrate adjustment, which takes int32_t type data as
549 // payload that indicates the new target bitrate value.
551
552 // NETINT: custom INTRAPRD adjustment, which takes int32_t type data
553 // as payload that specifies the new intra period
555
556 // NETINT: custom VUI adjustment, which is a struct of
557 // ni_vui_hrd_t that specifies a frame's support of vui
559
560 // NETINT: long term reference frame support, which is a struct of
561 // ni_long_term_ref_t that specifies a frame's support of long term
562 // reference frame.
564
565 // NETINT: long term reference interval adjustment, which takes int32_t
566 // type data as payload that indicates the new long term reference interval
567 // value.
569
570 // NETINT: frame reference invalidation, which takes int32_t type data
571 // as payload that indicates the frame number after which all references
572 // shall be invalidated.
574
575 // NETINT: framerate adjustment, which takes int32_t type data as
576 // payload that indicates the new target framerate numerator and denominator values.
578
579 // NETINT: maxFrameSize adjustment, which takes int16_t type data as
580 // payload that indicates the new maxFrameSize value
582
583 // NETINT: max&min QP adjustment, which is a struct of
584 // payload that indicate the new max&min QP values
586
587 // NETINT: crf adjustment, which takes int32_t type data
588 // as payload that indicates the new crf value.
590
591 // NETINT: crf adjustment, which takes float type data
592 // as payload that indicates the new crf value.
594
595 // NETINT: VbvMaxRate adjust, which takes int32_t type
596 // as payload that indicates the VbvMaxRate value.
598
599 // NETINT: VbvBufferSize adjust, which takes int32_t type
600 // as payload that indicates the vbvBufferSize value.
602
603 // NETINT: sliceArg adjust, which takes int16_t type
604 // as payload that indicates the sliceArg value.
606
607 // NETINT: sliceArg adjust, which takes ni_category_classify_t
608 // type as payload that indicates the class and prob.
611
612// rational number (pair of numerator and denominator)
613typedef struct _ni_rational
614{
615 int num; // numerator
616 int den; // denominator
618
619// create an ni_rational_t
620static inline ni_rational_t ni_make_q(int num, int den)
621{
622 ni_rational_t ret = {num, den};
623 return ret;
624}
625
626// convert an ni_rational_t to a double
627static inline double ni_q2d(ni_rational_t a)
628{
629 return a.num / (double)a.den;
630}
631
632// struct to hold auxiliary data for ni_frame_t
639
640// struct describing a Region Of Interest (ROI)
642{
643 // self size: must be set to: sizeof(ni_region_of_interest_t)
644 uint32_t self_size;
645
646 // ROI rectangle: pixels from the frame's top edge to the top and bottom
647 // edges of the rectangle, from the frame's left edge to the left and right
648 // edges of the rectangle.
649 int top;
651 int left;
652 int right;
653
654 // quantisation offset: [-1, +1], 0 means no quality change; < 0 value asks
655 // for better quality (less quantisation), > 0 value asks for worse quality
656 // (greater quantisation).
659
660// struct describing category class and prob
667
668// struct describing VUI HRD support.
669typedef struct _ni_vui_hrd
670{
671 // Indicates the presence of color info such as primaries, trc etc.
673
674 // Indicates the chromaticity of RGB and white components of the
675 // displayed image (See Table E.3 of H.265 spec)
677
678 // The opto-electronic transfer characteristic of the source picture
679 // (See Table E.4 of H.265 spec)
680 int32_t colorTrc;
681
682 // Method to represent brightness, luminance or luma and colour (e.g. RGB)
683 int32_t colorSpace;
684
685 // Luma sample aspect ratio width. With aspectRatioHeight, translates
686 // into specific display ratios such as 16:9, 4:3, etc.
688
689 // Luma sample aspect ratio height
691
692 // Input video signal sample range [0,1].
693 // 0 = Y range in [16..235] Cb,Cr in [16..240]. 1 = Y,Cb,Cr in [0..255]
696
697// struct describing long term reference frame support.
698typedef struct _ni_long_term_ref
699{
700 // A flag for the current picture to be used as a long term reference
701 // picture later at other pictures' encoding
703
704 // A flag to use a long term reference picture in DPB when encoding the
705 // current picture
708
709// struct describing framerate.
710typedef struct _ni_framerate
711{
712 // framerate numerator
714
715 // framerate denominator
718
719typedef struct _ni_rc_min_max_qp
720{
721 int32_t minQpI;
722 int32_t maxQpI;
723 int32_t maxDeltaQp;
724 int32_t minQpPB;
725 int32_t maxQpPB;
727
728typedef struct _ni_dec_win
729{
730 int16_t left;
731 int16_t right;
732 int16_t top;
733 int16_t bottom;
735
737{
739 uint32_t time_scale;
741 uint8_t color_trc;
742 uint8_t color_space;
744 // 48 bytes reserved for receiving more header info
745 uint64_t rsvd0;
746 uint64_t rsvd1;
747 uint64_t rsvd2;
748 uint64_t rsvd3;
749 uint64_t rsvd4;
750 uint64_t rsvd5;
752
753/*!*
754* \brief decoded payload format of H.265 VUI
755*
756*/
758{
763
766
769
770 uint16_t sar_width;
771 uint16_t sar_height;
772
776
780
782
784
789
792
795
802
806
808
810
811/*!*
812* \brief decoded payload format of H.264 VUI
813*
814*/
859
860/*!*
861* \brief encoder HEVC ROI custom map (1 CTU = 64bits)
862*/
864{
865 struct
866 {
867 uint32_t ctu_force_mode : 2; //[ 1: 0]
868 uint32_t ctu_coeff_drop : 1; //[ 2]
869 uint32_t reserved : 5; //[ 7: 3]
870 uint32_t sub_ctu_qp_0 : 6; //[13: 8]
871 uint32_t sub_ctu_qp_1 : 6; //[19:14]
872 uint32_t sub_ctu_qp_2 : 6; //[25:20]
873 uint32_t sub_ctu_qp_3 : 6; //[31:26]
874
875 uint32_t lambda_sad_0 : 8; //[39:32]
876 uint32_t lambda_sad_1 : 8; //[47:40]
877 uint32_t lambda_sad_2 : 8; //[55:48]
878 uint32_t lambda_sad_3 : 8; //[63:56]
881
882/*!*
883* \brief encoder AVC ROI custom map (1 MB = 8bits)
884*/
886{
887 struct
888 {
889 uint8_t mb_force_mode : 2; // [ 1: 0]
890 uint8_t mb_qp : 6; // [ 7: 2]
893
894/*!*
895* \brief encoder AVC ROI custom map (1 MB = 8bits)
896*/
897// QP/CU Control Information Format 1
899{
900 struct
901 {
902 uint8_t roiAbsQp_flag : 1; // [ 0] (0: QP_delta, 1: abs_QP)
903 uint8_t
904 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)
905 uint8_t
906 ipcm_flag : 1; // [ 7] (0: do not force IPCM mode, 1: force IPCM mode)
909// QP/CU Control Information Format 2
910/*
911typedef union _ni_enc_quad_roi_custom_map
912{
913 struct
914 {
915 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)
916 uint8_t roiAbsQp_flag : 1; // [ 6] (0: QP_delta, 1: abs_QP)
917 uint8_t skip_flag : 1; // [ 7] (0: do not force skip mode, 1: force skip)
918 } field;
919} ni_enc_quad_roi_custom_map;
920*/
921/*!*
922* \brief This is an enumeration for supported codec formats.
923*/
932
940
947
948
949/*!*
950* \brief This is an enumeration for hw actions
951*/
961
962/*!*
963* \brief This is an enumeration for encoder parameter change.
964*/
966{
967 // COMMON parameters which can be changed frame by frame.
969 //NI_SET_CHANGE_PARAM_INTRA_PARAM = (1 << 1), // not required by customers
971 //NI_SET_CHANGE_PARAM_RC = (1 << 9), // not required by customers
990 NI_SET_CHANGE_PARAM_INTRA_PERIOD = ((unsigned int)1 << 31),
991 //bit [2,7] and [13,15] is still unused
993
998{
1000
1001 // NI_SET_CHANGE_PARAM_RC_TARGET_RATE
1002 int32_t bitRate;
1005 // NI_SET_CHANGE_PARAM_RC
1006// (rcEnable, cuLevelRc, bitAllocMode, RoiEnable, RcInitQp can't be changed while encoding)
1007 int32_t hvsQPEnable;
1008 int32_t hvsQpScale;
1012 // NI_SET_CHANGE_PARAM_RC_MIN_MAX_QP
1013 int32_t minQpI;
1014 int32_t maxQpI;
1016 int32_t maxDeltaQp;
1017#ifdef QUADRA
1018 int32_t minQpPB;
1019 int32_t maxQpPB;
1020#else
1021 int32_t minQpP;
1022 int32_t minQpB;
1023 int32_t maxQpP;
1024 int32_t maxQpB;
1025#endif
1026
1027 // NI_SET_CHANGE_PARAM_INTRA_PARAM
1028 int32_t intraQP;
1029 int32_t intraPeriod;
1032#ifdef QUADRA
1033 // NI_SET_CHANGE_PARAM_VUI_HRD_PARAM
1036 uint8_t colorTrc;
1037 uint8_t colorSpace;
1042 // RESERVED FOR FUTURE USE
1043 uint8_t reserved[5];
1044
1045 // NI_SET_CHANGE_PARAM_SLICE_ARG
1046 int16_t sliceArg;
1047 //NI_SET_CHANGE_PARAM_VBV also reconfig for ni_vbvBufferSize
1048 int32_t vbvMaxRate;
1049
1050 // NI_SET_CHANGE_PARAM_CRF
1051 // crf reconfig (range in [0.00 .. 51.00])
1052 uint8_t crfDecimal; // crf decimal fraction * 100 (range in [0 .. 99])
1053 uint8_t crf; // crf integer (range in [0 .. 51])
1054
1055 // NI_SET_CHANGE_PARAM_MAX_FRAME_SIZE
1056 uint16_t maxFrameSize; // maxFrameSize reconfig (in unit of 2000 bytes)
1057
1058 // NI_SET_CHANGE_PARAM_INVALID_REF_FRAME
1060
1061 // NI_SET_CHANGE_PARAM_LTR_INTERVAL
1063
1064 // NI_SET_CHANGE_PARAM_RC_FRAMERATE
1067#else
1068 int32_t reserved[8];
1069#endif
1071
1072/*!*
1073* \brief decoded payload format of HDR SEI mastering display colour volume
1074*
1075*/
1084
1085/*!*
1086* \brief payload format of HDR SEI content light level info
1087*
1088*/
1094
1095/*!*
1096* \brief encoded payload format of HDR SEI mastering display colour volume
1097*
1098*/
1107
1108typedef struct _ni_pkt_info
1109{
1110 double psnr_y;
1111 double psnr_u;
1112 double psnr_v;
1114 double ssim_y;
1115 double ssim_u;
1116 double ssim_v;
1117 double reserved[1];
1119
1120/*!*
1121 * \brief This is an enumeration for illustrating the custom SEI locations.
1122 */
1128
1129/*!*
1130 * \brief custom sei payload passthrough
1131 */
1139
1145
1146/*!*
1147* \brief hardware capability type
1148*/
1149typedef struct _ni_hw_capability
1150{
1151 uint8_t hw_id;
1153 uint8_t max_4k_fps;
1155 uint8_t codec_type;
1162 uint8_t reserved; // 16B alignment. Unnecessary?
1164
1165/*!*
1166* \brief device capability type
1167*/
1169{
1175
1176 uint8_t serial_number[20];
1177 uint8_t model_number[40];
1178
1179 uint8_t fw_rev[8]; // space right filled ASCII array, not a string
1180 uint8_t fw_branch_name[256];
1181 uint8_t fw_commit_time[26];
1182 uint8_t fw_commit_hash[41];
1183 uint8_t fw_build_time[26];
1184 uint8_t fw_build_id[256];
1186
1187/*!*
1188* \brief Session running state type.
1189*/
1198
1199typedef struct _ni_context_query
1200{
1201 uint32_t context_id : 8; //07:00 SW Instance ID (0 to Max number of instances)
1202 uint32_t context_status : 8; //15:08 Instance Status (0-Idle, 1-Active)
1203 uint32_t
1204 codec_format : 8; //23:16 Codec Format (0-H264, 1-H265, 2-VP9, 3-JPEG, 4-AV1)
1205 uint32_t video_width : 16; //39:24 Video Width (0 to Max Width)
1206 uint32_t video_height : 16; //55:40 Video Height (0 to Max Height)
1207 uint32_t fps : 8; //63:56 FPS (0 to 255)
1208 uint32_t reserved : 8; //Alignment
1210
1211typedef struct _ni_load_query
1212{
1215 uint32_t fw_load;
1217 union{
1219 uint32_t pcie_throughput; //PCIe throughput - ni_query_nvme_status
1220 };
1221 union {
1223 uint32_t pcie_load; //PCIe load - ni_query_nvme_status
1224 };
1227 union {
1229 uint32_t tp_fw_load; //TP FW load - ni_query_nvme_status
1230 };
1231
1233
1236
1244
1256
1266
1271
1273{
1274 int hw_id; // Codec ID
1275 uint32_t session_id; // session id
1276 uint64_t session_timestamp; // Session Start Timestamp
1277 bool close_thread; // a flag that the keep alive thread is closed or need to be closed
1278 uint32_t device_type; // Device Type, Either NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
1279 ni_device_handle_t device_handle; // block device handler
1280 ni_event_handle_t thread_event_handle; // only for Windows asynchronous read and write
1281 void *p_buffer; // only be used when regular-io.
1282 ni_pthread_mutex_t *p_mutex; // referring to mutex of session context.
1283 uint32_t keep_alive_timeout; // keep alive timeout setting
1284 volatile uint64_t *plast_access_time; // shared variable for main thread to verify timeout. Keep alive thread will update last_access_time
1286
1296
1307
1318
1327
1335
1340
1342{
1343 uint32_t num_of_dims; /* The number of dimensions specified in *sizes */
1344 uint32_t sizes[6]; /* The pointer to an array of dimension */
1345 int32_t
1346 data_format; /* Data format for the tensor, see ni_ai_buffer_format_e */
1347 int32_t
1348 quant_format; /* Quantized format see ni_ai_buffer_quantize_format_e */
1349 union
1350 {
1351 struct
1352 {
1353 int32_t
1354 fixed_point_pos; /* Specifies the fixed point position when the input element type is int16, if 0 calculations are performed in integer math */
1356
1357 struct
1358 {
1359 float scale; /* Scale value for the quantized value */
1360 int32_t zeroPoint; /* A 32 bit integer, in range [0, 255] */
1362 } quant_data; /* The union of quantization information */
1363 /* The type of this buffer memory. */
1364 uint32_t memory_type;
1366
1372
1377
1378typedef struct _ni_network_data
1379{
1380 uint32_t input_num;
1381 uint32_t output_num;
1384 *inset; /* point to each input layer start offset from p_frame */
1386 *outset; /* point to each output layer start offset from p_packet */
1388
1389// if change this structure, you need to change ni_quadra_filter_api.h ni_quadra_frameclone_desc_t
1391{
1392 uint16_t ui16SrcIdx;
1393 uint16_t ui16DstIdx;
1394 uint32_t ui32Offset;
1395 uint32_t ui32Size;
1396 uint32_t reserved;
1398
1410
1411typedef struct _ni_input_frame
1412{
1414
1415 uint32_t video_width;
1417
1418 int64_t pts;
1419
1420 int8_t usable;
1422
1423// This is for decoder to reset the ppu value
1424// ppu_set_enable & (0x1 << idx) is which ppu[idx] enabled
1425// for examle, ppu_set_enable is 3, so ppu0 amd ppu1 is enabled
1426// 0x03 & (0x01 << 0) is not 0 and 0x03 &(0x01 << 1) is not 0
1427// 0: all ppu disabled. 1: ppu0 enabled. 2: ppu1 enabled
1428// 3: ppu0 ppu1 enabled. 4: ppu2 enabled. 5: ppu0 ppu2 enabled
1429// 6: ppu1 ppu enabled. 7: all ppu enabled others: disabled
1435
1437{
1439 /* frame_time_q is pointer to ni_lat_meas_q_t but reserved as void pointer
1440 here as ni_lat_meas_q_t is part of private API */
1442#ifndef DEPRECATION_AS_ERROR
1444#endif
1445
1451
1453
1464
1467 int64_t last_pts;
1468 int64_t last_dts;
1476#ifndef DEPRECATION_AS_ERROR
1478#endif
1479
1480 /* store pts values to create an accurate pts offset */
1489
1492
1494 ni_device_handle_t device_handle;
1495
1497 ni_device_handle_t blk_io_handle;
1498
1500 ni_device_handle_t sender_handle;
1501 ni_device_handle_t auto_dl_handle;
1502 uint8_t is_auto_dl;
1503
1506
1512 uint32_t session_id;
1516 uint32_t device_type;
1523
1524 int src_bit_depth; // 8 or 10 bits/pixel formats, default 8
1525 int src_endian; // encoding 0: little endian (default) 1: big
1526 int bit_depth_factor; // for YUV buffer allocation
1527 // for encoder roi metadata
1528 uint32_t roi_len;
1529 uint32_t roi_avg_qp;
1530
1533
1534 /* Overall resource use among namespaces */
1536
1538 uint8_t *p_leftover;
1540 uint32_t sent_size;
1541
1543 uint8_t *p_hdr_buf;
1545
1548
1551
1554
1558
1559 void *p_dump[2];
1560 char param_err_msg[512];
1561
1562 int keyframe_factor; // Unused
1563 uint64_t frame_num;
1564 uint64_t pkt_num;
1565 int rc_error_count; // Unused
1566
1568 uint32_t hwd_src_cpu;
1571 uint32_t hwd_Inst_ID;
1572
1573 // frame forcing: for encoding
1575
1576 uint32_t ready_to_close; //flag to indicate we are ready to close session
1577
1578 // session running state
1580 //Current video width. this is used to do sequence change
1582 //Current video height ,this is used to do sequence change
1584 //Actual video width (without stride + cropped)
1586 // Used to track sequence changes that require bigger bitstream buffers
1588 ni_pthread_t keep_alive_thread;
1592
1593 // original resolution this stream started with, this is used by encoder sequence change
1595
1596 // a mutex for Xcoder API, to keep the thread-safety.
1597 ni_pthread_mutex_t mutex;
1598
1599 // Xcoder running state
1601
1602 // only be used when regular-io
1603 void *p_all_zero_buf; //This is for sos, eos, flush and keep alive request
1604
1605 // these two event handle are only for Windows asynchronous read and write now
1606 ni_event_handle_t event_handle;
1607 ni_event_handle_t thread_event_handle;
1608
1609 // ROI data
1611 // last passed in ni_region_of_interest_t
1614 ni_enc_quad_roi_custom_map *roi_map; // actual AVC/HEVC QP map
1615
1616 // only for H.264 test roi buffer for up to 8k resolution H.264 - 32 x 32 sub CTUs
1618 // only for H.265 custom map buffer for up to 8k resolution - 64x64 CTU Regions
1620 // only for hevc actual ROI map is stored in individual session context !
1622
1623 // encoder reconfig parameters
1625 // decoder lowDelay mode for All I packets or IPPP packets
1628
1629 // wrapper API request data, to be sent out once with the next input frame
1630 // to encoder
1631 int32_t target_bitrate; // A target bitrate to reconfig, -1 if inactive
1632 int force_idr_frame; // force IDR frame type
1634 int32_t ltr_interval; // LTR interval to set
1635 int32_t ltr_frame_ref_invalid; // frame after which all ref to be invalid
1636 ni_framerate_t framerate; // framerate to reconfig, 0 if inactive
1637 ni_vui_hrd_t vui; // vui to reconfig
1638
1639 // path of decoder input pkt saving folder
1643
1644 // some parameters for decoder session
1645 // int hw_frame_extra_buffer; e.g. 3
1649 int32_t isP2P;
1651 unsigned short domain;
1652 unsigned short bus;
1653 unsigned short dev;
1654 unsigned short fn;
1655
1656 // the FW API version of device that opened
1657 uint8_t fw_rev[8];
1658 uint8_t ddr_config;
1659
1661
1663 uint32_t prev_fps;
1665 uint64_t prev_pts;
1669
1670 uint32_t meta_size;
1674
1675 // flags_array to save packet flags
1677
1678 // for decoder: store currently returned decoded frame's pkt offset
1681
1683
1684 uint32_t count_frame_num_in_sec; //used in the vfr mode, indicate the frame count in seconds
1685 uint32_t passed_time_in_timebase_unit; //used in the vfr mode, indicate how long it has passed
1686
1687 int32_t max_frame_size; // maxFrameSize (in bytes) to reconfig, 0 if inactive
1688
1689 // block device name requested by caller to open: when specified this block
1690 // device has priority over hw_id which is device specified by index.
1692
1693 // decoder low delay send/recv sync; async_mode = 0 by default, i.e.
1694 // codec send-to/recv-from FW is in synchrounous mode by default.
1697 ni_pthread_mutex_t low_delay_sync_mutex;
1698 ni_pthread_cond_t low_delay_sync_cond;
1699
1700 // muxtex default from source session
1701 // required pointer to external if used by hwdl
1702 ni_pthread_mutex_t* pext_mutex;
1704
1705 // required parameters for slow sequence change
1708
1709 // AI embedded network parameters data
1711
1714 //shared variable for main thread to read and keepalive thread to update
1715 volatile uint64_t last_access_time;
1716
1717 int reconfig_crf; // crf value to reconfig (range in [0..51]), -1 if inactive
1718 int reconfig_crf_decimal; // crf decimal fration value to reconfig
1719 // (range in [0..99]), -1 if inactive
1720 int reconfig_vbv_buffer_size; // vbv buffer size value to reconfig
1721 int reconfig_vbv_max_rate; // vbv max rate value to reconfig
1722
1727 uint64_t av1_pkt_num;
1728
1735 char E2EID[128];
1737 int pixel_format_changed; // only for decoder now
1739
1742 double psnr_y;
1743 double psnr_u;
1744 double psnr_v;
1748
1750
1751 // write packet/frame required buf size
1753
1754 // record the drop num
1756
1757 //for AI aio
1758 ni_aio_context_t aio_context;
1759 ni_iocb_t **iocbs;
1760 ni_io_event_t *io_event;
1762
1767
1769{
1771 int w[3];
1772 int h[3];
1773 int f[3]; //planar format
1774 int f8b[3]; //forced 8bit
1775 //int crop_meta_data_rltb[3][4]; //crop rectangle
1777
1778/*!*
1779* \brief This is an enumeration for encoder reconfiguration test settings
1780*/
1781typedef enum _ni_reconfig
1782{
1788//XCODER_TEST_RECONF_RC = 5, // not required by customers
1789 XCODER_TEST_RECONF_RC_MIN_MAX_QP = 6, // reconfig min&max QP
1790#ifdef QUADRA
1795 XCODER_TEST_RECONF_RC_MIN_MAX_QP_REDUNDANT = 11, // reconfig min&max QP through libxcoder API (redundant demo mode index)
1801 XCODER_TEST_FORCE_IDR_FRAME = 100, // force IDR through libxcoder API
1802 XCODER_TEST_RECONF_BR_API = 101, // reconfig BR through libxcoder API
1803 XCODER_TEST_RECONF_INTRAPRD_API = 102, // reconfig intraperiod through libxcoder API
1804 XCODER_TEST_RECONF_VUI_HRD_API = 103, // reconfig VUI through libxcoder API
1805 XCODER_TEST_RECONF_LTR_API = 104, // reconfig LTR through libxcoder API
1806 XCODER_TEST_RECONF_RC_MIN_MAX_QP_API_REDUNDANT = 106, // reconfig min&max QP through libxcoder API (redundant demo mode index)
1807 XCODER_TEST_RECONF_LTR_INTERVAL_API = 107, // reconf LTR interval thru API
1808 XCODER_TEST_INVALID_REF_FRAME_API = 108, // invalidate ref frame thru API
1809 XCODER_TEST_RECONF_FRAMERATE_API = 109, // reconfig framerate through libxcoder API
1810 XCODER_TEST_RECONF_MAX_FRAME_SIZE_API = 110, // reconfig maxFrameSize through libxcoder API
1811 XCODER_TEST_RECONF_RC_MIN_MAX_QP_API = 111, // reconfig min&max QP through libxcoder API
1812 XCODER_TEST_CRF_API = 114, // reconfig crf through libxcoder API
1813 XCODER_TEST_CRF_FLOAT_API = 115, // reconfig crf float type through libxcoder API
1814 XCODER_TEST_RECONF_VBV_API = 116, // reconfig vbv buffer size and vbv max rate through libxcoder API
1815 XCODER_TEST_RECONF_MAX_FRAME_SIZE_RATIO_API = 117, // reconfig maxFrameSize ratio through libxcoder API
1816 XCODER_TEST_RECONF_SLICE_ARG_API = 118, // reconfig sliceArg through libxcoder API
1818#endif
1820
1822{
1823 /* A float type of buffer data */
1825 /* A half float type of buffer data */
1827 /* A 8 bit unsigned integer type of buffer data */
1829 /* A 8 bit signed integer type of buffer data */
1831 /* A 16 bit unsigned integer type of buffer data */
1833 /* A 16 signed integer type of buffer data */
1835 /* A char type of data */
1837 /* A bfloat 16 type of data */
1839 /* A 32 bit integer type of data */
1841 /* A 32 bit unsigned signed integer type of buffer */
1843 /* A 64 bit signed integer type of data */
1845 /* A 64 bit unsigned integer type of data */
1847 /* A 64 bit float type of buffer data */
1850
1852{
1853 /* Not quantized format */
1855 /* A quantization data type which specifies the fixed point position for whole tensor. */
1857 /* A quantization data type which has scale value and zero point to match with TF and
1858 Android NN API for whole tensor. */
1860 /* A max vaule support quantize format */
1863
1865{
1866 NI_DDR_PRIORITY_NONE = -1, // Do not change DDR priorities
1867 NI_DDR_PRIORITY_RESET, // Reset DDR priorities to default
1868 NI_DDR_PRIORITY_DECENC, // DDR prioritize decoder and encoder
1869 NI_DDR_PRIORITY_FILT, // DDR prioritize filter
1870 NI_DDR_PRIORITY_AI, // DDR prioritize AI
1873
1886
1887#ifdef QUADRA
1888#define NI_ENC_GOP_PARAMS_G0_POC_OFFSET "g0pocOffset"
1889#define NI_ENC_GOP_PARAMS_G0_QP_OFFSET "g0QpOffset"
1890//#define NI_ENC_GOP_PARAMS_G0_QP_FACTOR "g0QpFactor"
1891#define NI_ENC_GOP_PARAMS_G0_TEMPORAL_ID "g0temporalId"
1892#define NI_ENC_GOP_PARAMS_G0_PIC_TYPE "g0picType"
1893#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PICS "g0numRefPics"
1894#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC0 "g0refPic0"
1895#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC0_USED "g0refPic0Used"
1896#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC1 "g0refPic1"
1897#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC1_USED "g0refPic1Used"
1898#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC2 "g0refPic2"
1899#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC2_USED "g0refPic2Used"
1900#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC3 "g0refPic3"
1901#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC3_USED "g0refPic3Used"
1902
1903#define NI_ENC_GOP_PARAMS_G1_POC_OFFSET "g1pocOffset"
1904#define NI_ENC_GOP_PARAMS_G1_QP_OFFSET "g1QpOffset"
1905//#define NI_ENC_GOP_PARAMS_G1_QP_FACTOR "g1QpFactor"
1906#define NI_ENC_GOP_PARAMS_G1_TEMPORAL_ID "g1temporalId"
1907#define NI_ENC_GOP_PARAMS_G1_PIC_TYPE "g1picType"
1908#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PICS "g1numRefPics"
1909#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC0 "g1refPic0"
1910#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC0_USED "g1refPic0Used"
1911#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC1 "g1refPic1"
1912#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC1_USED "g1refPic1Used"
1913#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC2 "g1refPic2"
1914#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC2_USED "g1refPic2Used"
1915#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC3 "g1refPic3"
1916#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC3_USED "g1refPic3Used"
1917
1918#define NI_ENC_GOP_PARAMS_G2_POC_OFFSET "g2pocOffset"
1919#define NI_ENC_GOP_PARAMS_G2_QP_OFFSET "g2QpOffset"
1920//#define NI_ENC_GOP_PARAMS_G2_QP_FACTOR "g2QpFactor"
1921#define NI_ENC_GOP_PARAMS_G2_TEMPORAL_ID "g2temporalId"
1922#define NI_ENC_GOP_PARAMS_G2_PIC_TYPE "g2picType"
1923#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PICS "g2numRefPics"
1924#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC0 "g2refPic0"
1925#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC0_USED "g2refPic0Used"
1926#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC1 "g2refPic1"
1927#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC1_USED "g2refPic1Used"
1928#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC2 "g2refPic2"
1929#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC2_USED "g2refPic2Used"
1930#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC3 "g2refPic3"
1931#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC3_USED "g2refPic3Used"
1932
1933#define NI_ENC_GOP_PARAMS_G3_POC_OFFSET "g3pocOffset"
1934#define NI_ENC_GOP_PARAMS_G3_QP_OFFSET "g3QpOffset"
1935//#define NI_ENC_GOP_PARAMS_G3_QP_FACTOR "g3QpFactor"
1936#define NI_ENC_GOP_PARAMS_G3_TEMPORAL_ID "g3temporalId"
1937#define NI_ENC_GOP_PARAMS_G3_PIC_TYPE "g3picType"
1938#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PICS "g3numRefPics"
1939#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC0 "g3refPic0"
1940#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC0_USED "g3refPic0Used"
1941#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC1 "g3refPic1"
1942#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC1_USED "g3refPic1Used"
1943#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC2 "g3refPic2"
1944#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC2_USED "g3refPic2Used"
1945#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC3 "g3refPic3"
1946#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC3_USED "g3refPic3Used"
1947
1948#define NI_ENC_GOP_PARAMS_G4_POC_OFFSET "g4pocOffset"
1949#define NI_ENC_GOP_PARAMS_G4_QP_OFFSET "g4QpOffset"
1950//#define NI_ENC_GOP_PARAMS_G4_QP_FACTOR "g4QpFactor"
1951#define NI_ENC_GOP_PARAMS_G4_TEMPORAL_ID "g4temporalId"
1952#define NI_ENC_GOP_PARAMS_G4_PIC_TYPE "g4picType"
1953#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PICS "g4numRefPics"
1954#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC0 "g4refPic0"
1955#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC0_USED "g4refPic0Used"
1956#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC1 "g4refPic1"
1957#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC1_USED "g4refPic1Used"
1958#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC2 "g4refPic2"
1959#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC2_USED "g4refPic2Used"
1960#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC3 "g4refPic3"
1961#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC3_USED "g4refPic3Used"
1962
1963#define NI_ENC_GOP_PARAMS_G5_POC_OFFSET "g5pocOffset"
1964#define NI_ENC_GOP_PARAMS_G5_QP_OFFSET "g5QpOffset"
1965//#define NI_ENC_GOP_PARAMS_G5_QP_FACTOR "g5QpFactor"
1966#define NI_ENC_GOP_PARAMS_G5_TEMPORAL_ID "g5temporalId"
1967#define NI_ENC_GOP_PARAMS_G5_PIC_TYPE "g5picType"
1968#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PICS "g5numRefPics"
1969#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC0 "g5refPic0"
1970#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC0_USED "g5refPic0Used"
1971#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC1 "g5refPic1"
1972#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC1_USED "g5refPic1Used"
1973#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC2 "g5refPic2"
1974#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC2_USED "g5refPic2Used"
1975#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC3 "g5refPic3"
1976#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC3_USED "g5refPic3Used"
1977
1978#define NI_ENC_GOP_PARAMS_G6_POC_OFFSET "g6pocOffset"
1979#define NI_ENC_GOP_PARAMS_G6_QP_OFFSET "g6QpOffset"
1980//#define NI_ENC_GOP_PARAMS_G6_QP_FACTOR "g6QpFactor"
1981#define NI_ENC_GOP_PARAMS_G6_TEMPORAL_ID "g6temporalId"
1982#define NI_ENC_GOP_PARAMS_G6_PIC_TYPE "g6picType"
1983#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PICS "g6numRefPics"
1984#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC0 "g6refPic0"
1985#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC0_USED "g6refPic0Used"
1986#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC1 "g6refPic1"
1987#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC1_USED "g6refPic1Used"
1988#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC2 "g6refPic2"
1989#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC2_USED "g6refPic2Used"
1990#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC3 "g6refPic3"
1991#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC3_USED "g6refPic3Used"
1992
1993#define NI_ENC_GOP_PARAMS_G7_POC_OFFSET "g7pocOffset"
1994#define NI_ENC_GOP_PARAMS_G7_QP_OFFSET "g7QpOffset"
1995//#define NI_ENC_GOP_PARAMS_G7_QP_FACTOR "g7QpFactor"
1996#define NI_ENC_GOP_PARAMS_G7_TEMPORAL_ID "g7temporalId"
1997#define NI_ENC_GOP_PARAMS_G7_PIC_TYPE "g7picType"
1998#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PICS "g7numRefPics"
1999#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC0 "g7refPic0"
2000#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC0_USED "g7refPic0Used"
2001#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC1 "g7refPic1"
2002#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC1_USED "g7refPic1Used"
2003#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC2 "g7refPic2"
2004#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC2_USED "g7refPic2Used"
2005#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC3 "g7refPic3"
2006#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC3_USED "g7refPic3Used"
2007
2008typedef struct _ni_gop_rps
2009{
2010 int ref_pic; /*!*< delta_poc of this short reference picture relative to the poc of current picture or index of LTR */
2011 int ref_pic_used; /*!*< whether this reference picture used by current picture */
2013
2014typedef struct _ni_gop_params
2015{
2016 int poc_offset; /*!*< A POC of Nth picture in the custom GOP */
2017 int qp_offset; /*!*< QP offset of Nth picture in the custom GOP */
2018 float qp_factor; /*!*< QP factor of Nth picture in the custom GOP */
2019 int temporal_id; /*!*< A temporal ID of Nth picture in the custom GOP */
2020 int pic_type; /*!*< A picture type of Nth picture in the custom GOP */
2021 int num_ref_pics; /*!*< the number of reference pictures kept for this picture, the value should be within [0, 4] */
2024#else
2025#define NI_ENC_GOP_PARAMS_G0_PIC_TYPE "g0picType"
2026#define NI_ENC_GOP_PARAMS_G0_POC_OFFSET "g0pocOffset"
2027#define NI_ENC_GOP_PARAMS_G0_PIC_QP "g0picQp"
2028#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC_L0 "g0numRefPicL0"
2029#define NI_ENC_GOP_PARAMS_G0_NUM_REF_POC_L0 "g0refPocL0"
2030#define NI_ENC_GOP_PARAMS_G0_NUM_REF_POC_L1 "g0refPocL1"
2031#define NI_ENC_GOP_PARAMS_G0_TEMPORAL_ID "g0temporalId"
2032
2033#define NI_ENC_GOP_PARAMS_G1_PIC_TYPE "g1picType"
2034#define NI_ENC_GOP_PARAMS_G1_POC_OFFSET "g1pocOffset"
2035#define NI_ENC_GOP_PARAMS_G1_PIC_QP "g1picQp"
2036#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC_L0 "g1numRefPicL0"
2037#define NI_ENC_GOP_PARAMS_G1_NUM_REF_POC_L0 "g1refPocL0"
2038#define NI_ENC_GOP_PARAMS_G1_NUM_REF_POC_L1 "g1refPocL1"
2039#define NI_ENC_GOP_PARAMS_G1_TEMPORAL_ID "g1temporalId"
2040
2041#define NI_ENC_GOP_PARAMS_G2_PIC_TYPE "g2picType"
2042#define NI_ENC_GOP_PARAMS_G2_POC_OFFSET "g2pocOffset"
2043#define NI_ENC_GOP_PARAMS_G2_PIC_QP "g2picQp"
2044#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC_L0 "g2numRefPicL0"
2045#define NI_ENC_GOP_PARAMS_G2_NUM_REF_POC_L0 "g2refPocL0"
2046#define NI_ENC_GOP_PARAMS_G2_NUM_REF_POC_L1 "g2refPocL1"
2047#define NI_ENC_GOP_PARAMS_G2_TEMPORAL_ID "g2temporalId"
2048
2049#define NI_ENC_GOP_PARAMS_G3_PIC_TYPE "g3picType"
2050#define NI_ENC_GOP_PARAMS_G3_POC_OFFSET "g3pocOffset"
2051#define NI_ENC_GOP_PARAMS_G3_PIC_QP "g3picQp"
2052#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC_L0 "g3numRefPicL0"
2053#define NI_ENC_GOP_PARAMS_G3_NUM_REF_POC_L0 "g3refPocL0"
2054#define NI_ENC_GOP_PARAMS_G3_NUM_REF_POC_L1 "g3refPocL1"
2055#define NI_ENC_GOP_PARAMS_G3_TEMPORAL_ID "g3temporalId"
2056
2057#define NI_ENC_GOP_PARAMS_G4_PIC_TYPE "g4picType"
2058#define NI_ENC_GOP_PARAMS_G4_POC_OFFSET "g4pocOffset"
2059#define NI_ENC_GOP_PARAMS_G4_PIC_QP "g4picQp"
2060#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC_L0 "g4numRefPicL0"
2061#define NI_ENC_GOP_PARAMS_G4_NUM_REF_POC_L0 "g4refPocL0"
2062#define NI_ENC_GOP_PARAMS_G4_NUM_REF_POC_L1 "g4refPocL1"
2063#define NI_ENC_GOP_PARAMS_G4_TEMPORAL_ID "g4temporalId"
2064
2065#define NI_ENC_GOP_PARAMS_G5_PIC_TYPE "g5picType"
2066#define NI_ENC_GOP_PARAMS_G5_POC_OFFSET "g5pocOffset"
2067#define NI_ENC_GOP_PARAMS_G5_PIC_QP "g5picQp"
2068#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC_L0 "g5numRefPicL0"
2069#define NI_ENC_GOP_PARAMS_G5_NUM_REF_POC_L0 "g5refPocL0"
2070#define NI_ENC_GOP_PARAMS_G5_NUM_REF_POC_L1 "g5refPocL1"
2071#define NI_ENC_GOP_PARAMS_G5_TEMPORAL_ID "g5temporalId"
2072
2073#define NI_ENC_GOP_PARAMS_G6_PIC_TYPE "g6picType"
2074#define NI_ENC_GOP_PARAMS_G6_POC_OFFSET "g6pocOffset"
2075#define NI_ENC_GOP_PARAMS_G6_PIC_QP "g6picQp"
2076#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC_L0 "g6numRefPicL0"
2077#define NI_ENC_GOP_PARAMS_G6_NUM_REF_POC_L0 "g6refPocL0"
2078#define NI_ENC_GOP_PARAMS_G6_NUM_REF_POC_L1 "g6refPocL1"
2079#define NI_ENC_GOP_PARAMS_G6_TEMPORAL_ID "g6temporalId"
2080
2081#define NI_ENC_GOP_PARAMS_G7_PIC_TYPE "g7picType"
2082#define NI_ENC_GOP_PARAMS_G7_POC_OFFSET "g7pocOffset"
2083#define NI_ENC_GOP_PARAMS_G7_PIC_QP "g7picQp"
2084#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC_L0 "g7numRefPicL0"
2085#define NI_ENC_GOP_PARAMS_G7_NUM_REF_POC_L0 "g7refPocL0"
2086#define NI_ENC_GOP_PARAMS_G7_NUM_REF_POC_L1 "g7refPocL1"
2087#define NI_ENC_GOP_PARAMS_G7_TEMPORAL_ID "g7temporalId"
2088
2089typedef struct _ni_gop_params
2090{
2091 int pic_type; /*!*< A picture type of Nth picture in the custom GOP */
2092 int poc_offset; /*!*< A POC of Nth picture in the custom GOP */
2093 int pic_qp; /*!*< A quantization parameter of Nth picture in the custom GOP */
2094 int num_ref_pic_L0; /*!*< The number of reference L0 of Nth picture in the custom GOP */
2095 int ref_poc_L0; /*!*< A POC of reference L0 of Nth picture in the custom GOP */
2096 int ref_poc_L1; /*!*< A POC of reference L1 of Nth picture in the custom GOP */
2097 int temporal_id; /*!*< A temporal ID of Nth picture in the custom GOP */
2099#endif
2100
2101
2102
2103#define NI_ENC_GOP_PARAMS_CUSTOM_GOP_SIZE "customGopSize"
2104
2106{
2107 int custom_gop_size; /*!*< The size of custom GOP (0~8) */
2108 ni_gop_params_t pic_param[NI_MAX_GOP_NUM]; /*!*< Picture parameters of Nth picture in custom GOP */
2110
2111#define NI_ENC_REPEAT_HEADERS_FIRST_IDR 0
2112#define NI_ENC_REPEAT_HEADERS_ALL_I_FRAMES 1
2113#define NI_KEEP_ALIVE_TIMEOUT "keepAliveTimeout"
2114
2116{
2117#define NI_ENC_PARAM_BITRATE "bitrate"
2118#define NI_ENC_PARAM_RECONF_DEMO_MODE "ReconfDemoMode"
2119#define NI_ENC_PARAM_RECONF_FILE "ReconfFile"
2120#define NI_ENC_PARAM_ROI_DEMO_MODE "RoiDemoMode"
2121#define NI_ENC_PARAM_CACHE_ROI "cacheRoi"
2122#define NI_ENC_PARAM_FORCE_PIC_QP_DEMO_MODE "ForcePicQpDemoMode"
2123
2124#ifndef DEPRECATION_AS_ERROR
2126#define NI_ENC_PARAM_GEN_HDRS NI_DEPRECATED_MACRO "GenHdrs"
2127#endif
2128#define NI_ENC_PARAM_PADDING "padding"
2129#define NI_ENC_PARAM_FORCE_FRAME_TYPE "forceFrameType"
2130#define NI_ENC_PARAM_PROFILE "profile"
2131#define NI_ENC_PARAM_LEVEL "level"
2132#define NI_ENC_PARAM_HIGH_TIER "high-tier"
2133#define NI_ENC_PARAM_LOG_LEVEL "log-level"
2134#define NI_ENC_PARAM_LOG "log"
2135#define NI_ENC_PARAM_GOP_PRESET_IDX "gopPresetIdx"
2136#define NI_ENC_PARAM_LOW_DELAY "lowDelay"
2137#define NI_ENC_PARAM_MIN_FRAMES_DELAY "minFramesDelay"
2138#define NI_ENC_PARAM_USE_RECOMMENDED_ENC_PARAMS "useRecommendEncParam"
2139#define NI_ENC_PARAM_USE_LOW_DELAY_POC_TYPE "useLowDelayPocType"
2140#define NI_ENC_PARAM_CU_SIZE_MODE "cuSizeMode"
2141#define NI_ENC_PARAM_MAX_NUM_MERGE "maxNumMerge"
2142#define NI_ENC_PARAM_ENABLE_DYNAMIC_8X8_MERGE "dynamicMerge8x8Enable"
2143#define NI_ENC_PARAM_ENABLE_DYNAMIC_16X16_MERGE "dynamicMerge16x16Enable"
2144#define NI_ENC_PARAM_ENABLE_DYNAMIC_32X32_MERGE "dynamicMerge32x32Enable"
2145#define NI_ENC_PARAM_ENABLE_RATE_CONTROL "RcEnable"
2146#define NI_ENC_PARAM_ENABLE_CU_LEVEL_RATE_CONTROL "cuLevelRCEnable"
2147#define NI_ENC_PARAM_ENABLE_HVS_QP "hvsQPEnable"
2148#define NI_ENC_PARAM_ENABLE_HVS_QP_SCALE "hvsQpScaleEnable"
2149#define NI_ENC_PARAM_HVS_QP_SCALE "hvsQpScale"
2150#define NI_ENC_PARAM_MIN_QP "minQp"
2151#define NI_ENC_PARAM_MAX_QP "maxQp"
2152#define NI_ENC_PARAM_MAX_DELTA_QP "maxDeltaQp"
2153#define NI_ENC_PARAM_FORCED_HEADER_ENABLE "repeatHeaders"
2154#define NI_ENC_PARAM_ROI_ENABLE "roiEnable"
2155#define NI_ENC_PARAM_CONF_WIN_TOP "confWinTop"
2156#define NI_ENC_PARAM_CONF_WIN_BOTTOM "confWinBot"
2157#define NI_ENC_PARAM_CONF_WIN_LEFT "confWinLeft"
2158#define NI_ENC_PARAM_CONF_WIN_RIGHT "confWinRight"
2159#define NI_ENC_PARAM_INTRA_PERIOD "intraPeriod"
2160#define NI_ENC_PARAM_TRANS_RATE "transRate"
2161#define NI_ENC_PARAM_FRAME_RATE "frameRate"
2162#define NI_ENC_PARAM_FRAME_RATE_DENOM "frameRateDenom"
2163#define NI_ENC_PARAM_INTRA_QP "intraQP"
2164#define NI_ENC_PARAM_DECODING_REFRESH_TYPE "decodingRefreshType"
2165#define NI_ENC_PARAM_INTRA_REFRESH_RESET "intraRefreshResetOnForceIDR"
2166// Rev. B: H.264 only parameters.
2167#define NI_ENC_PARAM_ENABLE_8X8_TRANSFORM "transform8x8Enable"
2168#define NI_ENC_PARAM_ENTROPY_CODING_MODE "entropyCodingMode"
2169// Rev. B: shared between HEVC and H.264
2170#define NI_ENC_PARAM_SLICE_MODE "sliceMode"
2171#define NI_ENC_PARAM_SLICE_ARG "sliceArg"
2172#define NI_ENC_PARAM_INTRA_MB_REFRESH_MODE "intraMbRefreshMode"
2173#define NI_ENC_PARAM_INTRA_MB_REFRESH_ARG "intraMbRefreshArg"
2174#define NI_ENC_PARAM_INTRA_REFRESH_MODE "intraRefreshMode"
2175#define NI_ENC_PARAM_INTRA_REFRESH_ARG "intraRefreshArg"
2176#define NI_ENC_PARAM_ENABLE_MB_LEVEL_RC "mbLevelRcEnable"
2177#define NI_ENC_PARAM_PREFERRED_TRANSFER_CHARACTERISTICS "prefTRC"
2178
2179// To be deprecated: RcInitDelay -> vbvBufferSize, cbr -> fillerEnable
2180#define NI_ENC_PARAM_RC_INIT_DELAY "RcInitDelay"
2181#define NI_ENC_PARAM_CBR "cbr"
2182#define NI_ENC_PARAM_INTRA_REFRESH_MIN_PERIOD "intraRefreshMinPeriod"
2183
2184//QUADRA
2185#ifndef DEPRECATION_AS_ERROR
2187#define NI_ENC_PARAM_CONSTANT_RATE_FACTOR NI_DEPRECATED_MACRO "crf"
2188#endif
2189#define NI_ENC_PARAM_CONSTANT_RATE_FACTOR_FLOAT "crfFloat"
2190#define NI_ENC_PARAM_RDO_LEVEL "rdoLevel"
2191#define NI_ENC_PARAM_RDO_QUANT "EnableRdoQuant"
2192#define NI_ENC_PARAM_MAX_CLL "maxCLL"
2193#define NI_ENC_PARAM_MASTER_DISPLAY "masterDisplay"
2194#define NI_ENC_PARAM_LOOK_AHEAD_DEPTH "lookAheadDepth"
2195#define NI_ENC_PARAM_ENABLE_AUD "enableAUD"
2196#define NI_ENC_PARAM_CTB_RC_MODE "ctbRcMode"
2197#define NI_ENC_PARAM_GOP_SIZE "gopSize"
2198#define NI_ENC_PARAM_GOP_LOW_DELAY "gopLowdelay"
2199#define NI_ENC_PARAM_GDR_DURATION "intraRefreshDuration"
2200#define NI_ENC_PARAM_HRD_ENABLE "hrdEnable"
2201#define NI_ENC_PARAM_DOLBY_VISION_PROFILE "dolbyVisionProfile"
2202#define NI_ENC_PARAM_VBV_BUFFER_SIZE "vbvBufferSize"
2203#define NI_ENC_PARAM_VBV_MAXRAE "vbvMaxRate"
2204#define NI_ENC_PARAM_ENABLE_FILLER "fillerEnable"
2205#define NI_ENC_PARAM_ENABLE_PIC_SKIP "picSkip"
2206#ifndef DEPRECATION_AS_ERROR
2208#define NI_ENC_PARAM_MAX_FRAME_SIZE_LOW_DELAY NI_DEPRECATED_MACRO "maxFrameSize"
2209#endif
2210#define NI_ENC_PARAM_MAX_FRAME_SIZE_BITS_LOW_DELAY "maxFrameSize-Bits"
2211#define NI_ENC_PARAM_MAX_FRAME_SIZE_BYTES_LOW_DELAY "maxFrameSize-Bytes"
2212#define NI_ENC_PARAM_LTR_REF_INTERVAL "ltrRefInterval"
2213#define NI_ENC_PARAM_LTR_REF_QPOFFSET "ltrRefQpOffset"
2214#define NI_ENC_PARAM_LTR_FIRST_GAP "ltrFirstGap"
2215#define NI_ENC_PARAM_LTR_NEXT_INTERVAL "ltrNextInterval"
2216#define NI_ENC_PARAM_MULTICORE_JOINT_MODE "multicoreJointMode"
2217#define NI_ENC_PARAM_JPEG_QLEVEL "qlevel"
2218#define NI_ENC_PARAM_CHROMA_QP_OFFSET "chromaQpOffset"
2219#define NI_ENC_PARAM_TOL_RC_INTER "tolCtbRcInter"
2220#define NI_ENC_PARAM_TOL_RC_INTRA "tolCtbRcIntra"
2221#define NI_ENC_PARAM_BITRATE_WINDOW "bitrateWindow"
2222#define NI_ENC_INLOOP_DS_RATIO "inLoopDSRatio"
2223#define NI_ENC_BLOCK_RC_SIZE "blockRCSize"
2224#define NI_ENC_RC_QP_DELTA_RANGE "rcQpDeltaRange"
2225#define NI_ENC_CTB_ROW_QP_STEP "ctbRowQpStep"
2226#define NI_ENC_NEW_RC_ENABLE "newRcEnable"
2227#define NI_ENC_PARAM_INTRA_QP_DELTA "intraQpDelta"
2228#define NI_ENC_PARAM_LONG_TERM_REFERENCE_ENABLE "longTermReferenceEnable"
2229#define NI_ENC_PARAM_LONG_TERM_REFERENCE_COUNT "longTermReferenceCount"
2230#define NI_ENC_PARAM_LONG_TERM_REFERENCE_INTERVAL "longTermReferenceInterval"
2231#define NI_ENC_PARAM_SKIP_FRAME_ENABLE "skipFrameEnable"
2232#define NI_ENC_PARAM_MAX_CONSUTIVE_SKIP_FRAME_NUMBER "maxConsecutiveSkipFrameNum"
2233#define NI_ENC_PARAM_SKIP_FRAME_INTERVAL "skipFrameInterVal"
2234#define NI_ENC_PARAM_IFRAME_SIZE_RATIO "iFrameSizeRatio"
2235#define NI_ENC_PARAM_STILL_IMAGE_DETECT_LEVEL "stillImageDetectLevel"
2236#define NI_ENC_PARAM_SCENE_CHANG_DETECT_LEVEL "sceneChangeDetectLevel"
2237#define NI_ENC_PARAM_ENABLE_SMOOTH_CRF "enableSmoothCRF"
2238#define NI_ENC_PARAM_ENABLE_COMPENSATE_QP "enableCompensateQp"
2239#define NI_ENC_PARAM_ADAPTIVE_LAMDA_MODE "adaptiveLamdaMode"
2240#define NI_ENC_PARAM_ADAPTIVE_CRF_MODE "adaptiveCrfMode"
2241#define NI_ENC_PARAM_INTRA_COMPENSATE_MODE "intraCompensateMode"
2242#define NI_ENC_PARAM_CUSTOM_MIN_COEFF_DIV "customMinCoeffDiv"
2243// stream color info
2244#define NI_ENC_PARAM_COLOR_PRIMARY "colorPri"
2245#define NI_ENC_PARAM_COLOR_TRANSFER_CHARACTERISTIC "colorTrc"
2246#define NI_ENC_PARAM_COLOR_SPACE "colorSpc"
2247// sample aspect ratio specified in numerator/denominator
2248#define NI_ENC_PARAM_SAR_NUM "sarNum"
2249#define NI_ENC_PARAM_SAR_DENOM "sarDenom"
2250// video_full_range_flag
2251#define NI_ENC_PARAM_VIDEO_FULL_RANGE_FLAG "videoFullRangeFlag"
2252// VFR related
2253#define NI_ENC_PARAM_ENABLE_VFR "enableVFR"
2254#define NI_ENC_ENABLE_SSIM "enableSSIM"
2255#define NI_ENC_PARAM_AVCC_HVCC "avccHvcc"
2256#define NI_ENC_PARAM_AV1_ERROR_RESILIENT_MODE "av1ErrorResilientMode"
2257// set memory allocation parameters, M_MMAP_THRESHOLD and M_TRIM_THRESHOLD
2258#define NI_ENC_PARAM_STATIC_MMAP_THRESHOLD "staticMmapThreshold"
2259#define NI_ENC_PARAM_TEMPORAL_LAYERS_ENABLE "temporalLayersEnable"
2260#define NI_ENC_PARAM_ENABLE_AI_ENHANCE "enableAIEnhance"
2261#define NI_ENC_PARAM_ENABLE_AI_HVSPLUS "enableHVSPlus"
2262#define NI_ENC_PARAM_ENABLE_2PASS_GOP "enable2PassGop"
2263#define NI_ENC_PARAM_ZEROCOPY_MODE "zeroCopyMode"
2264#define NI_ENC_PARAM_AI_ENHANCE_LEVEL "AIEnhanceLevel"
2265#define NI_ENC_PARAM_HVSPLUS_LEVEL "HVSPlusLevel"
2266#define NI_ENC_PARAM_CROP_WIDTH "cropWidth"
2267#define NI_ENC_PARAM_CROP_HEIGHT "cropHeight"
2268#define NI_ENC_PARAM_HORIZONTAL_OFFSET "horOffset"
2269#define NI_ENC_PARAM_VERTICAL_OFFSET "verOffset"
2270#define NI_ENC_PARAM_CONSTANT_RATE_FACTOR_MAX "crfMax"
2271#define NI_ENC_PARAM_QCOMP "qcomp"
2272#define NI_ENC_PARAM_NO_MBTREE "noMbtree"
2273#define NI_ENC_PARAM_NO_HW_MULTIPASS_SUPPORT "noHWMultiPassSupport"
2274#define NI_ENC_PARAM_CU_TREE_FACTOR "cuTreeFactor"
2275#define NI_ENC_PARAM_IP_RATIO "ipRatio"
2276#define NI_ENC_PARAM_ENABLE_IP_RATIO "enableipRatio"
2277#define NI_ENC_PARAM_PB_RATIO "pbRatio"
2278#define NI_ENC_PARAM_CPLX_DECAY "cplxDecay"
2279#define NI_ENC_PARAM_PPS_INIT_QP "ppsInitQp"
2280#define NI_ENC_PARAM_DDR_PRIORITY_MODE "ddrPriorityMode"
2281#define NI_ENC_PARAM_BITRATE_MODE "bitrateMode"
2282#define NI_ENC_PARAM_PASS1_QP "pass1Qp"
2283#define NI_ENC_PARAM_HVS_BASE_MB_COMPLEXITY "hvsBaseMbComplexity"
2284#define NI_ENC_PARAM_STATISTIC_OUTPUT_LEVEL "statisticOutputLevel"
2285#define NI_ENC_PARAM_ENABLE_ALL_SEI_PASSTHRU "enableAllSeiPassthru"
2286#define NI_ENC_PARAM_CRF_MAX_IFRAME_ENABLE "crfMaxIframeEnable"
2287#define NI_ENC_PARAM_VBV_MINRATE "vbvMinRate"
2288#define NI_ENC_PARAM_DISABLE_ADAPTIVE_BUFFERS "disableAdaptiveBuffers"
2289#define NI_ENC_PARAM_DISABLE_BFRAME_RDOQ "disableBframeRDOQ"
2290#define NI_ENC_PARAM_FORCE_BFRAME_QPFACTOR "forceBframeQpfactor"
2291#define NI_ENC_PARAM_TUNE_BFRAME_VISUAL "tuneBframeVisual"
2292#define NI_ENC_PARAM_ENABLE_ACQUIRE_LIMIT "enableAcqLimit"
2293#define NI_ENC_PARAM_GET_PSNR_MODE "getPsnrMode"
2294#define NI_ENC_PARAM_PSNR_INTERVAL "intervalOfPsnr"
2295#define NI_ENC_PARAM_CUSTOMIZE_ROI_QP_LEVEL "customizeQpLevel"
2296#define NI_ENC_PARAM_CUSTOMIZE_ROI_QP_MAP "customizeQpMapFile"
2297#define NI_ENC_PARAM_MOTION_CONSTRAINED_MODE "motionConstrainedMode"
2298#define NI_ENC_PARAM_ALLOCATE_STRAEGY "encMemAllocateStrategy"
2299#define NI_ENC_PARAM_SPATIAL_LAYERS "spatialLayers"
2300#define NI_ENC_PARAM_ENABLE_TIMECODE "enableTimecode"
2301#define NI_ENC_PARAM_SPATIAL_LAYERS_REF_BASE_LAYER "spatialLayersRefBaseLayer"
2302#define NI_ENC_PARAM_GET_RECONSTRUCTED_MODE "getReconstructedMode"
2303#define NI_ENC_PARAM_VBV_BUFFER_REENCODE "vbvBufferReencode"
2304#define NI_ENC_PARAM_TOTAL_CUTREE_DEPTH "totalCuTreeDepth"
2305#define NI_ENC_PARAM_ADAPTIVE_CUTREE "adaptiveCuTree"
2306#define NI_ENC_PARAM_PRE_INTRA_HANDLING "preIntraHandling"
2307#define NI_ENC_PARAM_BASE_LAYER_ONLY "baseLayerOnly"
2308#define NI_ENC_PARAM_PAST_FRAME_MAX_INTRA_RATIO "pastFrameMaxIntraRatio"
2309#define NI_ENC_PARAM_LINK_FRAME_MAX_INTRA_RATIO "linkFrameMaxIntraRatio"
2310#define NI_ENC_PARAM_SPATIAL_LAYER_BITRATE "spatialLayerBitrate"
2311#define NI_ENC_PARAM_DISABLE_AV1_TIMING_INFO "disableAv1TimingInfo"
2312#define NI_ENC_PARAM_AV1_OP_LEVEL "av1OpLevel"
2313#define NI_ENC_PARAM_ENABLE_CPU_AFFINITY "enableCpuAffinity"
2314#define NI_ENC_PARAM_PRESET "preset"
2315
2316 //----- Start supported by all codecs -----
2323 //----- End supported by all codecs -----
2324
2325 //----- Start supported by AV1, AVC, HEVC only -----
2328 //GOP Pattern
2330 /*!*< A GOP structure preset option (IPP, IBP, IBBP, IbBbP, use Custom GOP, etc) */ // 0-custom 1-I-only 2-IPPP 3-IBBB 4-IBP .....
2331
2332 // CUSTOM_GOP
2334
2341
2342 // HLG preferred transfer characteristics
2344
2347 int crf;
2371 //----- End supported by AV1, AVC, HEVC only -----
2372
2373 //----- Start supported by AVC, HEVC only -----
2374 //ConformanceWindowOffsets
2375 int conf_win_top; /*!*< A conformance window size of TOP */
2376 int conf_win_bottom; /*!*< A conformance window size of BOTTOM */
2377 int conf_win_left; /*!*< A conformance window size of LEFT */
2378 int conf_win_right; /*!*< A conformance window size of RIGHT */
2382 //----- End supported by AVC, HEVC only -----
2383
2384 //----- Start supported by AVC only -----
2386 //----- End supported by AVC only -----
2387
2388 //----- Start supported by HEVC only -----
2393 //----- End supported by HEVC only -----
2394
2395 //----- Start supported by JPEG only -----
2397 //----- End supported by JPEG only -----
2398
2399 //----- Start test use only -----
2403 //----- End test use only -----
2404
2405 //----- Start supported by AV1, AVC, HEVC only -----
2410 //----- End supported by AV1, AVC, HEVC only -----
2411
2412 //----- Start test use only -----
2415 //----- End test use only -----
2416
2417 //----- Start supported by AV1, AVC, HEVC only -----
2419 //----- End supported by AV1, AVC, HEVC only -----
2420
2421 //----- start DEPRECATED or for T408 -----
2423 //Preset Mode
2424 int use_recommend_enc_params; /*!*< 0: Custom, 1: Slow speed and best quality, 2: Normal Speed and quality, 3: Fast Speed and Low Quality */
2425 //Encode Options
2426 int cu_size_mode; /*!*< bit 0: enable 8x8 CU, bit 1: enable 16x16 CU, bit 2: enable 32x32 CU */
2427 int max_num_merge; /*!*< Maximum number of merge candidates (0~2) */
2428 int enable_dynamic_8x8_merge; /*!*< It enables dynamic merge 8x8 candidates. */
2429 int enable_dynamic_16x16_merge; /*!*< It enables dynamic merge 16x16 candidates. */
2430 int enable_dynamic_32x32_merge; /*!*< It enables dynamic merge 32x32 candidates. */
2431
2432 // Rev. B: H.264 only parameters, in ni_t408_config_t
2433 // - for H.264 on T408:
2437
2439 //----- end DEPRECATED or for T408 -----
2440
2441 struct //Rate control parameters
2442 {
2443 int enable_rate_control; /*!*< It enable rate control */
2444 int min_qp; /*!*< A minimum QP for rate control */ //8
2445 int max_qp; /*!*< A maximum QP for rate control */ //51
2449
2450 //no JPEG
2451 int enable_cu_level_rate_control; /*!*< It enable CU level rate control */
2452 int enable_hvs_qp; /*!*< It enable CU QP adjustment for subjective quality enhancement */
2453 int hvs_qp_scale; /*!*< A QP scaling factor for CU QP adjustment when hvcQpenable = 1 */
2457
2458 //deprecated
2459 int enable_hvs_qp_scale; /*!*< It enable QP scaling factor for CU QP adjustment when enable_hvs_qp = 1 */
2460 int max_delta_qp; /*!*< A maximum delta QP for rate control */ //10
2464 int keep_alive_timeout; /* keep alive timeout setting */
2478 float qcomp;
2482 float ipRatio;
2483 float pbRatio;
2490 // 0: no extra output encoder information
2491 // 1: Frame Level output encoder information
2492 // 2: Cu Level Output encoder information
2493 // 3: Frame&Cu Level encoder information
2494 // 6: 1-pass satd cost
2539
2541{
2542#define NI_DEC_PARAM_OUT "out"
2543#define NI_DEC_PARAM_ENABLE_OUT_1 "enableOut1"
2544#define NI_DEC_PARAM_ENABLE_OUT_2 "enableOut2"
2545#define NI_DEC_PARAM_FORCE_8BIT_0 "force8Bit0"
2546#define NI_DEC_PARAM_FORCE_8BIT_1 "force8Bit1"
2547#define NI_DEC_PARAM_FORCE_8BIT_2 "force8Bit2"
2548#define NI_DEC_PARAM_SEMI_PLANAR_0 "semiplanar0"
2549#define NI_DEC_PARAM_SEMI_PLANAR_1 "semiplanar1"
2550#define NI_DEC_PARAM_SEMI_PLANAR_2 "semiplanar2"
2551#define NI_DEC_PARAM_CROP_MODE_0 "cropMode0"
2552#define NI_DEC_PARAM_CROP_MODE_1 "cropMode1"
2553#define NI_DEC_PARAM_CROP_MODE_2 "cropMode2"
2554#define NI_DEC_PARAM_CROP_PARAM_0 "crop0"
2555#define NI_DEC_PARAM_CROP_PARAM_1 "crop1"
2556#define NI_DEC_PARAM_CROP_PARAM_2 "crop2"
2557#define NI_DEC_PARAM_SCALE_0 "scale0"
2558#define NI_DEC_PARAM_SCALE_1 "scale1"
2559#define NI_DEC_PARAM_SCALE_2 "scale2"
2560#define NI_DEC_PARAM_SCALE_0_LONG_SHORT_ADAPT "scale0LongShortAdapt"
2561#define NI_DEC_PARAM_SCALE_1_LONG_SHORT_ADAPT "scale1LongShortAdapt"
2562#define NI_DEC_PARAM_SCALE_2_LONG_SHORT_ADAPT "scale2LongShortAdapt"
2563#define NI_DEC_PARAM_SCALE_0_RES_CEIL "scale0ResCeil"
2564#define NI_DEC_PARAM_SCALE_1_RES_CEIL "scale1ResCeil"
2565#define NI_DEC_PARAM_SCALE_2_RES_CEIL "scale2ResCeil"
2566#define NI_DEC_PARAM_SCALE_0_ROUND "scale0Round"
2567#define NI_DEC_PARAM_SCALE_1_ROUND "scale1Round"
2568#define NI_DEC_PARAM_SCALE_2_ROUND "scale2Round"
2569#define NI_DEC_PARAM_MULTICORE_JOINT_MODE "multicoreJointMode"
2570#define NI_DEC_PARAM_SAVE_PKT "savePkt"
2571#define NI_DEC_PARAM_LOW_DELAY "lowDelay"
2572#define NI_DEC_PARAM_FORCE_LOW_DELAY "forceLowDelay"
2573#define NI_DEC_PARAM_MIN_PACKETS_DELAY "minPacketsDelay"
2574#define NI_DEC_PARAM_ENABLE_LOW_DELAY_CHECK "enableLowDelayCheck"
2575#define NI_DEC_PARAM_DISABLE_REORDER "disableReorder"
2576#define NI_DEC_PARAM_ENABLE_USR_DATA_SEI_PASSTHRU "enableUserDataSeiPassthru"
2577#define NI_DEC_PARAM_ENABLE_CUSTOM_SEI_PASSTHRU "customSeiPassthru"
2578#define NI_DEC_PARAM_SVC_T_DECODING_LAYER "svctDecodingLayer"
2579#define NI_DEC_PARAM_DDR_PRIORITY_MODE "ddrPriorityMode"
2580#define NI_DEC_PARAM_EC_POLICY "ecPolicy"
2581#define NI_DEC_PARAM_ENABLE_ADVANCED_EC "enableAdvancedEc"
2582#define NI_DEC_PARAM_ERROR_THRESHOLD "ecErrThreshold"
2583#define NI_DEC_PARAM_ENABLE_PPU_SCALE_ADAPT "enablePpuScaleAdapt"
2584#define NI_DEC_PARAM_ENABLE_PPU_SCALE_LIMIT "enablePpuScaleLimit"
2585#define NI_DEC_PARAM_MAX_EXTRA_HW_FRAME_CNT "maxExtraHwFrameCnt"
2586#define NI_DEC_PARAM_SKIP_PTS_GUESS "skipPtsGuess"
2587#define NI_DEC_PARAM_PKT_PTS_UNCHANGE "pktPtsUnchange"
2588#define NI_DEC_PARAM_ENABLE_ALL_SEI_PASSTHRU "enableAllSeiPassthru"
2589#define NI_DEC_PARAM_ENABLE_FOLLOW_IFRAME "enableFollowIFrame"
2590#define NI_DEC_PARAM_DISABLE_ADAPTIVE_BUFFERS "disableAdaptiveBuffers"
2591#define NI_DEC_PARAM_SURVIVE_STREAM_ERR "surviveStreamErr"
2592#define NI_DEC_PARAM_REDUCE_DPB_DELAY "reduceDpbDelay"
2593#define NI_DEC_PARAM_SKIP_EXTRA_HEADERS "skipExtraHeaders"
2594#define NI_DEC_PARAM_ENABLE_CPU_AFFINITY "enableCpuAffinity"
2595
2600 int nb_save_pkt; // number of decoder input packets to be saved
2607 1]; /*cut-out of expression to be parsed*/
2611 1]; /*cut-out of expression to be parsed*/
2612 int keep_alive_timeout; /* keep alive timeout setting */
2613 // decoder lowDelay mode for All I packets or IPPP packets
2622 int enable_ppu_scale_adapt; // 0: disabled; 1: adapt to long edge; 2: adapt to short edge.
2629 // 0: disabled; 1: adapt to long edge; 2: adapt to short edge.
2632 int scale_round[NI_MAX_NUM_OF_DECODER_OUTPUTS]; // 0 up align 1 dowm align
2641
2663
2672
2674{
2675 uint32_t start_x;
2676 uint32_t start_y;
2677 uint32_t end_x;
2678 uint32_t end_y;
2679 uint32_t rgba_c;
2681
2689
2694
2698
2699typedef struct _ni_iovec {
2700 uint32_t size;
2701 void *ptr;
2703
2704typedef struct _ni_frame
2705{
2706 // codec of the source from which this frame is decoded
2708
2709 long long dts;
2710 long long pts;
2713 uint32_t video_width;
2715
2716 uint32_t crop_top;
2717 uint32_t crop_bottom;
2718 uint32_t crop_left;
2719 uint32_t crop_right;
2720
2721 // for encoder: force headers on this frame
2723 // for encoder: control long term reference picture feature
2726
2728 // for encoding: frame picture type sent to encoder
2729 // for decoding: frame picture type returned from decoder
2731 // total SEI size: used by encoder
2732 unsigned int sei_total_len;
2733
2734 // SEI info of closed caption: returned by decoder or set by encoder
2735 unsigned int sei_cc_offset;
2736 unsigned int sei_cc_len;
2737 // SEI info of HDR: returned by decoder
2742 // SEI info of HDR10+: returned by decoder
2744 unsigned int sei_hdr_plus_len;
2745 // SEI info of User Data Unregistered SEI: returned by decoder
2748 // SEI info of alternative transfer characteristics: returned by decoder
2751 // VUI info: returned by decoder
2752 unsigned int vui_offset;
2753 unsigned int vui_len;
2754
2755 // ROI data length: for encoder
2756 unsigned int roi_len;
2757 // reconfig data length: for encoder
2758 unsigned int reconf_len;
2759 // total extra data data length: for encoder
2760 unsigned int extra_data_len;
2761 // force pic qp value
2763 // frame chunk index
2765
2768
2769 uint8_t *p_buffer;
2770 uint32_t buffer_size;
2771
2772 ni_buf_t
2773 *dec_buf; // buffer pool entry (has memory pointed to by p_buffer)
2776
2778
2779 // frame auxiliary data
2782
2783 // the following info is of the source stream that is returned by decoder:
2784 // color info, sample aspect ratio, timing etc that are useful at encoding.
2786 uint8_t color_trc;
2790 uint16_t sar_width;
2791 uint16_t sar_height;
2794
2795 int flags; // flags of demuxed packet
2796
2797 // for encoder: metadata buffer info if not contiguous with YUV
2800 // for encoder: whether metadata should be sent separately for frame
2802 uint64_t pkt_pos;
2803
2804 // for encoder: non-4k-aligned part at the start of YUV data
2809 // for encoder: whether the start of non-4k-aligned YUV data should be sent separately for frame
2812 long long orignal_pts;
2813 uint32_t error_ratio;
2814
2815 //for AI non-4k-aligned memory buffer
2816 uint32_t iovec_num;
2818
2819 // offset to be adjusted in FW for zero copy - obtain from ni_encoder_frame_zerocopy_adjust
2822
2823typedef struct _ni_xcoder_params
2824{
2825 int log;
2827 /* Numerator and denominator of frame rate */
2828 uint32_t fps_number;
2830 /* Width (in pixels) of the source pictures. If this width is not an even
2831 * multiple of 4, the encoder will pad the pictures internally to meet this
2832 * minimum requirement. All valid HEVC widths are supported */
2834
2835 /* Height (in pixels) of the source pictures. If this height is not an even
2836 * multiple of 4, the encoder will pad the pictures internally to meet this
2837 * minimum requirement. All valid HEVC heights are supported */
2840 int roi_demo_mode; // for encoder ROI testing
2841 int reconf_demo_mode; // for encoder reconfiguration testing
2842 int force_pic_qp_demo_mode; // for force pic qp mode testing
2843 int low_delay_mode; // encoder low latency mode
2844 int padding; // encoder input padding setting
2845 int generate_enc_hdrs; // in libavcodec, open a dummy session to generate codec headers during init
2846 int use_low_delay_poc_type; // specifies the encoder to set
2847 // picture_order_count_type=2 in the H.264 SPS
2848
2850
2851 // 1: force on every frame with same input type; 0: no (except for I-frame)
2853
2856
2857 int cacheRoi; // enables caching of ROIs applied to subsequent frames
2858
2859#ifndef DEPRECATION_AS_ERROR
2861 NI_DEPRECATED uint32_t
2866#endif
2867
2874
2875 union
2876 {
2879 };
2880
2881 // for encoder reconfiguration testing, saving key:val1,val2,val3,...val9
2882 // (max 9 values) in the demo reconfig data file this supports max 50000
2883 // lines in reconfig file, max 10 key/values per line
2889
2890 int enable_vfr; //enable the vfr
2891
2905
2906typedef struct _niFrameSurface1
2907{
2908 uint16_t ui16FrameIdx; //frame location on device
2909 uint16_t ui16session_ID; //for instance tracking
2910 uint16_t ui16width; // width on device
2911 uint16_t ui16height; // height on device
2912 uint32_t ui32nodeAddress; //currently not in use, formerly offset
2913 int32_t device_handle; //handle to access device
2914 int8_t bit_depth; //1 == 8bit per pixel, 2 == 10bit
2915 int8_t encoding_type; //0 = semiplanar, 1 = planar, 2 = tiled4x4
2916 int8_t output_idx; // 0-2 for decoder output index
2917 int8_t src_cpu; // frame origin location
2918 int32_t dma_buf_fd; // P2P dma buffer file descriptor
2920
2921typedef struct _ni_frame_config
2922{
2926 uint16_t options;
2931 uint32_t rgba_color;
2932 uint16_t frame_index;
2933 uint16_t session_id;
2935 uint8_t orientation; // 0 <= n <= 3, (n * 90°) clockwise rotation
2937
2938
2939// bitstream features related definitions
2947
2955
2963
2971
2979
2985
2991
2996
2997typedef enum
2998{
3001
3002typedef struct _ni_packet
3003{
3004 long long dts;
3005 long long pts;
3006 long long pos;
3007 uint64_t pkt_pos;
3010 uint32_t video_width;
3012 uint32_t frame_type; // encoding only 0=I, 1=P, 2=B
3014 void* p_data;
3015 uint32_t data_len;
3017
3019 uint32_t buffer_size;
3020 uint32_t avg_frame_qp; // average frame QP reported by VPU
3027
3028 int flags; // flags of demuxed packet
3029
3031
3032 double psnr_y;
3033 double psnr_u;
3034 double psnr_v;
3036 double ssim_y;
3037 double ssim_u;
3038 double ssim_v;
3042
3052
3059typedef enum _ni_device_mode{
3060 NI_DEVICE_READ_ONLY = 0x0001, /* Read-only access */
3061 NI_DEVICE_WRITE_ONLY = 0x0002, /* Write-only access */
3062 NI_DEVICE_READ_WRITE = 0x0003 /* Read-write access */
3064
3065#define NI_XCODER_PRESET_NAMES_ARRAY_LEN 7
3066#define NI_XCODER_LOG_NAMES_ARRAY_LEN 7
3067
3068#define NI_XCODER_PRESET_NAME_NONE "none"
3069#define NI_XCODER_PRESET_NAME_VERYFAST "veryfast"
3070#define NI_XCODER_PRESET_NAME_FASTER "faster"
3071#define NI_XCODER_PRESET_NAME_FAST "fast"
3072#define NI_XCODER_PRESET_NAME_MEDIUM "medium"
3073#define NI_XCODER_PRESET_NAME_SLOW "slow"
3074#define NI_XCODER_PRESET_NAME_SLOWER "slower"
3075#define NI_XCODER_PRESET_NAME_VERYSLOW "veryslow"
3076
3077#define NI_XCODER_LOG_NAME_NONE "none"
3078#define NI_XCODER_LOG_NAME_ERROR "error"
3079#define NI_XCODER_LOG_NAME_WARN "warning"
3080#define NI_XCODER_LOG_NAME_INFO "info"
3081#define NI_XCODER_LOG_NAME_DEBUG "debug"
3082#define NI_XCODER_LOG_NAME_FULL "full"
3083
3086
3087/*!*****************************************************************************
3088 * \brief Allocate and initialize a new ni_session_context_t struct
3089 *
3090 *
3091 * \return On success returns a valid pointer to newly allocated context
3092 * On failure returns NULL
3093 ******************************************************************************/
3095
3096/*!*****************************************************************************
3097 * \brief Initialize already allocated session context to a known state
3098 *
3099 * \param[in] p_ctx Pointer to an already allocated ni_session_context_t
3100 * struct
3101 *
3102 * \return On success
3103 * NI_RETCODE_SUCCESS
3104 * On failure
3105 * NI_RETCODE_INVALID_PARAM
3106 * NI_RETCODE_FAILURE
3107 ******************************************************************************/
3110
3111/*!*****************************************************************************
3112 * \brief Clear already allocated session context
3113 *
3114 * \param[in] p_ctx Pointer to an already allocated ni_session_context_t
3115 *
3116 *
3117 ******************************************************************************/
3119
3120/*!*****************************************************************************
3121 * \brief Free previously allocated session context
3122 *
3123 * \param[in] p_ctx Pointer to an already allocated ni_session_context_t
3124 * struct
3125 *
3126 ******************************************************************************/
3128
3129/*!*****************************************************************************
3130 * \brief Create event and return event handle if successful (Windows only)
3131 *
3132 * \return On success returns a event handle
3133 * On failure returns NI_INVALID_EVENT_HANDLE
3134 ******************************************************************************/
3135LIB_API ni_event_handle_t ni_create_event(void);
3136
3137/*!*****************************************************************************
3138 * \brief Close event and release resources (Windows only)
3139 *
3140 * \return NONE
3141 *
3142 ******************************************************************************/
3143LIB_API void ni_close_event(ni_event_handle_t event_handle);
3144
3145#ifndef DEPRECATION_AS_ERROR
3146/*!*****************************************************************************
3147 * \brief Open device and return device device_handle if successful
3148 *
3149 * \param[in] p_dev Device name represented as c string. ex: "/dev/nvme0"
3150 * \param[out] p_max_io_size_out Maximum IO Transfer size supported
3151 *
3152 * \return On success returns a device device_handle
3153 * On failure returns NI_INVALID_DEVICE_HANDLE
3154 ******************************************************************************/
3155LIB_API NI_DEPRECATED ni_device_handle_t ni_device_open(const char *dev,
3156 uint32_t *p_max_io_size_out);
3157#endif
3158
3159/*!*****************************************************************************
3160 * \brief Open device and return device device_handle if successful
3161 *
3162 * \param[in] p_dev Device name represented as c string. ex: "/dev/nvme0"
3163 * \param[in] mode Device configuration parameters
3164 *
3165 * \return On success returns a device device_handle
3166 * On failure returns NI_INVALID_DEVICE_HANDLE
3167 ******************************************************************************/
3168LIB_API ni_device_handle_t ni_device_open2(const char *dev,
3169 ni_device_mode_t mode);
3170
3171/*!*****************************************************************************
3172 * \brief Close device and release resources
3173 *
3174 * \param[in] device_handle Device handle obtained by calling ni_device_open()
3175 *
3176 * \return NONE
3177 *
3178 ******************************************************************************/
3179LIB_API void ni_device_close(ni_device_handle_t dev);
3180
3181#ifndef DEPRECATION_AS_ERROR
3182/*!*****************************************************************************
3183 * \brief Query device and return device capability structure
3184 * This function had been replaced by ni_device_capability_query2
3185 * This function can't be callback in multi thread
3186 *
3187 * \param[in] device_handle Device handle obtained by calling ni_device_open
3188 * \param[in] p_cap Pointer to a caller allocated ni_device_capability_t
3189 * struct
3190 * \return On success
3191 * NI_RETCODE_SUCCESS
3192 * On failure
3193 * NI_RETCODE_INVALID_PARAM
3194 * NI_RETCODE_ERROR_MEM_ALOC
3195 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3196 ******************************************************************************/
3198 ni_device_handle_t device_handle, ni_device_capability_t *p_cap);
3199#endif
3200
3201/*!*****************************************************************************
3202 * \brief Query device and return device capability structure
3203 * This function had replaced ni_device_capability_query
3204 * This function can be callback with multi thread
3205 *
3206 * \param[in] device_handle Device handle obtained by calling ni_device_open
3207 * \param[in] p_cap Pointer to a caller allocated ni_device_capability_t
3208 * struct
3209 * \param[in] device_in_ctxt If device is in ctx
3210 * \return On success
3211 * NI_RETCODE_SUCCESS
3212 * On failure
3213 * NI_RETCODE_INVALID_PARAM
3214 * NI_RETCODE_ERROR_MEM_ALOC
3215 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3216 ******************************************************************************/
3217LIB_API ni_retcode_t ni_device_capability_query2(ni_device_handle_t device_handle,
3218 ni_device_capability_t *p_cap, bool device_in_ctxt);
3219
3220/*!*****************************************************************************
3221 * \brief Open a new device session depending on the device_type parameter
3222 * If device_type is NI_DEVICE_TYPE_DECODER opens decoding session
3223 * If device_type is NI_DEVICE_TYPE_ENCODER opens encoding session
3224 * If device_type is NI_DEVICE_TYPE_SCALER opens scaling session
3225 *
3226 * \param[in] p_ctx Pointer to a caller allocated
3227 * ni_session_context_t struct
3228 * \param[in] device_type NI_DEVICE_TYPE_DECODER, NI_DEVICE_TYPE_ENCODER,
3229 * or NI_DEVICE_TYPE_SCALER
3230 * \return On success
3231 * NI_RETCODE_SUCCESS
3232 * On failure
3233 * NI_RETCODE_INVALID_PARAM
3234 * NI_RETCODE_ERROR_MEM_ALOC
3235 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3236 * NI_RETCODE_ERROR_INVALID_SESSION
3237 ******************************************************************************/
3239 ni_device_type_t device_type);
3240
3241/*!*****************************************************************************
3242 * \brief Close device session that was previously opened by calling
3243 * ni_device_session_open()
3244 * If device_type is NI_DEVICE_TYPE_DECODER closes decoding session
3245 * If device_type is NI_DEVICE_TYPE_ENCODER closes encoding session
3246 * If device_type is NI_DEVICE_TYPE_SCALER closes scaling session
3247 *
3248 * \param[in] p_ctx Pointer to a caller allocated
3249 * ni_session_context_t struct
3250 * \param[in] eos_received Flag indicating if End Of Stream indicator was
3251 * received
3252 * \param[in] device_type NI_DEVICE_TYPE_DECODER, NI_DEVICE_TYPE_ENCODER,
3253 * or NI_DEVICE_TYPE_SCALER
3254 * \return On success
3255 * NI_RETCODE_SUCCESS
3256 * On failure
3257 * NI_RETCODE_INVALID_PARAM
3258 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3259 * NI_RETCODE_ERROR_INVALID_SESSION
3260 ******************************************************************************/
3262 int eos_received,
3263 ni_device_type_t device_type);
3264
3265/*!*****************************************************************************
3266 * \brief Send a flush command to the device
3267 * If device_type is NI_DEVICE_TYPE_DECODER sends EOS command to
3268 * decoder
3269 * If device_type is NI_DEVICE_TYPE_ENCODER sends EOS command to
3270 * encoder
3271 *
3272 * \param[in] p_ctx Pointer to a caller allocated
3273 * ni_session_context_t struct
3274 * \param[in] device_type NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
3275 * \return On success
3276 * NI_RETCODE_SUCCESS
3277 * On failure
3278 * NI_RETCODE_INVALID_PARAM
3279 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3280 * NI_RETCODE_ERROR_INVALID_SESSION
3281 ******************************************************************************/
3283 ni_device_type_t device_type);
3284
3285/*!*****************************************************************************
3286 * \brief Save a stream's headers in a decoder session that can be used later
3287 * for continuous decoding from the same source.
3288 *
3289 * \param[in] p_ctx Pointer to a caller allocated
3290 * ni_session_context_t struct
3291 * \param[in] hdr_data Pointer to header data
3292 * \param[in] hdr_size Size of header data in bytes
3293 * \return On success
3294 * NI_RETCODE_SUCCESS
3295 * On failure
3296 * NI_RETCODE_INVALID_PARAM
3297 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3298 * NI_RETCODE_ERROR_INVALID_SESSION
3299 ******************************************************************************/
3301 ni_session_context_t *p_ctx, uint8_t *hdr_data, uint8_t hdr_size);
3302
3303/*!*****************************************************************************
3304 * \brief Flush a decoder session to get ready to continue decoding.
3305 * Note: this is different from ni_device_session_flush in that it closes the
3306 * current decode session and opens a new one for continuous decoding.
3307 *
3308 * \param[in] p_ctx Pointer to a caller allocated
3309 * ni_session_context_t struct
3310 * \return On success
3311 * NI_RETCODE_SUCCESS
3312 * On failure
3313 * NI_RETCODE_INVALID_PARAM
3314 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3315 * NI_RETCODE_ERROR_INVALID_SESSION
3316 ******************************************************************************/
3318
3319/*!*****************************************************************************
3320 * \brief Send data to the device
3321 * If device_type is NI_DEVICE_TYPE_DECODER sends data packet to
3322 * decoder
3323 * If device_type is NI_DEVICE_TYPE_ENCODER sends data frame to encoder
3324 * If device_type is NI_DEVICE_TYPE_AI sends data frame to AI engine
3325 *
3326 * \param[in] p_ctx Pointer to a caller allocated
3327 * ni_session_context_t struct
3328 * \param[in] p_data Pointer to a caller allocated
3329 * ni_session_data_io_t struct which contains either a
3330 * ni_frame_t data frame or ni_packet_t data packet to
3331 * send
3332 * \param[in] device_type NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER or
3333 * NI_DEVICE_TYPE_AI
3334 * If NI_DEVICE_TYPE_DECODER is specified, it is
3335 * expected that the ni_packet_t struct inside the
3336 * p_data pointer contains data to send.
3337 * If NI_DEVICE_TYPE_ENCODER or NI_DEVICE_TYPE_AI is
3338 * specified, it is expected that the ni_frame_t
3339 * struct inside the p_data pointer contains data to
3340 * send.
3341 * \return On success
3342 * Total number of bytes written
3343 * On failure
3344 * NI_RETCODE_INVALID_PARAM
3345 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3346 * NI_RETCODE_ERROR_INVALID_SESSION
3347 ******************************************************************************/
3349 ni_session_data_io_t *p_data,
3350 ni_device_type_t device_type);
3351
3352/*!*****************************************************************************
3353 * \brief Read data from the device
3354 * If device_type is NI_DEVICE_TYPE_DECODER reads data packet from
3355 * decoder
3356 * If device_type is NI_DEVICE_TYPE_ENCODER reads data frame from
3357 * encoder
3358 * If device_type is NI_DEVICE_TYPE_AI reads data frame from AI engine
3359 *
3360 * \param[in] p_ctx Pointer to a caller allocated
3361 * ni_session_context_t struct
3362 * \param[in] p_data Pointer to a caller allocated ni_session_data_io_t
3363 * struct which contains either a ni_frame_t data frame
3364 * or ni_packet_t data packet to send
3365 * \param[in] device_type NI_DEVICE_TYPE_DECODER, NI_DEVICE_TYPE_ENCODER, or
3366 * NI_DEVICE_TYPE_SCALER
3367 * If NI_DEVICE_TYPE_DECODER is specified, data that
3368 * was read will be placed into ni_frame_t struct
3369 * inside the p_data pointer
3370 * If NI_DEVICE_TYPE_ENCODER is specified, data that
3371 * was read will be placed into ni_packet_t struct
3372 * inside the p_data pointer
3373 * If NI_DEVICE_TYPE_AI is specified, data that was
3374 * read will be placed into ni_frame_t struct inside
3375 * the p_data pointer
3376 * \return On success
3377 * Total number of bytes read
3378 * On failure
3379 * NI_RETCODE_INVALID_PARAM
3380 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3381 * NI_RETCODE_ERROR_INVALID_SESSION
3382 ******************************************************************************/
3384 ni_session_data_io_t *p_data,
3385 ni_device_type_t device_type);
3386
3387/*!*****************************************************************************
3388 * \brief Query session data from the device -
3389 * If device_type is valid, will query session data
3390 * from specified device type
3391 *
3392 * \param[in] p_ctx Pointer to a caller allocated
3393 * ni_session_context_t struct
3394 * \param[in] device_type NI_DEVICE_TYPE_DECODER or
3395 * NI_DEVICE_TYPE_ENCODER or
3396 * NI_DEVICE_TYPE_SCALER or
3397 * NI_DEVICE_TYPE_AI or
3398 * NI_DEVICE_TYPE_UPLOADER
3399 *
3400 * \return On success
3401 * NI_RETCODE_SUCCESS
3402 * On failure
3403 * NI_RETCODE_INVALID_PARAM
3404 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3405 * NI_RETCODE_ERROR_INVALID_SESSION
3406 ******************************************************************************/
3408 ni_device_type_t device_type);
3409/*!*****************************************************************************
3410 * \brief Query detail session data from the device -
3411 * If device_type is valid, will query session data
3412 * from specified device type
3413 *
3414 * \param[in] p_ctx Pointer to a caller allocated
3415 * ni_session_context_t struct
3416 * \param[in] device_type NI_DEVICE_TYPE_DECODER or
3417 * NI_DEVICE_TYPE_ENCODER or
3418 *
3419 * \return On success
3420 * NI_RETCODE_SUCCESS
3421 * On failure
3422 * NI_RETCODE_INVALID_PARAM
3423 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3424 * NI_RETCODE_ERROR_INVALID_SESSION
3425 ******************************************************************************/
3427 ni_device_type_t device_type, ni_instance_mgr_detail_status_t *detail_data);
3428
3429/*!*****************************************************************************
3430 * \brief Query detail session data from the device -
3431 * If device_type is valid, will query session data
3432 * from specified device type
3433 *
3434 * \param[in] p_ctx Pointer to a caller allocated
3435 * ni_session_context_t struct
3436 * \param[in] device_type NI_DEVICE_TYPE_DECODER or
3437 * NI_DEVICE_TYPE_ENCODER or
3438 *
3439 * \return On success
3440 * NI_RETCODE_SUCCESS
3441 * On failure
3442 * NI_RETCODE_INVALID_PARAM
3443 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3444 * NI_RETCODE_ERROR_INVALID_SESSION
3445 ******************************************************************************/
3447
3448/*!*****************************************************************************
3449 * \brief Send namespace num and SRIOv index to the device with specified logic block
3450 * address.
3451 *
3452 * \param[in] device_handle Device handle obtained by calling ni_device_open
3453 * \param[in] namespace_num Set the namespace number with designated sriov
3454 * \param[in] sriov_index Identify which sriov need to be set
3455 *
3456 * \return On success
3457 * NI_RETCODE_SUCCESS
3458 * On failure
3459 * NI_RETCODE_ERROR_MEM_ALOC
3460 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3461 ******************************************************************************/
3462LIB_API ni_retcode_t ni_device_config_namespace_num(ni_device_handle_t device_handle,
3463 uint32_t namespace_num, uint32_t sriov_index);
3464
3465/*!*****************************************************************************
3466 * \brief Send qos mode to the device with specified logic block
3467 * address.
3468 *
3469 * \param[in] device_handle Device handle obtained by calling ni_device_open
3470 * \param[in] mode The requested qos mode
3471 *
3472 * \return On success
3473 * NI_RETCODE_SUCCESS
3474 * On failure
3475 * NI_RETCODE_ERROR_MEM_ALOC
3476 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3477 ******************************************************************************/
3478LIB_API ni_retcode_t ni_device_config_qos(ni_device_handle_t device_handle,
3479 uint32_t mode);
3480
3481 /*!*****************************************************************************
3482 * \brief Send qos over provisioning mode to target namespace with specified logic
3483 * block address.
3484 *
3485 * \param[in] device_handle Device handle obtained by calling ni_device_open
3486 * \param[in] device_handle_t Target device handle of namespace required for OP
3487 * \param[in] over_provision The request overprovision percent
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_qos_op(ni_device_handle_t device_handle,
3496 ni_device_handle_t device_handle_t,
3497 uint32_t over_provision);
3498
3499/*!*****************************************************************************
3500 * \brief Allocate preliminary memory for the frame buffer based on provided
3501 * parameters. Applicable to YUV420 Planar pixel (8 or 10 bit/pixel)
3502 * format or 32-bit RGBA.
3503 *
3504 * \param[in] p_frame Pointer to a caller allocated
3505 * ni_frame_t struct
3506 * \param[in] video_width Width of the video frame
3507 * \param[in] video_height Height of the video frame
3508 * \param[in] alignment Allignment requirement
3509 * \param[in] metadata_flag Flag indicating if space for additional metadata
3510 * should be allocated
3511 * \param[in] factor 1 for 8 bits/pixel format, 2 for 10 bits/pixel,
3512 * 4 for 32 bits/pixel (RGBA)
3513 * \param[in] hw_frame_count Number of hw descriptors stored in lieu of raw YUV
3514 * \param[in] is_planar 0 if semiplanar else planar
3515 *
3516 * \return On success
3517 * NI_RETCODE_SUCCESS
3518 * On failure
3519 * NI_RETCODE_INVALID_PARAM
3520 * NI_RETCODE_ERROR_MEM_ALOC
3521 ******************************************************************************/
3522LIB_API ni_retcode_t ni_frame_buffer_alloc(ni_frame_t *p_frame, int video_width,
3523 int video_height, int alignment,
3524 int metadata_flag, int factor,
3525 int hw_frame_count, int is_planar);
3526
3527/*!*****************************************************************************
3528 * \brief Wrapper function for ni_frame_buffer_alloc. Meant to handle RGBA min.
3529 * resoulution considerations for encoder.
3530 *
3531 * \param[in] p_frame Pointer to a caller allocated
3532 * ni_frame_t struct
3533 * \param[in] video_width Width of the video frame
3534 * \param[in] video_height Height of the video frame
3535 * \param[in] alignment Allignment requirement
3536 * \param[in] metadata_flag Flag indicating if space for additional metadata
3537 * should be allocated
3538 * \param[in] factor 1 for 8 bits/pixel format, 2 for 10 bits/pixel,
3539 * 4 for 32 bits/pixel (RGBA)
3540 * \param[in] hw_frame_count Number of hw descriptors stored
3541 * \param[in] is_planar 0 if semiplanar else planar
3542 * \param[in] pix_fmt pixel format to distinguish between planar types
3543 * and/or components
3544 *
3545 * \return On success
3546 * NI_RETCODE_SUCCESS
3547 * On failure
3548 * NI_RETCODE_INVALID_PARAM
3549 * NI_RETCODE_ERROR_MEM_ALOC
3550 ******************************************************************************/
3552 int video_height, int alignment,
3553 int metadata_flag, int factor,
3554 int hw_frame_count, int is_planar,
3555 ni_pix_fmt_t pix_fmt);
3556
3558 int video_width, int video_height,
3559 int pixel_format);
3560
3561/*!*****************************************************************************
3562 * \brief Allocate memory for decoder frame buffer based on provided
3563 * parameters; the memory is retrieved from a buffer pool and will be
3564 * returned to the same buffer pool by ni_decoder_frame_buffer_free.
3565 * Note: all attributes of ni_frame_t will be set up except for memory and
3566 * buffer, which rely on the pool being allocated; the pool will be
3567 * allocated only after the frame resolution is known.
3568 *
3569 * \param[in] p_pool Buffer pool to get the memory from
3570 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
3571 * \param[in] alloc_mem Whether to get memory from buffer pool
3572 * \param[in] video_width Width of the video frame
3573 * \param[in] video_height Height of the video frame
3574 * \param[in] alignment Alignment requirement
3575 * \param[in] factor 1 for 8 bits/pixel format, 2 for 10 bits/pixel
3576 * \param[in] is_planar 0 if semiplanar else planar
3577 *
3578 * \return On success
3579 * NI_RETCODE_SUCCESS
3580 * On failure
3581 * NI_RETCODE_INVALID_PARAM
3582 * NI_RETCODE_ERROR_MEM_ALOC
3583 ******************************************************************************/
3585 ni_buf_pool_t *p_pool, ni_frame_t *pframe, int alloc_mem, int video_width,
3586 int video_height, int alignment, int factor, int is_planar);
3587
3588/*!*****************************************************************************
3589 * \brief Allocate memory for the frame buffer for encoding based on given
3590 * parameters, taking into account pic line size and extra data.
3591 * Applicable to YUV420p AVFrame only. 8 or 10 bit/pixel.
3592 * Cb/Cr size matches that of Y.
3593 *
3594 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
3595 *
3596 * \param[in] video_width Width of the video frame
3597 * \param[in] video_height Height of the video frame
3598 * \param[in] linesize Picture line size
3599 * \param[in] alignment Allignment requirement
3600 * \param[in] extra_len Extra data size (incl. meta data). < 0 means not
3601 * to allocate any buffer (zero-copy from existing)
3602 * \param[in] alignment_2pass_wa set alignment to work with 2pass encode
3603 *
3604 * \return On success
3605 * NI_RETCODE_SUCCESS
3606 * On failure
3607 * NI_RETCODE_INVALID_PARAM
3608 * NI_RETCODE_ERROR_MEM_ALOC
3609 *****************************************************************************/
3611 ni_frame_t *pframe, int video_width, int video_height, int linesize[],
3612 int alignment, int extra_len, bool alignment_2pass_wa);
3613
3615 ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params,
3616 niFrameSurface1_t *p_surface);
3617
3619 ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params,
3620 niFrameSurface1_t *p_src_surface);
3621
3623 ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params);
3624
3625/*!*****************************************************************************
3626* \brief Allocate memory for the frame buffer based on provided parameters
3627* taking into account pic line size and extra data.
3628* Applicable to nv12 AVFrame only. Cb/Cr size matches that of Y.
3629*
3630* \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
3631*
3632* \param[in] video_width Width of the video frame
3633* \param[in] video_height Height of the video frame
3634* \param[in] linesize Picture line size
3635* \param[in] extra_len Extra data size (incl. meta data). < 0 means not
3636* to allocate any buffer (zero-copy from existing)
3637* \param[in] alignment_2pass_wa set alignment to work with 2pass encode
3638*
3639* \return On success
3640* NI_RETCODE_SUCCESS
3641* On failure
3642* NI_RETCODE_INVALID_PARAM
3643* NI_RETCODE_ERROR_MEM_ALOC
3644*****************************************************************************/
3646 int video_width, int video_height,
3647 int linesize[], int extra_len,
3648 bool alignment_2pass_wa);
3649
3650/*!*****************************************************************************
3651 * \brief This API is a wrapper for ni_encoder_frame_buffer_alloc(), used
3652 * for planar pixel formats, and ni_frame_buffer_alloc_nv(), used for
3653 * semi-planar pixel formats. This API is meant to combine the
3654 * functionality for both formats.
3655 * Allocate memory for the frame buffer for encoding based on given
3656 * parameters, taking into account pic line size and extra data.
3657 * Applicable to YUV420p(8 or 10 bit/pixel) or nv12 AVFrame.
3658 * Cb/Cr size matches that of Y.
3659 *
3660 * \param[in] planar true: if planar:
3661 * pixel_format == (NI_PIX_FMT_YUV420P ||
3662 * NI_PIX_FMT_YUV420P10LE ||NI_PIX_FMT_RGBA).
3663 * false: semi-planar:
3664 * pixel_format == (NI_PIX_FMT_NV12 ||
3665 * NI_PIX_FMT_P010LE).
3666 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
3667 * \param[in] video_width Width of the video frame
3668 * \param[in] video_height Height of the video frame
3669 * \param[in] linesize Picture line size
3670 * \param[in] alignment Allignment requirement. Only used for planar format.
3671 * \param[in] extra_len Extra data size (incl. meta data). < 0 means not
3672 * to allocate any buffer (zero-copy from existing)
3673 * \param[in] alignment_2pass_wa set alignment to work with 2pass encode
3674 *
3675 * \return On success
3676 * NI_RETCODE_SUCCESS
3677 * On failure
3678 * NI_RETCODE_INVALID_PARAM
3679 * NI_RETCODE_ERROR_MEM_ALOC
3680 *****************************************************************************/
3682 int video_width, int video_height,
3683 int linesize[], int alignment,
3684 int extra_len,
3685 bool alignment_2pass_wa);
3686
3687/*!*****************************************************************************
3688 * \brief Free frame buffer that was previously allocated with either
3689 * ni_frame_buffer_alloc or ni_encoder_frame_buffer_alloc or
3690 * ni_frame_buffer_alloc_nv
3691 *
3692 * \param[in] p_frame Pointer to a previously allocated ni_frame_t struct
3693 *
3694 * \return On success NI_RETCODE_SUCCESS
3695 * On failure NI_RETCODE_INVALID_PARAM
3696 ******************************************************************************/
3698
3699/*!*****************************************************************************
3700 * \brief Free decoder frame buffer that was previously allocated with
3701 * ni_decoder_frame_buffer_alloc, returning memory to a buffer pool.
3702 *
3703 * \param[in] p_frame Pointer to a previously allocated ni_frame_t struct
3704 *
3705 * \return On success NI_RETCODE_SUCCESS
3706 * On failure NI_RETCODE_INVALID_PARAM
3707 ******************************************************************************/
3709
3710/*!*****************************************************************************
3711 * \brief Return a memory buffer to memory buffer pool, for a decoder frame.
3712 *
3713 * \param[in] buf Buffer to be returned.
3714 * \param[in] p_buffer_pool Buffer pool to return buffer to.
3715 *
3716 * \return None
3717 ******************************************************************************/
3718LIB_API void
3720 ni_buf_pool_t *p_buffer_pool);
3721
3722/*!*****************************************************************************
3723 * \brief Allocate memory for the packet buffer based on provided packet size
3724 *
3725 * \param[in] p_packet Pointer to a caller allocated
3726 * ni_packet_t struct
3727 * \param[in] packet_size Required allocation size
3728 *
3729 * \return On success
3730 * NI_RETCODE_SUCCESS
3731 * On failure
3732 * NI_RETCODE_INVALID_PARAM
3733 * NI_RETCODE_ERROR_MEM_ALOC
3734 ******************************************************************************/
3736 int packet_size);
3737
3738/*!*****************************************************************************
3739 * \brief Allocate packet buffer using a user provided pointer, the memory
3740 * is expected to have already been allocated.
3741 *
3742 * For ideal performance memory should be 4k aligned. If it is not 4K aligned
3743 * then a temporary 4k aligned memory will be used to copy data to and from
3744 * when writing and reading. This will negatively impact performance.
3745 *
3746 * This API will overwrite p_packet->buffer_size, p_packet->p_buffer and
3747 * p_packet->p_data fields in p_packet.
3748 *
3749 * This API will not free any memory associated with p_packet->p_buffer and
3750 * p_packet->p_data fields in p_packet.
3751 * Common use case could be,
3752 * 1. Allocate memory to pointer
3753 * 2. Call ni_custom_packet_buffer_alloc() with allocated pointer.
3754 * 3. Use p_packet as required.
3755 * 4. Call ni_packet_buffer_free() to free up the memory.
3756 *
3757 * \param[in] p_buffer User provided pointer to be used for buffer
3758 * \param[in] p_packet Pointer to a caller allocated
3759 * ni_packet_t struct
3760 * \param[in] buffer_size Buffer size
3761 *
3762 * \return On success
3763 * NI_RETCODE_SUCCESS
3764 * On failure
3765 * NI_RETCODE_INVALID_PARAM
3766 * NI_RETCODE_ERROR_MEM_ALOC
3767 ******************************************************************************/
3769 ni_packet_t *p_packet,
3770 int buffer_size);
3771
3772/*!*****************************************************************************
3773 * \brief Free packet buffer that was previously allocated with
3774 * ni_packet_buffer_alloc
3775 *
3776 * \param[in] p_packet Pointer to a previously allocated ni_packet_t struct
3777 *
3778 * \return On success NI_RETCODE_SUCCESS
3779 * On failure NI_RETCODE_INVALID_PARAM
3780 ******************************************************************************/
3782
3783/*!*****************************************************************************
3784 * \brief Free packet buffer that was previously allocated with
3785 * ni_packet_buffer_alloc for AV1 packets merge
3786 *
3787 * \param[in] p_packet Pointer to a previously allocated ni_packet_t struct
3788 *
3789 * \return On success NI_RETCODE_SUCCESS
3790 * On failure NI_RETCODE_INVALID_PARAM
3791 ******************************************************************************/
3793
3794/*!*****************************************************************************
3795 * \brief Copy video packet accounting for alignment
3796 *
3797 * \param[in] p_destination Destination to where to copy to
3798 * \param[in] p_source Source from where to copy from
3799 * \param[in] cur_size current size
3800 * \param[out] p_leftover Pointer to the data that was left over
3801 * \param[out] p_prev_size Size of the data leftover
3802 *
3803 * \return On success Total number of bytes that were copied
3804 * On failure NI_RETCODE_FAILURE
3805 ******************************************************************************/
3806LIB_API int ni_packet_copy(void *p_destination, const void *const p_source,
3807 int cur_size, void *p_leftover, int *p_prev_size);
3808
3809/*!*****************************************************************************
3810 * \brief Add a new auxiliary data to a frame
3811 *
3812 * \param[in/out] frame a frame to which the auxiliary data should be added
3813 * \param[in] type type of the added auxiliary data
3814 * \param[in] data_size size of the added auxiliary data
3815 *
3816 * \return a pointer to the newly added aux data on success, NULL otherwise
3817 ******************************************************************************/
3819 ni_aux_data_type_t type,
3820 int data_size);
3821
3822/*!*****************************************************************************
3823 * \brief Add a new auxiliary data to a frame and copy in the raw data
3824 *
3825 * \param[in/out] frame a frame to which the auxiliary data should be added
3826 * \param[in] type type of the added auxiliary data
3827 * \param[in] raw_data the raw data of the aux data
3828 * \param[in] data_size size of the added auxiliary data
3829 *
3830 * \return a pointer to the newly added aux data on success, NULL otherwise
3831 ******************************************************************************/
3834 const uint8_t *raw_data, int data_size);
3835
3836/*!*****************************************************************************
3837 * \brief Retrieve from the frame auxiliary data of a given type if exists
3838 *
3839 * \param[in] frame a frame from which the auxiliary data should be retrieved
3840 * \param[in] type type of the auxiliary data to be retrieved
3841 *
3842 * \return a pointer to the aux data of a given type on success, NULL otherwise
3843 ******************************************************************************/
3845 ni_aux_data_type_t type);
3846
3847/*!*****************************************************************************
3848 * \brief If auxiliary data of the given type exists in the frame, free it
3849 * and remove it from the frame.
3850 *
3851 * \param[in/out] frame a frame from which the auxiliary data should be removed
3852 * \param[in] type type of the auxiliary data to be removed
3853 *
3854 * \return None
3855 ******************************************************************************/
3857
3858/*!*****************************************************************************
3859 * \brief Free and remove all auxiliary data from the frame.
3860 *
3861 * \param[in/out] frame a frame from which the auxiliary data should be removed
3862 *
3863 * \return None
3864 ******************************************************************************/
3866
3867/*!*****************************************************************************
3868 * \brief Initialize default encoder parameters
3869 *
3870 * \param[out] param Pointer to a user allocated ni_xcoder_params_t
3871 * to initialize to default parameters
3872 * \param[in] fps_num Frames per second
3873 * \param[in] fps_denom FPS denomination
3874 * \param[in] bit_rate bit rate
3875 * \param[in] width frame width
3876 * \param[in] height frame height
3877 * \param[in] codec_format codec from ni_codec_format_t
3878 *
3879 * \return On success
3880 * NI_RETCODE_SUCCESS
3881 * On failure
3882 * NI_RETCODE_FAILURE
3883 * NI_RETCODE_INVALID_PARAM
3884 ******************************************************************************/
3886 ni_xcoder_params_t *p_param, int fps_num, int fps_denom, long bit_rate,
3887 int width, int height, ni_codec_format_t codec_format);
3888
3889/*!*****************************************************************************
3890 * \brief Initialize default decoder parameters
3891 *
3892 * \param[out] param Pointer to a user allocated ni_xcoder_params_t
3893 * to initialize to default parameters
3894 * \param[in] fps_num Frames per second
3895 * \param[in] fps_denom FPS denomination
3896 * \param[in] bit_rate bit rate
3897 * \param[in] width frame width
3898 * \param[in] height frame height
3899 *
3900 * \return On success
3901 * NI_RETCODE_SUCCESS
3902 * On failure
3903 * NI_RETCODE_FAILURE
3904 * NI_RETCODE_INVALID_PARAM
3905 ******************************************************************************/
3907 int fps_num, int fps_denom,
3908 long bit_rate, int width,
3909 int height);
3910
3911/*!*****************************************************************************
3912 * \brief Set value referenced by name in encoder parameters structure
3913 *
3914 * \param[in] p_params Pointer to a user allocated ni_xcoder_params_t
3915 * to find and set a particular parameter
3916 * \param[in] name String represented parameter name to search
3917 * \param[in] value Parameter value to set
3918*
3919 * \return On success
3920 * NI_RETCODE_SUCCESS
3921 * On failure
3922 * NI_RETCODE_FAILURE
3923 * NI_RETCODE_INVALID_PARAM
3924 ******************************************************************************/
3926 const char *name,
3927 const char *value);
3928
3929/*!*****************************************************************************
3930* \brief Set value referenced by name in decoder parameters structure
3931*
3932* \param[in] p_params Pointer to a user allocated ni_xcoder_params_t (used
3933* for decoder too for now ) to find and set a particular
3934* parameter
3935* \param[in] name String represented parameter name to search
3936* \param[in] value Parameter value to set
3937*
3938* \return On success
3939* NI_RETCODE_SUCCESS
3940* On failure
3941* NI_RETCODE_FAILURE
3942* NI_RETCODE_INVALID_PARAM
3943******************************************************************************/
3945 const char *name, char *value);
3946
3947/*!*****************************************************************************
3948 * \brief Set GOP parameter value referenced by name in encoder parameters
3949 * structure
3950 *
3951 * \param[in] p_params Pointer to a user allocated ni_xcoder_params_t
3952 * to find and set a particular parameter
3953 * \param[in] name String represented parameter name to search
3954 * \param[in] value Parameter value to set
3955*
3956 * \return On success
3957 * NI_RETCODE_SUCCESS
3958 * On failure
3959 * NI_RETCODE_FAILURE
3960 * NI_RETCODE_INVALID_PARAM
3961 ******************************************************************************/
3963 ni_xcoder_params_t *p_params, const char *name, const char *value);
3964
3965/*!*****************************************************************************
3966* \brief Copy existing decoding session params for hw frame usage
3967*
3968* \param[in] src_p_ctx Pointer to a caller allocated source session context
3969* \param[in] dst_p_ctx Pointer to a caller allocated destination session
3970* context
3971* \return On success
3972* NI_RETCODE_SUCCESS
3973* On failure
3974* NI_RETCODE_INVALID_PARAM
3975******************************************************************************/
3977 ni_session_context_t *dst_p_ctx);
3978
3979/*!*****************************************************************************
3980* \brief Send frame pool setup info to device
3981*
3982* \param[in] p_ctx Pointer to a caller allocated
3983* ni_session_context_t struct
3984* \param[in] pool_size Upload session initial allocated frames count
3985* must be > 0,
3986* \param[in] pool 0 use the normal pool
3987* 1 use a dedicated P2P pool
3988*
3989* \return On success Return code
3990* On failure
3991* NI_RETCODE_INVALID_PARAM
3992* NI_RETCODE_ERROR_NVME_CMD_FAILED
3993* NI_RETCODE_ERROR_INVALID_SESSION
3994* NI_RETCODE_ERROR_MEM_ALOC
3995******************************************************************************/
3997 uint32_t pool_size, uint32_t pool);
3998
3999/*!*****************************************************************************
4000* \brief Sends frame pool change info to device
4001*
4002* \param[in] p_ctx Pointer to a caller allocated
4003* ni_session_context_t struct
4004* \param[in] pool_size if pool_size = 0, free allocated device memory buffers
4005* if pool_size > 0, expand device frame buffer pool of
4006* current instance with pool_size more frame buffers
4007*
4008* \return On success Return code
4009* On failure
4010* NI_RETCODE_FAILURE
4011* NI_RETCODE_INVALID_PARAM
4012* NI_RETCODE_ERROR_NVME_CMD_FAILED
4013* NI_RETCODE_ERROR_INVALID_SESSION
4014* NI_RETCODE_ERROR_MEM_ALOC
4015* NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4016*******************************************************************************/
4018 uint32_t pool_size);
4019
4020/*!*****************************************************************************
4021* \brief Read data from the device
4022* If device_type is NI_DEVICE_TYPE_DECODER reads data hwdesc from
4023* decoder
4024* If device_type is NI_DEVICE_TYPE_SCALER reads data hwdesc from
4025* scaler
4026*
4027* \param[in] p_ctx Pointer to a caller allocated
4028* ni_session_context_t struct
4029* \param[in] p_data Pointer to a caller allocated
4030* ni_session_data_io_t struct which contains either a
4031* ni_frame_t data frame or ni_packet_t data packet to
4032* send
4033* \param[in] device_type NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_SCALER
4034* If NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_SCALER is specified,
4035* hw descriptor info will be stored in p_data ni_frame
4036* \return On success
4037* Total number of bytes read
4038* On failure
4039* NI_RETCODE_INVALID_PARAM
4040* NI_RETCODE_ERROR_NVME_CMD_FAILED
4041* NI_RETCODE_ERROR_INVALID_SESSION
4042******************************************************************************/
4044 ni_session_data_io_t *p_data,
4045 ni_device_type_t device_type);
4046
4047/*!*****************************************************************************
4048* \brief Read YUV data from hw descriptor stored location on device
4049*
4050* \param[in] p_ctx Pointer to a caller allocated
4051* ni_session_context_t struct
4052* \param[in] p_data Pointer to a caller allocated
4053* ni_session_data_io_t struct which contains either a
4054* ni_frame_t data frame or ni_packet_t data packet to
4055* send
4056* \param[in] hwdesc HW descriptor to find frame in XCODER
4057* \return On success
4058* Total number of bytes read
4059* On failure
4060* NI_RETCODE_INVALID_PARAM
4061* NI_RETCODE_ERROR_NVME_CMD_FAILED
4062* NI_RETCODE_ERROR_INVALID_SESSION
4063******************************************************************************/
4065 ni_session_data_io_t *p_data,
4066 niFrameSurface1_t *hwdesc);
4067
4068/*!*****************************************************************************
4069* \brief Query the session if a buffer is available
4070*
4071* \param[in] p_ctx Pointer to a caller allocated
4072* ni_session_context_t struct
4073* \param[in] device_type Quadra device type
4074*
4075* \return On success
4076* NI_RETCODE_SUCCESS
4077* On failure
4078* NI_RETCODE_INVALID_PARAM
4079* NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4080* NI_RETCODE_ERROR_NVME_CMD_FAILED
4081* NI_RETCODE_ERROR_INVALID_SESSION
4082*******************************************************************************/
4084 ni_device_type_t device_type);
4085
4086
4087/*!*****************************************************************************
4088* \brief Send raw YUV input to uploader instance and retrieve a HW descriptor
4089* to represent it
4090*
4091* \param[in] p_ctx Pointer to a caller allocated
4092* ni_session_context_t struct
4093* \param[in] p_src_data Pointer to a caller allocated
4094* ni_session_data_io_t struct which contains a
4095* ni_frame_t data frame to send to uploader
4096* \param[out] hwdesc HW descriptor to find frame in XCODER
4097* \return On success
4098* Total number of bytes read
4099* On failure
4100* NI_RETCODE_INVALID_PARAM
4101* NI_RETCODE_ERROR_NVME_CMD_FAILED
4102* NI_RETCODE_ERROR_INVALID_SESSION
4103*******************************************************************************/
4105
4106/*!*****************************************************************************
4107* \brief Allocate memory for the hwDescriptor buffer based on provided
4108* parameters taking into account pic size and extra data.
4109*
4110* \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
4111*
4112* \param[in] video_width Width of the video frame
4113* \param[in] video_height Height of the video frame
4114* \param[in] extra_len Extra data size (incl. meta data)
4115*
4116* \return On success
4117* NI_RETCODE_SUCCESS
4118* On failure
4119* NI_RETCODE_INVALID_PARAM
4120* NI_RETCODE_ERROR_MEM_ALOC
4121*****************************************************************************/
4123 int video_width,
4124 int video_height,
4125 int extra_len);
4126
4127/*!*****************************************************************************
4128* \brief Recycle a hwframe buffer on card
4129*
4130* \param[in] surface Struct containing device and frame location to clear out
4131* \param[in] device_handle handle to access device memory buffer is stored in
4132*
4133* \return On success NI_RETCODE_SUCCESS
4134* On failure NI_RETCODE_INVALID_PARAM
4135*******************************************************************************/
4137 int32_t device_handle);
4138
4139
4140/*!*****************************************************************************
4141* \brief Recycle a hwframe buffer on card
4142*
4143* \param[in] surface Struct containing device and frame location to clear out
4144*
4145* \return On success NI_RETCODE_SUCCESS
4146* On failure NI_RETCODE_INVALID_PARAM
4147*******************************************************************************/
4149
4150/*!*****************************************************************************
4151 * \brief Set parameters on the device for the 2D engine
4152 *
4153 * \param[in] p_ctx pointer to session context
4154 * \param[in] p_params pointer to the scaler parameters
4155 *
4156 * \return NI_RETCODE_INVALID_PARAM
4157 * NI_RETCODE_ERROR_INVALID_SESSION
4158 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4159
4160 ******************************************************************************/
4162 ni_scaler_params_t *p_params);
4163
4164/*!*****************************************************************************
4165 * \brief Allocate a frame on the device for 2D engine or AI engine
4166 * to work on based on provided parameters
4167 *
4168 * \param[in] p_ctx pointer to session context
4169 * \param[in] width width, in pixels
4170 * \param[in] height height, in pixels
4171 * \param[in] format pixel format
4172 * \param[in] options options bitmap flags, bit 0 (NI_SCALER_FLAG_IO) is
4173 * 0=input frame or 1=output frame. Bit 1 (NI_SCALER_FLAG_PC) is
4174 * 0=single allocation, 1=create pool. Bit 2 (NI_SCALER_FLAG_PA) is
4175 * 0=straight alpha, 1=premultiplied alpha
4176 * \param[in] rectangle_width clipping rectangle width
4177 * \param[in] rectangle_height clipping rectangle height
4178 * \param[in] rectangle_x horizontal position of clipping rectangle
4179 * \param[in] rectangle_y vertical position of clipping rectangle
4180 * \param[in] rgba_color RGBA fill colour (for padding only)
4181 * \param[in] frame_index input hwdesc index
4182 * \param[in] device_type only NI_DEVICE_TYPE_SCALER
4183 * and NI_DEVICE_TYPE_AI (only needs p_ctx and frame_index)
4184 *
4185 * \return NI_RETCODE_INVALID_PARAM
4186 * NI_RETCODE_ERROR_INVALID_SESSION
4187 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4188 * NI_RETCODE_ERROR_MEM_ALOC
4189 ******************************************************************************/
4191 int width,
4192 int height,
4193 int format,
4194 int options,
4195 int rectangle_width,
4196 int rectangle_height,
4197 int rectangle_x,
4198 int rectangle_y,
4199 int rgba_color,
4200 int frame_index,
4201 ni_device_type_t device_type);
4202
4203/*!*****************************************************************************
4204 * \brief Allocate a frame on the device and return the frame index
4205 *
4206 * \param[in] p_ctx pointer to session context
4207 * \param[in] p_out_surface pointer to output frame surface
4208 * \param[in] device_type currently only NI_DEVICE_TYPE_AI
4209 *
4210 * \return NI_RETCODE_INVALID_PARAM
4211 * NI_RETCODE_ERROR_INVALID_SESSION
4212 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4213 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4214 * NI_RETCODE_ERROR_MEM_ALOC
4215 ******************************************************************************/
4217 niFrameSurface1_t *p_out_surface,
4218 ni_device_type_t device_type);
4219
4220/*!*****************************************************************************
4221 * \brief Copy the data of src hwframe to dst hwframe
4222 *
4223 * \param[in] p_ctx pointer to session context
4224 * \param[in] p_frameclone_desc pointer to the frameclone descriptor
4225 *
4226 * \return NI_RETCODE_INVALID_PARAM
4227 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4228 * NI_RETCODE_ERROR_INVALID_SESSION
4229 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4230 * NI_RETCODE_ERROR_MEM_ALOC
4231 ******************************************************************************/
4233 ni_frameclone_desc_t *p_frameclone_desc);
4234
4235/*!*****************************************************************************
4236 * \brief Config a frame on the device for 2D engined
4237 * to work on based on provided parameters
4238 *
4239 * \param[in] p_ctx pointer to session context
4240 * \param[in] p_cfg pointer to frame config
4241 *
4242 * \return NI_RETCODE_INVALID_PARAM
4243 * NI_RETCODE_ERROR_INVALID_SESSION
4244 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4245 * NI_RETCODE_ERROR_MEM_ALOC
4246 ******************************************************************************/
4248 ni_frame_config_t *p_cfg);
4249
4251 ni_scaler_drawbox_params_t *p_params);
4252
4255
4256/*!*****************************************************************************
4257 * \brief Config multiple frame on the device for 2D engined
4258 * to work on based on provided parameters
4259 *
4260 * \param[in] p_ctx pointer to session context
4261 * \param[in] p_cfg_in input frame config array
4262 * \param[in] numInCfgs number of frame config entries in the p_cfg_in array
4263 * \param[in] p_cfg_out output frame config
4264 *
4265 * \return NI_RETCODE_INVALID_PARAM
4266 * NI_RETCODE_ERROR_INVALID_SESSION
4267 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4268 * NI_RETCODE_ERROR_MEM_ALOC
4269 ******************************************************************************/
4271 ni_frame_config_t p_cfg_in[],
4272 int numInCfgs,
4273 ni_frame_config_t *p_cfg_out);
4274
4275/*!*****************************************************************************
4276 * \brief Allocate memory for the frame buffer based on provided parameters
4277 * taking into account the pixel format, width, height, stride,
4278 * alignment, and extra data
4279 * \param[in] p_frame Pointer to caller allocated ni_frame_t
4280 * \param[in] pixel_format a pixel format in ni_pix_fmt_t enum
4281 * \param[in] video_width width, in pixels
4282 * \param[in] video_height height, in pixels
4283 * \param[in] linesize horizontal stride
4284 * \param[in] alignment apply a 16 pixel height alignment (T408 only)
4285 * \param[in] extra_len meta data size
4286 *
4287 * \return NI_RETCODE_SUCCESS
4288 * NI_RETCODE_INVALID_PARAM
4289 * NI_RETCODE_ERROR_MEM_ALOC
4290 *
4291 ******************************************************************************/
4293 ni_frame_t *pframe, int pixel_format, int video_width, int video_height,
4294 int linesize[], int alignment, int extra_len);
4295
4296/*!*****************************************************************************
4297 * \brief configure a network context based with the network binary
4298 *
4299 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4300 * \param[in] file Pointer to caller network binary file path
4301 *
4302 * \return NI_RETCODE_SUCCESS
4303 * NI_RETCODE_INVALID_PARAM
4304 * NI_RETCODE_ERROR_MEM_ALOC
4305 * NI_RETCODE_ERROR_INVALID_SESSION
4306 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4307 * NI_RETCODE_FAILURE
4308 *
4309 ******************************************************************************/
4311 ni_network_data_t *p_network,
4312 const char *file);
4313
4314/*!*****************************************************************************
4315 * \brief configure a hvsplus filter
4316 *
4317 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4318 *
4319 * \return NI_RETCODE_SUCCESS
4320 * NI_RETCODE_FAILURE
4321 *
4322 ******************************************************************************/
4324 ni_network_data_t *p_network);
4325
4326/*!*****************************************************************************
4327 * \brief Allocate input layers memory for AI frame buffer based on provided parameters
4328 * taking into account width, height, format defined by network.
4329 *
4330 * \param[out] p_frame Pointer to caller allocated ni_frame_t
4331 * \param[in] p_network Pointer to caller allocated ni_network_data_t
4332 *
4333 * \return NI_RETCODE_SUCCESS
4334 * NI_RETCODE_INVALID_PARAM
4335 * NI_RETCODE_ERROR_MEM_ALOC
4336 *
4337 ******************************************************************************/
4339 ni_network_data_t *p_network);
4340
4341/*!*****************************************************************************
4342 * \brief Allocate output layers memory for the packet buffer based on provided network
4343 *
4344 * \param[out] p_packet Pointer to a caller allocated
4345 * ni_packet_t struct
4346 * \param[in] p_network Pointer to a caller allocated
4347 * ni_network_data_t struct
4348 *
4349 * \return On success
4350 * NI_RETCODE_SUCCESS
4351 * On failure
4352 * NI_RETCODE_INVALID_PARAM
4353 * NI_RETCODE_ERROR_MEM_ALOC
4354 ******************************************************************************/
4356 ni_network_data_t *p_network);
4357
4358// wrapper API request, dynamic encode configuration setting to be sent to the
4359// encoder with the next frame
4360
4361/*!*****************************************************************************
4362 * \brief Reconfigure bitrate dynamically during encoding.
4363 *
4364 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4365 * \param[in] bitrate Target bitrate to set
4366 *
4367 * \return On success NI_RETCODE_SUCCESS
4368 * On failure NI_RETCODE_INVALID_PARAM
4369 ******************************************************************************/
4371 int32_t bitrate);
4372
4373/*!*****************************************************************************
4374 * \brief Reconfigure intraPeriod dynamically during encoding.
4375 *
4376 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4377 * \param[in] intra_period Target intra period to set
4378 *
4379 * \return On success NI_RETCODE_SUCCESS
4380 * On failure NI_RETCODE_INVALID_PARAM
4381 *
4382 * NOTE - the frame upon which intra period is reconfigured is encoded as IDR frame
4383 * NOTE - reconfigure intra period is not allowed if intraRefreshMode is enabled or if gopPresetIdx is 1
4384 *
4385 ******************************************************************************/
4387 int32_t intra_period);
4388
4389/*!*****************************************************************************
4390 * \brief Reconfigure VUI dynamically during encoding.
4391 *
4392 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4393 * \param[in] bitrate Target bitrate to set
4394 *
4395 * \return On success NI_RETCODE_SUCCESS
4396 * On failure NI_RETCODE_INVALID_PARAM
4397 ******************************************************************************/
4399 ni_vui_hrd_t *vui);
4400
4401/*!*****************************************************************************
4402 * \brief Force next frame to be IDR frame during encoding.
4403 *
4404 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4405 *
4406 * \return On success NI_RETCODE_SUCCESS
4407 ******************************************************************************/
4409
4410/*!*****************************************************************************
4411 * \brief Set a frame's support of Long Term Reference frame during encoding.
4412 *
4413 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4414 * \param[in] ltr Pointer to struct specifying LTR support
4415 *
4416 * \return On success NI_RETCODE_SUCCESS
4417 * On failure NI_RETCODE_INVALID_PARAM
4418 ******************************************************************************/
4420 ni_long_term_ref_t *ltr);
4421
4422/*!*****************************************************************************
4423 * \brief Set Long Term Reference interval
4424 *
4425 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4426 * \param[in] ltr_interval the new long term reference inteval value
4427 *
4428 * \return On success NI_RETCODE_SUCCESS
4429 * On failure NI_RETCODE_INVALID_PARAM
4430 ******************************************************************************/
4432 int32_t ltr_interval);
4433
4434/*!*****************************************************************************
4435 * \brief Set frame reference invalidation
4436 *
4437 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4438 * \param[in] frame_num frame number after which all references shall be
4439 * invalidated
4440 *
4441 * \return On success NI_RETCODE_SUCCESS
4442 * On failure NI_RETCODE_INVALID_PARAM
4443 ******************************************************************************/
4445 int32_t frame_num);
4446
4447/*!*****************************************************************************
4448 * \brief Reconfigure framerate dynamically during encoding.
4449 *
4450 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4451 * \param[in] framerate Pointer to struct specifying framerate to set
4452 *
4453 * \return On success NI_RETCODE_SUCCESS
4454 * On failure NI_RETCODE_INVALID_PARAM
4455 ******************************************************************************/
4457 ni_framerate_t *framerate);
4458
4459/*!*****************************************************************************
4460 * \brief Reconfigure maxFrameSize dynamically during encoding.
4461 *
4462 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4463 * \param[in] max_frame_size the new maxFrameSize value
4464 *
4465 * \return On success NI_RETCODE_SUCCESS
4466 * On failure NI_RETCODE_INVALID_PARAM
4467 *
4468 * NOTE - maxFrameSize_Bytes value less than ((bitrate / 8) / framerate) will be rejected
4469 *
4470 ******************************************************************************/
4472 int32_t max_frame_size);
4473
4474/*!*****************************************************************************
4475 * \brief Reconfigure min&max qp dynamically during encoding.
4476 *
4477 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4478 * \param[in] ni_rc_min_max_qp Target min&max qp to set
4479 *
4480 * \return On success NI_RETCODE_SUCCESS
4481 * On failure NI_RETCODE_INVALID_PARAM
4482 ******************************************************************************/
4484 ni_rc_min_max_qp *p_min_max_qp);
4485
4486
4487/*!*****************************************************************************
4488 * \brief Reconfigure crf value dynamically during encoding.
4489 *
4490 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4491 * \param[in] crf crf value to reconfigure
4492 *
4493 * \return On success NI_RETCODE_SUCCESS
4494 * On failure NI_RETCODE_INVALID_PARAM
4495 ******************************************************************************/
4497 int32_t crf);
4498
4499/*!*****************************************************************************
4500 * \brief Reconfigure crf float point value dynamically during encoding.
4501 *
4502 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4503 * \param[in] crf crf float point value to reconfigure
4504 *
4505 * \return On success NI_RETCODE_SUCCESS
4506 * On failure NI_RETCODE_INVALID_PARAM
4507 ******************************************************************************/
4509 float crf);
4510
4511
4512/*!*****************************************************************************
4513 * \brief Reconfigure vbv buffer size and vbv max rate dynamically during encoding.
4514 *
4515 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4516 * \param[in] vbvBufferSize Target vbvBufferSize to set
4517 * \param[in] vbvMaxRate Target vbvMaxRate to set
4518 *
4519 * \return On success NI_RETCODE_SUCCESS
4520 * On failure NI_RETCODE_INVALID_PARAM
4521 ******************************************************************************/
4523 int32_t vbvMaxRate, int32_t vbvBufferSize);
4524
4525/*!*****************************************************************************
4526 * \brief Reconfigure maxFrameSizeRatio dynamically during encoding.
4527 *
4528 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4529 * \param[in] max_frame_size_ratio the new maxFrameSizeRatio value
4530 *
4531 * \return On success NI_RETCODE_SUCCESS
4532 * On failure NI_RETCODE_INVALID_PARAM
4533 ******************************************************************************/
4535 int32_t max_frame_size_ratio);
4536
4537/*!*****************************************************************************
4538 * \brief Reconfigure sliceArg dynamically during encoding.
4539 *
4540 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4541 * \param[in] sliceArg the new sliceArg value
4542 *
4543 * \return On success NI_RETCODE_SUCCESS
4544 * On failure NI_RETCODE_INVALID_PARAM
4545 ******************************************************************************/
4547 int16_t sliceArg);
4548
4549#ifndef _WIN32
4550/*!*****************************************************************************
4551* \brief Acquire a P2P frame buffer from the hwupload session
4552*
4553* \param[in] p_upl_ctx Pointer to a caller allocated
4554* ni_session_context_t struct
4555* \param[out] p_frame Pointer to a caller allocated hw frame
4556*
4557* \return On success
4558* NI_RETCODE_SUCCESS
4559* On failure
4560* NI_RETCODE_INVALID_PARAM
4561* NI_RETCODE_ERROR_NVME_CMD_FAILED
4562* NI_RETCODE_ERROR_INVALID_SESSION
4563*******************************************************************************/
4565 ni_frame_t *p_frame);
4566
4567/*!*****************************************************************************
4568* \brief Acquire a P2P frame buffer from the hwupload session for P2P read
4569*
4570* \param[in] p_upl_ctx Pointer to a caller allocated
4571* ni_session_context_t struct
4572* \param[out] p_frame Pointer to a caller allocated hw frame
4573*
4574* \return On success
4575* NI_RETCODE_SUCCESS
4576* On failure
4577* NI_RETCODE_INVALID_PARAM
4578* NI_RETCODE_ERROR_NVME_CMD_FAILED
4579* NI_RETCODE_ERROR_INVALID_SESSION
4580*******************************************************************************/
4582 ni_frame_t *p_frame);
4583
4584/*!*****************************************************************************
4585 * \brief Lock a hardware P2P frame prior to encoding
4586 *
4587 * \param[in] p_upl_ctx pointer to caller allocated upload context
4588 * [in] p_frame pointer to caller allocated hardware P2P frame
4589 *
4590 * \return On success
4591 * NI_RETCODE_SUCCESS
4592 * On failure NI_RETCODE_FAILURE
4593 * NI_RETCODE_INVALID_PARAM
4594*******************************************************************************/
4596 ni_session_context_t *p_upl_ctx, ni_frame_t *p_frame);
4597
4598/*!*****************************************************************************
4599 * \brief Unlock a hardware P2P frame after encoding
4600 *
4601 * \param[in] p_upl_ctx pointer to caller allocated upload context
4602 * [in] p_frame pointer to caller allocated hardware P2P frame
4603 *
4604 * \return On success
4605 * NI_RETCODE_SUCCESS
4606 * On failure NI_RETCODE_FAILURE
4607 * NI_RETCODE_INVALID_PARAM
4608*******************************************************************************/
4610 ni_session_context_t *p_upl_ctx, ni_frame_t *p_frame);
4611
4612/*!*****************************************************************************
4613 * \brief Special P2P test API call. Copies YUV data from the software
4614 * frame to the hardware P2P frame on the Quadra device
4615 *
4616 * \param[in] p_upl_ctx pointer to caller allocated uploader session
4617 * context
4618 * [in] p_swframe pointer to a caller allocated software frame
4619 * [in] p_hwframe pointer to a caller allocated hardware frame
4620 *
4621 * \return On success
4622 * NI_RETCODE_SUCCESS
4623 * On failure
4624 * NI_RETCODE_FAILURE
4625 * NI_RETCODE_INVALID_PARAM
4626*******************************************************************************/
4628 uint8_t *p_data, uint32_t len,
4629 ni_frame_t *p_hwframe);
4630
4631
4633 uint8_t *p_data, uint32_t len,
4634 ni_frame_t *p_hwframe);
4635
4636/*!*****************************************************************************
4637 * \brief Set the incoming frame format for the encoder
4638 *
4639 * \param[in] p_enc_ctx pointer to encoder context
4640 * [in] p_enc_params pointer to encoder parameters
4641 * [in] width input width
4642 * [in] height input height
4643 * [in] bit_depth 8 for 8-bit YUV, 10 for 10-bit YUV
4644 * [in] src_endian NI_FRAME_LITTLE_ENDIAN or NI_FRAME_BIG_ENDIAN
4645 * [in] planar 0 for semi-planar YUV, 1 for planar YUV
4646 *
4647 * \return on success
4648 * NI_RETCODE_SUCCESS
4649 *
4650 * on failure
4651 * NI_RETCODE_INVALID_PARAM
4652*******************************************************************************/
4654 ni_session_context_t *p_enc_ctx, ni_xcoder_params_t *p_enc_params,
4655 int width, int height, int bit_depth, int src_endian, int planar);
4656
4657/*!*****************************************************************************
4658 * \brief Acquire the scaler P2P DMA buffer for read/write
4659 *
4660 * \param [in] p_ctx pointer to caller allocated upload context
4661 * [in] p_surface pointer to a caller allocated hardware frame
4662 * [in] data_len scaler frame buffer data length
4663 *
4664 * \return on success
4665 * NI_RETCODE_SUCCESS
4666 *
4667 * on failure
4668 * NI_RETCODE_FAILURE
4669*******************************************************************************/
4671 niFrameSurface1_t *p_surface,
4672 int data_len);
4673
4674/*!*****************************************************************************
4675 * \brief Recycle hw P2P frames
4676 *
4677 * \param [in] p_frame pointer to an acquired P2P hw frame
4678 *
4679 * \return on success
4680 * NI_RETCODE_SUCCESS
4681 *
4682 * on failure
4683 * NI_RETCODE_INVALID_PARAM
4684*******************************************************************************/
4686#endif
4687
4688/*!*****************************************************************************
4689 * \brief Set the frame format for the uploader
4690 *
4691 * \param[in] p_upl_ctx pointer to uploader context
4692 * [in] width width
4693 * [in] height height
4694 * [in] pixel_format pixel format
4695 * [in] isP2P 0 = normal, 1 = P2P
4696 *
4697 * \return on success
4698 * NI_RETCODE_SUCCESS
4699 *
4700 * on failure
4701 * NI_RETCODE_INVALID_PARAM
4702*******************************************************************************/
4705 int height, ni_pix_fmt_t pixel_format, int isP2P);
4706
4707/*!*****************************************************************************
4708 * \brief Read encoder stream header from the device
4709 *
4710 * \param[in] p_ctx Pointer to a caller allocated
4711 * ni_session_context_t struct from encoder
4712 * \param[in] p_data Pointer to a caller allocated ni_session_data_io_t
4713 * struct which contains a ni_packet_t data packet to
4714 * receive
4715 * \return On success
4716 * Total number of bytes read
4717 * On failure
4718 * NI_RETCODE_INVALID_PARAM
4719 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4720 * NI_RETCODE_ERROR_INVALID_SESSION
4721*******************************************************************************/
4723 ni_session_data_io_t *p_data);
4724
4725
4726/*!*****************************************************************************
4727 * \brief Get the DMA buffer file descriptor from the P2P frame
4728 *
4729 * \param[in] p_frame pointer to a P2P frame
4730 *
4731 * \return On success
4732 * DMA buffer file descriptor
4733 * On failure
4734 * NI_RETCODE_FAILURE
4735*******************************************************************************/
4736LIB_API int32_t ni_get_dma_buf_file_descriptor(const ni_frame_t* p_frame);
4737
4738
4739/*!*****************************************************************************
4740 * \brief Send sequence change information to device
4741 *
4742 * \param[in] p_ctx Pointer to a caller allocated
4743 * ni_session_context_t struct
4744 * \param[in] width input width
4745 * \param[in] height input height
4746 * \param[in] bit_depth_factor 1 for 8-bit YUV, 2 for 10-bit YUV
4747 * \param[in] device_type device type (must be encoder)
4748 * \return On success
4749 * NI_RETCODE_SUCCESS
4750 * On failure
4751 * NI_RETCODE_INVALID_PARAM
4752 * NI_RETCODE_ERROR_MEM_ALOC
4753 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4754 * NI_RETCODE_ERROR_INVALID_SESSION
4755 ******************************************************************************/
4757 int width, int height, int bit_depth_factor, ni_device_type_t device_type);
4758
4759/*!*****************************************************************************
4760 * \brief Fetch perf metrics of inferences from device
4761 *
4762 * \param[in] p_ctx Pointer to a caller allocated
4763 * ni_session_context_t struct
4764 * \param[in] p_metrics Pointer to network metrics
4765 * \return On success
4766 * NI_RETCODE_SUCCESS
4767 * On failure
4768 * NI_RETCODE_INVALID_PARAM
4769 * NI_RETCODE_ERROR_MEM_ALOC
4770 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4771 ******************************************************************************/
4774
4775/*!*****************************************************************************
4776 * \brief Query firmware loader and firmware versions from the device
4777 *
4778 * \param[in] device_handle Device handle obtained by calling ni_device_open()
4779 * \param[in] device_info
4780 *
4781 * \return On success
4782 * NI_RETCODE_SUCCESS
4783 * On failure
4784 * NI_RETCODE_INVALID_PARAM
4785 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4786 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4787 * NI_RETCODE_ERROR_MEM_ALOC
4788 ******************************************************************************/
4789LIB_API ni_retcode_t ni_query_fl_fw_versions(ni_device_handle_t device_handle,
4790 ni_device_info_t *p_dev_info);
4791
4792/*!*****************************************************************************
4793 * \brief Query NVMe load from the device
4794 *
4795 * \param[in] p_ctx Pointer to a caller allocated
4796 * ni_session_context_t struct
4797 * \param[in] p_load_query Pointer to a caller allocated
4798 * ni_load_query_t struct
4799 *
4800 * \return On success
4801 * NI_RETCODE_SUCCESS
4802 * On failure
4803 * NI_RETCODE_INVALID_PARAM
4804 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4805 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4806 * NI_RETCODE_ERROR_MEM_ALOC
4807 ******************************************************************************/
4809 ni_session_context_t *p_ctx, ni_load_query_t *p_load_query);
4810
4811/*!*****************************************************************************
4812 * \brief Query VF and NS id from device
4813 *
4814 * \param[in] device_handle Device handle obtained by calling ni_device_open()
4815 * \param[in] p_dev_ns_vf Pointer to a ni_device_vf_ns_id_t struct
4816 * \param[in] fw_rev[] Fw version to check if this function is supported
4817 *
4818 * \return On success
4819 * NI_RETCODE_SUCCESS
4820 * On failure
4821 * NI_RETCODE_INVALID_PARAM
4822 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4823 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4824 * NI_RETCODE_ERROR_MEM_ALOC
4825 ******************************************************************************/
4826LIB_API ni_retcode_t ni_query_vf_ns_id(ni_device_handle_t device_handle,
4827 ni_device_vf_ns_id_t *p_dev_ns_vf,
4828 uint8_t fw_rev[]);
4829
4830/*!*****************************************************************************
4831 * \brief Query CompositeTemp from device
4832 *
4833 * \param[in] device_handle Device handle obtained by calling ni_device_open()
4834 * \param[in] p_dev_temp Pointer to device temperature
4835 * \param[in] fw_rev[] Fw version to check if this function is supported
4836 *
4837 * \return On success
4838 * NI_RETCODE_SUCCESS
4839 * On failure
4840 * NI_RETCODE_INVALID_PARAM
4841 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4842 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4843 * NI_RETCODE_ERROR_MEM_ALOC
4844 ******************************************************************************/
4845LIB_API ni_retcode_t ni_query_temperature(ni_device_handle_t device_handle,
4846 ni_device_temp_t *p_dev_temp,
4847 uint8_t fw_rev[]);
4848
4849/*!*****************************************************************************
4850 * \brief Query CompositeTemp from device
4851 *
4852 * \param[in] device_handle Device handle obtained by calling ni_device_open()
4853 * \param[in] p_dev_extra_info Pointer to device extra info
4854 * \param[in] fw_rev[] Fw version to check if this function is supported
4855 *
4856 * \return On success
4857 * NI_RETCODE_SUCCESS
4858 * On failure
4859 * NI_RETCODE_INVALID_PARAM
4860 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4861 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4862 * NI_RETCODE_ERROR_MEM_ALOC
4863 ******************************************************************************/
4864LIB_API ni_retcode_t ni_query_extra_info(ni_device_handle_t device_handle,
4865 ni_device_extra_info_t *p_dev_extra_info,
4866 uint8_t fw_rev[]);
4867
4868/*!*****************************************************************************
4869 * \brief Check if incoming frame is encoder zero copy compatible or not
4870 *
4871 * \param[in] p_enc_ctx pointer to encoder context
4872 * [in] p_enc_params pointer to encoder parameters
4873 * [in] width input width
4874 * [in] height input height
4875 * [in] linesize input linesizes (pointer to array)
4876 * [in] set_linesize setup linesizes 0 means not setup linesizes, 1 means setup linesizes (before encoder open)
4877 *
4878 * \return on success and can do zero copy
4879 * NI_RETCODE_SUCCESS
4880 *
4881 * cannot do zero copy
4882 * NI_RETCODE_ERROR_UNSUPPORTED_FEATURE
4883 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4884 * NI_RETCODE_INVALID_PARAM
4885 *
4886*******************************************************************************/
4888 ni_xcoder_params_t *p_enc_params,
4889 int width, int height,
4890 const int linesize[],
4891 bool set_linesize);
4892
4893/*!*****************************************************************************
4894 * \brief Check if the frame data transferred is within a frame boundary and
4895 * adjust with offset if it doesn't. EP will re-adjust the data pointer
4896 * to the correct start address.
4897 *
4898 * \param[in] video_height Height of the video frame
4899 * [in] linesize Picture line size after filtering (i.e. cropping)
4900 * [in] data Picture data pointers after filtering (for each of YUV planes)
4901 * [in] buf_size0 Y frame size before any filtering (original size)
4902 * [in] buf_size1 U frame size before any filtering (original)
4903 * [in] buf_size2 V frame size before any filtering (original)
4904 * [in] buf_data0 Y picture data pointer before any filtering (original)
4905 * [in] buf_data1 U picture data pointer before any filtering (original)
4906 * [in] buf_data2 V picture data pointer before any filtering (original)
4907 *
4908 * \return On success
4909 * NI_RETCODE_SUCCESS
4910 * On failure
4911 * NI_RETCODE_INVALID_PARAM
4912 *****************************************************************************/
4914 ni_frame_t *p_frame, int video_height,
4915 const int linesize[], const uint8_t *data[],
4916 int buf_size0, int buf_size1, int buf_size2,
4917 uint8_t *buf_data0, uint8_t *buf_data1, uint8_t *buf_data2);
4918
4919/*!*****************************************************************************
4920 * \brief Allocate memory for encoder zero copy (metadata, etc.)
4921 * for encoding based on given
4922 * parameters, taking into account pic linesize and extra data.
4923 * Applicable to YUV planr / semi-planar 8 or 10 bit and RGBA pixel formats.
4924 *
4925 *
4926 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
4927 * \param[in] video_width Width of the video frame
4928 * \param[in] video_height Height of the video frame
4929 * \param[in] linesize Picture line size
4930 * \param[in] data Picture data pointers (for each of YUV planes)
4931 * \param[in] extra_len Extra data size (incl. meta data)
4932 *
4933 * \return On success
4934 * NI_RETCODE_SUCCESS
4935 * On failure
4936 * NI_RETCODE_INVALID_PARAM
4937 * NI_RETCODE_ERROR_MEM_ALOC
4938 *****************************************************************************/
4940 int video_width, int video_height,
4941 const int linesize[], const uint8_t *data[],
4942 int extra_len);
4943
4944/*!*****************************************************************************
4945 * \brief Check if incoming frame is hwupload zero copy compatible or not
4946 *
4947 * \param[in] p_upl_ctx pointer to uploader context
4948 * [in] width input width
4949 * [in] height input height
4950 * [in] linesize input linesizes (pointer to array)
4951 * [in] pixel_format input pixel format
4952 *
4953 * \return on success and can do zero copy
4954 * NI_RETCODE_SUCCESS
4955 *
4956 * cannot do zero copy
4957 * NI_RETCODE_ERROR_UNSUPPORTED_FEATURE
4958 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4959 * NI_RETCODE_INVALID_PARAM
4960 *
4961*******************************************************************************/
4963 int width, int height,
4964 const int linesize[], int pixel_format);
4965
4966/*!*****************************************************************************
4967 * \brief Allocate log buffer if needed and retrieve firmware logs from device
4968 *
4969 * \param[in] p_ctx Pointer to a caller allocated
4970 * ni_session_context_t struct
4971 * \param[in] p_log_buffer Reference to pointer to a log buffer
4972 * If log buffer pointer is NULL, this function will allocate log buffer
4973 * NOTE caller is responsible for freeing log buffer after calling this function
4974 * \param[in] gen_log_file Indicating whether it is required to generate log files
4975 *
4976 *
4977 * \return on success
4978 * NI_RETCODE_SUCCESS
4979 *
4980 * on failure
4981 * NI_RETCODE_ERROR_MEM_ALOC
4982 * NI_RETCODE_INVALID_PARAM
4983*******************************************************************************/
4984LIB_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);
4985
4986/*!*****************************************************************************
4987 * \brief Set up hard coded demo ROI map
4988 *
4989 * \param[in] p_enc_ctx Pointer to a caller allocated
4990 *
4991 * \return on success
4992 * NI_RETCODE_SUCCESS
4993 *
4994 * on failure
4995 * NI_RETCODE_ERROR_MEM_ALOC
4996*******************************************************************************/
4998
4999/*!*****************************************************************************
5000 * \brief Convert various reconfig and demo modes (stored in encoder configuration) to
5001 * aux data and store them in frame
5002 *
5003 * \param[in] p_enc_ctx Pointer to a caller allocated
5004 * ni_session_context_t struct
5005 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
5006 *
5007 *
5008 * \return on success
5009 * NI_RETCODE_SUCCESS
5010 *
5011 * on failure
5012 * NI_RETCODE_ERROR_MEM_ALOC
5013*******************************************************************************/
5015 ni_frame_t *p_frame);
5016
5017/*!*****************************************************************************
5018 * \brief Set custom gop and prepare to check if success
5019 *
5020 * \param[in] p_param Pointer to a caller allocated ni_xcoder_params_t struct
5021 * \param[in] value Pointer to a caller allocated custom gop name
5022 *
5023 * \return none
5024 *
5025*******************************************************************************/
5026LIB_API void ni_gop_params_check_set(ni_xcoder_params_t *p_param, char *value);
5027
5028/*!*****************************************************************************
5029 * \brief Check custom gop params set.
5030 *
5031 * \param[in] p_param Pointer to a caller allocated ni_xcoder_params_t struct
5032 *
5033 *
5034 * \return on success
5035 * true
5036 *
5037 * on failure
5038 * false
5039*******************************************************************************/
5041
5042#ifndef DEPRECATION_AS_ERROR
5043/*!*****************************************************************************
5044 * \brief Initiate P2P transfer (P2P write) (deprecated)
5045 *
5046 * \param[in] pSession Pointer to source card destination
5047 * \param[in] source Pointer to source frame to transmit
5048 * \param[in] ui64DestAddr Destination address on target device
5049 * \param[in] ui32FrameSize Size of frame to transfer
5050 *
5051 * \return always returns
5052 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
5053*******************************************************************************/
5055 niFrameSurface1_t *source,
5056 uint64_t ui64DestAddr,
5057 uint32_t ui32FrameSize);
5058#endif
5059
5060/*!*****************************************************************************
5061 * \brief Initiate P2P transfer to another device (P2P write)
5062 *
5063 * \param[in] pSession Pointer to source card destination
5064 * \param[in] source Pointer to source frame to transmit
5065 * \param[in] ui64DestAddr Destination address on target device
5066 * \param[in] ui32FrameSize Size of frame to transfer
5067 *
5068 * \return on success
5069 * NI_RETCODE_SUCCESS
5070 * on failure
5071 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
5072 * NI_RETCODE_INVALID_PARAM
5073 * NI_RETCODE_ERROR_INVALID_SESSION
5074 * NI_RETCODE_ERROR_MEM_ALOC
5075 * NI_RETCODE_ERROR_NVME_CMD_FAILED
5076*******************************************************************************/
5078 niFrameSurface1_t *source,
5079 uint64_t ui64DestAddr,
5080 uint32_t ui32FrameSize);
5081
5082/*!*****************************************************************************
5083 * \brief Calculate the total size of a frame based on the upload
5084 * context attributes and includes rounding up to the page size
5085 *
5086 * \param[in] p_upl_ctx pointer to an uploader session context
5087 * \param[in] linesize array of line stride
5088 *
5089 * \return size
5090 * NI_RETCODE_INVALID_PARAM
5091 *
5092 ******************************************************************************/
5094 const int linesize[]);
5095
5096
5097/*!*****************************************************************************
5098 * \brief Initiate a P2P transfer (P2P read)
5099 *
5100 * \param[in] pSession Pointer to destination upload session
5101 * \param[in] dmaAddrs Pointer to source DMA addresses
5102 * \param[in] pDstFrame Pointer to destination P2P frame
5103 *
5104 * \return on success
5105 * NI_RETCODE_SUCCESS
5106 * on failure
5107 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
5108 * NI_RETCODE_INVALID_PARAM
5109 * NI_RETCODE_ERROR_INVALID_SESSION
5110 * NI_RETCODE_ERROR_MEM_ALOC
5111 * NI_RETCODE_ERROR_NVME_CMD_FAILED
5112*******************************************************************************/
5114 const ni_p2p_sgl_t *dmaAddrs,
5115 ni_frame_t *pDstFrame);
5116
5117/*!*****************************************************************************
5118 * \brief Send a restart command after flush command
5119 * Only support Encoder now
5120 *
5121 * \param[in] p_ctx Pointer to a caller allocated
5122 * ni_session_context_t struct
5123 * \param[in] width width, in pixels
5124 * \param[in] height height, in pixels
5125 * \param[in] device_type NI_DEVICE_TYPE_ENCODER
5126 * \return On success
5127 * NI_RETCODE_SUCCESS
5128 * On failure
5129 * NI_RETCODE_INVALID_PARAM
5130 * NI_RETCODE_ERROR_NVME_CMD_FAILED
5131 * NI_RETCODE_ERROR_INVALID_SESSION
5132 ******************************************************************************/
5134 int video_width,
5135 int video_height,
5136 ni_device_type_t device_type);
5137
5138/*!******************************************************************************
5139* \brief Send a p_config command to reconfigure decoding ppu params.
5140*
5141* \param ni_session_context_t p_session_ctx - xcoder Context
5142* \param ni_xcoder_params_t p_param - xcoder Params
5143* \param ni_ppu_config_t p_ppu_config - Struct ni_ppu_config
5144*
5145* \return - NI_RETCODE_SUCCESS on success, NI_RETCODE_ERROR_INVALID_SESSION, NI_RETCODE_ERROR_NVME_CMD_FAILED on failure
5146*******************************************************************************/
5148 ni_xcoder_params_t *p_param,
5149 ni_ppu_config_t *p_ppu_config);
5150#ifdef __cplusplus
5151}
5152#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:442
#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_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_p2p_send(ni_session_context_t *pSession, niFrameSurface1_t *source, uint64_t ui64DestAddr, uint32_t ui32FrameSize)
Initiate P2P transfer to another device (P2P write)
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_NOTCODED_FRAME
@ NI_QUADRA_PREDICTED_FRAME
@ 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_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_OP_CONFIG_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
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
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
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
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