libxcoder 5.9.0
Loading...
Searching...
No Matches
ni_device_api.h
Go to the documentation of this file.
1/*******************************************************************************
2 *
3 * Copyright (C) 2022 NETINT Technologies
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18 * SOFTWARE.
19 *
20 ******************************************************************************/
21
22/*!*****************************************************************************
23 * \file ni_device_api.h
24 *
25 * \brief Public definitions for operating NETINT video processing devices for
26 * video processing
27 ******************************************************************************/
28
29#pragma once
30
31
32#ifdef __cplusplus
33extern "C"
34{
35#endif
36
37#include "ni_defs.h"
38#include "ni_rsrc_api.h"
39
40// resource allocation strategy names
41#define NI_BEST_MODEL_LOAD_STR "bestmodelload"
42#define NI_BEST_REAL_LOAD_STR "bestload"
43
44#define NI_DATA_FORMAT_VIDEO_PACKET 0
45#define NI_DATA_FORMAT_YUV_FRAME 1
46#define NI_DATA_FORMAT_Y_FRAME 2
47#define NI_DATA_FORMAT_CB_FRAME 3
48#define NI_DATA_FORMAT_CR_FRAME 4
49
50// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
51// If you change this,you should also change NI_QUADRA_NOPTS_VALUE in ni_quadra_filter_api.h
52#define NI_NOPTS_VALUE ((int64_t)UINT64_C(0x8000000000000000))
53
54// the following are the default values from FFmpeg
55#define AV_CODEC_DEFAULT_BITRATE 200 * 1000
56#define PRESET_DEFAULT_BITRATE 1000 * 1000
57
58#define NI_MAX_GOP_NUM 8
59
60#define NI_MAX_REF_PIC 4
61
62#ifndef DEPRECATION_AS_ERROR
64#define NI_MAX_VUI_SIZE NI_DEPRECATED_MACRO 32
65#endif
66
67#define NI_MAX_TX_RETRIES 1000
68
69#define NI_MAX_ENCODER_QUERY_RETRIES 5000
70
71// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
72// If you change this,you should also change NI_QUADRA_MAX_SUPPORT_DRAWBOX_NUM, NI_MAX_SUPPORT_WATERMARK_NUM
73// in ni_quadra_filter_api.h
74#define NI_MAX_SUPPORT_DRAWBOX_NUM 5
75#define NI_MAX_SUPPORT_WATERMARK_NUM 6
76
77// Number of pixels for main stream resolutions
78#define NI_NUM_OF_PIXELS_360P (640*360)
79#define NI_NUM_OF_PIXELS_720P (1280*720)
80#define NI_NUM_OF_PIXELS_1080P (1920*1080)
81#define NI_NUM_OF_PIXELS_1440P (2560*1440)
82#define NI_NUM_OF_PIXELS_4K (3840*2160)
83#define NI_NUM_OF_PIXELS_4K_2 (4096*2160)
84#define NI_NUM_OF_PIXELS_8K (7680*4320)
85
86#define NI_MIN_RESOLUTION_WIDTH_JPEG 48
87#define NI_MIN_RESOLUTION_HEIGHT_JPEG 48
88
89#define NI_MIN_RESOLUTION_WIDTH 144
90#define NI_MIN_RESOLUTION_HEIGHT 144
91#define NI_ENC_MIN_RESOLUTION_WIDTH 144
92#define NI_ENC_MIN_RESOLUTION_HEIGHT 128
93
94// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
95// If you change this,you should also change NI_MIN_RESOLUTION_WIDTH_SCALER,
96// NI_MIN_RESOLUTION_HEIGHT_SCALER in ni_quadra_filter_api.h
97#define NI_MIN_RESOLUTION_WIDTH_SCALER 16
98#define NI_MIN_RESOLUTION_HEIGHT_SCALER 16
99
100// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
101// If you change this,you should also change NI_QUADRA_MAX_RESOLUTION_WIDTH,
102// NI_QUADRA_MAX_RESOLUTION_HEIGHT in ni_quadra_filter_api.h
103#define NI_MAX_RESOLUTION_WIDTH 8192
104#define NI_MAX_RESOLUTION_HEIGHT 8192
105#define NI_MAX_RESOLUTION_AREA 8192*8192
106#define NI_MAX_RESOLUTION_RGBA_WIDTH 7040
107#define NI_MAX_RESOLUTION_RGBA_HEIGHT 7040
108
109#define NI_MAX_RESOLUTION_LINESIZE (NI_MAX_RESOLUTION_WIDTH*2)
110
111#define NI_FRAME_LITTLE_ENDIAN 0
112#define NI_FRAME_BIG_ENDIAN 1
113
114#define NI_INVALID_SESSION_ID 0xFFFF
115
116#define NI_MAX_BITRATE 800000000
117#define NI_MIN_BITRATE 10000
118
119#define NI_MAX_FRAMERATE 65535
120#define NI_MAX_ASPECTRATIO 65535
121
122/*Values below used for VPU resolution range checking*/
123// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
124// If you change this,you should also change NI_QUADRA_MAX_WIDTH, NI_QUADRA_MIN_WIDTH,
125// NI_QUADRA_MAX_HEIGHT, NI_QUADRA_MIN_HEIGHT in ni_quadra_filter_api.h
126#define NI_MAX_WIDTH 8192
127#define NI_MIN_WIDTH 144
128#define NI_MAX_HEIGHT 8192
129#define NI_MIN_HEIGHT 128
130
131#define NI_2PASS_ENCODE_MIN_WIDTH ((272 + 31) / 32 * 32)
132#define NI_2PASS_ENCODE_MIN_HEIGHT 256
133
134#define NI_MULTICORE_ENCODE_MIN_WIDTH 256
135#define NI_MULTICORE_ENCODE_MIN_HEIGHT 256
136
137/*Values below used for parameter resolution range checking*/
138#define NI_PARAM_MAX_WIDTH 8192
139#define NI_PARAM_MIN_WIDTH 32
140#define NI_PARAM_MAX_HEIGHT 8192
141#define NI_PARAM_MIN_HEIGHT 32
142
143#define NI_PARAM_JPEG_MIN_WIDTH 48
144#define NI_PARAM_JPEG_MIN_HEIGHT 48
145
146#define NI_PARAM_AV1_MIN_WIDTH 144
147#define NI_PARAM_AV1_MIN_HEIGHT 128
148#define NI_PARAM_AV1_MAX_WIDTH 4096
149#define NI_PARAM_AV1_MAX_HEIGHT 4352
150#define NI_PARAM_AV1_MAX_AREA (4096 * 2304)
151#define NI_PARAM_AV1_ALIGN_WIDTH_HEIGHT 8
152
153#define NI_MAX_GOP_SIZE 8
154#define NI_MIN_GOP_SIZE 1
155#define NI_MAX_GOP_PRESET_IDX 15
156#define NI_MIN_GOP_PRESET_IDX -1
157#define NI_MAX_DECODING_REFRESH_TYPE 2
158#define NI_MIN_DECODING_REFRESH_TYPE 0
159#define NI_MAX_CU_SIZE_MODE 2
160#define NI_MIN_CU_SIZE_MODE 0
161#define NI_DEFAULT_CU_SIZE_MODE 7
162#define NI_MAX_DYNAMIC_MERGE 1
163#define NI_MIN_DYNAMIC_MERGE 0
164#define NI_MAX_USE_RECOMMENDED_ENC_PARAMS 3
165#define NI_MIN_USE_RECOMMENDED_ENC_PARAMS 0
166#define NI_MAX_MAX_NUM_MERGE 3
167#define NI_MIN_MAX_NUM_MERGE 0
168#define NI_MAX_INTRA_QP 51
169#define NI_MIN_INTRA_QP -1
170#define NI_MAX_INTRA_QP_DELTA 51
171#define NI_MIN_INTRA_QP_DELTA -51
172#define NI_DEFAULT_INTRA_QP 22
173#define NI_INTRA_QP_RANGE 25
174#define NI_MIN_QP_DELTA (-25)
175#define NI_MAX_QP_DELTA 25
176#define NI_MAX_QP_INFO 63
177#define NI_MAX_BIN 1
178#define NI_MIN_BIN 0
179#define NI_MAX_NUM_SESSIONS 32
180#define NI_MIN_FRAME_SIZE 0
181#define NI_MAX_FRAME_SIZE (7680*4320*3)
182#define NI_AV1_INVALID_BUFFER_INDEX (-1)
183#define NI_MAX_SPATIAL_LAYERS 4
184
185#define RC_SUCCESS true
186#define RC_ERROR false
187
188#define MAX_CHAR_IN_DEVICE_NAME 32
189
190// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
191// If you change this,you should also change MAX_QUADRA_NUM_FRAMEPOOL_HWAVFRAME in ni_quadra_filter_api.h
192#define MAX_NUM_FRAMEPOOL_HWAVFRAME 128
193
194/* These constants are the values used by the GC620 2D engine */
195#define GC620_NV12 0x104
196#define GC620_NV21 0x105
197#define GC620_I420 0x103
198#define GC620_P010_MSB 0x108
199#define GC620_I010 0x10A
200#define GC620_YUYV 0x100
201#define GC620_UYVY 0x101
202#define GC620_NV16 0x106
203#define GC620_RGBA8888 0
204#define GC620_BGRA8888 4
205#define GC620_BGRX8888 5
206#define GC620_ABGR8888 12
207#define GC620_ARGB8888 15
208#define GC620_RGB565 3
209#define GC620_BGR565 11
210#define GC620_B5G5R5X1 8
211#define GC620_RGB888_PLANAR 0x10C
212
213#define NI_ENABLE_AUD_FOR_GLOBAL_HEADER 2
214
215// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
216// If you change this,you should also change NI_QUADRA_MAX_FIFO_CAPACITY in ni_quadra_filter_api.h
217#define NI_MAX_FIFO_CAPACITY 120
218
219/* These are Namespace and QOS configuration related */
220#define NI_NAMESPACE_MAX_NUM 128
221
222/* These are sliceArg configuration related */
223#define NI_MAX_SLICE_SIZE 127
224
225/*!*
226* Operation modes for QOS
227*/
234
235/*!*
236* Operation codes for ni_device_config_ns_qos
237*/
246
247// XCODER STATE
248typedef enum
249{
250 NI_XCODER_IDLE_STATE = 0x00, // Xcoder idle state
251 NI_XCODER_OPEN_STATE = 0x01 << 1, // Xcoder open state
252 NI_XCODER_WRITE_STATE = 0x01 << 2, // Xcoder write state
253 NI_XCODER_READ_STATE = 0x01 << 3, // Xcoder read state
254 NI_XCODER_CLOSE_STATE = 0x01 << 4, // Xcoder close state
255 // Xcoder flush state, flush at the end of stream
257 // Xcoder inter flush state, flush during transcoding stream
259 NI_XCODER_READ_DESC_STATE = 0x01 << 7, // Xcoder Read Desc state
260 NI_XCODER_HWUP_STATE = 0x01 << 8, // Xcoder HW upload state
261 NI_XCODER_HWDL_STATE = 0x01 << 9, // Xcoder HW download state
262 // Other states, like init, alloc, etc.
265
266typedef enum
267{
268 NI_PIX_FMT_YUV420P = 0, /* 8-bit YUV420 planar */
269 NI_PIX_FMT_YUV420P10LE = 1, /* 10-bit YUV420 planar */
270 NI_PIX_FMT_NV12 = 2, /* 8-bit YUV420 semi-planar */
271 NI_PIX_FMT_P010LE = 3, /* 10-bit YUV420 semi-planar */
272 NI_PIX_FMT_RGBA = 4, /* 32-bit RGBA packed */
273 NI_PIX_FMT_BGRA = 5, /* 32-bit BGRA packed */
274 NI_PIX_FMT_ARGB = 6, /* 32-bit ARGB packed */
275 NI_PIX_FMT_ABGR = 7, /* 32-bit ABGR packed */
276 NI_PIX_FMT_BGR0 = 8, /* 32-bit BGRX packed */
277 NI_PIX_FMT_BGRP = 9, /* 24-bit BGR planar */
278 NI_PIX_FMT_NV16 = 10, /* 8-bit YUV422 semi-planar */
279 NI_PIX_FMT_YUYV422 = 11, /* 8-bit YUV422 packed */
280 NI_PIX_FMT_UYVY422 = 12, /* 8-bit YUV422 packed */
281 NI_PIX_FMT_8_TILED4X4 = 13, /* 8 bit tiled4x4 */
282 NI_PIX_FMT_10_TILED4X4 = 14,/* 10 bit tiled4x4 */
283 NI_PIX_FMT_NONE = 15, /* invalid format */
285
294
295typedef enum {
296 NI_CUS_ROI_DISABLE = 0, // disable 2-pass customize roi
297 NI_CUS_ROI_MAPFILE = 1, // select qp in customizeQpMapFile
298 NI_CUS_ROI_REPLACE = 2, // replace the cutree roimap with the customize roimap
299 NI_CUS_ROI_OVERWRITE = 3, // overwrite the cutree roimap with the customize roimap
300 NI_CUS_ROI_MERGE = 4 // add the customize roimap into the cutree roimap
302
303// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
304// If you change this,you should also change NI_QUADRA_SCALER_FLAG_* in ni_quadra_filter_api.h
305#define NI_SCALER_FLAG_IO 0x0001 /* 0 = source frame, 1 = destination frame */
306#define NI_SCALER_FLAG_PC 0x0002 /* 0 = single allocation, 1 = create pool */
307#define NI_SCALER_FLAG_PA 0x0004 /* 0 = straight alpha, 1 = premultiplied alpha */
308#define NI_SCALER_FLAG_P2 0x0008 /* 0 = normal allocation, 1 = P2P allocation */
309#define NI_SCALER_FLAG_FCE 0x0010 /* 0 = no fill color, 1 = fill color enabled */
310#define NI_SCALER_FLAG_CS 0x0020 /* 0 = BT.709, 1 = BT.2020 */
311#define NI_SCALER_FLAG_LM 0x0040 /* 0 == no memory acquisition limit, 1 == limit memory acquisition */
312#define NI_SCALER_FLAG_CMP 0x0800 /* 0 = no compress, 1 = compress*/
313
314#define NI_AI_FLAG_IO 0x0001 /* 0 = source frame, 1 = destination frame */
315#define NI_AI_FLAG_PC 0x0002 /* 0 = single allocation, 1 = create pool */
316#define NI_AI_FLAG_LM 0x0004 /* 0 == no memory acquisition limit; 1 == limit memory acquisition */
317#define NI_AI_FLAG_IOVEC 0x0008
318#define NI_AI_FLAG_SC 0x0010 /* 0 == size got from network info; 1 == size configured by sw */
319
320#define NI_UPLOADER_FLAG_LM 0x0010 /* 0 == no memory acquisition limit, 1 == limit memory acquisition */
321
322// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
323// If you change this,you should also change NI_QUADRA_MAX_KEEP_ALIVE_TIMEOUT,
324// NI_QUADRA_MIN_KEEP_ALIVE_TIMEOUT,NI_QUADRA_DEFAULT_KEEP_ALIVE_TIMEOUT in ni_quadra_filter_api.h
325#define NI_MAX_KEEP_ALIVE_TIMEOUT 100
326#define NI_MIN_KEEP_ALIVE_TIMEOUT 1
327#define NI_DEFAULT_KEEP_ALIVE_TIMEOUT 3
328
329#define NI_MAX_DEFAULT_RETRY 1
330#define NI_MAX_AI_SESSION_RETRY 500
331
332#define NI_MIN_CUSTOM_SEI_PASSTHRU -1
333#define NI_MAX_CUSTOM_SEI_PASSTHRU 254
334#define NI_DISABLE_USR_DATA_SEI_PASSTHRU 0
335#define NI_ENABLE_USR_DATA_SEI_PASSTHRU 1
336#define NI_INVALID_SVCT_DECODING_LAYER -1
337#define NI_EC_POLICY_TOLERANT 1
338#define NI_EC_POLICY_IGNORE 2
339#define NI_EC_POLICY_SKIP 3
340#define NI_EC_POLICY_BEST_EFFORT 4
341#define NI_EC_POLICY_LIMITED_ERROR 5
342#define NI_EC_POLICY_BEST_EFFORT_OUT_DC 6
343#define NI_EC_POLICY_DEFAULT NI_EC_POLICY_BEST_EFFORT
344#define NI_EC_ERR_THRESHOLD_DEFAULT 10
345
346//DecDecoderMode defined in ctrlsw
347#define NI_DEC_MODE_NORMAL 0x00000000
348#define NI_DEC_MODE_LOW_LATENCY 0x00000001
349#define NI_DEC_MODE_LOW_LATENCY_RTL 0x00000002
350#define NI_DEC_MODE_SECURITY 0x00000004
351#define NI_DEC_MODE_PARTIAL_DECODING 0x00000008
352#define NI_DEC_MODE_INTRA_ONLY 0x00000010
353
354// Picked from the xcoder firmware, commit e3b882e7
355#define NI_VPU_CEIL(_data, _align) (((_data)+((_align)-1))&~((_align)-1))
356#define NI_VPU_ALIGN4(_x) (((_x)+0x03)&~0x03)
357#define NI_VPU_ALIGN8(_x) (((_x)+0x07)&~0x07)
358#define NI_VPU_ALIGN16(_x) (((_x)+0x0f)&~0x0f)
359#define NI_VPU_ALIGN32(_x) (((_x)+0x1f)&~0x1f)
360#define NI_VPU_ALIGN64(_x) (((_x)+0x3f)&~0x3f)
361#define NI_VPU_ALIGN128(_x) (((_x)+0x7f)&~0x7f)
362#define NI_VPU_ALIGN256(_x) (((_x)+0xff)&~0xff)
363#define NI_VPU_ALIGN512(_x) (((_x)+0x1ff)&~0x1ff)
364#define NI_VPU_ALIGN2048(_x) (((_x)+0x7ff)&~0x7ff)
365#define NI_VPU_ALIGN4096(_x) (((_x)+0xfff)&~0xfff)
366#define NI_VPU_ALIGN16384(_x) (((_x)+0x3fff)&~0x3fff)
367
368#if 1 // QUADRA_SEI_FMT
369#pragma pack(1)
370typedef struct _ni_sei_header {
371 uint8_t status;
372 uint16_t size;
373 uint8_t type;
375#pragma pack()
376#else // QUADRA_SEI_FMT
377typedef struct _ni_sei_user_data_entry
378{
379 uint32_t offset;
380 uint32_t size;
381} ni_sei_user_data_entry_t;
382#endif // QUADRA_SEI_FMT
383
384typedef enum
385{
391 NI_H265_USERDATA_FLAG_ITU_T_T35_PRE = 5, /* SEI Prefix: user_data_registered_itu_t_t35 */
392 NI_H265_USERDATA_FLAG_UNREGISTERED_PRE = 6, /* SEI Prefix: user_data_unregistered */
393 NI_H265_USERDATA_FLAG_ITU_T_T35_SUF = 7, /* SEI Suffix: user_data_registered_itu_t_t35 */
394 NI_H265_USERDATA_FLAG_UNREGISTERED_SUF = 8, /* SEI Suffix: user_data_unregistered */
395 NI_H265_USERDATA_FLAG_RESERVED_9 = 9, /* SEI RESERVED */
396 NI_H265_USERDATA_FLAG_MASTERING_COLOR_VOL = 10, /* SEI Prefix: mastering_display_color_volume */
397 NI_H265_USERDATA_FLAG_CHROMA_RESAMPLING_FILTER_HINT = 11, /* SEI Prefix: chroma_resampling_filter_hint */
398 NI_H265_USERDATA_FLAG_KNEE_FUNCTION_INFO = 12, /* SEI Prefix: knee_function_info */
399 NI_H265_USERDATA_FLAG_TONE_MAPPING_INFO = 13, /* SEI Prefix: tone_mapping_info */
400 NI_H265_USER_DATA_FLAG_FILM_GRAIN_CHARACTERISTICS_INFO = 14, /* SEI Prefix: film_grain_characteristics_info */
401 NI_H265_USER_DATA_FLAG_CONTENT_LIGHT_LEVEL_INFO = 15, /* SEI Prefix: content_light_level_info */
402 NI_H265_USER_DATA_FLAG_COLOUR_REMAPPING_INFO = 16, /* SEI Prefix: content_light_level_info */
403 NI_H265_USERDATA_FLAG_ITU_T_T35_PRE_1 = 28, /* SEI Prefix: additional user_data_registered_itu_t_t35 */
404 NI_H265_USERDATA_FLAG_ITU_T_T35_PRE_2 = 29, /* SEI Prefix: additional user_data_registered_itu_t_t35 */
405 NI_H265_USERDATA_FLAG_ITU_T_T35_SUF_1 = 30, /* SEI Suffix: additional user_data_registered_itu_t_t35 */
406 NI_H265_USERDATA_FLAG_ITU_T_T35_SUF_2 = 31, /* SEI Suffix: additional user_data_registered_itu_t_t35 */
408
409typedef enum
410{
411 PIC_TYPE_I = 0, /*!*< I picture */
412 PIC_TYPE_P = 1, /*!*< P picture */
413 PIC_TYPE_B = 2, /*!*< B picture (except VC1) */
414
416 PIC_TYPE_IDR = 3, /*!*< Encoder IDR pic type */
417 DECODER_PIC_TYPE_IDR = 5, /*!*< Decoder-returned IDR pic type */
418 PIC_TYPE_NIDR = 5, /*!*< H.264/H.265 IDR picture */
419 PIC_NOT_CODED = 6, /*!*< Picture dropped in encoder */
420 PIC_TYPE_MAX /*!*< No Meaning */
422
423#if 1 // QUADRA_SEI_FMT
424// user data unreg and custom SEIs have variable length;
425// non-custom SEIs will be dropped if buffer overflow;
426// custom SEIs passthru is via SW and host memory constrained
427#define NI_ENC_MAX_SEI_BUF_SIZE NI_VPU_ALIGN64(1024) // sync with encoder
428
429// PIC_TIMING and BUFFERING_PERIOD apply to encoder only, not needed from decoder
430// For now, only the following will be returned from decoder:
431// - T35 has 3 possible data types: CLOSE_CAPTION, HDR10PLUS, AFD
432// - MASTERING_DISPLAY_COLOUR
433// - CONTENT_LIGHT_LEVEL
434// - USER_DATA_UNREGISTERED
435// - CUSTOM_SEI
436// Note: USER_DATA_UNREGISTERED may have arbitrary size but SEI buffer
437// size is limited. The SEI buffer on decoder has the following format:
438// [byte0: #entries][entry1]..[entryN]
439// up to (1 + sizeof(ni_sei_header_t) + NI_MAX_SEI_DATA) bytes maximum;
440// where [entryX] := [ni_sei_header][payload]
441// [payload] of ni_sei_header.size: present only if ni_sei_header.status == 1
442// X in [1..N] with N <= #entries
443// N == #entries only if NI_MAX_SEI_DATA is large enough to store all #entries
444// ex:
445// entryX header fits in the buffer during SEI extration, but payload can't fit in;
446// so only entryX header is stored but payload is drop with status set 0.
447// entryX header can't fit in the buffer (SEI buffer full); so extryX is not stored
448// in the SEI buffer (neither will any further SEIs)
449//
450// To maintain alignment, current implementation retrieves SEI data buffer from
451// entry 1's payload onwards (skipping byte0, and entry 1's header),
452// while #entries (same value as SEI buffer byte0) and entry 1's header are notified
453// separately via metadata.
454#define NI_MAX_SEI_DATA (NI_ENC_MAX_SEI_BUF_SIZE) // sync with decoder_manager
455// Custom SEI only applies to software delivery
456#define NI_MAX_CUSTOM_SEI_DATA (8192)
457
458#else // QUADRA_SEI_FMT
459#define NI_MAX_SEI_ENTRIES 32
460// 32 user_data_entry_t records + various SEI messages sizes
461#define NI_MAX_SEI_DATA \
462 NI_MAX_SEI_ENTRIES * sizeof(ni_sei_user_data_entry_t) + \
463 NI_MAX_T35_CLOSE_CAPTION_SIZE + \
464 NI_MASTERING_DISPLAY_COLOUR_VOLUME_SIZE + \
465 NI_CONTENT_LIGHT_LEVEL_INFO_SIZE + NI_MAX_T35_HDR10PLUS_SIZE + \
466 NI_MAX_T35_AFD_SIZE
467#endif // QUADRA_SEI_FMT
468
469#define NI_DEC_MAX_CC_BUF_SIZE 93 // max 31 CC entries of 3 bytes each
470
471#define NI_CC_SEI_BYTE0 0xB5 // itu_t_t35_country_code =181 (North America)
472#define NI_CC_SEI_BYTE1 0x00
473#define NI_CC_SEI_BYTE2 0x31 // itu_t_t35_provider_code = 49
474#define NI_CC_SEI_BYTE3 0x47 // ATSC_user_identifier = "GA94"
475#define NI_CC_SEI_BYTE4 0x41
476#define NI_CC_SEI_BYTE5 0x39
477#define NI_CC_SEI_BYTE6 0x34
478#define NI_CC_SEI_BYTE7 0x03 // cc_data = 0x03
479
480#define NI_HDR10P_SEI_BYTE0 0xB5 // itu_t_t35_country_code =181 (North America
481#define NI_HDR10P_SEI_BYTE1 0x00
482#define NI_HDR10P_SEI_BYTE2 0x3c // itu_t_t35_provider_code = 0x003c
483#define NI_HDR10P_SEI_BYTE3 0x00
484#define NI_HDR10P_SEI_BYTE4 0x01 // u16 itu_t_t35_provider_oriented_code = 0x0001
485#define NI_HDR10P_SEI_BYTE5 0x04 // u8 application_identifier = 0x04
486// no longer checking the application version as it was originally 0 but was recently specified as one by AOM.
487#define NI_HDR10P_SEI_BYTE6 0x00 // u8 application version = 0x00
488
489#define NI_CC_SEI_HDR_HEVC_LEN 18
490#define NI_HDR10P_SEI_HDR_HEVC_LEN 9
491#define NI_HDR10P_SEI_HDR_H264_LEN 8
492#define NI_HDR10P_SEI_HDR_AV1_LEN 4
493#define NI_CC_SEI_HDR_H264_LEN 17
494#define NI_CC_SEI_HDR_AV1_LEN 13
495#define NI_CC_SEI_TRAILER_LEN 2
496#define NI_RBSP_TRAILING_BITS_LEN 1
497
498// The macro definition in ni_quadra_filter_api.h need to be synchronized with libxcoder
499// If you change this,you should also change NI_QUADRA_MAX_NUM_AUX_DATA_PER_FRAME in ni_quadra_filter_api.h
500#define NI_MAX_NUM_AUX_DATA_PER_FRAME 16
501
503#define NI_BITRATE_RECONFIG_FILE_MAX_LINES 50000
506#define NI_BITRATE_RECONFIG_FILE_MAX_ENTRIES_PER_LINE 10
507
509#define NI_CUSTOMIZE_ROI_QPOFFSET_LEVEL 10
511#define NI_CUSTOMIZE_ROI_QP_NUM 64
512
513#define MOTION_CONSTRAINED_PERFORMANCE_MODE 1
514#define MOTION_CONSTRAINED_QUALITY_MODE 2
515#define MOTION_CONSTRAINED_QUALITY_MODE_ADVANCED 3
516// Highest supported mode id; when adding a mode, define its value then point MAX at the new last id (no separate literal).
517#define MOTION_CONSTRAINED_MODE_MAX MOTION_CONSTRAINED_QUALITY_MODE_ADVANCED
518
519/*!*
520* \brief Frame pool type.
521*/
523{
524 NI_POOL_TYPE_NONE = -1, /* frame pool not inited or allocated */
528
529// frame auxiliary data; mostly used for SEI data associated with frame
531{
533
534 // ATSC A53 Part 4 Closed Captions
536
537 // HDR10 mastering display metadata associated with a video frame
539
540 // HDR10 content light level (based on CTA-861.3). This payload contains
541 // data in the form of ni_content_light_level_t struct.
543
544 // HDR10+ dynamic metadata associated with a video frame. The payload is
545 // a ni_dynamic_hdr_plus_t struct that contains information for color volume
546 // transform - application 4 of SMPTE 2094-40:2016 standard.
548
549 // Regions of Interest, the payload is an array of ni_region_of_interest_t,
550 // the number of array element is implied by:
551 // ni_frame_aux_data.size / sizeof(ni_region_of_interest_t)
553
554 // NETINT: user data unregistered SEI data, which takes SEI payload type
555 // USER_DATA_UNREGISTERED.
556 // There will be no byte reordering.
557 // Usually this payload would be: 16B UUID + other payload Bytes.
559
560 // NETINT: custom SEI data, which takes SEI payload custom types.
561 // There will be no byte reordering.
562 // Usually this payload would be: 1B Custom SEI type + 16B UUID + other
563 // payload Bytes.
565
566 // NETINT: bitrate adjustment, which takes int32_t type data as
567 // payload that indicates the new target bitrate value.
569
570 // NETINT: custom INTRAPRD adjustment, which takes int32_t type data
571 // as payload that specifies the new intra period
573
574 // NETINT: custom VUI adjustment, which is a struct of
575 // ni_vui_hrd_t that specifies a frame's support of vui
577
578 // NETINT: long term reference frame support, which is a struct of
579 // ni_long_term_ref_t that specifies a frame's support of long term
580 // reference frame.
582
583 // NETINT: long term reference interval adjustment, which takes int32_t
584 // type data as payload that indicates the new long term reference interval
585 // value.
587
588 // NETINT: frame reference invalidation, which takes int32_t type data
589 // as payload that indicates the frame number after which all references
590 // shall be invalidated.
592
593 // NETINT: framerate adjustment, which takes int32_t type data as
594 // payload that indicates the new target framerate numerator and denominator values.
596
597 // NETINT: maxFrameSize adjustment, which takes int16_t type data as
598 // payload that indicates the new maxFrameSize value
600
601 // NETINT: max&min QP adjustment, which is a struct of
602 // payload that indicate the new max&min QP values
604
605 // NETINT: crf adjustment, which takes int32_t type data
606 // as payload that indicates the new crf value.
608
609 // NETINT: crf adjustment, which takes float type data
610 // as payload that indicates the new crf value.
612
613 // NETINT: VbvMaxRate adjust, which takes int32_t type
614 // as payload that indicates the VbvMaxRate value.
616
617 // NETINT: VbvBufferSize adjust, which takes int32_t type
618 // as payload that indicates the vbvBufferSize value.
620
621 // NETINT: sliceArg adjust, which takes int16_t type
622 // as payload that indicates the sliceArg value.
624
625 // NETINT: sliceArg adjust, which takes ni_category_classify_t
626 // type as payload that indicates the class and prob.
629
630// rational number (pair of numerator and denominator)
631typedef struct _ni_rational
632{
633 int num; // numerator
634 int den; // denominator
636
637// create an ni_rational_t
638static inline ni_rational_t ni_make_q(int num, int den)
639{
640 ni_rational_t ret = {num, den};
641 return ret;
642}
643
644// convert an ni_rational_t to a double
645static inline double ni_q2d(ni_rational_t a)
646{
647 return a.num / (double)a.den;
648}
649
650// struct to hold auxiliary data for ni_frame_t
657
658// struct describing a Region Of Interest (ROI)
660{
661 // self size: must be set to: sizeof(ni_region_of_interest_t)
662 uint32_t self_size;
663
664 // ROI rectangle: pixels from the frame's top edge to the top and bottom
665 // edges of the rectangle, from the frame's left edge to the left and right
666 // edges of the rectangle.
667 int top;
669 int left;
670 int right;
671
672 // quantisation offset: [-1, +1], 0 means no quality change; < 0 value asks
673 // for better quality (less quantisation), > 0 value asks for worse quality
674 // (greater quantisation).
677
678// struct describing category class and prob
685
686// struct describing VUI HRD support.
687typedef struct _ni_vui_hrd
688{
689 // Indicates the presence of color info such as primaries, trc etc.
691
692 // Indicates the chromaticity of RGB and white components of the
693 // displayed image (See Table E.3 of H.265 spec)
695
696 // The opto-electronic transfer characteristic of the source picture
697 // (See Table E.4 of H.265 spec)
698 int32_t colorTrc;
699
700 // Method to represent brightness, luminance or luma and colour (e.g. RGB)
701 int32_t colorSpace;
702
703 // Luma sample aspect ratio width. With aspectRatioHeight, translates
704 // into specific display ratios such as 16:9, 4:3, etc.
706
707 // Luma sample aspect ratio height
709
710 // Input video signal sample range [0,1].
711 // 0 = Y range in [16..235] Cb,Cr in [16..240]. 1 = Y,Cb,Cr in [0..255]
714
715// struct describing long term reference frame support.
716typedef struct _ni_long_term_ref
717{
718 // A flag for the current picture to be used as a long term reference
719 // picture later at other pictures' encoding
721
722 // A flag to use a long term reference picture in DPB when encoding the
723 // current picture
726
727// struct describing framerate.
728typedef struct _ni_framerate
729{
730 // framerate numerator
732
733 // framerate denominator
736
737typedef struct _ni_rc_min_max_qp
738{
739 int32_t minQpI;
740 int32_t maxQpI;
741 int32_t maxDeltaQp;
742 int32_t minQpPB;
743 int32_t maxQpPB;
745
746typedef struct _ni_dec_win
747{
748 int16_t left;
749 int16_t right;
750 int16_t top;
751 int16_t bottom;
753
755{
757 uint32_t time_scale;
759 uint8_t color_trc;
760 uint8_t color_space;
762 // 48 bytes reserved for receiving more header info
763 uint64_t rsvd0;
764 uint64_t rsvd1;
765 uint64_t rsvd2;
766 uint64_t rsvd3;
767 uint64_t rsvd4;
768 uint64_t rsvd5;
770
771/*!*
772* \brief decoded payload format of H.265 VUI
773*
774*/
776{
781
784
787
788 uint16_t sar_width;
789 uint16_t sar_height;
790
794
798
800
802
807
810
813
820
824
826
828
829/*!*
830* \brief decoded payload format of H.264 VUI
831*
832*/
877
878/*!*
879* \brief encoder HEVC ROI custom map (1 CTU = 64bits)
880*/
882{
883 struct
884 {
885 uint32_t ctu_force_mode : 2; //[ 1: 0]
886 uint32_t ctu_coeff_drop : 1; //[ 2]
887 uint32_t reserved : 5; //[ 7: 3]
888 uint32_t sub_ctu_qp_0 : 6; //[13: 8]
889 uint32_t sub_ctu_qp_1 : 6; //[19:14]
890 uint32_t sub_ctu_qp_2 : 6; //[25:20]
891 uint32_t sub_ctu_qp_3 : 6; //[31:26]
892
893 uint32_t lambda_sad_0 : 8; //[39:32]
894 uint32_t lambda_sad_1 : 8; //[47:40]
895 uint32_t lambda_sad_2 : 8; //[55:48]
896 uint32_t lambda_sad_3 : 8; //[63:56]
899
900/*!*
901* \brief encoder AVC ROI custom map (1 MB = 8bits)
902*/
904{
905 struct
906 {
907 uint8_t mb_force_mode : 2; // [ 1: 0]
908 uint8_t mb_qp : 6; // [ 7: 2]
911
912/*!*
913* \brief encoder AVC ROI custom map (1 MB = 8bits)
914*/
915// QP/CU Control Information Format 1
917{
918 struct
919 {
920 uint8_t roiAbsQp_flag : 1; // [ 0] (0: QP_delta, 1: abs_QP)
921 uint8_t
922 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)
923 uint8_t
924 ipcm_flag : 1; // [ 7] (0: do not force IPCM mode, 1: force IPCM mode)
927// QP/CU Control Information Format 2
928/*
929typedef union _ni_enc_quad_roi_custom_map
930{
931 struct
932 {
933 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)
934 uint8_t roiAbsQp_flag : 1; // [ 6] (0: QP_delta, 1: abs_QP)
935 uint8_t skip_flag : 1; // [ 7] (0: do not force skip mode, 1: force skip)
936 } field;
937} ni_enc_quad_roi_custom_map;
938*/
939/*!*
940* \brief This is an enumeration for supported codec formats.
941*/
950
958
965
966
967/*!*
968* \brief This is an enumeration for hw actions
969*/
979
980/*!*
981* \brief This is an enumeration for encoder parameter change.
982*/
984{
985 // COMMON parameters which can be changed frame by frame.
987 //NI_SET_CHANGE_PARAM_INTRA_PARAM = (1 << 1), // not required by customers
989 //NI_SET_CHANGE_PARAM_RC = (1 << 9), // not required by customers
1008 NI_SET_CHANGE_PARAM_INTRA_PERIOD = ((unsigned int)1 << 31),
1009 //bit [2,7] and [13,15] is still unused
1011
1016{
1018
1019 // NI_SET_CHANGE_PARAM_RC_TARGET_RATE
1020 int32_t bitRate;
1023 // NI_SET_CHANGE_PARAM_RC
1024// (rcEnable, cuLevelRc, bitAllocMode, RoiEnable, RcInitQp can't be changed while encoding)
1025 int32_t hvsQPEnable;
1026 int32_t hvsQpScale;
1030 // NI_SET_CHANGE_PARAM_RC_MIN_MAX_QP
1031 int32_t minQpI;
1032 int32_t maxQpI;
1034 int32_t maxDeltaQp;
1035#ifdef QUADRA
1036 int32_t minQpPB;
1037 int32_t maxQpPB;
1038#else
1039 int32_t minQpP;
1040 int32_t minQpB;
1041 int32_t maxQpP;
1042 int32_t maxQpB;
1043#endif
1044
1045 // NI_SET_CHANGE_PARAM_INTRA_PARAM
1046 int32_t intraQP;
1047 int32_t intraPeriod;
1050#ifdef QUADRA
1051 // NI_SET_CHANGE_PARAM_VUI_HRD_PARAM
1054 uint8_t colorTrc;
1055 uint8_t colorSpace;
1060 // RESERVED FOR FUTURE USE
1061 uint8_t reserved[5];
1062
1063 // NI_SET_CHANGE_PARAM_SLICE_ARG
1064 int16_t sliceArg;
1065 //NI_SET_CHANGE_PARAM_VBV also reconfig for ni_vbvBufferSize
1066 int32_t vbvMaxRate;
1067
1068 // NI_SET_CHANGE_PARAM_CRF
1069 // crf reconfig (range in [0.00 .. 51.00])
1070 uint8_t crfDecimal; // crf decimal fraction * 100 (range in [0 .. 99])
1071 uint8_t crf; // crf integer (range in [0 .. 51])
1072
1073 // NI_SET_CHANGE_PARAM_MAX_FRAME_SIZE
1074 uint16_t maxFrameSize; // maxFrameSize reconfig (in unit of 2000 bytes)
1075
1076 // NI_SET_CHANGE_PARAM_INVALID_REF_FRAME
1078
1079 // NI_SET_CHANGE_PARAM_LTR_INTERVAL
1081
1082 // NI_SET_CHANGE_PARAM_RC_FRAMERATE
1085#else
1086 int32_t reserved[8];
1087#endif
1089
1090/*!*
1091* \brief decoded payload format of HDR SEI mastering display colour volume
1092*
1093*/
1102
1103/*!*
1104* \brief payload format of HDR SEI content light level info
1105*
1106*/
1112
1113/*!*
1114* \brief encoded payload format of HDR SEI mastering display colour volume
1115*
1116*/
1125
1126typedef struct _ni_pkt_info
1127{
1128 double psnr_y;
1129 double psnr_u;
1130 double psnr_v;
1132 double ssim_y;
1133 double ssim_u;
1134 double ssim_v;
1135 double reserved[1];
1137
1138/*!*
1139 * \brief This is an enumeration for illustrating the custom SEI locations.
1140 */
1146
1147/*!*
1148 * \brief custom sei payload passthrough
1149 */
1157
1163
1164/*!*
1165* \brief hardware capability type
1166*/
1167typedef struct _ni_hw_capability
1168{
1169 uint8_t hw_id;
1171 uint8_t max_4k_fps;
1173 uint8_t codec_type;
1180 uint8_t reserved; // 16B alignment. Unnecessary?
1182
1183/*!*
1184* \brief device capability type
1185*/
1206
1207/*!*
1208* \brief Session running state type.
1209*/
1218
1219typedef struct _ni_context_query
1220{
1221 uint32_t context_id : 8; //07:00 SW Instance ID (0 to Max number of instances)
1222 uint32_t context_status : 8; //15:08 Instance Status (0-Idle, 1-Active)
1223 uint32_t
1224 codec_format : 8; //23:16 Codec Format (0-H264, 1-H265, 2-VP9, 3-JPEG, 4-AV1)
1225 uint32_t video_width : 16; //39:24 Video Width (0 to Max Width)
1226 uint32_t video_height : 16; //55:40 Video Height (0 to Max Height)
1227 uint32_t fps : 8; //63:56 FPS (0 to 255)
1228 uint32_t reserved : 8; //Alignment
1230
1231typedef struct _ni_load_query
1232{
1235 uint32_t fw_load;
1237 union{
1239 uint32_t pcie_throughput; //PCIe throughput - ni_query_nvme_status
1240 };
1241 union {
1243 uint32_t pcie_load; //PCIe load - ni_query_nvme_status
1244 };
1247 union {
1249 uint32_t tp_fw_load; //TP FW load - ni_query_nvme_status
1250 };
1251
1253
1256
1264
1276
1287
1292
1294{
1295 int hw_id; // Codec ID
1296 uint32_t session_id; // session id
1297 uint64_t session_timestamp; // Session Start Timestamp
1298 bool close_thread; // a flag that the keep alive thread is closed or need to be closed
1299 uint32_t device_type; // Device Type, Either NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
1300 ni_device_handle_t device_handle; // block device handler
1301 ni_event_handle_t thread_event_handle; // only for Windows asynchronous read and write
1302 void *p_buffer; // only be used when regular-io.
1303 ni_pthread_mutex_t *p_mutex; // referring to mutex of session context.
1304 uint32_t keep_alive_timeout; // keep alive timeout setting
1305 volatile uint64_t *plast_access_time; // shared variable for main thread to verify timeout. Keep alive thread will update last_access_time
1307
1317
1328
1339
1348
1356
1361
1363{
1364 uint32_t num_of_dims; /* The number of dimensions specified in *sizes */
1365 uint32_t sizes[6]; /* The pointer to an array of dimension */
1366 int32_t
1367 data_format; /* Data format for the tensor, see ni_ai_buffer_format_e */
1368 int32_t
1369 quant_format; /* Quantized format see ni_ai_buffer_quantize_format_e */
1370 union
1371 {
1372 struct
1373 {
1374 int32_t
1375 fixed_point_pos; /* Specifies the fixed point position when the input element type is int16, if 0 calculations are performed in integer math */
1377
1378 struct
1379 {
1380 float scale; /* Scale value for the quantized value */
1381 int32_t zeroPoint; /* A 32 bit integer, in range [0, 255] */
1383 } quant_data; /* The union of quantization information */
1384 /* The type of this buffer memory. */
1385 uint32_t memory_type;
1387
1393
1398
1399typedef struct _ni_network_data
1400{
1401 uint32_t input_num;
1402 uint32_t output_num;
1405 *inset; /* point to each input layer start offset from p_frame */
1407 *outset; /* point to each output layer start offset from p_packet */
1409
1410// if change this structure, you need to change ni_quadra_filter_api.h ni_quadra_frameclone_desc_t
1412{
1413 uint16_t ui16SrcIdx;
1414 uint16_t ui16DstIdx;
1415 uint32_t ui32Offset;
1416 uint32_t ui32Size;
1417 uint32_t reserved;
1419
1431
1432typedef struct _ni_input_frame
1433{
1435
1436 uint32_t video_width;
1438
1439 int64_t pts;
1440
1441 int8_t usable;
1443
1444// This is for decoder to reset the ppu value
1445// ppu_set_enable & (0x1 << idx) is which ppu[idx] enabled
1446// for examle, ppu_set_enable is 3, so ppu0 amd ppu1 is enabled
1447// 0x03 & (0x01 << 0) is not 0 and 0x03 &(0x01 << 1) is not 0
1448// 0: all ppu disabled. 1: ppu0 enabled. 2: ppu1 enabled
1449// 3: ppu0 ppu1 enabled. 4: ppu2 enabled. 5: ppu0 ppu2 enabled
1450// 6: ppu1 ppu enabled. 7: all ppu enabled others: disabled
1456
1457typedef float (*ni_kernel_coeff_fn)(int filtersize, double offset, double B, double C);
1459{
1461 /* frame_time_q is pointer to ni_lat_meas_q_t but reserved as void pointer
1462 here as ni_lat_meas_q_t is part of private API */
1464#ifndef DEPRECATION_AS_ERROR
1466#endif
1467
1475
1477
1488
1491 int64_t last_pts;
1492 int64_t last_dts;
1500#ifndef DEPRECATION_AS_ERROR
1502#endif
1503
1504 /* store pts values to create an accurate pts offset */
1513
1516
1518 ni_device_handle_t device_handle;
1519
1521 ni_device_handle_t blk_io_handle;
1522
1524 ni_device_handle_t sender_handle;
1525 ni_device_handle_t auto_dl_handle;
1526 uint8_t is_auto_dl;
1527
1530
1536 uint32_t session_id;
1540 uint32_t device_type;
1547
1548 int src_bit_depth; // 8 or 10 bits/pixel formats, default 8
1549 int src_endian; // encoding 0: little endian (default) 1: big
1550 int bit_depth_factor; // for YUV buffer allocation
1551 // for encoder roi metadata
1552 uint32_t roi_len;
1553 uint32_t roi_avg_qp;
1554
1557
1558 /* Overall resource use among namespaces */
1560
1562 uint8_t *p_leftover;
1564 uint32_t sent_size;
1565
1567 uint8_t *p_hdr_buf;
1569
1572
1575
1578
1582
1583 void *p_dump[2];
1584 char param_err_msg[512];
1585
1586 int keyframe_factor; // Unused
1587 uint64_t frame_num;
1588 uint64_t pkt_num;
1589 int rc_error_count; // Unused
1590
1592 uint32_t hwd_src_cpu;
1595 uint32_t hwd_Inst_ID;
1596
1597 // frame forcing: for encoding
1599
1600 uint32_t ready_to_close; //flag to indicate we are ready to close session
1601
1602 // session running state
1604 //Current video width. this is used to do sequence change
1606 //Current video height ,this is used to do sequence change
1608 //Actual video width (without stride + cropped)
1610 // Used to track sequence changes that require bigger bitstream buffers
1612 ni_pthread_t keep_alive_thread;
1616
1617 // original resolution this stream started with, this is used by encoder sequence change
1619
1620 // a mutex for Xcoder API, to keep the thread-safety.
1621 ni_pthread_mutex_t mutex;
1622
1623 // Xcoder running state
1625
1626 // only be used when regular-io
1627 void *p_all_zero_buf; //This is for sos, eos, flush and keep alive request
1628
1629 // these two event handle are only for Windows asynchronous read and write now
1630 ni_event_handle_t event_handle;
1631 ni_event_handle_t thread_event_handle;
1632
1633 // ROI data
1635 // last passed in ni_region_of_interest_t
1638 ni_enc_quad_roi_custom_map *roi_map; // actual AVC/HEVC QP map
1639
1640 // only for H.264 test roi buffer for up to 8k resolution H.264 - 32 x 32 sub CTUs
1642 // only for H.265 custom map buffer for up to 8k resolution - 64x64 CTU Regions
1644 // only for hevc actual ROI map is stored in individual session context !
1646
1647 // encoder reconfig parameters
1649 // decoder lowDelay mode for All I packets or IPPP packets
1652
1653 // wrapper API request data, to be sent out once with the next input frame
1654 // to encoder
1655 int32_t target_bitrate; // A target bitrate to reconfig, -1 if inactive
1656 int force_idr_frame; // force IDR frame type
1658 int32_t ltr_interval; // LTR interval to set
1659 int32_t ltr_frame_ref_invalid; // frame after which all ref to be invalid
1660 ni_framerate_t framerate; // framerate to reconfig, 0 if inactive
1661 ni_vui_hrd_t vui; // vui to reconfig
1662
1663 // path of decoder input pkt saving folder
1667
1668 // some parameters for decoder session
1669 // int hw_frame_extra_buffer; e.g. 3
1673 int32_t isP2P;
1675 unsigned short domain;
1676 unsigned short bus;
1677 unsigned short dev;
1678 unsigned short fn;
1679
1680 // the FW API version of device that opened
1681 uint8_t fw_rev[8];
1682 uint8_t ddr_config;
1683
1685
1687 uint32_t prev_fps;
1689 uint64_t prev_pts;
1693
1694 uint32_t meta_size;
1698
1699 // flags_array to save packet flags
1701
1702 // for decoder: store currently returned decoded frame's pkt offset
1705
1707
1708 uint32_t count_frame_num_in_sec; //used in the vfr mode, indicate the frame count in seconds
1709 uint32_t passed_time_in_timebase_unit; //used in the vfr mode, indicate how long it has passed
1710
1711 int32_t max_frame_size; // maxFrameSize (in bytes) to reconfig, 0 if inactive
1712
1713 // block device name requested by caller to open: when specified this block
1714 // device has priority over hw_id which is device specified by index.
1716
1717 // decoder low delay send/recv sync; async_mode = 0 by default, i.e.
1718 // codec send-to/recv-from FW is in synchrounous mode by default.
1721 ni_pthread_mutex_t low_delay_sync_mutex;
1722 ni_pthread_cond_t low_delay_sync_cond;
1723
1724 // muxtex default from source session
1725 // required pointer to external if used by hwdl
1726 ni_pthread_mutex_t* pext_mutex;
1728
1729 // required parameters for slow sequence change
1732
1733 // AI embedded network parameters data
1735
1738 //shared variable for main thread to read and keepalive thread to update
1739 volatile uint64_t last_access_time;
1740
1741 int reconfig_crf; // crf value to reconfig (range in [0..51]), -1 if inactive
1742 int reconfig_crf_decimal; // crf decimal fration value to reconfig
1743 // (range in [0..99]), -1 if inactive
1744 int reconfig_vbv_buffer_size; // vbv buffer size value to reconfig
1745 int reconfig_vbv_max_rate; // vbv max rate value to reconfig
1746
1751 uint64_t av1_pkt_num;
1752
1759 char E2EID[128];
1761 int pixel_format_changed; // only for decoder now
1763
1766 double psnr_y;
1767 double psnr_u;
1768 double psnr_v;
1773
1775
1776 // write packet/frame required buf size
1778
1779 // record the drop num
1781
1782 //for AI aio
1783 ni_aio_context_t aio_context;
1784 ni_iocb_t **iocbs;
1785 ni_io_event_t *io_event;
1787
1791
1793 void *mctf;
1796 int accumulated_query_time; // for ai read
1797 uint8_t *rbsp[2];
1798 size_t rbsp_cap[2];
1799
1800 /* 1 after bitstream metadata reports an IDR (picture type I or IDR).
1801 * Cleared after mmco 4 is inserted into a later slice whose
1802 * adaptive_ref_pic_marking_mode_flag is already 1. Appended so existing
1803 * session-context field offsets stay the same. */
1806
1808{
1810 int w[3];
1811 int h[3];
1812 int f[3]; //planar format
1813 int f8b[3]; //forced 8bit
1814 //int crop_meta_data_rltb[3][4]; //crop rectangle
1816
1817/*!*
1818* \brief This is an enumeration for encoder reconfiguration test settings
1819*/
1820typedef enum _ni_reconfig
1821{
1827//XCODER_TEST_RECONF_RC = 5, // not required by customers
1828 XCODER_TEST_RECONF_RC_MIN_MAX_QP = 6, // reconfig min&max QP
1829#ifdef QUADRA
1834 XCODER_TEST_RECONF_RC_MIN_MAX_QP_REDUNDANT = 11, // reconfig min&max QP through libxcoder API (redundant demo mode index)
1840 XCODER_TEST_RECONF_LTR_INVALID_REF = 19, // set LTR and/or invalidate ref frames
1841 XCODER_TEST_FORCE_IDR_FRAME = 100, // force IDR through libxcoder API
1842 XCODER_TEST_RECONF_BR_API = 101, // reconfig BR through libxcoder API
1843 XCODER_TEST_RECONF_INTRAPRD_API = 102, // reconfig intraperiod through libxcoder API
1844 XCODER_TEST_RECONF_VUI_HRD_API = 103, // reconfig VUI through libxcoder API
1845 XCODER_TEST_RECONF_LTR_API = 104, // reconfig LTR through libxcoder API
1846 XCODER_TEST_RECONF_RC_MIN_MAX_QP_API_REDUNDANT = 106, // reconfig min&max QP through libxcoder API (redundant demo mode index)
1847 XCODER_TEST_RECONF_LTR_INTERVAL_API = 107, // reconf LTR interval thru API
1848 XCODER_TEST_INVALID_REF_FRAME_API = 108, // invalidate ref frame thru API
1849 XCODER_TEST_RECONF_FRAMERATE_API = 109, // reconfig framerate through libxcoder API
1850 XCODER_TEST_RECONF_MAX_FRAME_SIZE_API = 110, // reconfig maxFrameSize through libxcoder API
1851 XCODER_TEST_RECONF_RC_MIN_MAX_QP_API = 111, // reconfig min&max QP through libxcoder API
1852 XCODER_TEST_CRF_API = 114, // reconfig crf through libxcoder API
1853 XCODER_TEST_CRF_FLOAT_API = 115, // reconfig crf float type through libxcoder API
1854 XCODER_TEST_RECONF_VBV_API = 116, // reconfig vbv buffer size and vbv max rate through libxcoder API
1855 XCODER_TEST_RECONF_MAX_FRAME_SIZE_RATIO_API = 117, // reconfig maxFrameSize ratio through libxcoder API
1856 XCODER_TEST_RECONF_SLICE_ARG_API = 118, // reconfig sliceArg through libxcoder API
1857 XCODER_TEST_RECONF_LTR_INVALID_REF_API = 119, // set LTR and/or invalidate ref frames thru API
1859#endif
1861
1863{
1864 /* A float type of buffer data */
1866 /* A half float type of buffer data */
1868 /* A 8 bit unsigned integer type of buffer data */
1870 /* A 8 bit signed integer type of buffer data */
1872 /* A 16 bit unsigned integer type of buffer data */
1874 /* A 16 signed integer type of buffer data */
1876 /* A char type of data */
1878 /* A bfloat 16 type of data */
1880 /* A 32 bit integer type of data */
1882 /* A 32 bit unsigned signed integer type of buffer */
1884 /* A 64 bit signed integer type of data */
1886 /* A 64 bit unsigned integer type of data */
1888 /* A 64 bit float type of buffer data */
1891
1893{
1894 /* Not quantized format */
1896 /* A quantization data type which specifies the fixed point position for whole tensor. */
1898 /* A quantization data type which has scale value and zero point to match with TF and
1899 Android NN API for whole tensor. */
1901 /* A max vaule support quantize format */
1904
1906{
1907 NI_DDR_PRIORITY_NONE = -1, // Do not change DDR priorities
1908 NI_DDR_PRIORITY_RESET, // Reset DDR priorities to default
1909 NI_DDR_PRIORITY_DECENC, // DDR prioritize decoder and encoder
1910 NI_DDR_PRIORITY_FILT, // DDR prioritize filter
1911 NI_DDR_PRIORITY_AI, // DDR prioritize AI
1914
1927
1928#ifdef QUADRA
1929#define NI_ENC_GOP_PARAMS_G0_POC_OFFSET "g0pocOffset"
1930#define NI_ENC_GOP_PARAMS_G0_QP_OFFSET "g0QpOffset"
1931//#define NI_ENC_GOP_PARAMS_G0_QP_FACTOR "g0QpFactor"
1932#define NI_ENC_GOP_PARAMS_G0_TEMPORAL_ID "g0temporalId"
1933#define NI_ENC_GOP_PARAMS_G0_PIC_TYPE "g0picType"
1934#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PICS "g0numRefPics"
1935#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC0 "g0refPic0"
1936#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC0_USED "g0refPic0Used"
1937#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC1 "g0refPic1"
1938#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC1_USED "g0refPic1Used"
1939#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC2 "g0refPic2"
1940#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC2_USED "g0refPic2Used"
1941#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC3 "g0refPic3"
1942#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC3_USED "g0refPic3Used"
1943
1944#define NI_ENC_GOP_PARAMS_G1_POC_OFFSET "g1pocOffset"
1945#define NI_ENC_GOP_PARAMS_G1_QP_OFFSET "g1QpOffset"
1946//#define NI_ENC_GOP_PARAMS_G1_QP_FACTOR "g1QpFactor"
1947#define NI_ENC_GOP_PARAMS_G1_TEMPORAL_ID "g1temporalId"
1948#define NI_ENC_GOP_PARAMS_G1_PIC_TYPE "g1picType"
1949#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PICS "g1numRefPics"
1950#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC0 "g1refPic0"
1951#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC0_USED "g1refPic0Used"
1952#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC1 "g1refPic1"
1953#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC1_USED "g1refPic1Used"
1954#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC2 "g1refPic2"
1955#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC2_USED "g1refPic2Used"
1956#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC3 "g1refPic3"
1957#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC3_USED "g1refPic3Used"
1958
1959#define NI_ENC_GOP_PARAMS_G2_POC_OFFSET "g2pocOffset"
1960#define NI_ENC_GOP_PARAMS_G2_QP_OFFSET "g2QpOffset"
1961//#define NI_ENC_GOP_PARAMS_G2_QP_FACTOR "g2QpFactor"
1962#define NI_ENC_GOP_PARAMS_G2_TEMPORAL_ID "g2temporalId"
1963#define NI_ENC_GOP_PARAMS_G2_PIC_TYPE "g2picType"
1964#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PICS "g2numRefPics"
1965#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC0 "g2refPic0"
1966#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC0_USED "g2refPic0Used"
1967#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC1 "g2refPic1"
1968#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC1_USED "g2refPic1Used"
1969#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC2 "g2refPic2"
1970#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC2_USED "g2refPic2Used"
1971#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC3 "g2refPic3"
1972#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC3_USED "g2refPic3Used"
1973
1974#define NI_ENC_GOP_PARAMS_G3_POC_OFFSET "g3pocOffset"
1975#define NI_ENC_GOP_PARAMS_G3_QP_OFFSET "g3QpOffset"
1976//#define NI_ENC_GOP_PARAMS_G3_QP_FACTOR "g3QpFactor"
1977#define NI_ENC_GOP_PARAMS_G3_TEMPORAL_ID "g3temporalId"
1978#define NI_ENC_GOP_PARAMS_G3_PIC_TYPE "g3picType"
1979#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PICS "g3numRefPics"
1980#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC0 "g3refPic0"
1981#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC0_USED "g3refPic0Used"
1982#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC1 "g3refPic1"
1983#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC1_USED "g3refPic1Used"
1984#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC2 "g3refPic2"
1985#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC2_USED "g3refPic2Used"
1986#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC3 "g3refPic3"
1987#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC3_USED "g3refPic3Used"
1988
1989#define NI_ENC_GOP_PARAMS_G4_POC_OFFSET "g4pocOffset"
1990#define NI_ENC_GOP_PARAMS_G4_QP_OFFSET "g4QpOffset"
1991//#define NI_ENC_GOP_PARAMS_G4_QP_FACTOR "g4QpFactor"
1992#define NI_ENC_GOP_PARAMS_G4_TEMPORAL_ID "g4temporalId"
1993#define NI_ENC_GOP_PARAMS_G4_PIC_TYPE "g4picType"
1994#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PICS "g4numRefPics"
1995#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC0 "g4refPic0"
1996#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC0_USED "g4refPic0Used"
1997#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC1 "g4refPic1"
1998#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC1_USED "g4refPic1Used"
1999#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC2 "g4refPic2"
2000#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC2_USED "g4refPic2Used"
2001#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC3 "g4refPic3"
2002#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC3_USED "g4refPic3Used"
2003
2004#define NI_ENC_GOP_PARAMS_G5_POC_OFFSET "g5pocOffset"
2005#define NI_ENC_GOP_PARAMS_G5_QP_OFFSET "g5QpOffset"
2006//#define NI_ENC_GOP_PARAMS_G5_QP_FACTOR "g5QpFactor"
2007#define NI_ENC_GOP_PARAMS_G5_TEMPORAL_ID "g5temporalId"
2008#define NI_ENC_GOP_PARAMS_G5_PIC_TYPE "g5picType"
2009#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PICS "g5numRefPics"
2010#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC0 "g5refPic0"
2011#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC0_USED "g5refPic0Used"
2012#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC1 "g5refPic1"
2013#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC1_USED "g5refPic1Used"
2014#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC2 "g5refPic2"
2015#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC2_USED "g5refPic2Used"
2016#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC3 "g5refPic3"
2017#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC3_USED "g5refPic3Used"
2018
2019#define NI_ENC_GOP_PARAMS_G6_POC_OFFSET "g6pocOffset"
2020#define NI_ENC_GOP_PARAMS_G6_QP_OFFSET "g6QpOffset"
2021//#define NI_ENC_GOP_PARAMS_G6_QP_FACTOR "g6QpFactor"
2022#define NI_ENC_GOP_PARAMS_G6_TEMPORAL_ID "g6temporalId"
2023#define NI_ENC_GOP_PARAMS_G6_PIC_TYPE "g6picType"
2024#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PICS "g6numRefPics"
2025#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC0 "g6refPic0"
2026#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC0_USED "g6refPic0Used"
2027#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC1 "g6refPic1"
2028#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC1_USED "g6refPic1Used"
2029#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC2 "g6refPic2"
2030#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC2_USED "g6refPic2Used"
2031#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC3 "g6refPic3"
2032#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC3_USED "g6refPic3Used"
2033
2034#define NI_ENC_GOP_PARAMS_G7_POC_OFFSET "g7pocOffset"
2035#define NI_ENC_GOP_PARAMS_G7_QP_OFFSET "g7QpOffset"
2036//#define NI_ENC_GOP_PARAMS_G7_QP_FACTOR "g7QpFactor"
2037#define NI_ENC_GOP_PARAMS_G7_TEMPORAL_ID "g7temporalId"
2038#define NI_ENC_GOP_PARAMS_G7_PIC_TYPE "g7picType"
2039#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PICS "g7numRefPics"
2040#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC0 "g7refPic0"
2041#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC0_USED "g7refPic0Used"
2042#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC1 "g7refPic1"
2043#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC1_USED "g7refPic1Used"
2044#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC2 "g7refPic2"
2045#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC2_USED "g7refPic2Used"
2046#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC3 "g7refPic3"
2047#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC3_USED "g7refPic3Used"
2048
2049typedef struct _ni_gop_rps
2050{
2051 int ref_pic; /*!*< delta_poc of this short reference picture relative to the poc of current picture or index of LTR */
2052 int ref_pic_used; /*!*< whether this reference picture used by current picture */
2054
2055typedef struct _ni_gop_params
2056{
2057 int poc_offset; /*!*< A POC of Nth picture in the custom GOP */
2058 int qp_offset; /*!*< QP offset of Nth picture in the custom GOP */
2059 float qp_factor; /*!*< QP factor of Nth picture in the custom GOP */
2060 int temporal_id; /*!*< A temporal ID of Nth picture in the custom GOP */
2061 int pic_type; /*!*< A picture type of Nth picture in the custom GOP */
2062 int num_ref_pics; /*!*< the number of reference pictures kept for this picture, the value should be within [0, 4] */
2065#else
2066#define NI_ENC_GOP_PARAMS_G0_PIC_TYPE "g0picType"
2067#define NI_ENC_GOP_PARAMS_G0_POC_OFFSET "g0pocOffset"
2068#define NI_ENC_GOP_PARAMS_G0_PIC_QP "g0picQp"
2069#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC_L0 "g0numRefPicL0"
2070#define NI_ENC_GOP_PARAMS_G0_NUM_REF_POC_L0 "g0refPocL0"
2071#define NI_ENC_GOP_PARAMS_G0_NUM_REF_POC_L1 "g0refPocL1"
2072#define NI_ENC_GOP_PARAMS_G0_TEMPORAL_ID "g0temporalId"
2073
2074#define NI_ENC_GOP_PARAMS_G1_PIC_TYPE "g1picType"
2075#define NI_ENC_GOP_PARAMS_G1_POC_OFFSET "g1pocOffset"
2076#define NI_ENC_GOP_PARAMS_G1_PIC_QP "g1picQp"
2077#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC_L0 "g1numRefPicL0"
2078#define NI_ENC_GOP_PARAMS_G1_NUM_REF_POC_L0 "g1refPocL0"
2079#define NI_ENC_GOP_PARAMS_G1_NUM_REF_POC_L1 "g1refPocL1"
2080#define NI_ENC_GOP_PARAMS_G1_TEMPORAL_ID "g1temporalId"
2081
2082#define NI_ENC_GOP_PARAMS_G2_PIC_TYPE "g2picType"
2083#define NI_ENC_GOP_PARAMS_G2_POC_OFFSET "g2pocOffset"
2084#define NI_ENC_GOP_PARAMS_G2_PIC_QP "g2picQp"
2085#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC_L0 "g2numRefPicL0"
2086#define NI_ENC_GOP_PARAMS_G2_NUM_REF_POC_L0 "g2refPocL0"
2087#define NI_ENC_GOP_PARAMS_G2_NUM_REF_POC_L1 "g2refPocL1"
2088#define NI_ENC_GOP_PARAMS_G2_TEMPORAL_ID "g2temporalId"
2089
2090#define NI_ENC_GOP_PARAMS_G3_PIC_TYPE "g3picType"
2091#define NI_ENC_GOP_PARAMS_G3_POC_OFFSET "g3pocOffset"
2092#define NI_ENC_GOP_PARAMS_G3_PIC_QP "g3picQp"
2093#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC_L0 "g3numRefPicL0"
2094#define NI_ENC_GOP_PARAMS_G3_NUM_REF_POC_L0 "g3refPocL0"
2095#define NI_ENC_GOP_PARAMS_G3_NUM_REF_POC_L1 "g3refPocL1"
2096#define NI_ENC_GOP_PARAMS_G3_TEMPORAL_ID "g3temporalId"
2097
2098#define NI_ENC_GOP_PARAMS_G4_PIC_TYPE "g4picType"
2099#define NI_ENC_GOP_PARAMS_G4_POC_OFFSET "g4pocOffset"
2100#define NI_ENC_GOP_PARAMS_G4_PIC_QP "g4picQp"
2101#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC_L0 "g4numRefPicL0"
2102#define NI_ENC_GOP_PARAMS_G4_NUM_REF_POC_L0 "g4refPocL0"
2103#define NI_ENC_GOP_PARAMS_G4_NUM_REF_POC_L1 "g4refPocL1"
2104#define NI_ENC_GOP_PARAMS_G4_TEMPORAL_ID "g4temporalId"
2105
2106#define NI_ENC_GOP_PARAMS_G5_PIC_TYPE "g5picType"
2107#define NI_ENC_GOP_PARAMS_G5_POC_OFFSET "g5pocOffset"
2108#define NI_ENC_GOP_PARAMS_G5_PIC_QP "g5picQp"
2109#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC_L0 "g5numRefPicL0"
2110#define NI_ENC_GOP_PARAMS_G5_NUM_REF_POC_L0 "g5refPocL0"
2111#define NI_ENC_GOP_PARAMS_G5_NUM_REF_POC_L1 "g5refPocL1"
2112#define NI_ENC_GOP_PARAMS_G5_TEMPORAL_ID "g5temporalId"
2113
2114#define NI_ENC_GOP_PARAMS_G6_PIC_TYPE "g6picType"
2115#define NI_ENC_GOP_PARAMS_G6_POC_OFFSET "g6pocOffset"
2116#define NI_ENC_GOP_PARAMS_G6_PIC_QP "g6picQp"
2117#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC_L0 "g6numRefPicL0"
2118#define NI_ENC_GOP_PARAMS_G6_NUM_REF_POC_L0 "g6refPocL0"
2119#define NI_ENC_GOP_PARAMS_G6_NUM_REF_POC_L1 "g6refPocL1"
2120#define NI_ENC_GOP_PARAMS_G6_TEMPORAL_ID "g6temporalId"
2121
2122#define NI_ENC_GOP_PARAMS_G7_PIC_TYPE "g7picType"
2123#define NI_ENC_GOP_PARAMS_G7_POC_OFFSET "g7pocOffset"
2124#define NI_ENC_GOP_PARAMS_G7_PIC_QP "g7picQp"
2125#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC_L0 "g7numRefPicL0"
2126#define NI_ENC_GOP_PARAMS_G7_NUM_REF_POC_L0 "g7refPocL0"
2127#define NI_ENC_GOP_PARAMS_G7_NUM_REF_POC_L1 "g7refPocL1"
2128#define NI_ENC_GOP_PARAMS_G7_TEMPORAL_ID "g7temporalId"
2129
2130typedef struct _ni_gop_params
2131{
2132 int pic_type; /*!*< A picture type of Nth picture in the custom GOP */
2133 int poc_offset; /*!*< A POC of Nth picture in the custom GOP */
2134 int pic_qp; /*!*< A quantization parameter of Nth picture in the custom GOP */
2135 int num_ref_pic_L0; /*!*< The number of reference L0 of Nth picture in the custom GOP */
2136 int ref_poc_L0; /*!*< A POC of reference L0 of Nth picture in the custom GOP */
2137 int ref_poc_L1; /*!*< A POC of reference L1 of Nth picture in the custom GOP */
2138 int temporal_id; /*!*< A temporal ID of Nth picture in the custom GOP */
2140#endif
2141
2142
2143
2144#define NI_ENC_GOP_PARAMS_CUSTOM_GOP_SIZE "customGopSize"
2145
2147{
2148 int custom_gop_size; /*!*< The size of custom GOP (0~8) */
2149 ni_gop_params_t pic_param[NI_MAX_GOP_NUM]; /*!*< Picture parameters of Nth picture in custom GOP */
2151
2152#define NI_ENC_REPEAT_HEADERS_FIRST_IDR 0
2153#define NI_ENC_REPEAT_HEADERS_ALL_I_FRAMES 1
2154#define NI_KEEP_ALIVE_TIMEOUT "keepAliveTimeout"
2155
2157{
2158#define NI_ENC_PARAM_BITRATE "bitrate"
2159#define NI_ENC_PARAM_RECONF_DEMO_MODE "ReconfDemoMode"
2160#define NI_ENC_PARAM_RECONF_FILE "ReconfFile"
2161#define NI_ENC_PARAM_ROI_DEMO_MODE "RoiDemoMode"
2162#define NI_ENC_PARAM_CACHE_ROI "cacheRoi"
2163#define NI_ENC_PARAM_FORCE_PIC_QP_DEMO_MODE "ForcePicQpDemoMode"
2164
2165#ifndef DEPRECATION_AS_ERROR
2167#define NI_ENC_PARAM_GEN_HDRS NI_DEPRECATED_MACRO "GenHdrs"
2168#endif
2169#define NI_ENC_PARAM_PADDING "padding"
2170#define NI_ENC_PARAM_FORCE_FRAME_TYPE "forceFrameType"
2171#define NI_ENC_PARAM_PROFILE "profile"
2172#define NI_ENC_PARAM_LEVEL "level"
2173#define NI_ENC_PARAM_HIGH_TIER "high-tier"
2174#define NI_ENC_PARAM_LOG_LEVEL "log-level"
2175#define NI_ENC_PARAM_LOG "log"
2176#define NI_ENC_PARAM_GOP_PRESET_IDX "gopPresetIdx"
2177#define NI_ENC_PARAM_LOW_DELAY "lowDelay"
2178#define NI_ENC_PARAM_MIN_FRAMES_DELAY "minFramesDelay"
2179#define NI_ENC_PARAM_USE_RECOMMENDED_ENC_PARAMS "useRecommendEncParam"
2180#define NI_ENC_PARAM_USE_LOW_DELAY_POC_TYPE "useLowDelayPocType"
2181#define NI_ENC_PARAM_CU_SIZE_MODE "cuSizeMode"
2182#define NI_ENC_PARAM_MAX_NUM_MERGE "maxNumMerge"
2183#define NI_ENC_PARAM_ENABLE_DYNAMIC_8X8_MERGE "dynamicMerge8x8Enable"
2184#define NI_ENC_PARAM_ENABLE_DYNAMIC_16X16_MERGE "dynamicMerge16x16Enable"
2185#define NI_ENC_PARAM_ENABLE_DYNAMIC_32X32_MERGE "dynamicMerge32x32Enable"
2186#define NI_ENC_PARAM_ENABLE_RATE_CONTROL "RcEnable"
2187#define NI_ENC_PARAM_ENABLE_CU_LEVEL_RATE_CONTROL "cuLevelRCEnable"
2188#define NI_ENC_PARAM_ENABLE_HVS_QP "hvsQPEnable"
2189#define NI_ENC_PARAM_ENABLE_HVS_QP_SCALE "hvsQpScaleEnable"
2190#define NI_ENC_PARAM_HVS_QP_SCALE "hvsQpScale"
2191#define NI_ENC_PARAM_MIN_QP "minQp"
2192#define NI_ENC_PARAM_MAX_QP "maxQp"
2193#define NI_ENC_PARAM_MAX_DELTA_QP "maxDeltaQp"
2194#define NI_ENC_PARAM_FORCED_HEADER_ENABLE "repeatHeaders"
2195#define NI_ENC_PARAM_ROI_ENABLE "roiEnable"
2196#define NI_ENC_PARAM_CONF_WIN_TOP "confWinTop"
2197#define NI_ENC_PARAM_CONF_WIN_BOTTOM "confWinBot"
2198#define NI_ENC_PARAM_CONF_WIN_LEFT "confWinLeft"
2199#define NI_ENC_PARAM_CONF_WIN_RIGHT "confWinRight"
2200#define NI_ENC_PARAM_INTRA_PERIOD "intraPeriod"
2201#define NI_ENC_PARAM_TRANS_RATE "transRate"
2202#define NI_ENC_PARAM_FRAME_RATE "frameRate"
2203#define NI_ENC_PARAM_FRAME_RATE_DENOM "frameRateDenom"
2204#define NI_ENC_PARAM_INTRA_QP "intraQP"
2205#define NI_ENC_PARAM_DECODING_REFRESH_TYPE "decodingRefreshType"
2206#define NI_ENC_PARAM_INTRA_REFRESH_RESET "intraRefreshResetOnForceIDR"
2207// Rev. B: H.264 only parameters.
2208#define NI_ENC_PARAM_ENABLE_8X8_TRANSFORM "transform8x8Enable"
2209#define NI_ENC_PARAM_ENTROPY_CODING_MODE "entropyCodingMode"
2210// Rev. B: shared between HEVC and H.264
2211#define NI_ENC_PARAM_SLICE_MODE "sliceMode"
2212#define NI_ENC_PARAM_SLICE_ARG "sliceArg"
2213#define NI_ENC_PARAM_INTRA_MB_REFRESH_MODE "intraMbRefreshMode"
2214#define NI_ENC_PARAM_INTRA_MB_REFRESH_ARG "intraMbRefreshArg"
2215#define NI_ENC_PARAM_INTRA_REFRESH_MODE "intraRefreshMode"
2216#define NI_ENC_PARAM_INTRA_REFRESH_ARG "intraRefreshArg"
2217#define NI_ENC_PARAM_ENABLE_MB_LEVEL_RC "mbLevelRcEnable"
2218#define NI_ENC_PARAM_PREFERRED_TRANSFER_CHARACTERISTICS "prefTRC"
2219
2220// To be deprecated: RcInitDelay -> vbvBufferSize, cbr -> fillerEnable
2221#define NI_ENC_PARAM_RC_INIT_DELAY "RcInitDelay"
2222#define NI_ENC_PARAM_CBR "cbr"
2223#define NI_ENC_PARAM_INTRA_REFRESH_MIN_PERIOD "intraRefreshMinPeriod"
2224
2225#define NI_ENC_PARAM_USE_MCTF "useMCTF"
2226
2227//QUADRA
2228#ifndef DEPRECATION_AS_ERROR
2230#define NI_ENC_PARAM_CONSTANT_RATE_FACTOR NI_DEPRECATED_MACRO "crf"
2231#endif
2232#define NI_ENC_PARAM_CONSTANT_RATE_FACTOR_FLOAT "crfFloat"
2233#define NI_ENC_PARAM_RDO_LEVEL "rdoLevel"
2234#define NI_ENC_PARAM_RDO_QUANT "EnableRdoQuant"
2235#define NI_ENC_PARAM_MAX_CLL "maxCLL"
2236#define NI_ENC_PARAM_MASTER_DISPLAY "masterDisplay"
2237#define NI_ENC_PARAM_LOOK_AHEAD_DEPTH "lookAheadDepth"
2238#define NI_ENC_PARAM_ENABLE_AUD "enableAUD"
2239#define NI_ENC_PARAM_CTB_RC_MODE "ctbRcMode"
2240#define NI_ENC_PARAM_GOP_SIZE "gopSize"
2241#define NI_ENC_PARAM_GOP_LOW_DELAY "gopLowdelay"
2242#define NI_ENC_PARAM_GDR_DURATION "intraRefreshDuration"
2243#define NI_ENC_PARAM_HRD_ENABLE "hrdEnable"
2244#define NI_ENC_PARAM_DOLBY_VISION_PROFILE "dolbyVisionProfile"
2245#define NI_ENC_PARAM_VBV_BUFFER_SIZE "vbvBufferSize"
2246#define NI_ENC_PARAM_VBV_MAXRAE "vbvMaxRate"
2247#define NI_ENC_PARAM_ENABLE_FILLER "fillerEnable"
2248#define NI_ENC_PARAM_ENABLE_PIC_SKIP "picSkip"
2249#ifndef DEPRECATION_AS_ERROR
2251#define NI_ENC_PARAM_MAX_FRAME_SIZE_LOW_DELAY NI_DEPRECATED_MACRO "maxFrameSize"
2252#endif
2253#define NI_ENC_PARAM_MAX_FRAME_SIZE_BITS_LOW_DELAY "maxFrameSize-Bits"
2254#define NI_ENC_PARAM_MAX_FRAME_SIZE_BYTES_LOW_DELAY "maxFrameSize-Bytes"
2255#define NI_ENC_PARAM_LTR_REF_INTERVAL "ltrRefInterval"
2256#define NI_ENC_PARAM_LTR_REF_QPOFFSET "ltrRefQpOffset"
2257#define NI_ENC_PARAM_LTR_FIRST_GAP "ltrFirstGap"
2258#define NI_ENC_PARAM_LTR_NEXT_INTERVAL "ltrNextInterval"
2259#define NI_ENC_PARAM_MULTICORE_JOINT_MODE "multicoreJointMode"
2260#define NI_ENC_PARAM_JPEG_QLEVEL "qlevel"
2261#define NI_ENC_PARAM_CHROMA_QP_OFFSET "chromaQpOffset"
2262#define NI_ENC_PARAM_TOL_RC_INTER "tolCtbRcInter"
2263#define NI_ENC_PARAM_TOL_RC_INTRA "tolCtbRcIntra"
2264#define NI_ENC_PARAM_BITRATE_WINDOW "bitrateWindow"
2265#define NI_ENC_INLOOP_DS_RATIO "inLoopDSRatio"
2266#define NI_ENC_BLOCK_RC_SIZE "blockRCSize"
2267#define NI_ENC_RC_QP_DELTA_RANGE "rcQpDeltaRange"
2268#define NI_ENC_CTB_ROW_QP_STEP "ctbRowQpStep"
2269#define NI_ENC_NEW_RC_ENABLE "newRcEnable"
2270#define NI_ENC_PARAM_INTRA_QP_DELTA "intraQpDelta"
2271#define NI_ENC_PARAM_LONG_TERM_REFERENCE_ENABLE "longTermReferenceEnable"
2272#define NI_ENC_PARAM_LONG_TERM_REFERENCE_COUNT "longTermReferenceCount"
2273#define NI_ENC_PARAM_LONG_TERM_REFERENCE_INTERVAL "longTermReferenceInterval"
2274#define NI_ENC_PARAM_SKIP_FRAME_ENABLE "skipFrameEnable"
2275#define NI_ENC_PARAM_MAX_CONSUTIVE_SKIP_FRAME_NUMBER "maxConsecutiveSkipFrameNum"
2276#define NI_ENC_PARAM_SKIP_FRAME_INTERVAL "skipFrameInterVal"
2277#define NI_ENC_PARAM_IFRAME_SIZE_RATIO "iFrameSizeRatio"
2278#define NI_ENC_PARAM_STILL_IMAGE_DETECT_LEVEL "stillImageDetectLevel"
2279#define NI_ENC_PARAM_SCENE_CHANG_DETECT_LEVEL "sceneChangeDetectLevel"
2280#define NI_ENC_PARAM_ENABLE_SMOOTH_CRF "enableSmoothCRF"
2281#define NI_ENC_PARAM_ENABLE_COMPENSATE_QP "enableCompensateQp"
2282#define NI_ENC_PARAM_ADAPTIVE_LAMDA_MODE "adaptiveLamdaMode"
2283#define NI_ENC_PARAM_ADAPTIVE_CRF_MODE "adaptiveCrfMode"
2284#define NI_ENC_PARAM_INTRA_COMPENSATE_MODE "intraCompensateMode"
2285#define NI_ENC_PARAM_CUSTOM_MIN_COEFF_DIV "customMinCoeffDiv"
2286// stream color info
2287#define NI_ENC_PARAM_COLOR_PRIMARY "colorPri"
2288#define NI_ENC_PARAM_COLOR_TRANSFER_CHARACTERISTIC "colorTrc"
2289#define NI_ENC_PARAM_COLOR_SPACE "colorSpc"
2290// sample aspect ratio specified in numerator/denominator
2291#define NI_ENC_PARAM_SAR_NUM "sarNum"
2292#define NI_ENC_PARAM_SAR_DENOM "sarDenom"
2293// video_full_range_flag
2294#define NI_ENC_PARAM_VIDEO_FULL_RANGE_FLAG "videoFullRangeFlag"
2295// VFR related
2296#define NI_ENC_PARAM_ENABLE_VFR "enableVFR"
2297#define NI_ENC_ENABLE_SSIM "enableSSIM"
2298#define NI_ENC_PARAM_AVCC_HVCC "avccHvcc"
2299#define NI_ENC_PARAM_AV1_ERROR_RESILIENT_MODE "av1ErrorResilientMode"
2300// set memory allocation parameters, M_MMAP_THRESHOLD and M_TRIM_THRESHOLD
2301#define NI_ENC_PARAM_STATIC_MMAP_THRESHOLD "staticMmapThreshold"
2302#define NI_ENC_PARAM_TEMPORAL_LAYERS_ENABLE "temporalLayersEnable"
2303#define NI_ENC_PARAM_ENABLE_AI_ENHANCE "enableAIEnhance"
2304#define NI_ENC_PARAM_ENABLE_AI_HVSPLUS "enableHVSPlus"
2305#define NI_ENC_PARAM_ENABLE_2PASS_GOP "enable2PassGop"
2306#define NI_ENC_PARAM_ZEROCOPY_MODE "zeroCopyMode"
2307#define NI_ENC_PARAM_AI_ENHANCE_LEVEL "AIEnhanceLevel"
2308#define NI_ENC_PARAM_HVSPLUS_LEVEL "HVSPlusLevel"
2309#define NI_ENC_PARAM_CROP_WIDTH "cropWidth"
2310#define NI_ENC_PARAM_CROP_HEIGHT "cropHeight"
2311#define NI_ENC_PARAM_HORIZONTAL_OFFSET "horOffset"
2312#define NI_ENC_PARAM_VERTICAL_OFFSET "verOffset"
2313#define NI_ENC_PARAM_CONSTANT_RATE_FACTOR_MAX "crfMax"
2314#define NI_ENC_PARAM_QCOMP "qcomp"
2315#define NI_ENC_PARAM_NO_MBTREE "noMbtree"
2316#define NI_ENC_PARAM_NO_HW_MULTIPASS_SUPPORT "noHWMultiPassSupport"
2317#define NI_ENC_PARAM_CU_TREE_FACTOR "cuTreeFactor"
2318#define NI_ENC_PARAM_IP_RATIO "ipRatio"
2319#define NI_ENC_PARAM_ENABLE_IP_RATIO "enableipRatio"
2320#define NI_ENC_PARAM_PB_RATIO "pbRatio"
2321#define NI_ENC_PARAM_CPLX_DECAY "cplxDecay"
2322#define NI_ENC_PARAM_PPS_INIT_QP "ppsInitQp"
2323#define NI_ENC_PARAM_DDR_PRIORITY_MODE "ddrPriorityMode"
2324#define NI_ENC_PARAM_BITRATE_MODE "bitrateMode"
2325#define NI_ENC_PARAM_PASS1_QP "pass1Qp"
2326#define NI_ENC_PARAM_HVS_BASE_MB_COMPLEXITY "hvsBaseMbComplexity"
2327#define NI_ENC_PARAM_STATISTIC_OUTPUT_LEVEL "statisticOutputLevel"
2328#define NI_ENC_PARAM_ENABLE_ALL_SEI_PASSTHRU "enableAllSeiPassthru"
2329#define NI_ENC_PARAM_CRF_MAX_IFRAME_ENABLE "crfMaxIframeEnable"
2330#define NI_ENC_PARAM_VBV_MINRATE "vbvMinRate"
2331#define NI_ENC_PARAM_DISABLE_ADAPTIVE_BUFFERS "disableAdaptiveBuffers"
2332#define NI_ENC_PARAM_DISABLE_BFRAME_RDOQ "disableBframeRDOQ"
2333#define NI_ENC_PARAM_FORCE_BFRAME_QPFACTOR "forceBframeQpfactor"
2334#define NI_ENC_PARAM_TUNE_BFRAME_VISUAL "tuneBframeVisual"
2335#define NI_ENC_PARAM_ENABLE_ACQUIRE_LIMIT "enableAcqLimit"
2336#define NI_ENC_PARAM_GET_PSNR_MODE "getPsnrMode"
2337#define NI_ENC_PARAM_PSNR_INTERVAL "intervalOfPsnr"
2338#define NI_ENC_PARAM_CUSTOMIZE_ROI_QP_LEVEL "customizeQpLevel"
2339#define NI_ENC_PARAM_CUSTOMIZE_ROI_QP_MAP "customizeQpMapFile"
2340#define NI_ENC_PARAM_MOTION_CONSTRAINED_MODE "motionConstrainedMode"
2341#define NI_ENC_PARAM_ALLOCATE_STRAEGY "encMemAllocateStrategy"
2342#define NI_ENC_PARAM_SPATIAL_LAYERS "spatialLayers"
2343#define NI_ENC_PARAM_ENABLE_TIMECODE "enableTimecode"
2344#define NI_ENC_PARAM_SPATIAL_LAYERS_REF_BASE_LAYER "spatialLayersRefBaseLayer"
2345#define NI_ENC_PARAM_GET_RECONSTRUCTED_MODE "getReconstructedMode"
2346#define NI_ENC_PARAM_VBV_BUFFER_REENCODE "vbvBufferReencode"
2347#define NI_ENC_PARAM_TOTAL_CUTREE_DEPTH "totalCuTreeDepth"
2348#define NI_ENC_PARAM_ADAPTIVE_CUTREE "adaptiveCuTree"
2349#define NI_ENC_PARAM_PRE_INTRA_HANDLING "preIntraHandling"
2350#define NI_ENC_PARAM_BASE_LAYER_ONLY "baseLayerOnly"
2351#define NI_ENC_PARAM_PAST_FRAME_MAX_INTRA_RATIO "pastFrameMaxIntraRatio"
2352#define NI_ENC_PARAM_LINK_FRAME_MAX_INTRA_RATIO "linkFrameMaxIntraRatio"
2353#define NI_ENC_PARAM_SPATIAL_LAYER_BITRATE "spatialLayerBitrate"
2354#define NI_ENC_PARAM_DISABLE_AV1_TIMING_INFO "disableAv1TimingInfo"
2355#define NI_ENC_PARAM_AV1_OP_LEVEL "av1OpLevel"
2356#define NI_ENC_PARAM_ENABLE_CPU_AFFINITY "enableCpuAffinity"
2357#define NI_ENC_PARAM_PRESET "preset"
2358#define NI_ENC_PARAM_QP_SCALE_ENABLE "qpScaleEnable"
2359#define NI_ENC_PARAM_GET_BITSTREAM_FEATURES "getBitstreamFeatures"
2360#define NI_ENC_PARAM_CLEAR_REF_LIST_MODIFICATION "clearRefListModification"
2361#define NI_ENC_PARAM_LONG_TERM_REFERENCE_OLDEST "longTermReferenceOldest"
2362
2363 //----- Start supported by all codecs -----
2370 //----- End supported by all codecs -----
2371
2372 //----- Start supported by AV1, AVC, HEVC only -----
2375 //GOP Pattern
2377 /*!*< A GOP structure preset option (IPP, IBP, IBBP, IbBbP, use Custom GOP, etc) */ // 0-custom 1-I-only 2-IPPP 3-IBBB 4-IBP .....
2378
2379 // CUSTOM_GOP
2381
2388
2389 // HLG preferred transfer characteristics
2391
2394 int crf;
2418 //----- End supported by AV1, AVC, HEVC only -----
2419
2420 //----- Start supported by AVC, HEVC only -----
2421 //ConformanceWindowOffsets
2422 int conf_win_top; /*!*< A conformance window size of TOP */
2423 int conf_win_bottom; /*!*< A conformance window size of BOTTOM */
2424 int conf_win_left; /*!*< A conformance window size of LEFT */
2425 int conf_win_right; /*!*< A conformance window size of RIGHT */
2429 //----- End supported by AVC, HEVC only -----
2430
2431 //----- Start supported by AVC only -----
2433 //----- End supported by AVC only -----
2434
2435 //----- Start supported by HEVC only -----
2440 //----- End supported by HEVC only -----
2441
2442 //----- Start supported by JPEG only -----
2444 //----- End supported by JPEG only -----
2445
2446 //----- Start test use only -----
2450 //----- End test use only -----
2451
2452 //----- Start supported by AV1, AVC, HEVC only -----
2457 //----- End supported by AV1, AVC, HEVC only -----
2458
2459 //----- Start test use only -----
2462 //----- End test use only -----
2463
2464 //----- Start supported by AV1, AVC, HEVC only -----
2466 //----- End supported by AV1, AVC, HEVC only -----
2467
2468 //----- start DEPRECATED or for T408 -----
2470 //Preset Mode
2471 int use_recommend_enc_params; /*!*< 0: Custom, 1: Slow speed and best quality, 2: Normal Speed and quality, 3: Fast Speed and Low Quality */
2472 //Encode Options
2473 int cu_size_mode; /*!*< bit 0: enable 8x8 CU, bit 1: enable 16x16 CU, bit 2: enable 32x32 CU */
2474 int max_num_merge; /*!*< Maximum number of merge candidates (0~2) */
2475 int enable_dynamic_8x8_merge; /*!*< It enables dynamic merge 8x8 candidates. */
2476 int enable_dynamic_16x16_merge; /*!*< It enables dynamic merge 16x16 candidates. */
2477 int enable_dynamic_32x32_merge; /*!*< It enables dynamic merge 32x32 candidates. */
2478
2479 // Rev. B: H.264 only parameters, in ni_t408_config_t
2480 // - for H.264 on T408:
2484
2486 //----- end DEPRECATED or for T408 -----
2487
2488 struct //Rate control parameters
2489 {
2490 int enable_rate_control; /*!*< It enable rate control */
2491 int min_qp; /*!*< A minimum QP for rate control */ //8
2492 int max_qp; /*!*< A maximum QP for rate control */ //51
2496
2497 //no JPEG
2498 int enable_cu_level_rate_control; /*!*< It enable CU level rate control */
2499 int enable_hvs_qp; /*!*< It enable CU QP adjustment for subjective quality enhancement */
2500 int hvs_qp_scale; /*!*< A QP scaling factor for CU QP adjustment when hvcQpenable = 1 */
2504
2505 //deprecated
2506 int enable_hvs_qp_scale; /*!*< It enable QP scaling factor for CU QP adjustment when enable_hvs_qp = 1 */
2507 int max_delta_qp; /*!*< A maximum delta QP for rate control */ //10
2511 int keep_alive_timeout; /* keep alive timeout setting */
2525 float qcomp;
2529 float ipRatio;
2530 float pbRatio;
2537 // 0: no extra output encoder information
2538 // 1: Frame Level output encoder information
2539 // 2: Cu Level Output encoder information
2540 // 3: Frame&Cu Level encoder information
2541 // 6: 1-pass satd cost
2590
2592{
2593#define NI_DEC_PARAM_OUT "out"
2594#define NI_DEC_PARAM_ENABLE_OUT_1 "enableOut1"
2595#define NI_DEC_PARAM_ENABLE_OUT_2 "enableOut2"
2596#define NI_DEC_PARAM_FORCE_8BIT_0 "force8Bit0"
2597#define NI_DEC_PARAM_FORCE_8BIT_1 "force8Bit1"
2598#define NI_DEC_PARAM_FORCE_8BIT_2 "force8Bit2"
2599#define NI_DEC_PARAM_SEMI_PLANAR_0 "semiplanar0"
2600#define NI_DEC_PARAM_SEMI_PLANAR_1 "semiplanar1"
2601#define NI_DEC_PARAM_SEMI_PLANAR_2 "semiplanar2"
2602#define NI_DEC_PARAM_CROP_MODE_0 "cropMode0"
2603#define NI_DEC_PARAM_CROP_MODE_1 "cropMode1"
2604#define NI_DEC_PARAM_CROP_MODE_2 "cropMode2"
2605#define NI_DEC_PARAM_CROP_PARAM_0 "crop0"
2606#define NI_DEC_PARAM_CROP_PARAM_1 "crop1"
2607#define NI_DEC_PARAM_CROP_PARAM_2 "crop2"
2608#define NI_DEC_PARAM_SCALE_0 "scale0"
2609#define NI_DEC_PARAM_SCALE_1 "scale1"
2610#define NI_DEC_PARAM_SCALE_2 "scale2"
2611#define NI_DEC_PARAM_SCALE_0_W "scale0w"
2612#define NI_DEC_PARAM_SCALE_0_H "scale0h"
2613#define NI_DEC_PARAM_SCALE_1_W "scale1w"
2614#define NI_DEC_PARAM_SCALE_1_H "scale1h"
2615#define NI_DEC_PARAM_SCALE_2_W "scale2w"
2616#define NI_DEC_PARAM_SCALE_2_H "scale2h"
2617#define NI_DEC_PARAM_SCALE_0_LONG_SHORT_ADAPT "scale0LongShortAdapt"
2618#define NI_DEC_PARAM_SCALE_1_LONG_SHORT_ADAPT "scale1LongShortAdapt"
2619#define NI_DEC_PARAM_SCALE_2_LONG_SHORT_ADAPT "scale2LongShortAdapt"
2620#define NI_DEC_PARAM_SCALE_0_RES_CEIL "scale0ResCeil"
2621#define NI_DEC_PARAM_SCALE_1_RES_CEIL "scale1ResCeil"
2622#define NI_DEC_PARAM_SCALE_2_RES_CEIL "scale2ResCeil"
2623#define NI_DEC_PARAM_SCALE_0_ROUND "scale0Round"
2624#define NI_DEC_PARAM_SCALE_1_ROUND "scale1Round"
2625#define NI_DEC_PARAM_SCALE_2_ROUND "scale2Round"
2626#define NI_DEC_PARAM_MULTICORE_JOINT_MODE "multicoreJointMode"
2627#define NI_DEC_PARAM_SAVE_PKT "savePkt"
2628#define NI_DEC_PARAM_LOW_DELAY "lowDelay"
2629#define NI_DEC_PARAM_FORCE_LOW_DELAY "forceLowDelay"
2630#define NI_DEC_PARAM_MIN_PACKETS_DELAY "minPacketsDelay"
2631#define NI_DEC_PARAM_ENABLE_LOW_DELAY_CHECK "enableLowDelayCheck"
2632#define NI_DEC_PARAM_DISABLE_REORDER "disableReorder"
2633#define NI_DEC_PARAM_ENABLE_USR_DATA_SEI_PASSTHRU "enableUserDataSeiPassthru"
2634#define NI_DEC_PARAM_ENABLE_CUSTOM_SEI_PASSTHRU "customSeiPassthru"
2635#define NI_DEC_PARAM_SVC_T_DECODING_LAYER "svctDecodingLayer"
2636#define NI_DEC_PARAM_DDR_PRIORITY_MODE "ddrPriorityMode"
2637#define NI_DEC_PARAM_EC_POLICY "ecPolicy"
2638#define NI_DEC_PARAM_ENABLE_ADVANCED_EC "enableAdvancedEc"
2639#define NI_DEC_PARAM_ERROR_THRESHOLD "ecErrThreshold"
2640#define NI_DEC_PARAM_ENABLE_PPU_SCALE_ADAPT "enablePpuScaleAdapt"
2641#define NI_DEC_PARAM_ENABLE_PPU_SCALE_LIMIT "enablePpuScaleLimit"
2642#define NI_DEC_PARAM_MAX_EXTRA_HW_FRAME_CNT "maxExtraHwFrameCnt"
2643#define NI_DEC_PARAM_SKIP_PTS_GUESS "skipPtsGuess"
2644#define NI_DEC_PARAM_PKT_PTS_UNCHANGE "pktPtsUnchange"
2645#define NI_DEC_PARAM_ENABLE_ALL_SEI_PASSTHRU "enableAllSeiPassthru"
2646#define NI_DEC_PARAM_ENABLE_FOLLOW_IFRAME "enableFollowIFrame"
2647#define NI_DEC_PARAM_DISABLE_ADAPTIVE_BUFFERS "disableAdaptiveBuffers"
2648#define NI_DEC_PARAM_SURVIVE_STREAM_ERR "surviveStreamErr"
2649#define NI_DEC_PARAM_REDUCE_DPB_DELAY "reduceDpbDelay"
2650#define NI_DEC_PARAM_SKIP_EXTRA_HEADERS "skipExtraHeaders"
2651#define NI_DEC_PARAM_ENABLE_CPU_AFFINITY "enableCpuAffinity"
2652#define NI_DEC_PARAM_EXTEND_POOL_SIZE "extendPoolSize"
2653#define NI_DEC_PARAM_DECODER_MODE "decoderMode"
2654
2659 int nb_save_pkt; // number of decoder input packets to be saved
2666 1]; /*cut-out of expression to be parsed*/
2670 1]; /*cut-out of expression to be parsed*/
2671 int keep_alive_timeout; /* keep alive timeout setting */
2672 // decoder lowDelay mode for All I packets or IPPP packets
2681 int enable_ppu_scale_adapt; // 0: disabled; 1: adapt to long edge; 2: adapt to short edge.
2688 // 0: disabled; 1: adapt to long edge; 2: adapt to short edge.
2691 int scale_round[NI_MAX_NUM_OF_DECODER_OUTPUTS]; // 0 up align 1 dowm align
2702
2727
2728/*
2729 * Algorithm identifier for user-supplied Q14 kernel (N2D_FILTER_USER).
2730 * Must match SCALER_ALGORITHM_USER_KERNEL in firmware/fp/inc/scaler_manager.h
2731 * and NI_SCALER_ALGORITHM_USER_KERNEL in the 3rd_libs header copy.
2732 */
2733#define NI_SCALER_ALGORITHM_USER_KERNEL 6
2734
2735/* Kernel table geometry — must match firmware constants. */
2736#define NI_SCALER_KERNEL_POSITIONS 17 /* gcvSUBPIXELLOADCOUNT */
2737#define NI_SCALER_KERNEL_SLOTS 9 /* gcvMAXTAPSIZE (rows) */
2738#define NI_SCALER_MAX_KERNEL_TAPS 5 /* gcvMAXTAPSIZE_OPF */
2739#define NI_SCALER_KERNEL_BYTES (NI_SCALER_KERNEL_POSITIONS * \
2740 NI_SCALER_KERNEL_SLOTS * 2) /* 306 */
2741#define NI_SCALER_Q14_ONE 0x4000 /* 1.0 in Q14 fixed-point */
2742
2744{
2750 /* User-defined Q14 polyphase kernel (NI_SCALER_ALGORITHM_USER_KERNEL).
2751 *
2752 * Set kernel_taps to the number of active taps (1 .. NI_SCALER_MAX_KERNEL_TAPS).
2753 * Populate kernel_array via ni_scaler_build_kernel():
2754 * kernel_array[0] horizontal pass (17 positions × 9 slots × uint16_t)
2755 * kernel_array[1] vertical pass (same layout)
2756 * ni_scaler_set_params() will:
2757 * - validate that each of the 17 rows in kernel_array[0] sums to Q14_ONE
2758 * - override filterblit → NI_SCALER_ALGORITHM_USER_KERNEL
2759 * - forward kernel_array[0] to the firmware (firmware shares one table
2760 * for both H and V passes; kernel_array[1] is reserved for future use)
2761 *
2762 * Leave kernel_taps = 0 to disable (all other filter algorithms). */
2763 uint8_t kernel_taps; /* active taps: 1..5; 0 = disabled */
2764 uint16_t kernel_array[2][17 * 9]; /* Q14: [0]=H [1]=V, 17 pos × 9 slots */
2766
2768{
2769 uint32_t start_x;
2770 uint32_t start_y;
2771 uint32_t end_x;
2772 uint32_t end_y;
2773 uint32_t rgba_c;
2775
2783
2788
2792
2793typedef struct _ni_iovec {
2794 uint32_t size;
2795 void *ptr;
2797
2798typedef struct _ni_frame
2799{
2800 // codec of the source from which this frame is decoded
2802
2803 long long dts;
2804 long long pts;
2807 uint32_t video_width;
2809
2810 uint32_t crop_top;
2811 uint32_t crop_bottom;
2812 uint32_t crop_left;
2813 uint32_t crop_right;
2814
2815 // for encoder: force headers on this frame
2817 // for encoder: control long term reference picture feature
2820
2822 // for encoding: frame picture type sent to encoder
2823 // for decoding: frame picture type returned from decoder
2825 // total SEI size: used by encoder
2826 unsigned int sei_total_len;
2827
2828 // SEI info of closed caption: returned by decoder or set by encoder
2829 unsigned int sei_cc_offset;
2830 unsigned int sei_cc_len;
2831 // SEI info of HDR: returned by decoder
2836 // SEI info of HDR10+: returned by decoder
2838 unsigned int sei_hdr_plus_len;
2839 // SEI info of User Data Unregistered SEI: returned by decoder
2842 // SEI info of alternative transfer characteristics: returned by decoder
2845 // VUI info: returned by decoder
2846 unsigned int vui_offset;
2847 unsigned int vui_len;
2848
2849 // ROI data length: for encoder
2850 unsigned int roi_len;
2851 // reconfig data length: for encoder
2852 unsigned int reconf_len;
2853 // total extra data data length: for encoder
2854 unsigned int extra_data_len;
2855 // force pic qp value
2857 // frame chunk index
2859
2862
2863 uint8_t *p_buffer;
2864 uint32_t buffer_size;
2865
2866 ni_buf_t
2867 *dec_buf; // buffer pool entry (has memory pointed to by p_buffer)
2870
2872
2873 // frame auxiliary data
2876
2877 // the following info is of the source stream that is returned by decoder:
2878 // color info, sample aspect ratio, timing etc that are useful at encoding.
2880 uint8_t color_trc;
2884 uint16_t sar_width;
2885 uint16_t sar_height;
2888
2889 int flags; // flags of demuxed packet
2890
2891 // for encoder: metadata buffer info if not contiguous with YUV
2894 // for encoder: whether metadata should be sent separately for frame
2896 uint64_t pkt_pos;
2897
2898 // for encoder: non-4k-aligned part at the start of YUV data
2903 // for encoder: whether the start of non-4k-aligned YUV data should be sent separately for frame
2906 long long orignal_pts;
2907 uint32_t error_ratio;
2908
2909 //for AI non-4k-aligned memory buffer
2910 uint32_t iovec_num;
2912
2913 // offset to be adjusted in FW for zero copy - obtain from ni_encoder_frame_zerocopy_adjust
2915 // for encoder: indicates if raw timecode data is present in frame extra data
2918
2919typedef struct _ni_xcoder_params
2920{
2921 int log;
2923 /* Numerator and denominator of frame rate */
2924 uint32_t fps_number;
2926 /* Width (in pixels) of the source pictures. If this width is not an even
2927 * multiple of 4, the encoder will pad the pictures internally to meet this
2928 * minimum requirement. All valid HEVC widths are supported */
2930
2931 /* Height (in pixels) of the source pictures. If this height is not an even
2932 * multiple of 4, the encoder will pad the pictures internally to meet this
2933 * minimum requirement. All valid HEVC heights are supported */
2936 int roi_demo_mode; // for encoder ROI testing
2937 int reconf_demo_mode; // for encoder reconfiguration testing
2938 int force_pic_qp_demo_mode; // for force pic qp mode testing
2939 int low_delay_mode; // encoder low latency mode
2940 int padding; // encoder input padding setting
2941 int generate_enc_hdrs; // in libavcodec, open a dummy session to generate codec headers during init
2942 int use_low_delay_poc_type; // specifies the encoder to set
2943 // picture_order_count_type=2 in the H.264 SPS
2944
2946
2947 // 1: force on every frame with same input type; 0: no (except for I-frame)
2949
2952
2953 int cacheRoi; // enables caching of ROIs applied to subsequent frames
2954
2955#ifndef DEPRECATION_AS_ERROR
2957 NI_DEPRECATED uint32_t
2962#endif
2963
2970
2971 union
2972 {
2975 };
2976
2977 // for encoder reconfiguration testing, saving key:val1,val2,val3,...val9
2978 // (max 9 values) in the demo reconfig data file this supports max 50000
2979 // lines in reconfig file, max 10 key/values per line
2985
2986 int enable_vfr; //enable the vfr
2987
3002
3003typedef struct _niFrameSurface1
3004{
3005 uint16_t ui16FrameIdx; //frame location on device
3006 uint16_t ui16session_ID; //for instance tracking
3007 uint16_t ui16width; // width on device
3008 uint16_t ui16height; // height on device
3009 uint32_t ui32nodeAddress; //currently not in use, formerly offset
3010 int32_t device_handle; //handle to access device
3011 int8_t bit_depth; //1 == 8bit per pixel, 2 == 10bit
3012 int8_t encoding_type; //0 = semiplanar, 1 = planar, 2 = tiled4x4
3013 int8_t output_idx; // 0-2 for decoder output index
3014 int8_t src_cpu; // frame origin location
3015 int32_t dma_buf_fd; // P2P dma buffer file descriptor
3017
3018typedef struct _ni_frame_config
3019{
3023 uint16_t options;
3028 uint32_t rgba_color;
3029 uint16_t frame_index;
3030 uint16_t session_id;
3032 uint8_t orientation; // 0 <= n <= 3, (n * 90°) clockwise rotation
3034
3035
3036// bitstream features related definitions
3037typedef enum
3038{
3043 //NI_QUADRA_NOTCODED_FRAME = 3, /* Used just as a return value */
3045
3053
3061
3069
3077
3083
3089
3094
3095typedef enum
3096{
3099
3101{
3108 int analyzed_mbs; // intra 16x16, intra 8x8, intra 4x4 and inter blocks
3109 int num_intra_block_blocks; // intra 4x4 and 8x8 blocks (counted in 4x4)
3110 int num_intra_plane_blocks; // intra 16x16 blocks (counted in 4x4)
3111 int num_skip_blocks; // skip blocks (counted in 4x4)
3112 int num_forward_pred_blocks; // forward prediction blocks (counted in 4x4)
3114
3115
3116typedef struct _ni_packet
3117{
3118 long long dts;
3119 long long pts;
3120 long long pos;
3121 uint64_t pkt_pos;
3124 uint32_t video_width;
3126 uint32_t frame_type; // encoding only 0=I, 1=P, 2=B
3128 void* p_data;
3129 uint32_t data_len;
3131
3133 uint32_t buffer_size;
3134 uint32_t avg_frame_qp; // average frame QP reported by VPU
3141
3142 int flags; // flags of demuxed packet
3143
3145
3146 double psnr_y;
3147 double psnr_u;
3148 double psnr_v;
3150 double ssim_y;
3151 double ssim_u;
3152 double ssim_v;
3157
3167
3174typedef enum _ni_device_mode{
3175 NI_DEVICE_READ_ONLY = 0x0001, /* Read-only access */
3176 NI_DEVICE_WRITE_ONLY = 0x0002, /* Write-only access */
3177 NI_DEVICE_READ_WRITE = 0x0003 /* Read-write access */
3179
3180#define NI_XCODER_PRESET_NAMES_ARRAY_LEN 7
3181#define NI_XCODER_LOG_NAMES_ARRAY_LEN 7
3182
3183#define NI_XCODER_PRESET_NAME_NONE "none"
3184#define NI_XCODER_PRESET_NAME_VERYFAST "veryfast"
3185#define NI_XCODER_PRESET_NAME_FASTER "faster"
3186#define NI_XCODER_PRESET_NAME_FAST "fast"
3187#define NI_XCODER_PRESET_NAME_MEDIUM "medium"
3188#define NI_XCODER_PRESET_NAME_SLOW "slow"
3189#define NI_XCODER_PRESET_NAME_SLOWER "slower"
3190#define NI_XCODER_PRESET_NAME_VERYSLOW "veryslow"
3191
3192#define NI_XCODER_LOG_NAME_NONE "none"
3193#define NI_XCODER_LOG_NAME_ERROR "error"
3194#define NI_XCODER_LOG_NAME_WARN "warning"
3195#define NI_XCODER_LOG_NAME_INFO "info"
3196#define NI_XCODER_LOG_NAME_DEBUG "debug"
3197#define NI_XCODER_LOG_NAME_FULL "full"
3198
3201
3202/*!*****************************************************************************
3203 * \brief Allocate and initialize a new ni_session_context_t struct
3204 *
3205 *
3206 * \return On success returns a valid pointer to newly allocated context
3207 * On failure returns NULL
3208 ******************************************************************************/
3210
3211/*!*****************************************************************************
3212 * \brief Initialize already allocated session context to a known state
3213 *
3214 * \param[in] p_ctx Pointer to an already allocated ni_session_context_t
3215 * struct
3216 *
3217 * \return On success
3218 * NI_RETCODE_SUCCESS
3219 * On failure
3220 * NI_RETCODE_INVALID_PARAM
3221 * NI_RETCODE_FAILURE
3222 ******************************************************************************/
3225
3226/*!*****************************************************************************
3227 * \brief Clear already allocated session context
3228 *
3229 * \param[in] p_ctx Pointer to an already allocated ni_session_context_t
3230 *
3231 *
3232 ******************************************************************************/
3234
3235/*!*****************************************************************************
3236 * \brief Free previously allocated session context
3237 *
3238 * \param[in] p_ctx Pointer to an already allocated ni_session_context_t
3239 * struct
3240 *
3241 ******************************************************************************/
3243
3244/*!*****************************************************************************
3245 * \brief Create event and return event handle if successful (Windows only)
3246 *
3247 * \return On success returns a event handle
3248 * On failure returns NI_INVALID_EVENT_HANDLE
3249 ******************************************************************************/
3250LIB_API ni_event_handle_t ni_create_event(void);
3251
3252/*!*****************************************************************************
3253 * \brief Close event and release resources (Windows only)
3254 *
3255 * \return NONE
3256 *
3257 ******************************************************************************/
3258LIB_API void ni_close_event(ni_event_handle_t event_handle);
3259
3260#ifndef DEPRECATION_AS_ERROR
3261/*!*****************************************************************************
3262 * \brief Open device and return device device_handle if successful
3263 *
3264 * \param[in] p_dev Device name represented as c string. ex: "/dev/nvme0"
3265 * \param[out] p_max_io_size_out Maximum IO Transfer size supported
3266 *
3267 * \return On success returns a device device_handle
3268 * On failure returns NI_INVALID_DEVICE_HANDLE
3269 ******************************************************************************/
3270LIB_API NI_DEPRECATED ni_device_handle_t ni_device_open(const char *dev,
3271 uint32_t *p_max_io_size_out);
3272#endif
3273
3274/*!*****************************************************************************
3275 * \brief Open device and return device device_handle if successful
3276 *
3277 * \param[in] p_dev Device name represented as c string. ex: "/dev/nvme0"
3278 * \param[in] mode Device configuration parameters
3279 *
3280 * \return On success returns a device device_handle
3281 * On failure returns NI_INVALID_DEVICE_HANDLE
3282 ******************************************************************************/
3283LIB_API ni_device_handle_t ni_device_open2(const char *dev,
3284 ni_device_mode_t mode);
3285
3286/*!*****************************************************************************
3287 * \brief Close device and release resources
3288 *
3289 * \param[in] device_handle Device handle obtained by calling ni_device_open()
3290 *
3291 * \return NONE
3292 *
3293 ******************************************************************************/
3294LIB_API void ni_device_close(ni_device_handle_t dev);
3295
3296#ifndef DEPRECATION_AS_ERROR
3297/*!*****************************************************************************
3298 * \brief Query device and return device capability structure
3299 * This function had been replaced by ni_device_capability_query2
3300 * This function can't be callback in multi thread
3301 *
3302 * \param[in] device_handle Device handle obtained by calling ni_device_open
3303 * \param[in] p_cap Pointer to a caller allocated ni_device_capability_t
3304 * struct
3305 * \return On success
3306 * NI_RETCODE_SUCCESS
3307 * On failure
3308 * NI_RETCODE_INVALID_PARAM
3309 * NI_RETCODE_ERROR_MEM_ALOC
3310 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3311 ******************************************************************************/
3313 ni_device_handle_t device_handle, ni_device_capability_t *p_cap);
3314#endif
3315
3316/*!*****************************************************************************
3317 * \brief Query device and return device capability structure
3318 * This function had replaced ni_device_capability_query
3319 * This function can be callback with multi thread
3320 *
3321 * \param[in] device_handle Device handle obtained by calling ni_device_open
3322 * \param[in] p_cap Pointer to a caller allocated ni_device_capability_t
3323 * struct
3324 * \param[in] device_in_ctxt If device is in ctx
3325 * \return On success
3326 * NI_RETCODE_SUCCESS
3327 * On failure
3328 * NI_RETCODE_INVALID_PARAM
3329 * NI_RETCODE_ERROR_MEM_ALOC
3330 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3331 ******************************************************************************/
3332LIB_API ni_retcode_t ni_device_capability_query2(ni_device_handle_t device_handle,
3333 ni_device_capability_t *p_cap, bool device_in_ctxt);
3334
3335/*!*****************************************************************************
3336 * \brief Open a new device session depending on the device_type parameter
3337 * If device_type is NI_DEVICE_TYPE_DECODER opens decoding session
3338 * If device_type is NI_DEVICE_TYPE_ENCODER opens encoding session
3339 * If device_type is NI_DEVICE_TYPE_SCALER opens scaling session
3340 *
3341 * \param[in] p_ctx Pointer to a caller allocated
3342 * ni_session_context_t struct
3343 * \param[in] device_type NI_DEVICE_TYPE_DECODER, NI_DEVICE_TYPE_ENCODER,
3344 * or NI_DEVICE_TYPE_SCALER
3345 * \return On success
3346 * NI_RETCODE_SUCCESS
3347 * On failure
3348 * NI_RETCODE_INVALID_PARAM
3349 * NI_RETCODE_ERROR_MEM_ALOC
3350 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3351 * NI_RETCODE_ERROR_INVALID_SESSION
3352 ******************************************************************************/
3354 ni_device_type_t device_type);
3355
3356/*!*****************************************************************************
3357 * \brief Close device session that was previously opened by calling
3358 * ni_device_session_open()
3359 * If device_type is NI_DEVICE_TYPE_DECODER closes decoding session
3360 * If device_type is NI_DEVICE_TYPE_ENCODER closes encoding session
3361 * If device_type is NI_DEVICE_TYPE_SCALER closes scaling session
3362 *
3363 * \param[in] p_ctx Pointer to a caller allocated
3364 * ni_session_context_t struct
3365 * \param[in] eos_received Flag indicating if End Of Stream indicator was
3366 * received
3367 * \param[in] device_type NI_DEVICE_TYPE_DECODER, NI_DEVICE_TYPE_ENCODER,
3368 * or NI_DEVICE_TYPE_SCALER
3369 * \return On success
3370 * NI_RETCODE_SUCCESS
3371 * On failure
3372 * NI_RETCODE_INVALID_PARAM
3373 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3374 * NI_RETCODE_ERROR_INVALID_SESSION
3375 ******************************************************************************/
3377 int eos_received,
3378 ni_device_type_t device_type);
3379
3380/*!*****************************************************************************
3381 * \brief Send a flush command to the device
3382 * If device_type is NI_DEVICE_TYPE_DECODER sends EOS command to
3383 * decoder
3384 * If device_type is NI_DEVICE_TYPE_ENCODER sends EOS command to
3385 * encoder
3386 *
3387 * \param[in] p_ctx Pointer to a caller allocated
3388 * ni_session_context_t struct
3389 * \param[in] device_type NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
3390 * \return On success
3391 * NI_RETCODE_SUCCESS
3392 * On failure
3393 * NI_RETCODE_INVALID_PARAM
3394 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3395 * NI_RETCODE_ERROR_INVALID_SESSION
3396 ******************************************************************************/
3398 ni_device_type_t device_type);
3399
3400/*!*****************************************************************************
3401 * \brief Save a stream's headers in a decoder session that can be used later
3402 * for continuous decoding from the same source.
3403 *
3404 * \param[in] p_ctx Pointer to a caller allocated
3405 * ni_session_context_t struct
3406 * \param[in] hdr_data Pointer to header data
3407 * \param[in] hdr_size Size of header data in bytes
3408 * \return On success
3409 * NI_RETCODE_SUCCESS
3410 * On failure
3411 * NI_RETCODE_INVALID_PARAM
3412 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3413 * NI_RETCODE_ERROR_INVALID_SESSION
3414 ******************************************************************************/
3416 ni_session_context_t *p_ctx, uint8_t *hdr_data, uint8_t hdr_size);
3417
3418/*!*****************************************************************************
3419 * \brief Flush a decoder session to get ready to continue decoding.
3420 * Note: this is different from ni_device_session_flush in that it closes the
3421 * current decode session and opens a new one for continuous decoding.
3422 *
3423 * \param[in] p_ctx Pointer to a caller allocated
3424 * ni_session_context_t struct
3425 * \return On success
3426 * NI_RETCODE_SUCCESS
3427 * On failure
3428 * NI_RETCODE_INVALID_PARAM
3429 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3430 * NI_RETCODE_ERROR_INVALID_SESSION
3431 ******************************************************************************/
3433
3434/*!*****************************************************************************
3435 * \brief Send data to the device
3436 * If device_type is NI_DEVICE_TYPE_DECODER sends data packet to
3437 * decoder
3438 * If device_type is NI_DEVICE_TYPE_ENCODER sends data frame to encoder
3439 * If device_type is NI_DEVICE_TYPE_AI sends data frame to AI engine
3440 *
3441 * \param[in] p_ctx Pointer to a caller allocated
3442 * ni_session_context_t struct
3443 * \param[in] p_data Pointer to a caller allocated
3444 * ni_session_data_io_t struct which contains either a
3445 * ni_frame_t data frame or ni_packet_t data packet to
3446 * send
3447 * \param[in] device_type NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER or
3448 * NI_DEVICE_TYPE_AI
3449 * If NI_DEVICE_TYPE_DECODER is specified, it is
3450 * expected that the ni_packet_t struct inside the
3451 * p_data pointer contains data to send.
3452 * If NI_DEVICE_TYPE_ENCODER or NI_DEVICE_TYPE_AI is
3453 * specified, it is expected that the ni_frame_t
3454 * struct inside the p_data pointer contains data to
3455 * send.
3456 * \return On success
3457 * Total number of bytes written
3458 * On failure
3459 * NI_RETCODE_INVALID_PARAM
3460 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3461 * NI_RETCODE_ERROR_INVALID_SESSION
3462 ******************************************************************************/
3464 ni_session_data_io_t *p_data,
3465 ni_device_type_t device_type);
3466
3467/*!*****************************************************************************
3468 * \brief Read data from the device
3469 * If device_type is NI_DEVICE_TYPE_DECODER reads data frame from
3470 * decoder
3471 * If device_type is NI_DEVICE_TYPE_ENCODER reads data packet from
3472 * encoder
3473 * If device_type is NI_DEVICE_TYPE_AI reads data frame from AI engine
3474 *
3475 * \param[in] p_ctx Pointer to a caller allocated
3476 * ni_session_context_t struct
3477 * \param[in] p_data Pointer to a caller allocated ni_session_data_io_t
3478 * struct which contains either a ni_frame_t data frame
3479 * or ni_packet_t data packet to send
3480 * \param[in] device_type NI_DEVICE_TYPE_DECODER, NI_DEVICE_TYPE_ENCODER, or
3481 * NI_DEVICE_TYPE_SCALER
3482 * If NI_DEVICE_TYPE_DECODER is specified, data that
3483 * was read will be placed into ni_frame_t struct
3484 * inside the p_data pointer
3485 * If NI_DEVICE_TYPE_ENCODER is specified, data that
3486 * was read will be placed into ni_packet_t struct
3487 * inside the p_data pointer
3488 * If NI_DEVICE_TYPE_AI is specified, data that was
3489 * read will be placed into ni_frame_t struct inside
3490 * the p_data pointer
3491 * \return On success
3492 * Total number of bytes read
3493 * On failure
3494 * NI_RETCODE_INVALID_PARAM
3495 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3496 * NI_RETCODE_ERROR_INVALID_SESSION
3497 ******************************************************************************/
3499 ni_session_data_io_t *p_data,
3500 ni_device_type_t device_type);
3501
3502/*!*****************************************************************************
3503 * \brief Query session data from the device -
3504 * If device_type is valid, will query session data
3505 * from specified device type
3506 *
3507 * \param[in] p_ctx Pointer to a caller allocated
3508 * ni_session_context_t struct
3509 * \param[in] device_type NI_DEVICE_TYPE_DECODER or
3510 * NI_DEVICE_TYPE_ENCODER or
3511 * NI_DEVICE_TYPE_SCALER or
3512 * NI_DEVICE_TYPE_AI or
3513 * NI_DEVICE_TYPE_UPLOADER
3514 *
3515 * \return On success
3516 * NI_RETCODE_SUCCESS
3517 * On failure
3518 * NI_RETCODE_INVALID_PARAM
3519 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3520 * NI_RETCODE_ERROR_INVALID_SESSION
3521 ******************************************************************************/
3523 ni_device_type_t device_type);
3524/*!*****************************************************************************
3525 * \brief Query detail session data from the device -
3526 * If device_type is valid, will query session data
3527 * from specified device type
3528 *
3529 * \param[in] p_ctx Pointer to a caller allocated
3530 * ni_session_context_t struct
3531 * \param[in] device_type NI_DEVICE_TYPE_DECODER or
3532 * NI_DEVICE_TYPE_ENCODER or
3533 * \param[out] detail_data Device data
3534 * \return On success
3535 * NI_RETCODE_SUCCESS
3536 * On failure
3537 * NI_RETCODE_INVALID_PARAM
3538 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3539 * NI_RETCODE_ERROR_INVALID_SESSION
3540 ******************************************************************************/
3542 ni_device_type_t device_type, ni_instance_mgr_detail_status_t *detail_data);
3543
3544/*!*****************************************************************************
3545 * \brief Query detail session data from the device -
3546 * If device_type is valid, will query session data
3547 * from specified device type
3548 *
3549 * \param[in] p_ctx Pointer to a caller allocated
3550 * ni_session_context_t struct
3551 * \param[in] device_type NI_DEVICE_TYPE_DECODER or
3552 * NI_DEVICE_TYPE_ENCODER or
3553 * \param[out] detail_data Device Data
3554 * \return On success
3555 * NI_RETCODE_SUCCESS
3556 * On failure
3557 * NI_RETCODE_INVALID_PARAM
3558 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3559 * NI_RETCODE_ERROR_INVALID_SESSION
3560 ******************************************************************************/
3562
3563/*!*****************************************************************************
3564 * \brief Send namespace num and SRIOv index to the device with specified logic block
3565 * address.
3566 *
3567 * \param[in] device_handle Device handle obtained by calling ni_device_open
3568 * \param[in] namespace_num Set the namespace number with designated sriov
3569 * \param[in] sriov_index Identify which sriov need to be set
3570 *
3571 * \return On success
3572 * NI_RETCODE_SUCCESS
3573 * On failure
3574 * NI_RETCODE_ERROR_MEM_ALOC
3575 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3576 ******************************************************************************/
3577LIB_API ni_retcode_t ni_device_config_namespace_num(ni_device_handle_t device_handle,
3578 uint32_t namespace_num, uint32_t sriov_index);
3579
3580/*!*****************************************************************************
3581 * \brief Send qos mode to the device with specified logic block
3582 * address.
3583 *
3584 * \param[in] device_handle Device handle obtained by calling ni_device_open
3585 * \param[in] mode The requested qos mode
3586 *
3587 * \return On success
3588 * NI_RETCODE_SUCCESS
3589 * On failure
3590 * NI_RETCODE_ERROR_MEM_ALOC
3591 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3592 ******************************************************************************/
3593LIB_API ni_retcode_t ni_device_config_qos(ni_device_handle_t device_handle,
3594 uint32_t mode);
3595
3596 /*!*****************************************************************************
3597 * \brief Send qos over provisioning mode to target namespace with specified logic
3598 * block address.
3599 *
3600 * \param[in] device_handle Device handle obtained by calling ni_device_open
3601 * \param[in] device_handle_t Target device handle of namespace required for OP
3602 * \param[in] over_provision The request overprovision percent
3603 *
3604 * \return On success
3605 * NI_RETCODE_SUCCESS
3606 * On failure
3607 * NI_RETCODE_ERROR_MEM_ALOC
3608 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3609 ******************************************************************************/
3610LIB_API ni_retcode_t ni_device_config_qos_op(ni_device_handle_t device_handle,
3611 ni_device_handle_t device_handle_t,
3612 uint32_t over_provision);
3613/*!*****************************************************************************
3614 * \brief Set QoS allowance for a specific namespace
3615 *
3616 * \param[in] device_handle Device handle obtained by calling ni_device_open
3617 * \param[in] device_handle_t Target device handle of namespace required
3618 * \param[in] allowance Allowance percentage (0.0-100.0)
3619 *
3620 * \return On success
3621 * NI_RETCODE_SUCCESS
3622 * On failure
3623 * NI_RETCODE_ERROR_MEM_ALOC
3624 * NI_RETCODE_ERROR_NVME_CMD_FAILED
3625 ******************************************************************************/
3626LIB_API ni_retcode_t ni_device_config_qos_allowance(ni_device_handle_t device_handle,
3627 ni_device_handle_t device_handle_t,
3628 uint32_t allowance);
3629
3630
3631/*!*****************************************************************************
3632 * \brief Allocate preliminary memory for the frame buffer based on provided
3633 * parameters. Applicable to YUV420 Planar pixel (8 or 10 bit/pixel)
3634 * format or 32-bit RGBA.
3635 *
3636 * \param[in] p_frame Pointer to a caller allocated
3637 * ni_frame_t struct
3638 * \param[in] video_width Width of the video frame
3639 * \param[in] video_height Height of the video frame
3640 * \param[in] alignment Allignment requirement
3641 * \param[in] metadata_flag Flag indicating if space for additional metadata
3642 * should be allocated
3643 * \param[in] factor 1 for 8 bits/pixel format, 2 for 10 bits/pixel,
3644 * 4 for 32 bits/pixel (RGBA)
3645 * \param[in] hw_frame_count Number of hw descriptors stored in lieu of raw YUV
3646 * \param[in] is_planar 0 if semiplanar else planar
3647 *
3648 * \return On success
3649 * NI_RETCODE_SUCCESS
3650 * On failure
3651 * NI_RETCODE_INVALID_PARAM
3652 * NI_RETCODE_ERROR_MEM_ALOC
3653 ******************************************************************************/
3654LIB_API ni_retcode_t ni_frame_buffer_alloc(ni_frame_t *p_frame, int video_width,
3655 int video_height, int alignment,
3656 int metadata_flag, int factor,
3657 int hw_frame_count, int is_planar);
3658
3659/*!*****************************************************************************
3660 * \brief Wrapper function for ni_frame_buffer_alloc. Meant to handle RGBA min.
3661 * resoulution considerations for encoder.
3662 *
3663 * \param[in] p_frame Pointer to a caller allocated
3664 * ni_frame_t struct
3665 * \param[in] video_width Width of the video frame
3666 * \param[in] video_height Height of the video frame
3667 * \param[in] alignment Allignment requirement
3668 * \param[in] metadata_flag Flag indicating if space for additional metadata
3669 * should be allocated
3670 * \param[in] factor 1 for 8 bits/pixel format, 2 for 10 bits/pixel,
3671 * 4 for 32 bits/pixel (RGBA)
3672 * \param[in] hw_frame_count Number of hw descriptors stored
3673 * \param[in] is_planar 0 if semiplanar else planar
3674 * \param[in] pix_fmt pixel format to distinguish between planar types
3675 * and/or components
3676 *
3677 * \return On success
3678 * NI_RETCODE_SUCCESS
3679 * On failure
3680 * NI_RETCODE_INVALID_PARAM
3681 * NI_RETCODE_ERROR_MEM_ALOC
3682 ******************************************************************************/
3684 int video_height, int alignment,
3685 int metadata_flag, int factor,
3686 int hw_frame_count, int is_planar,
3687 ni_pix_fmt_t pix_fmt);
3688
3690 int video_width, int video_height,
3691 int pixel_format);
3692
3693/*!*****************************************************************************
3694 * \brief Allocate memory for decoder frame buffer based on provided
3695 * parameters; the memory is retrieved from a buffer pool and will be
3696 * returned to the same buffer pool by ni_decoder_frame_buffer_free.
3697 * Note: all attributes of ni_frame_t will be set up except for memory and
3698 * buffer, which rely on the pool being allocated; the pool will be
3699 * allocated only after the frame resolution is known.
3700 *
3701 * \param[in] p_pool Buffer pool to get the memory from
3702 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
3703 * \param[in] alloc_mem Whether to get memory from buffer pool
3704 * \param[in] video_width Width of the video frame
3705 * \param[in] video_height Height of the video frame
3706 * \param[in] alignment Alignment requirement
3707 * \param[in] factor 1 for 8 bits/pixel format, 2 for 10 bits/pixel
3708 * \param[in] is_planar 0 if semiplanar else planar
3709 *
3710 * \return On success
3711 * NI_RETCODE_SUCCESS
3712 * On failure
3713 * NI_RETCODE_INVALID_PARAM
3714 * NI_RETCODE_ERROR_MEM_ALOC
3715 ******************************************************************************/
3717 ni_buf_pool_t *p_pool, ni_frame_t *pframe, int alloc_mem, int video_width,
3718 int video_height, int alignment, int factor, int is_planar);
3719
3720/*!*****************************************************************************
3721 * \brief Allocate memory for the frame buffer for encoding based on given
3722 * parameters, taking into account pic line size and extra data.
3723 * Applicable to YUV420p AVFrame only. 8 or 10 bit/pixel.
3724 * Cb/Cr size matches that of Y.
3725 *
3726 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
3727 *
3728 * \param[in] video_width Width of the video frame
3729 * \param[in] video_height Height of the video frame
3730 * \param[in] linesize Picture line size
3731 * \param[in] alignment Allignment requirement
3732 * \param[in] extra_len Extra data size (incl. meta data). < 0 means not
3733 * to allocate any buffer (zero-copy from existing)
3734 * \param[in] alignment_2pass_wa set alignment to work with 2pass encode
3735 *
3736 * \return On success
3737 * NI_RETCODE_SUCCESS
3738 * On failure
3739 * NI_RETCODE_INVALID_PARAM
3740 * NI_RETCODE_ERROR_MEM_ALOC
3741 *****************************************************************************/
3743 ni_frame_t *pframe, int video_width, int video_height, int linesize[],
3744 int alignment, int extra_len, bool alignment_2pass_wa);
3745
3747 ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params,
3748 niFrameSurface1_t *p_surface);
3749
3751 ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params,
3752 niFrameSurface1_t *p_src_surface);
3753
3755 ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params);
3756
3757/*!*****************************************************************************
3758* \brief Allocate memory for the frame buffer based on provided parameters
3759* taking into account pic line size and extra data.
3760* Applicable to nv12 AVFrame only. Cb/Cr size matches that of Y.
3761*
3762* \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
3763*
3764* \param[in] video_width Width of the video frame
3765* \param[in] video_height Height of the video frame
3766* \param[in] linesize Picture line size
3767* \param[in] extra_len Extra data size (incl. meta data). < 0 means not
3768* to allocate any buffer (zero-copy from existing)
3769* \param[in] alignment_2pass_wa set alignment to work with 2pass encode
3770*
3771* \return On success
3772* NI_RETCODE_SUCCESS
3773* On failure
3774* NI_RETCODE_INVALID_PARAM
3775* NI_RETCODE_ERROR_MEM_ALOC
3776*****************************************************************************/
3778 int video_width, int video_height,
3779 int linesize[], int extra_len,
3780 bool alignment_2pass_wa);
3781
3782/*!*****************************************************************************
3783 * \brief This API is a wrapper for ni_encoder_frame_buffer_alloc(), used
3784 * for planar pixel formats, and ni_frame_buffer_alloc_nv(), used for
3785 * semi-planar pixel formats. This API is meant to combine the
3786 * functionality for both formats.
3787 * Allocate memory for the frame buffer for encoding based on given
3788 * parameters, taking into account pic line size and extra data.
3789 * Applicable to YUV420p(8 or 10 bit/pixel) or nv12 AVFrame.
3790 * Cb/Cr size matches that of Y.
3791 *
3792 * \param[in] planar true: if planar:
3793 * pixel_format == (NI_PIX_FMT_YUV420P ||
3794 * NI_PIX_FMT_YUV420P10LE ||NI_PIX_FMT_RGBA).
3795 * false: semi-planar:
3796 * pixel_format == (NI_PIX_FMT_NV12 ||
3797 * NI_PIX_FMT_P010LE).
3798 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
3799 * \param[in] video_width Width of the video frame
3800 * \param[in] video_height Height of the video frame
3801 * \param[in] linesize Picture line size
3802 * \param[in] alignment Allignment requirement. Only used for planar format.
3803 * \param[in] extra_len Extra data size (incl. meta data). < 0 means not
3804 * to allocate any buffer (zero-copy from existing)
3805 * \param[in] alignment_2pass_wa set alignment to work with 2pass encode
3806 *
3807 * \return On success
3808 * NI_RETCODE_SUCCESS
3809 * On failure
3810 * NI_RETCODE_INVALID_PARAM
3811 * NI_RETCODE_ERROR_MEM_ALOC
3812 *****************************************************************************/
3814 int video_width, int video_height,
3815 int linesize[], int alignment,
3816 int extra_len,
3817 bool alignment_2pass_wa);
3818
3819/*!*****************************************************************************
3820 * \brief Free frame buffer that was previously allocated with either
3821 * ni_frame_buffer_alloc or ni_encoder_frame_buffer_alloc or
3822 * ni_frame_buffer_alloc_nv
3823 *
3824 * \param[in] p_frame Pointer to a previously allocated ni_frame_t struct
3825 *
3826 * \return On success NI_RETCODE_SUCCESS
3827 * On failure NI_RETCODE_INVALID_PARAM
3828 ******************************************************************************/
3830
3831/*!*****************************************************************************
3832 * \brief Free decoder frame buffer that was previously allocated with
3833 * ni_decoder_frame_buffer_alloc, returning memory to a buffer pool.
3834 *
3835 * \param[in] p_frame Pointer to a previously allocated ni_frame_t struct
3836 *
3837 * \return On success NI_RETCODE_SUCCESS
3838 * On failure NI_RETCODE_INVALID_PARAM
3839 ******************************************************************************/
3841
3842/*!*****************************************************************************
3843 * \brief Return a memory buffer to memory buffer pool, for a decoder frame.
3844 *
3845 * \param[in] buf Buffer to be returned.
3846 * \param[in] p_buffer_pool Buffer pool to return buffer to.
3847 *
3848 * \return None
3849 ******************************************************************************/
3850LIB_API void
3852 ni_buf_pool_t *p_buffer_pool);
3853
3854/*!*****************************************************************************
3855 * \brief Allocate memory for the packet buffer based on provided packet size
3856 *
3857 * \param[in] p_packet Pointer to a caller allocated
3858 * ni_packet_t struct
3859 * \param[in] packet_size Required allocation size
3860 *
3861 * \return On success
3862 * NI_RETCODE_SUCCESS
3863 * On failure
3864 * NI_RETCODE_INVALID_PARAM
3865 * NI_RETCODE_ERROR_MEM_ALOC
3866 ******************************************************************************/
3868 int packet_size);
3869
3870/*!*****************************************************************************
3871 * \brief Allocate packet buffer using a user provided pointer, the memory
3872 * is expected to have already been allocated.
3873 *
3874 * For ideal performance memory should be 4k aligned. If it is not 4K aligned
3875 * then a temporary 4k aligned memory will be used to copy data to and from
3876 * when writing and reading. This will negatively impact performance.
3877 *
3878 * This API will overwrite p_packet->buffer_size, p_packet->p_buffer and
3879 * p_packet->p_data fields in p_packet.
3880 *
3881 * This API will not free any memory associated with p_packet->p_buffer and
3882 * p_packet->p_data fields in p_packet.
3883 * Common use case could be,
3884 * 1. Allocate memory to pointer
3885 * 2. Call ni_custom_packet_buffer_alloc() with allocated pointer.
3886 * 3. Use p_packet as required.
3887 * 4. Call ni_packet_buffer_free() to free up the memory.
3888 *
3889 * \param[in] p_buffer User provided pointer to be used for buffer
3890 * \param[in] p_packet Pointer to a caller allocated
3891 * ni_packet_t struct
3892 * \param[in] buffer_size Buffer size
3893 *
3894 * \return On success
3895 * NI_RETCODE_SUCCESS
3896 * On failure
3897 * NI_RETCODE_INVALID_PARAM
3898 * NI_RETCODE_ERROR_MEM_ALOC
3899 ******************************************************************************/
3901 ni_packet_t *p_packet,
3902 int buffer_size);
3903
3904/*!*****************************************************************************
3905 * \brief Free packet buffer that was previously allocated with
3906 * ni_packet_buffer_alloc
3907 *
3908 * \param[in] p_packet Pointer to a previously allocated ni_packet_t struct
3909 *
3910 * \return On success NI_RETCODE_SUCCESS
3911 * On failure NI_RETCODE_INVALID_PARAM
3912 ******************************************************************************/
3914
3915/*!*****************************************************************************
3916 * \brief Free packet buffer that was previously allocated with
3917 * ni_packet_buffer_alloc for AV1 packets merge
3918 *
3919 * \param[in] p_packet Pointer to a previously allocated ni_packet_t struct
3920 *
3921 * \return On success NI_RETCODE_SUCCESS
3922 * On failure NI_RETCODE_INVALID_PARAM
3923 ******************************************************************************/
3925
3926/*!*****************************************************************************
3927 * \brief Copy video packet accounting for alignment
3928 *
3929 * \param[in] p_destination Destination to where to copy to
3930 * \param[in] p_source Source from where to copy from
3931 * \param[in] cur_size current size
3932 * \param[out] p_leftover Pointer to the data that was left over
3933 * \param[out] p_prev_size Size of the data leftover
3934 *
3935 * \return On success Total number of bytes that were copied
3936 * On failure NI_RETCODE_FAILURE
3937 ******************************************************************************/
3938LIB_API int ni_packet_copy(void *p_destination, const void *const p_source,
3939 int cur_size, void *p_leftover, int *p_prev_size);
3940
3941/*!*****************************************************************************
3942 * \brief Add a new auxiliary data to a frame
3943 *
3944 * \param[in/out] frame a frame to which the auxiliary data should be added
3945 * \param[in] type type of the added auxiliary data
3946 * \param[in] data_size size of the added auxiliary data
3947 *
3948 * \return a pointer to the newly added aux data on success, NULL otherwise
3949 ******************************************************************************/
3951 ni_aux_data_type_t type,
3952 int data_size);
3953
3954/*!*****************************************************************************
3955 * \brief Add a new auxiliary data to a frame and copy in the raw data
3956 *
3957 * \param[in/out] frame a frame to which the auxiliary data should be added
3958 * \param[in] type type of the added auxiliary data
3959 * \param[in] raw_data the raw data of the aux data
3960 * \param[in] data_size size of the added auxiliary data
3961 *
3962 * \return a pointer to the newly added aux data on success, NULL otherwise
3963 ******************************************************************************/
3966 const uint8_t *raw_data, int data_size);
3967
3968/*!*****************************************************************************
3969 * \brief Retrieve from the frame auxiliary data of a given type if exists
3970 *
3971 * \param[in] frame a frame from which the auxiliary data should be retrieved
3972 * \param[in] type type of the auxiliary data to be retrieved
3973 *
3974 * \return a pointer to the aux data of a given type on success, NULL otherwise
3975 ******************************************************************************/
3977 ni_aux_data_type_t type);
3978
3979/*!*****************************************************************************
3980 * \brief If auxiliary data of the given type exists in the frame, free it
3981 * and remove it from the frame.
3982 *
3983 * \param[in/out] frame a frame from which the auxiliary data should be removed
3984 * \param[in] type type of the auxiliary data to be removed
3985 *
3986 * \return None
3987 ******************************************************************************/
3989
3990/*!*****************************************************************************
3991 * \brief Free and remove all auxiliary data from the frame.
3992 *
3993 * \param[in/out] frame a frame from which the auxiliary data should be removed
3994 *
3995 * \return None
3996 ******************************************************************************/
3998
3999/*!*****************************************************************************
4000 * \brief Initialize default encoder parameters
4001 *
4002 * \param[out] param Pointer to a user allocated ni_xcoder_params_t
4003 * to initialize to default parameters
4004 * \param[in] fps_num Frames per second
4005 * \param[in] fps_denom FPS denomination
4006 * \param[in] bit_rate bit rate
4007 * \param[in] width frame width
4008 * \param[in] height frame height
4009 * \param[in] codec_format codec from ni_codec_format_t
4010 *
4011 * \return On success
4012 * NI_RETCODE_SUCCESS
4013 * On failure
4014 * NI_RETCODE_FAILURE
4015 * NI_RETCODE_INVALID_PARAM
4016 ******************************************************************************/
4018 ni_xcoder_params_t *p_param, int fps_num, int fps_denom, long bit_rate,
4019 int width, int height, ni_codec_format_t codec_format);
4020
4021/*!*****************************************************************************
4022 * \brief Initialize default decoder parameters
4023 *
4024 * \param[out] param Pointer to a user allocated ni_xcoder_params_t
4025 * to initialize to default parameters
4026 * \param[in] fps_num Frames per second
4027 * \param[in] fps_denom FPS denomination
4028 * \param[in] bit_rate bit rate
4029 * \param[in] width frame width
4030 * \param[in] height frame height
4031 *
4032 * \return On success
4033 * NI_RETCODE_SUCCESS
4034 * On failure
4035 * NI_RETCODE_FAILURE
4036 * NI_RETCODE_INVALID_PARAM
4037 ******************************************************************************/
4039 int fps_num, int fps_denom,
4040 long bit_rate, int width,
4041 int height);
4042
4043/*!*****************************************************************************
4044 * \brief Set value referenced by name in encoder parameters structure
4045 *
4046 * \param[in] p_params Pointer to a user allocated ni_xcoder_params_t
4047 * to find and set a particular parameter
4048 * \param[in] name String represented parameter name to search
4049 * \param[in] value Parameter value to set
4050*
4051 * \return On success
4052 * NI_RETCODE_SUCCESS
4053 * On failure
4054 * NI_RETCODE_FAILURE
4055 * NI_RETCODE_INVALID_PARAM
4056 ******************************************************************************/
4058 const char *name,
4059 const char *value);
4060
4061/*!*****************************************************************************
4062* \brief Set value referenced by name in decoder parameters structure
4063*
4064* \param[in] p_params Pointer to a user allocated ni_xcoder_params_t (used
4065* for decoder too for now ) to find and set a particular
4066* parameter
4067* \param[in] name String represented parameter name to search
4068* \param[in] value Parameter value to set
4069*
4070* \return On success
4071* NI_RETCODE_SUCCESS
4072* On failure
4073* NI_RETCODE_FAILURE
4074* NI_RETCODE_INVALID_PARAM
4075******************************************************************************/
4077 const char *name, char *value);
4078
4079/*!*****************************************************************************
4080 * \brief Set GOP parameter value referenced by name in encoder parameters
4081 * structure
4082 *
4083 * \param[in] p_params Pointer to a user allocated ni_xcoder_params_t
4084 * to find and set a particular parameter
4085 * \param[in] name String represented parameter name to search
4086 * \param[in] value Parameter value to set
4087*
4088 * \return On success
4089 * NI_RETCODE_SUCCESS
4090 * On failure
4091 * NI_RETCODE_FAILURE
4092 * NI_RETCODE_INVALID_PARAM
4093 ******************************************************************************/
4095 ni_xcoder_params_t *p_params, const char *name, const char *value);
4096
4097/*!*****************************************************************************
4098* \brief Copy existing decoding session params for hw frame usage
4099*
4100* \param[in] src_p_ctx Pointer to a caller allocated source session context
4101* \param[in] dst_p_ctx Pointer to a caller allocated destination session
4102* context
4103* \return On success
4104* NI_RETCODE_SUCCESS
4105* On failure
4106* NI_RETCODE_INVALID_PARAM
4107******************************************************************************/
4109 ni_session_context_t *dst_p_ctx);
4110
4111/*!*****************************************************************************
4112* \brief Send frame pool setup info to device
4113*
4114* \param[in] p_ctx Pointer to a caller allocated
4115* ni_session_context_t struct
4116* \param[in] pool_size Upload session initial allocated frames count
4117* must be > 0,
4118* \param[in] pool 0 use the normal pool
4119* 1 use a dedicated P2P pool
4120*
4121* \return On success Return code
4122* On failure
4123* NI_RETCODE_INVALID_PARAM
4124* NI_RETCODE_ERROR_NVME_CMD_FAILED
4125* NI_RETCODE_ERROR_INVALID_SESSION
4126* NI_RETCODE_ERROR_MEM_ALOC
4127******************************************************************************/
4129 uint32_t pool_size, uint32_t pool);
4130
4131/*!*****************************************************************************
4132* \brief Sends frame pool change info to device
4133*
4134* \param[in] p_ctx Pointer to a caller allocated
4135* ni_session_context_t struct
4136* \param[in] pool_size if pool_size = 0, free allocated device memory buffers
4137* if pool_size > 0, expand device frame buffer pool of
4138* current instance with pool_size more frame buffers
4139*
4140* \return On success Return code
4141* On failure
4142* NI_RETCODE_FAILURE
4143* NI_RETCODE_INVALID_PARAM
4144* NI_RETCODE_ERROR_NVME_CMD_FAILED
4145* NI_RETCODE_ERROR_INVALID_SESSION
4146* NI_RETCODE_ERROR_MEM_ALOC
4147* NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4148*******************************************************************************/
4150 uint32_t pool_size);
4151
4152/*!*****************************************************************************
4153* \brief Read data from the device
4154* If device_type is NI_DEVICE_TYPE_DECODER reads data hwdesc from
4155* decoder
4156* If device_type is NI_DEVICE_TYPE_SCALER reads data hwdesc from
4157* scaler
4158*
4159* \param[in] p_ctx Pointer to a caller allocated
4160* ni_session_context_t struct
4161* \param[in] p_data Pointer to a caller allocated
4162* ni_session_data_io_t struct which contains either a
4163* ni_frame_t data frame or ni_packet_t data packet to
4164* send
4165* \param[in] device_type NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_SCALER
4166* If NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_SCALER is specified,
4167* hw descriptor info will be stored in p_data ni_frame
4168* \return On success
4169* Total number of bytes read
4170* On failure
4171* NI_RETCODE_INVALID_PARAM
4172* NI_RETCODE_ERROR_NVME_CMD_FAILED
4173* NI_RETCODE_ERROR_INVALID_SESSION
4174******************************************************************************/
4176 ni_session_data_io_t *p_data,
4177 ni_device_type_t device_type);
4178
4179/*!*****************************************************************************
4180* \brief Read YUV data from hw descriptor stored location on device
4181*
4182* \param[in] p_ctx Pointer to a caller allocated
4183* ni_session_context_t struct
4184* \param[in] p_data Pointer to a caller allocated
4185* ni_session_data_io_t struct which contains either a
4186* ni_frame_t data frame or ni_packet_t data packet to
4187* send
4188* \param[in] hwdesc HW descriptor to find frame in XCODER
4189* \return On success
4190* Total number of bytes read
4191* On failure
4192* NI_RETCODE_INVALID_PARAM
4193* NI_RETCODE_ERROR_NVME_CMD_FAILED
4194* NI_RETCODE_ERROR_INVALID_SESSION
4195******************************************************************************/
4197 ni_session_data_io_t *p_data,
4198 niFrameSurface1_t *hwdesc);
4199
4200/*!*****************************************************************************
4201* \brief Query the session if a buffer is available
4202*
4203* \param[in] p_ctx Pointer to a caller allocated
4204* ni_session_context_t struct
4205* \param[in] device_type Quadra device type
4206*
4207* \return On success
4208* NI_RETCODE_SUCCESS
4209* On failure
4210* NI_RETCODE_INVALID_PARAM
4211* NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4212* NI_RETCODE_ERROR_NVME_CMD_FAILED
4213* NI_RETCODE_ERROR_INVALID_SESSION
4214*******************************************************************************/
4216 ni_device_type_t device_type);
4217
4218
4219/*!*****************************************************************************
4220* \brief Send raw YUV input to uploader instance and retrieve a HW descriptor
4221* to represent it
4222*
4223* \param[in] p_ctx Pointer to a caller allocated
4224* ni_session_context_t struct
4225* \param[in] p_src_data Pointer to a caller allocated
4226* ni_session_data_io_t struct which contains a
4227* ni_frame_t data frame to send to uploader
4228* \param[out] hwdesc HW descriptor to find frame in XCODER
4229* \return On success
4230* Total number of bytes read
4231* On failure
4232* NI_RETCODE_INVALID_PARAM
4233* NI_RETCODE_ERROR_NVME_CMD_FAILED
4234* NI_RETCODE_ERROR_INVALID_SESSION
4235*******************************************************************************/
4237
4238/*!*****************************************************************************
4239* \brief Allocate memory for the hwDescriptor buffer based on provided
4240* parameters taking into account pic size and extra data.
4241*
4242* \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
4243*
4244* \param[in] video_width Width of the video frame
4245* \param[in] video_height Height of the video frame
4246* \param[in] extra_len Extra data size (incl. meta data)
4247*
4248* \return On success
4249* NI_RETCODE_SUCCESS
4250* On failure
4251* NI_RETCODE_INVALID_PARAM
4252* NI_RETCODE_ERROR_MEM_ALOC
4253*****************************************************************************/
4255 int video_width,
4256 int video_height,
4257 int extra_len);
4258
4259/*!*****************************************************************************
4260* \brief Recycle a hwframe buffer on card
4261*
4262* \param[in] surface Struct containing device and frame location to clear out
4263* \param[in] device_handle handle to access device memory buffer is stored in
4264*
4265* \return On success NI_RETCODE_SUCCESS
4266* On failure NI_RETCODE_INVALID_PARAM
4267*******************************************************************************/
4269 int32_t device_handle);
4270
4271
4272/*!*****************************************************************************
4273* \brief Recycle a hwframe buffer on card
4274*
4275* \param[in] surface Struct containing device and frame location to clear out
4276*
4277* \return On success NI_RETCODE_SUCCESS
4278* On failure NI_RETCODE_INVALID_PARAM
4279*******************************************************************************/
4281
4282/*!*****************************************************************************
4283 * \brief Set parameters on the device for the 2D engine
4284 *
4285 * \param[in] p_ctx pointer to session context
4286 * \param[in] p_params pointer to the scaler parameters
4287 *
4288 * \return NI_RETCODE_INVALID_PARAM
4289 * NI_RETCODE_ERROR_INVALID_SESSION
4290 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4291
4292 ******************************************************************************/
4294 ni_scaler_params_t *p_params);
4295
4296/*!*****************************************************************************
4297 * \brief Allocate a frame on the device for 2D engine or AI engine
4298 * to work on based on provided parameters
4299 *
4300 * \param[in] p_ctx pointer to session context
4301 * \param[in] width width, in pixels
4302 * \param[in] height height, in pixels
4303 * \param[in] format pixel format
4304 * \param[in] options options bitmap flags, bit 0 (NI_SCALER_FLAG_IO) is
4305 * 0=input frame or 1=output frame. Bit 1 (NI_SCALER_FLAG_PC) is
4306 * 0=single allocation, 1=create pool. Bit 2 (NI_SCALER_FLAG_PA) is
4307 * 0=straight alpha, 1=premultiplied alpha
4308 * \param[in] rectangle_width clipping rectangle width
4309 * \param[in] rectangle_height clipping rectangle height
4310 * \param[in] rectangle_x horizontal position of clipping rectangle
4311 * \param[in] rectangle_y vertical position of clipping rectangle
4312 * \param[in] rgba_color RGBA fill colour (for padding only)
4313 * \param[in] frame_index input hwdesc index
4314 * \param[in] device_type only NI_DEVICE_TYPE_SCALER
4315 * and NI_DEVICE_TYPE_AI (only needs p_ctx and frame_index)
4316 *
4317 * \return NI_RETCODE_INVALID_PARAM
4318 * NI_RETCODE_ERROR_INVALID_SESSION
4319 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4320 * NI_RETCODE_ERROR_MEM_ALOC
4321 ******************************************************************************/
4323 int width,
4324 int height,
4325 int format,
4326 int options,
4327 int rectangle_width,
4328 int rectangle_height,
4329 int rectangle_x,
4330 int rectangle_y,
4331 int rgba_color,
4332 int frame_index,
4333 ni_device_type_t device_type);
4334
4335/*!*****************************************************************************
4336 * \brief Allocate a frame on the device and return the frame index
4337 *
4338 * \param[in] p_ctx pointer to session context
4339 * \param[out] p_out_surface pointer to output frame surface
4340 * \param[in] device_type currently only NI_DEVICE_TYPE_AI
4341 *
4342 * \return NI_RETCODE_INVALID_PARAM
4343 * NI_RETCODE_ERROR_INVALID_SESSION
4344 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4345 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4346 * NI_RETCODE_ERROR_MEM_ALOC
4347 ******************************************************************************/
4349 niFrameSurface1_t *p_out_surface,
4350 ni_device_type_t device_type);
4351
4352/*!*****************************************************************************
4353 * \brief Copy the data of src hwframe to dst hwframe
4354 *
4355 * \param[in] p_ctx pointer to session context
4356 * \param[in] p_frameclone_desc pointer to the frameclone descriptor
4357 *
4358 * \return NI_RETCODE_INVALID_PARAM
4359 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4360 * NI_RETCODE_ERROR_INVALID_SESSION
4361 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4362 * NI_RETCODE_ERROR_MEM_ALOC
4363 ******************************************************************************/
4365 ni_frameclone_desc_t *p_frameclone_desc);
4366
4367/*!*****************************************************************************
4368 * \brief Config a frame on the device for 2D engined
4369 * to work on based on provided parameters
4370 *
4371 * \param[in] p_ctx pointer to session context
4372 * \param[in] p_cfg pointer to frame config
4373 *
4374 * \return NI_RETCODE_INVALID_PARAM
4375 * NI_RETCODE_ERROR_INVALID_SESSION
4376 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4377 * NI_RETCODE_ERROR_MEM_ALOC
4378 ******************************************************************************/
4380 ni_frame_config_t *p_cfg);
4381
4383 ni_scaler_drawbox_params_t *p_params);
4384
4387
4388/*!*****************************************************************************
4389 * \brief Config multiple frame on the device for 2D engined
4390 * to work on based on provided parameters
4391 *
4392 * \param[in] p_ctx pointer to session context
4393 * \param[in] p_cfg_in input frame config array
4394 * \param[in] numInCfgs number of frame config entries in the p_cfg_in array
4395 * \param[in] p_cfg_out output frame config
4396 *
4397 * \return NI_RETCODE_INVALID_PARAM
4398 * NI_RETCODE_ERROR_INVALID_SESSION
4399 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4400 * NI_RETCODE_ERROR_MEM_ALOC
4401 ******************************************************************************/
4403 ni_frame_config_t p_cfg_in[],
4404 int numInCfgs,
4405 ni_frame_config_t *p_cfg_out);
4406
4407/*!*****************************************************************************
4408 * \brief Allocate memory for the frame buffer based on provided parameters
4409 * taking into account the pixel format, width, height, stride,
4410 * alignment, and extra data
4411 * \param[in] p_frame Pointer to caller allocated ni_frame_t
4412 * \param[in] pixel_format a pixel format in ni_pix_fmt_t enum
4413 * \param[in] video_width width, in pixels
4414 * \param[in] video_height height, in pixels
4415 * \param[in] linesize horizontal stride
4416 * \param[in] alignment apply a 16 pixel height alignment (T408 only)
4417 * \param[in] extra_len meta data size
4418 *
4419 * \return NI_RETCODE_SUCCESS
4420 * NI_RETCODE_INVALID_PARAM
4421 * NI_RETCODE_ERROR_MEM_ALOC
4422 *
4423 ******************************************************************************/
4425 ni_frame_t *pframe, int pixel_format, int video_width, int video_height,
4426 int linesize[], int alignment, int extra_len);
4427
4428/*!*****************************************************************************
4429 * \brief configure a network context based with the network binary
4430 *
4431 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4432 * \param[in] file Pointer to caller network binary file path
4433 *
4434 * \return NI_RETCODE_SUCCESS
4435 * NI_RETCODE_INVALID_PARAM
4436 * NI_RETCODE_ERROR_MEM_ALOC
4437 * NI_RETCODE_ERROR_INVALID_SESSION
4438 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4439 * NI_RETCODE_FAILURE
4440 *
4441 ******************************************************************************/
4443 ni_network_data_t *p_network,
4444 const char *file);
4445
4446/*!*****************************************************************************
4447 * \brief configure a hvsplus filter
4448 *
4449 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4450 * \param[in] p_network Pointer to caller allocated ni_network_data_t
4451 *
4452 * \return NI_RETCODE_SUCCESS
4453 * NI_RETCODE_FAILURE
4454 *
4455 ******************************************************************************/
4457 ni_network_data_t *p_network);
4458
4459/*!*****************************************************************************
4460 * \brief Allocate input layers memory for AI frame buffer based on provided parameters
4461 * taking into account width, height, format defined by network.
4462 *
4463 * \param[out] p_frame Pointer to caller allocated ni_frame_t
4464 * \param[in] p_network Pointer to caller allocated ni_network_data_t
4465 *
4466 * \return NI_RETCODE_SUCCESS
4467 * NI_RETCODE_INVALID_PARAM
4468 * NI_RETCODE_ERROR_MEM_ALOC
4469 *
4470 ******************************************************************************/
4472 ni_network_data_t *p_network);
4473
4474/*!*****************************************************************************
4475 * \brief Allocate output layers memory for the packet buffer based on provided network
4476 *
4477 * \param[out] p_packet Pointer to a caller allocated
4478 * ni_packet_t struct
4479 * \param[in] p_network Pointer to a caller allocated
4480 * ni_network_data_t struct
4481 *
4482 * \return On success
4483 * NI_RETCODE_SUCCESS
4484 * On failure
4485 * NI_RETCODE_INVALID_PARAM
4486 * NI_RETCODE_ERROR_MEM_ALOC
4487 ******************************************************************************/
4489 ni_network_data_t *p_network);
4490
4491// wrapper API request, dynamic encode configuration setting to be sent to the
4492// encoder with the next frame
4493
4494/*!*****************************************************************************
4495 * \brief Reconfigure bitrate dynamically during encoding.
4496 *
4497 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4498 * \param[in] bitrate Target bitrate to set
4499 *
4500 * \return On success NI_RETCODE_SUCCESS
4501 * On failure NI_RETCODE_INVALID_PARAM
4502 ******************************************************************************/
4504 int32_t bitrate);
4505
4506/*!*****************************************************************************
4507 * \brief Reconfigure intraPeriod dynamically during encoding.
4508 *
4509 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4510 * \param[in] intra_period Target intra period to set
4511 *
4512 * \return On success NI_RETCODE_SUCCESS
4513 * On failure NI_RETCODE_INVALID_PARAM
4514 *
4515 * NOTE - the frame upon which intra period is reconfigured is encoded as IDR frame
4516 * NOTE - reconfigure intra period is not allowed if intraRefreshMode is enabled or if gopPresetIdx is 1
4517 *
4518 ******************************************************************************/
4520 int32_t intra_period);
4521
4522/*!*****************************************************************************
4523 * \brief Reconfigure VUI dynamically during encoding.
4524 *
4525 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4526 * \param[in] vui Pointer to caller allocated ni_vui_hrd_t
4527 *
4528 * \return On success NI_RETCODE_SUCCESS
4529 * On failure NI_RETCODE_INVALID_PARAM
4530 ******************************************************************************/
4532 ni_vui_hrd_t *vui);
4533
4534/*!*****************************************************************************
4535 * \brief Force next frame to be IDR frame during encoding.
4536 *
4537 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4538 *
4539 * \return On success NI_RETCODE_SUCCESS
4540 ******************************************************************************/
4542
4543/*!*****************************************************************************
4544 * \brief Set a frame's support of Long Term Reference frame during encoding.
4545 *
4546 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4547 * \param[in] ltr Pointer to struct specifying LTR support
4548 *
4549 * \return On success NI_RETCODE_SUCCESS
4550 * On failure NI_RETCODE_INVALID_PARAM
4551 ******************************************************************************/
4553 ni_long_term_ref_t *ltr);
4554
4555/*!*****************************************************************************
4556 * \brief Set Long Term Reference interval
4557 *
4558 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4559 * \param[in] ltr_interval the new long term reference inteval value
4560 *
4561 * \return On success NI_RETCODE_SUCCESS
4562 * On failure NI_RETCODE_INVALID_PARAM
4563 ******************************************************************************/
4565 int32_t ltr_interval);
4566
4567/*!*****************************************************************************
4568 * \brief Set frame reference invalidation
4569 *
4570 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4571 * \param[in] frame_num frame number after which all references shall be
4572 * invalidated
4573 *
4574 * \return On success NI_RETCODE_SUCCESS
4575 * On failure NI_RETCODE_INVALID_PARAM
4576 ******************************************************************************/
4578 int32_t frame_num);
4579
4580/*!*****************************************************************************
4581 * \brief Reconfigure framerate dynamically during encoding.
4582 *
4583 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4584 * \param[in] framerate Pointer to struct specifying framerate to set
4585 *
4586 * \return On success NI_RETCODE_SUCCESS
4587 * On failure NI_RETCODE_INVALID_PARAM
4588 ******************************************************************************/
4590 ni_framerate_t *framerate);
4591
4592/*!*****************************************************************************
4593 * \brief Reconfigure maxFrameSize dynamically during encoding.
4594 *
4595 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4596 * \param[in] max_frame_size the new maxFrameSize value
4597 *
4598 * \return On success NI_RETCODE_SUCCESS
4599 * On failure NI_RETCODE_INVALID_PARAM
4600 *
4601 * NOTE - maxFrameSize_Bytes value less than ((bitrate / 8) / framerate) will be rejected
4602 *
4603 ******************************************************************************/
4605 int32_t max_frame_size);
4606
4607/*!*****************************************************************************
4608 * \brief Reconfigure min&max qp dynamically during encoding.
4609 *
4610 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4611 * \param[in] ni_rc_min_max_qp Target min&max qp to set
4612 *
4613 * \return On success NI_RETCODE_SUCCESS
4614 * On failure NI_RETCODE_INVALID_PARAM
4615 ******************************************************************************/
4617 ni_rc_min_max_qp *p_min_max_qp);
4618
4619
4620/*!*****************************************************************************
4621 * \brief Reconfigure crf value dynamically during encoding.
4622 *
4623 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4624 * \param[in] crf crf value to reconfigure
4625 *
4626 * \return On success NI_RETCODE_SUCCESS
4627 * On failure NI_RETCODE_INVALID_PARAM
4628 ******************************************************************************/
4630 int32_t crf);
4631
4632/*!*****************************************************************************
4633 * \brief Reconfigure crf float point value dynamically during encoding.
4634 *
4635 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4636 * \param[in] crf crf float point value to reconfigure
4637 *
4638 * \return On success NI_RETCODE_SUCCESS
4639 * On failure NI_RETCODE_INVALID_PARAM
4640 ******************************************************************************/
4642 float crf);
4643
4644
4645/*!*****************************************************************************
4646 * \brief Reconfigure vbv buffer size and vbv max rate dynamically during encoding.
4647 *
4648 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4649 * \param[in] vbvBufferSize Target vbvBufferSize to set
4650 * \param[in] vbvMaxRate Target vbvMaxRate to set
4651 *
4652 * \return On success NI_RETCODE_SUCCESS
4653 * On failure NI_RETCODE_INVALID_PARAM
4654 ******************************************************************************/
4656 int32_t vbvMaxRate, int32_t vbvBufferSize);
4657
4658/*!*****************************************************************************
4659 * \brief Reconfigure maxFrameSizeRatio dynamically during encoding.
4660 *
4661 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4662 * \param[in] max_frame_size_ratio the new maxFrameSizeRatio value
4663 *
4664 * \return On success NI_RETCODE_SUCCESS
4665 * On failure NI_RETCODE_INVALID_PARAM
4666 ******************************************************************************/
4668 int32_t max_frame_size_ratio);
4669
4670/*!*****************************************************************************
4671 * \brief Reconfigure sliceArg dynamically during encoding.
4672 *
4673 * \param[in] p_ctx Pointer to caller allocated ni_session_context_t
4674 * \param[in] sliceArg the new sliceArg value
4675 *
4676 * \return On success NI_RETCODE_SUCCESS
4677 * On failure NI_RETCODE_INVALID_PARAM
4678 ******************************************************************************/
4680 int16_t sliceArg);
4681
4682#ifndef _WIN32
4683/*!*****************************************************************************
4684* \brief Acquire a P2P frame buffer from the hwupload session
4685*
4686* \param[in] p_upl_ctx Pointer to a caller allocated
4687* ni_session_context_t struct
4688* \param[out] p_frame Pointer to a caller allocated hw frame
4689*
4690* \return On success
4691* NI_RETCODE_SUCCESS
4692* On failure
4693* NI_RETCODE_INVALID_PARAM
4694* NI_RETCODE_ERROR_NVME_CMD_FAILED
4695* NI_RETCODE_ERROR_INVALID_SESSION
4696*******************************************************************************/
4698 ni_frame_t *p_frame);
4699
4700/*!*****************************************************************************
4701* \brief Acquire a P2P frame buffer from the hwupload session for P2P read
4702*
4703* \param[in] p_upl_ctx Pointer to a caller allocated
4704* ni_session_context_t struct
4705* \param[out] p_frame Pointer to a caller allocated hw frame
4706*
4707* \return On success
4708* NI_RETCODE_SUCCESS
4709* On failure
4710* NI_RETCODE_INVALID_PARAM
4711* NI_RETCODE_ERROR_NVME_CMD_FAILED
4712* NI_RETCODE_ERROR_INVALID_SESSION
4713*******************************************************************************/
4715 ni_frame_t *p_frame);
4716
4717/*!*****************************************************************************
4718 * \brief Lock a hardware P2P frame prior to encoding
4719 *
4720 * \param[in] p_upl_ctx pointer to caller allocated upload context
4721 * \param[in] p_frame pointer to caller allocated hardware P2P frame
4722 *
4723 * \return On success
4724 * NI_RETCODE_SUCCESS
4725 * On failure NI_RETCODE_FAILURE
4726 * NI_RETCODE_INVALID_PARAM
4727*******************************************************************************/
4729 ni_session_context_t *p_upl_ctx, ni_frame_t *p_frame);
4730
4731/*!*****************************************************************************
4732 * \brief Unlock a hardware P2P frame after encoding
4733 *
4734 * \param[in] p_upl_ctx pointer to caller allocated upload context
4735 * \param[in] p_frame pointer to caller allocated hardware P2P frame
4736 *
4737 * \return On success
4738 * NI_RETCODE_SUCCESS
4739 * On failure NI_RETCODE_FAILURE
4740 * NI_RETCODE_INVALID_PARAM
4741*******************************************************************************/
4743 ni_session_context_t *p_upl_ctx, ni_frame_t *p_frame);
4744
4745/*!*****************************************************************************
4746 * \brief Special P2P test API call. Copies YUV data from the software
4747 * frame to the hardware P2P frame on the Quadra device
4748 *
4749 * \param[in] p_upl_ctx pointer to caller allocated uploader session
4750 * context
4751 * \param[in] p_data pointer to a caller allocated yuv data
4752 * \param[in] p_hwframe pointer to a caller allocated hardware frame
4753 * \param[in] len data length
4754 *
4755 * \return On success
4756 * NI_RETCODE_SUCCESS
4757 * On failure
4758 * NI_RETCODE_FAILURE
4759 * NI_RETCODE_INVALID_PARAM
4760*******************************************************************************/
4762 uint8_t *p_data, uint32_t len,
4763 ni_frame_t *p_hwframe);
4764
4765
4767 uint8_t *p_data, uint32_t len,
4768 ni_frame_t *p_hwframe);
4769
4770/*!*****************************************************************************
4771 * \brief Set the incoming frame format for the encoder
4772 *
4773 * \param[in] p_enc_ctx pointer to encoder context
4774 * \param[in] p_enc_params pointer to encoder parameters
4775 * \param[in] width input width
4776 * \param[in] height input height
4777 * \param[in] bit_depth 8 for 8-bit YUV, 10 for 10-bit YUV
4778 * \param[in] src_endian NI_FRAME_LITTLE_ENDIAN or NI_FRAME_BIG_ENDIAN
4779 * \param[in] planar 0 for semi-planar YUV, 1 for planar YUV
4780 *
4781 * \return on success
4782 * NI_RETCODE_SUCCESS
4783 *
4784 * on failure
4785 * NI_RETCODE_INVALID_PARAM
4786*******************************************************************************/
4788 ni_session_context_t *p_enc_ctx, ni_xcoder_params_t *p_enc_params,
4789 int width, int height, int bit_depth, int src_endian, int planar);
4790
4791/*!*****************************************************************************
4792 * \brief Acquire the scaler P2P DMA buffer for read/write
4793 *
4794 * \param[in] p_ctx pointer to caller allocated upload context
4795 * \param[in] p_surface pointer to a caller allocated hardware frame
4796 * \param[in] data_len scaler frame buffer data length
4797 *
4798 * \return on success
4799 * NI_RETCODE_SUCCESS
4800 *
4801 * on failure
4802 * NI_RETCODE_FAILURE
4803*******************************************************************************/
4805 niFrameSurface1_t *p_surface,
4806 int data_len);
4807
4808/*!*****************************************************************************
4809 * \brief Recycle hw P2P frames
4810 *
4811 * \param[in] p_frame pointer to an acquired P2P hw frame
4812 *
4813 * \return on success
4814 * NI_RETCODE_SUCCESS
4815 *
4816 * on failure
4817 * NI_RETCODE_INVALID_PARAM
4818*******************************************************************************/
4820#endif
4821
4822/*!*****************************************************************************
4823 * \brief Set the frame format for the uploader
4824 *
4825 * \param[in] p_upl_ctx pointer to uploader context
4826 * \param[in] width width
4827 * \param[in] height height
4828 * \param[in] pixel_format pixel format
4829 * \param[in] isP2P 0 = normal, 1 = P2P
4830 *
4831 * \return on success
4832 * NI_RETCODE_SUCCESS
4833 *
4834 * on failure
4835 * NI_RETCODE_INVALID_PARAM
4836*******************************************************************************/
4839 int height, ni_pix_fmt_t pixel_format, int isP2P);
4840
4841/*!*****************************************************************************
4842 * \brief Read encoder stream header from the device
4843 *
4844 * \param[in] p_ctx Pointer to a caller allocated
4845 * ni_session_context_t struct from encoder
4846 * \param[in] p_data Pointer to a caller allocated ni_session_data_io_t
4847 * struct which contains a ni_packet_t data packet to
4848 * receive
4849 * \return On success
4850 * Total number of bytes read
4851 * On failure
4852 * NI_RETCODE_INVALID_PARAM
4853 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4854 * NI_RETCODE_ERROR_INVALID_SESSION
4855*******************************************************************************/
4857 ni_session_data_io_t *p_data);
4858
4859
4860/*!*****************************************************************************
4861 * \brief Get the DMA buffer file descriptor from the P2P frame
4862 *
4863 * \param[in] p_frame pointer to a P2P frame
4864 *
4865 * \return On success
4866 * DMA buffer file descriptor
4867 * On failure
4868 * NI_RETCODE_FAILURE
4869*******************************************************************************/
4870LIB_API int32_t ni_get_dma_buf_file_descriptor(const ni_frame_t* p_frame);
4871
4872
4873/*!*****************************************************************************
4874 * \brief Send sequence change information to device
4875 *
4876 * \param[in] p_ctx Pointer to a caller allocated
4877 * ni_session_context_t struct
4878 * \param[in] width input width
4879 * \param[in] height input height
4880 * \param[in] bit_depth_factor 1 for 8-bit YUV, 2 for 10-bit YUV
4881 * \param[in] device_type device type (must be encoder)
4882 * \return On success
4883 * NI_RETCODE_SUCCESS
4884 * On failure
4885 * NI_RETCODE_INVALID_PARAM
4886 * NI_RETCODE_ERROR_MEM_ALOC
4887 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4888 * NI_RETCODE_ERROR_INVALID_SESSION
4889 ******************************************************************************/
4891 int width, int height, int bit_depth_factor, ni_device_type_t device_type);
4892
4893/*!*****************************************************************************
4894 * \brief Fetch perf metrics of inferences from device
4895 *
4896 * \param[in] p_ctx Pointer to a caller allocated
4897 * ni_session_context_t struct
4898 * \param[in] p_metrics Pointer to network metrics
4899 * \return On success
4900 * NI_RETCODE_SUCCESS
4901 * On failure
4902 * NI_RETCODE_INVALID_PARAM
4903 * NI_RETCODE_ERROR_MEM_ALOC
4904 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4905 ******************************************************************************/
4908
4909/*!*****************************************************************************
4910 * \brief Query firmware loader and firmware versions from the device
4911 *
4912 * \param[in] device_handle Device handle obtained by calling ni_device_open()
4913 * \param[in] p_dev_info
4914 *
4915 * \return On success
4916 * NI_RETCODE_SUCCESS
4917 * On failure
4918 * NI_RETCODE_INVALID_PARAM
4919 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4920 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4921 * NI_RETCODE_ERROR_MEM_ALOC
4922 ******************************************************************************/
4923LIB_API ni_retcode_t ni_query_fl_fw_versions(ni_device_handle_t device_handle,
4924 ni_device_info_t *p_dev_info);
4925
4926/*!*****************************************************************************
4927 * \brief Query NVMe load from the device
4928 *
4929 * \param[in] p_ctx Pointer to a caller allocated
4930 * ni_session_context_t struct
4931 * \param[in] p_load_query Pointer to a caller allocated
4932 * ni_load_query_t struct
4933 *
4934 * \return On success
4935 * NI_RETCODE_SUCCESS
4936 * On failure
4937 * NI_RETCODE_INVALID_PARAM
4938 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4939 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4940 * NI_RETCODE_ERROR_MEM_ALOC
4941 ******************************************************************************/
4943 ni_session_context_t *p_ctx, ni_load_query_t *p_load_query);
4944
4945/*!*****************************************************************************
4946 * \brief Query VF and NS id from device
4947 *
4948 * \param[in] device_handle Device handle obtained by calling ni_device_open()
4949 * \param[in] p_dev_ns_vf Pointer to a ni_device_vf_ns_id_t struct
4950 * \param[in] fw_rev[] Fw version to check if this function is supported
4951 *
4952 * \return On success
4953 * NI_RETCODE_SUCCESS
4954 * On failure
4955 * NI_RETCODE_INVALID_PARAM
4956 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4957 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4958 * NI_RETCODE_ERROR_MEM_ALOC
4959 ******************************************************************************/
4960LIB_API ni_retcode_t ni_query_vf_ns_id(ni_device_handle_t device_handle,
4961 ni_device_vf_ns_id_t *p_dev_ns_vf,
4962 uint8_t fw_rev[]);
4963
4964/*!*****************************************************************************
4965 * \brief Query CompositeTemp from device
4966 *
4967 * \param[in] device_handle Device handle obtained by calling ni_device_open()
4968 * \param[in] p_dev_temp Pointer to device temperature
4969 * \param[in] fw_rev[] Fw version to check if this function is supported
4970 *
4971 * \return On success
4972 * NI_RETCODE_SUCCESS
4973 * On failure
4974 * NI_RETCODE_INVALID_PARAM
4975 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4976 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4977 * NI_RETCODE_ERROR_MEM_ALOC
4978 ******************************************************************************/
4979LIB_API ni_retcode_t ni_query_temperature(ni_device_handle_t device_handle,
4980 ni_device_temp_t *p_dev_temp,
4981 uint8_t fw_rev[]);
4982
4983/*!*****************************************************************************
4984 * \brief Query Extra Info from device
4985 *
4986 * \param[in] device_handle Device handle obtained by calling ni_device_open()
4987 * \param[in] p_dev_extra_info Pointer to device extra info
4988 * \param[in] fw_rev[] Fw version to check if this function is supported
4989 *
4990 * \return On success
4991 * NI_RETCODE_SUCCESS
4992 * On failure
4993 * NI_RETCODE_INVALID_PARAM
4994 * NI_RETCODE_ERROR_NVME_CMD_FAILED
4995 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
4996 * NI_RETCODE_ERROR_MEM_ALOC
4997 ******************************************************************************/
4998LIB_API ni_retcode_t ni_query_extra_info(ni_device_handle_t device_handle,
4999 ni_device_extra_info_t *p_dev_extra_info,
5000 uint8_t fw_rev[]);
5001
5002/*!*****************************************************************************
5003 * \brief Query QoS information for the device
5004 *
5005 * \param[in] device_handle Device handle for the target namespace
5006 * \param[out] p_dev_qos_header Pointer to namespace QoS header info structure
5007 * \param[in] fw_rev[] Firmware version array
5008 *
5009 * \return On success
5010 * NI_RETCODE_SUCCESS
5011 * On failure
5012 * NI_RETCODE_INVALID_PARAM
5013 * NI_RETCODE_ERROR_NVME_CMD_FAILED
5014 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
5015 * NI_RETCODE_ERROR_MEM_ALOC
5016*******************************************************************************/
5017LIB_API ni_retcode_t ni_query_qos_info(ni_device_handle_t device_handle,
5018 ni_qos_header_info_log_page_t *p_dev_qos_header,
5019 uint8_t fw_rev[]);
5020
5021/*!*****************************************************************************
5022 * \brief Query QoS information for a specific namespace
5023 *
5024 * \param[in] device_handle Device handle for the target namespace
5025 * \param[out] p_dev_qos_ns Pointer to namespace QoS namespace info structure
5026 * \param[in] fw_rev[] Firmware version array
5027 *
5028 * \return On success
5029 * NI_RETCODE_SUCCESS
5030 * On failure
5031 * NI_RETCODE_INVALID_PARAM
5032 * NI_RETCODE_ERROR_NVME_CMD_FAILED
5033 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
5034 * NI_RETCODE_ERROR_MEM_ALOC
5035*******************************************************************************/
5036LIB_API ni_retcode_t ni_query_qos_namespace_info(ni_device_handle_t device_handle,
5038 uint8_t fw_rev[]);
5039
5040/*!*****************************************************************************
5041 * \brief Check if incoming frame is encoder zero copy compatible or not
5042 *
5043 * \param[in] p_enc_ctx pointer to encoder context
5044 * \param[in] p_enc_params pointer to encoder parameters
5045 * \param[in] width input width
5046 * \param[in] height input height
5047 * \param[in] linesize input linesizes (pointer to array)
5048 * \param[in] set_linesize setup linesizes 0 means not setup linesizes, 1 means setup linesizes (before encoder open)
5049 *
5050 * \return on success and can do zero copy
5051 * NI_RETCODE_SUCCESS
5052 *
5053 * cannot do zero copy
5054 * NI_RETCODE_ERROR_UNSUPPORTED_FEATURE
5055 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
5056 * NI_RETCODE_INVALID_PARAM
5057 *
5058*******************************************************************************/
5060 ni_xcoder_params_t *p_enc_params,
5061 int width, int height,
5062 const int linesize[],
5063 bool set_linesize);
5064
5065/*!*****************************************************************************
5066 * \brief Check if the frame data transferred is within a frame boundary and
5067 * adjust with offset if it doesn't. EP will re-adjust the data pointer
5068 * to the correct start address.
5069 *
5070 * \param[in] p_enc_ctx pointer to encoder context
5071 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
5072 * \param[in] video_height Height of the video frame
5073 * \param[in] linesize Picture line size after filtering (i.e. cropping)
5074 * \param[in] data Picture data pointers after filtering (for each of YUV planes)
5075 * \param[in] buf_size0 Y frame size before any filtering (original size)
5076 * \param[in] buf_size1 U frame size before any filtering (original)
5077 * \param[in] buf_size2 V frame size before any filtering (original)
5078 * \param[in] buf_data0 Y picture data pointer before any filtering (original)
5079 * \param[in] buf_data1 U picture data pointer before any filtering (original)
5080 * \param[in] buf_data2 V picture data pointer before any filtering (original)
5081 *
5082 * \return On success
5083 * NI_RETCODE_SUCCESS
5084 * On failure
5085 * NI_RETCODE_INVALID_PARAM
5086 *****************************************************************************/
5088 ni_frame_t *p_frame, int video_height,
5089 const int linesize[], const uint8_t *data[],
5090 int buf_size0, int buf_size1, int buf_size2,
5091 uint8_t *buf_data0, uint8_t *buf_data1, uint8_t *buf_data2);
5092
5093/*!*****************************************************************************
5094 * \brief Allocate memory for encoder zero copy (metadata, etc.)
5095 * for encoding based on given
5096 * parameters, taking into account pic linesize and extra data.
5097 * Applicable to YUV planr / semi-planar 8 or 10 bit and RGBA pixel formats.
5098 *
5099 *
5100 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
5101 * \param[in] video_width Width of the video frame
5102 * \param[in] video_height Height of the video frame
5103 * \param[in] linesize Picture line size
5104 * \param[in] data Picture data pointers (for each of YUV planes)
5105 * \param[in] extra_len Extra data size (incl. meta data)
5106 *
5107 * \return On success
5108 * NI_RETCODE_SUCCESS
5109 * On failure
5110 * NI_RETCODE_INVALID_PARAM
5111 * NI_RETCODE_ERROR_MEM_ALOC
5112 *****************************************************************************/
5114 int video_width, int video_height,
5115 const int linesize[], const uint8_t *data[],
5116 int extra_len);
5117
5118/*!*****************************************************************************
5119 * \brief Check if incoming frame is hwupload zero copy compatible or not
5120 *
5121 * \param[in] p_upl_ctx pointer to uploader context
5122 * \param[in] width input width
5123 * \param[in] height input height
5124 * \param[in] linesize input linesizes (pointer to array)
5125 * \param[in] pixel_format input pixel format
5126 *
5127 * \return on success and can do zero copy
5128 * NI_RETCODE_SUCCESS
5129 *
5130 * cannot do zero copy
5131 * NI_RETCODE_ERROR_UNSUPPORTED_FEATURE
5132 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
5133 * NI_RETCODE_INVALID_PARAM
5134 *
5135*******************************************************************************/
5137 int width, int height,
5138 const int linesize[], int pixel_format);
5139
5140/*!*****************************************************************************
5141 * \brief Allocate log buffer if needed and retrieve firmware logs from device
5142 *
5143 * \param[in] p_ctx Pointer to a caller allocated
5144 * ni_session_context_t struct
5145 * \param[in] p_log_buffer Reference to pointer to a log buffer
5146 * If log buffer pointer is NULL, this function will allocate log buffer
5147 * NOTE caller is responsible for freeing log buffer after calling this function
5148 * \param[in] gen_log_file Indicating whether it is required to generate log files
5149 *
5150 *
5151 * \return on success
5152 * NI_RETCODE_SUCCESS
5153 *
5154 * on failure
5155 * NI_RETCODE_ERROR_MEM_ALOC
5156 * NI_RETCODE_INVALID_PARAM
5157*******************************************************************************/
5158LIB_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);
5160
5161/*!*****************************************************************************
5162 * \brief Set up hard coded demo ROI map
5163 *
5164 * \param[in] p_enc_ctx Pointer to a caller allocated
5165 *
5166 * \return on success
5167 * NI_RETCODE_SUCCESS
5168 *
5169 * on failure
5170 * NI_RETCODE_ERROR_MEM_ALOC
5171*******************************************************************************/
5173
5174/*!*****************************************************************************
5175 * \brief Convert various reconfig and demo modes (stored in encoder configuration) to
5176 * aux data and store them in frame
5177 *
5178 * \param[in] p_enc_ctx Pointer to a caller allocated
5179 * ni_session_context_t struct
5180 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
5181 *
5182 *
5183 * \return on success
5184 * NI_RETCODE_SUCCESS
5185 *
5186 * on failure
5187 * NI_RETCODE_ERROR_MEM_ALOC
5188*******************************************************************************/
5190 ni_frame_t *p_frame);
5191
5192/*!*****************************************************************************
5193 * \brief Set custom gop and prepare to check if success
5194 *
5195 * \param[in] p_param Pointer to a caller allocated ni_xcoder_params_t struct
5196 * \param[in] value Pointer to a caller allocated custom gop name
5197 *
5198 * \return none
5199 *
5200*******************************************************************************/
5201LIB_API void ni_gop_params_check_set(ni_xcoder_params_t *p_param, char *value);
5202
5203/*!*****************************************************************************
5204 * \brief Check custom gop params set.
5205 *
5206 * \param[in] p_param Pointer to a caller allocated ni_xcoder_params_t struct
5207 *
5208 *
5209 * \return on success
5210 * true
5211 *
5212 * on failure
5213 * false
5214*******************************************************************************/
5216
5217#ifndef DEPRECATION_AS_ERROR
5218/*!*****************************************************************************
5219 * \brief Initiate P2P transfer (P2P write) (deprecated)
5220 *
5221 * \param[in] pSession Pointer to source card destination
5222 * \param[in] source Pointer to source frame to transmit
5223 * \param[in] ui64DestAddr Destination address on target device
5224 * \param[in] ui32FrameSize Size of frame to transfer
5225 *
5226 * \return always returns
5227 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
5228*******************************************************************************/
5230 niFrameSurface1_t *source,
5231 uint64_t ui64DestAddr,
5232 uint32_t ui32FrameSize);
5233#endif
5234
5235#ifndef DEPRECATION_AS_ERROR
5236/*!*****************************************************************************
5237 * \brief Initiate P2P transfer to another device (P2P write)
5238 *
5239 * \param[in] pSession Pointer to source card destination
5240 * \param[in] source Pointer to source frame to transmit
5241 * \param[in] ui64DestAddr Destination address on target device
5242 * \param[in] ui32FrameSize Size of frame to transfer
5243 *
5244 * \return on success
5245 * NI_RETCODE_SUCCESS
5246 * on failure
5247 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
5248 * NI_RETCODE_INVALID_PARAM
5249 * NI_RETCODE_ERROR_INVALID_SESSION
5250 * NI_RETCODE_ERROR_MEM_ALOC
5251 * NI_RETCODE_ERROR_NVME_CMD_FAILED
5252*******************************************************************************/
5254 niFrameSurface1_t *source,
5255 uint64_t ui64DestAddr,
5256 uint32_t ui32FrameSize);
5257#endif
5258
5259/*!*****************************************************************************
5260 * \brief Initiate P2P transfer to another device (P2P write) with sgl list
5261 *
5262 * \param[in] pSession Pointer to source card upload session
5263 * \param[in] pSrcFrame Pointer to source P2P frame
5264 * \param[in] dmaAddrs Pointer to destination DMA addresses - sgl_list
5265 *
5266 * \return on success
5267 * NI_RETCODE_SUCCESS
5268 * on failure
5269 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
5270 * NI_RETCODE_INVALID_PARAM
5271 * NI_RETCODE_ERROR_INVALID_SESSION
5272 * NI_RETCODE_ERROR_MEM_ALOC
5273 * NI_RETCODE_ERROR_NVME_CMD_FAILED
5274*******************************************************************************/
5276 ni_frame_t *pSrcFrame,
5277 const ni_p2p_sgl_t *dmaAddrs);
5278
5279/*!*****************************************************************************
5280 * \brief Calculate the total size of a frame based on the upload
5281 * context attributes and includes rounding up to the page size
5282 *
5283 * \param[in] p_upl_ctx pointer to an uploader session context
5284 * \param[in] linesize array of line stride
5285 *
5286 * \return size
5287 * NI_RETCODE_INVALID_PARAM
5288 *
5289 ******************************************************************************/
5291 const int linesize[]);
5292
5293
5294/*!*****************************************************************************
5295 * \brief Initiate a P2P transfer (P2P read)
5296 *
5297 * \param[in] pSession Pointer to destination upload session
5298 * \param[in] dmaAddrs Pointer to source DMA addresses
5299 * \param[in] pDstFrame Pointer to destination P2P frame
5300 *
5301 * \return on success
5302 * NI_RETCODE_SUCCESS
5303 * on failure
5304 * NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
5305 * NI_RETCODE_INVALID_PARAM
5306 * NI_RETCODE_ERROR_INVALID_SESSION
5307 * NI_RETCODE_ERROR_MEM_ALOC
5308 * NI_RETCODE_ERROR_NVME_CMD_FAILED
5309*******************************************************************************/
5311 const ni_p2p_sgl_t *dmaAddrs,
5312 ni_frame_t *pDstFrame);
5313
5314/*!*****************************************************************************
5315 * \brief Send a restart command after flush command
5316 * Only support Encoder now
5317 *
5318 * \param[in] p_ctx Pointer to a caller allocated
5319 * ni_session_context_t struct
5320 * \param[in] width width, in pixels
5321 * \param[in] height height, in pixels
5322 * \param[in] device_type NI_DEVICE_TYPE_ENCODER
5323 * \return On success
5324 * NI_RETCODE_SUCCESS
5325 * On failure
5326 * NI_RETCODE_INVALID_PARAM
5327 * NI_RETCODE_ERROR_NVME_CMD_FAILED
5328 * NI_RETCODE_ERROR_INVALID_SESSION
5329 ******************************************************************************/
5331 int video_width,
5332 int video_height,
5333 ni_device_type_t device_type);
5334
5335/*!******************************************************************************
5336* \brief Send a p_config command to reconfigure decoding ppu params.
5337*
5338* \param ni_session_context_t p_session_ctx - xcoder Context
5339* \param ni_xcoder_params_t p_param - xcoder Params
5340* \param ni_ppu_config_t p_ppu_config - Struct ni_ppu_config
5341*
5342* \return - NI_RETCODE_SUCCESS on success, NI_RETCODE_ERROR_INVALID_SESSION, NI_RETCODE_ERROR_NVME_CMD_FAILED on failure
5343*******************************************************************************/
5345 ni_xcoder_params_t *p_param,
5346 ni_ppu_config_t *p_ppu_config);
5347/*!*****************************************************************************
5348 * \brief Replace the kernel coefficient callback.
5349 *
5350 * \param ni_session_context_t p_session_ctx - xcoder Context
5351 * \param ni_kernel_coeff_fn fn - ni_kernel_coeff_fn
5352 * Thread-safety: must be called before any concurrent use of
5353 * ni_scaler_build_kernel().
5354 *
5355 * \param[in] fn New callback, or NULL to restore ni_bicubic_coeff_default.
5356 *
5357 * \return - NI_RETCODE_SUCCESS on success, NI_RETCODE_INVALID_PARAM on failure
5358 ******************************************************************************/
5361
5362/*!******************************************************************************
5363* \brief Build scaler kernal array.
5364*
5365* \param ni_session_context_t p_session_ctx - xcoder Context
5366* \param uint16_t kernel_array - fw kernel array[17 * 9]
5367* \param int kernel_taps - kernel_taps
5368* \param double param_b - param_b
5369* \param double param_c - param_c
5370* \param int SrcSize - input frame size(x/y)
5371* \param int DstSize - output frame size(x/y)
5372*
5373* \return - NI_RETCODE_SUCCESS on success
5374*******************************************************************************/
5376 uint16_t kernel_array[], int kernel_taps, double param_b,
5377 double param_c, int SrcSize, int DstSize);
5378
5379#ifdef __cplusplus
5380}
5381#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:447
#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 Extra Info 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_LTR_INVALID_REF
@ 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_LTR_INVALID_REF_API
@ XCODER_TEST_RECONF_OFF
ni_qos_modes
@ QOS_MODE_DISABLED
@ QOS_MODE_ENABLED_SHARE
@ QOS_MODE_ENABLED_NO_SHARE
struct _ni_aux_data ni_aux_data_t
_ni_frame_pool_type
Frame pool type.
@ NI_POOL_TYPE_NONE
@ NI_POOL_TYPE_NORMAL
@ NI_POOL_TYPE_P2P
struct _ni_buf_pool_t ni_buf_pool_t
union _ni_enc_avc_roi_custom_map ni_enc_avc_roi_custom_map_t
encoder AVC ROI custom map (1 MB = 8bits)
#define NI_BITRATE_RECONFIG_FILE_MAX_LINES
Max number of lines supported for the bitrate reconfig file.
_ni_custom_sei_location
This is an enumeration for illustrating the custom SEI locations.
@ NI_CUSTOM_SEI_LOC_AFTER_VCL
@ NI_CUSTOM_SEI_LOC_BEFORE_VCL
struct _ni_bitsream_features ni_bitstream_features_t
struct _ni_split_context_t ni_split_context_t
LIB_API ni_retcode_t ni_device_session_sequence_change(ni_session_context_t *p_ctx, int width, int height, int bit_depth_factor, ni_device_type_t device_type)
Send sequence change information to device.
LIB_API ni_retcode_t ni_uploader_frame_buffer_lock(ni_session_context_t *p_upl_ctx, ni_frame_t *p_frame)
Lock a hardware P2P frame prior to encoding.
struct _ni_frame_config ni_frame_config_t
#define NI_XCODER_LOG_NAMES_ARRAY_LEN
LIB_API const char *const g_xcoder_preset_names[NI_XCODER_PRESET_NAMES_ARRAY_LEN]
LIB_API ni_retcode_t ni_encoder_frame_buffer_alloc(ni_frame_t *pframe, int video_width, int video_height, int linesize[], int alignment, int extra_len, bool alignment_2pass_wa)
Allocate memory for the frame buffer for encoding based on given parameters, taking into account pic ...
#define NI_CC_SEI_TRAILER_LEN
LIB_API ni_retcode_t ni_scaler_input_frame_alloc(ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params, niFrameSurface1_t *p_src_surface)
allocate device input frame by hw descriptor. This call won't actually allocate a frame but sends the...
struct _ni_framerate ni_framerate_t
ni_quadra_frame_type
@ NI_QUADRA_PREDICTED_FRAME
@ NI_QUADRA_PIC_TYPE_IDR
@ NI_QUADRA_BIDIR_PREDICTED_FRAME
@ NI_QUADRA_INTRA_FRAME
LIB_API ni_retcode_t ni_device_config_qos_op(ni_device_handle_t device_handle, ni_device_handle_t device_handle_t, uint32_t over_provision)
Send qos over provisioning mode to target namespace with specified logic block address.
struct _ni_custom_sei ni_custom_sei_t
custom sei payload passthrough
LIB_API void ni_decoder_frame_buffer_pool_return_buf(ni_buf_t *buf, ni_buf_pool_t *p_buffer_pool)
Return a memory buffer to memory buffer pool, for a decoder frame.
LIB_API int ni_device_session_read(ni_session_context_t *p_ctx, ni_session_data_io_t *p_data, ni_device_type_t device_type)
Read data from the device If device_type is NI_DEVICE_TYPE_DECODER reads data frame from decoder If d...
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
float(* ni_kernel_coeff_fn)(int filtersize, double offset, double B, double C)
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
#define NI_HDR10P_SEI_HDR_AV1_LEN
LIB_API NI_DEPRECATED ni_retcode_t ni_device_capability_query(ni_device_handle_t device_handle, ni_device_capability_t *p_cap)
Query device and return device capability structure This function had been replaced by ni_device_capa...
LIB_API ni_retcode_t ni_device_multi_config_frame(ni_session_context_t *p_ctx, ni_frame_config_t p_cfg_in[], int numInCfgs, ni_frame_config_t *p_cfg_out)
Config multiple frame on the device for 2D engined to work on based on provided parameters.
LIB_API ni_aux_data_t * ni_frame_new_aux_data(ni_frame_t *frame, ni_aux_data_type_t type, int data_size)
Add a new auxiliary data to a frame.
ni_h265_sei_user_data_type_t
@ NI_H265_USERDATA_FLAG_RESERVED_3
@ NI_H265_USERDATA_FLAG_UNREGISTERED_PRE
@ NI_H265_USERDATA_FLAG_ITU_T_T35_PRE
@ NI_H265_USERDATA_FLAG_ITU_T_T35_PRE_1
@ NI_H265_USERDATA_FLAG_ITU_T_T35_SUF
@ NI_H265_USERDATA_FLAG_RESERVED_1
@ NI_H265_USERDATA_FLAG_VUI
@ NI_H265_USERDATA_FLAG_ITU_T_T35_PRE_2
@ NI_H265_USERDATA_FLAG_RESERVED_9
@ NI_H265_USERDATA_FLAG_TONE_MAPPING_INFO
@ NI_H265_USERDATA_FLAG_PIC_TIMING
@ NI_H265_USERDATA_FLAG_RESERVED_0
@ NI_H265_USERDATA_FLAG_MASTERING_COLOR_VOL
@ NI_H265_USERDATA_FLAG_CHROMA_RESAMPLING_FILTER_HINT
@ NI_H265_USER_DATA_FLAG_COLOUR_REMAPPING_INFO
@ NI_H265_USERDATA_FLAG_ITU_T_T35_SUF_2
@ NI_H265_USER_DATA_FLAG_CONTENT_LIGHT_LEVEL_INFO
@ NI_H265_USERDATA_FLAG_ITU_T_T35_SUF_1
@ NI_H265_USERDATA_FLAG_KNEE_FUNCTION_INFO
@ NI_H265_USER_DATA_FLAG_FILM_GRAIN_CHARACTERISTICS_INFO
@ NI_H265_USERDATA_FLAG_UNREGISTERED_SUF
LIB_API ni_retcode_t ni_reconfig_min_max_qp(ni_session_context_t *p_ctx, ni_rc_min_max_qp *p_min_max_qp)
Reconfigure min&max qp dynamically during encoding.
LIB_API ni_retcode_t ni_ai_packet_buffer_alloc(ni_packet_t *p_packet, ni_network_data_t *p_network)
Allocate output layers memory for the packet buffer based on provided network.
LIB_API ni_retcode_t ni_query_qos_namespace_info(ni_device_handle_t device_handle, ni_qos_namespace_info_log_page_t *p_dev_qos_ns, uint8_t fw_rev[])
Query QoS information for a specific namespace.
LIB_API ni_retcode_t ni_p2p_send_v2(ni_session_context_t *pSession, ni_frame_t *pSrcFrame, const ni_p2p_sgl_t *dmaAddrs)
Initiate P2P transfer to another device (P2P write) with sgl list.
LIB_API ni_retcode_t ni_reconfig_intraprd(ni_session_context_t *p_ctx, int32_t intra_period)
Reconfigure intraPeriod dynamically during encoding.
#define NI_ENC_PARAM_CONSTANT_RATE_FACTOR
LIB_API ni_event_handle_t ni_create_event(void)
Create event and return event handle if successful (Windows only)
LIB_API ni_retcode_t ni_hwframe_buffer_recycle2(niFrameSurface1_t *surface)
Recycle a hwframe buffer on card.
struct _ni_network_perf_metrics ni_network_perf_metrics_t
ni_qos_codes
@ QOS_ALLOW_CONFIG_CODE
@ QOS_OP_CONFIG_CODE
@ QOS_ALLOW_CONFIG_REC_ALLOW_CODE
@ QOS_OP_CONFIG_REC_OP_CODE
@ QOS_NAMESPACE_CODE
LIB_API ni_retcode_t ni_reconfig_vbv_value(ni_session_context_t *p_ctx, int32_t vbvMaxRate, int32_t vbvBufferSize)
Reconfigure vbv buffer size and vbv max rate dynamically during encoding.
LIB_API ni_retcode_t ni_frame_buffer_alloc_pixfmt(ni_frame_t *pframe, int pixel_format, int video_width, int video_height, int linesize[], int alignment, int extra_len)
Allocate memory for the frame buffer based on provided parameters taking into account the pixel forma...
LIB_API ni_retcode_t ni_ai_session_read_metrics(ni_session_context_t *p_ctx, ni_network_perf_metrics_t *p_metrics)
Fetch perf metrics of inferences from device.
union _ni_enc_hevc_roi_custom_map ni_enc_hevc_roi_custom_map_t
encoder HEVC ROI custom map (1 CTU = 64bits)
struct _ni_ppu_config ni_ppu_config_t
LIB_API void ni_device_close(ni_device_handle_t dev)
Close device and release resources.
LIB_API ni_retcode_t ni_hwframe_p2p_buffer_recycle(ni_frame_t *p_frame)
Recycle hw P2P frames.
#define NI_HDR10P_SEI_HDR_H264_LEN
LIB_API int32_t ni_get_dma_buf_file_descriptor(const ni_frame_t *p_frame)
Get the DMA buffer file descriptor from the P2P frame.
LIB_API ni_retcode_t ni_ai_config_network_binary(ni_session_context_t *p_ctx, ni_network_data_t *p_network, const char *file)
configure a network context based with the network binary
h264_codec_profile
@ H264_CODEC_PROFILE_EXTENDED
@ H264_CODEC_PROFILE_HIGH
@ H264_CODEC_PROFILE_BASELINE
@ H264_CODEC_PROFILE_MAIN
LIB_API ni_retcode_t ni_hwframe_buffer_recycle(niFrameSurface1_t *surface, int32_t device_handle)
Recycle a hwframe buffer on card.
#define NI_CC_SEI_HDR_AV1_LEN
LIB_API ni_retcode_t ni_force_idr_frame_type(ni_session_context_t *p_ctx)
Force next frame to be IDR frame during encoding.
LIB_API ni_retcode_t ni_uploader_frame_buffer_unlock(ni_session_context_t *p_upl_ctx, ni_frame_t *p_frame)
Unlock a hardware P2P frame after encoding.
enum _ni_vq_presets_e ni_vq_presets_e
LIB_API int ni_device_session_write(ni_session_context_t *p_ctx, ni_session_data_io_t *p_data, ni_device_type_t device_type)
Send data to the device If device_type is NI_DEVICE_TYPE_DECODER sends data packet to decoder If devi...
LIB_API ni_retcode_t ni_reconfig_crf(ni_session_context_t *p_ctx, int32_t crf)
Reconfigure crf value dynamically during encoding.
struct _ni_vui_hrd ni_vui_hrd_t
struct _ni_session_data_io ni_session_data_io_t
LIB_API ni_retcode_t ni_device_session_update_framepool(ni_session_context_t *p_ctx, uint32_t pool_size)
Sends frame pool change info to device.
LIB_API ni_retcode_t ni_device_capability_query2(ni_device_handle_t device_handle, ni_device_capability_t *p_cap, bool device_in_ctxt)
Query device and return device capability structure This function had replaced ni_device_capability_q...
struct _ni_rc_min_max_qp ni_rc_min_max_qp
LIB_API ni_retcode_t ni_reconfig_slice_arg(ni_session_context_t *p_ctx, int16_t sliceArg)
Reconfigure sliceArg dynamically during encoding.
LIB_API ni_retcode_t ni_device_alloc_and_get_firmware_logs(ni_session_context_t *p_ctx, void **p_log_buffer, bool gen_log_file)
Allocate log buffer if needed and retrieve firmware logs from device.
LIB_API ni_retcode_t ni_decoder_frame_buffer_alloc(ni_buf_pool_t *p_pool, ni_frame_t *pframe, int alloc_mem, int video_width, int video_height, int alignment, int factor, int is_planar)
Allocate memory for decoder frame buffer based on provided parameters; the memory is retrieved from a...
LIB_API bool ni_gop_params_check(ni_xcoder_params_t *p_param)
Check custom gop params set.
LIB_API ni_retcode_t ni_encoder_gop_params_set_value(ni_xcoder_params_t *p_params, const char *name, const char *value)
Set GOP parameter value referenced by name in encoder parameters structure.
LIB_API ni_retcode_t ni_scaler_p2p_frame_acquire(ni_session_context_t *p_ctx, niFrameSurface1_t *p_surface, int data_len)
Acquire the scaler P2P DMA buffer for read/write.
LIB_API ni_retcode_t ni_frame_buffer_alloc_hwenc(ni_frame_t *pframe, int video_width, int video_height, int extra_len)
Allocate memory for the hwDescriptor buffer based on provided parameters taking into account pic size...
LIB_API ni_retcode_t ni_decoder_init_default_params(ni_xcoder_params_t *p_param, int fps_num, int fps_denom, long bit_rate, int width, int height)
Initialize default decoder parameters.
enum _ni_custom_sei_location ni_custom_sei_location_t
This is an enumeration for illustrating the custom SEI locations.
LIB_API ni_retcode_t ni_device_clone_hwframe(ni_session_context_t *p_ctx, ni_frameclone_desc_t *p_frameclone_desc)
Copy the data of src hwframe to dst hwframe.
#define NI_CUSTOMIZE_ROI_QPOFFSET_LEVEL
Max number of lines supported for qpoffset level.
enum _ni_frame_aux_data_type ni_aux_data_type_t
struct _ni_gop_rps ni_gop_rps_t
hevc_codec_profile
@ HEVC_CODEC_PROFILE_MAIN10
@ HEVC_CODEC_PROFILE_MAIN
struct _ni_scaler_multi_watermark_params_t ni_scaler_multi_watermark_params_t
LIB_API ni_retcode_t ni_scaler_set_params(ni_session_context_t *p_ctx, ni_scaler_params_t *p_params)
Set parameters on the device for the 2D engine.
enum _ni_ai_buffer_format_e ni_ai_buffer_format_e
video_codec_identifier
@ VODEO_CODEC_ID_HEVC
@ VODEO_CODEC_ID_H264
@ VODEO_CODEC_ID_AV1
@ VODEO_CODEC_ID_VP9
LIB_API NI_DEPRECATED ni_retcode_t ni_p2p_send(ni_session_context_t *pSession, niFrameSurface1_t *source, uint64_t ui64DestAddr, uint32_t ui32FrameSize)
Initiate P2P transfer to another device (P2P write)
enum _ni_codec_format ni_codec_format_t
This is an enumeration for supported codec formats.
struct _ni_scaler_params_t ni_scaler_params_t
LIB_API int ni_packet_copy(void *p_destination, const void *const p_source, int cur_size, void *p_leftover, int *p_prev_size)
Copy video packet accounting for alignment.
struct _ni_overall_load_query ni_overall_load_query_t
LIB_API ni_retcode_t ni_device_session_context_init(ni_session_context_t *p_ctx)
Initialize already allocated session context to a known state.
#define NI_ENC_PARAM_MAX_FRAME_SIZE_LOW_DELAY
LIB_API ni_retcode_t ni_device_session_query_detail_v1(ni_session_context_t *p_ctx, ni_device_type_t device_type, ni_instance_mgr_detail_status_v1_t *detail_data)
Query detail session data from the device - If device_type is valid, will query session data from spe...
LIB_API ni_retcode_t ni_set_ltr(ni_session_context_t *p_ctx, ni_long_term_ref_t *ltr)
Set a frame's support of Long Term Reference frame during encoding.
ni_quadra_av1_profile
@ NI_QUADRA_AV1_PROFILE_MAIN
struct _ni_frame ni_frame_t
LIB_API void ni_frame_wipe_aux_data(ni_frame_t *frame)
Free and remove all auxiliary data from the frame.
LIB_API ni_retcode_t ni_device_alloc_dst_frame(ni_session_context_t *p_ctx, niFrameSurface1_t *p_out_surface, ni_device_type_t device_type)
Allocate a frame on the device and return the frame index.
_ni_ddr_priority_mode_t
@ NI_DDR_PRIORITY_AI
@ NI_DDR_PRIORITY_FILT
@ NI_DDR_PRIORITY_DECENC
@ NI_DDR_PRIORITY_NONE
@ NI_DDR_PRIORITY_RESET
@ NI_DDR_PRIORITY_MAX
LIB_API void ni_device_session_context_free(ni_session_context_t *p_ctx)
Free previously allocated session context.
LIB_API ni_retcode_t ni_frame_buffer_alloc(ni_frame_t *p_frame, int video_width, int video_height, int alignment, int metadata_flag, int factor, int hw_frame_count, int is_planar)
Allocate preliminary memory for the frame buffer based on provided parameters. Applicable to YUV420 P...
struct _ni_input_frame ni_input_frame
LIB_API ni_retcode_t ni_uploader_p2p_test_load(ni_session_context_t *p_upl_ctx, uint8_t *p_data, uint32_t len, ni_frame_t *p_hwframe)
Special P2P test API function. Copies video data from the software frame to the hardware P2P frame on...
#define MAX_CHAR_IN_DEVICE_NAME
struct _ni_timestamp_table_t ni_timestamp_table_t
LIB_API ni_retcode_t ni_kernel_set_callback(ni_session_context_t *p_session_ctx, ni_kernel_coeff_fn fn)
Replace the kernel coefficient callback.
LIB_API NI_DEPRECATED ni_retcode_t ni_p2p_xfer(ni_session_context_t *pSession, niFrameSurface1_t *source, uint64_t ui64DestAddr, uint32_t ui32FrameSize)
Initiate P2P transfer (P2P write) (deprecated)
LIB_API ni_retcode_t ni_device_session_restart(ni_session_context_t *p_ctx, int video_width, int video_height, ni_device_type_t device_type)
Send a restart command after flush command Only support Encoder now.
#define NI_MAX_SUPPORT_DRAWBOX_NUM
LIB_API ni_retcode_t ni_encoder_sw_frame_buffer_alloc(bool planar, ni_frame_t *p_frame, int video_width, int video_height, int linesize[], int alignment, int extra_len, bool alignment_2pass_wa)
This API is a wrapper for ni_encoder_frame_buffer_alloc(), used for planar pixel formats,...
struct _ni_network_data ni_network_data_t
LIB_API ni_retcode_t ni_set_demo_roi_map(ni_session_context_t *p_enc_ctx)
Set up hard coded demo ROI map.
LIB_API ni_retcode_t ni_device_session_copy(ni_session_context_t *src_p_ctx, ni_session_context_t *dst_p_ctx)
Copy existing decoding session params for hw frame usage.
LIB_API ni_retcode_t ni_query_fl_fw_versions(ni_device_handle_t device_handle, ni_device_info_t *p_dev_info)
Query firmware loader and firmware versions from the device.
struct _ni_custom_sei_set ni_custom_sei_set_t
#define NI_MAX_SPATIAL_LAYERS
LIB_API int ni_device_session_acquire(ni_session_context_t *p_upl_ctx, ni_frame_t *p_frame)
Acquire a P2P frame buffer from the hwupload session.
#define NI_HDR10P_SEI_HDR_HEVC_LEN
#define NI_NAMESPACE_MAX_NUM
LIB_API ni_retcode_t ni_device_dec_session_flush(ni_session_context_t *p_ctx)
Flush a decoder session to get ready to continue decoding. Note: this is different from ni_device_ses...
LIB_API ni_retcode_t ni_query_vf_ns_id(ni_device_handle_t device_handle, ni_device_vf_ns_id_t *p_dev_ns_vf, uint8_t fw_rev[])
Query VF and NS id from device.
ni_codec_hw_actions
This is an enumeration for hw actions.
@ NI_CODEC_HW_UPLOAD
@ NI_CODEC_HW_NONE
@ NI_CODEC_HW_DOWNLOAD
@ NI_CODEC_HW_ENABLE
@ NI_CODEC_HW_PAYLOAD_OFFSET
@ NI_CODEC_HW_RSVD
_ni_codec_format
This is an enumeration for supported codec formats.
@ NI_CODEC_FORMAT_H265
@ NI_CODEC_FORMAT_AV1
@ NI_CODEC_FORMAT_H264
@ NI_CODEC_FORMAT_JPEG
@ NI_CODEC_FORMAT_VP9
LIB_API ni_retcode_t ni_device_session_open(ni_session_context_t *p_ctx, ni_device_type_t device_type)
Open a new device session depending on the device_type parameter If device_type is NI_DEVICE_TYPE_DEC...
ni_pix_fmt_t
@ NI_PIX_FMT_ARGB
@ NI_PIX_FMT_P010LE
@ NI_PIX_FMT_YUV420P
@ NI_PIX_FMT_ABGR
@ NI_PIX_FMT_NONE
@ NI_PIX_FMT_10_TILED4X4
@ NI_PIX_FMT_BGRP
@ NI_PIX_FMT_BGR0
@ NI_PIX_FMT_YUYV422
@ NI_PIX_FMT_RGBA
@ NI_PIX_FMT_NV12
@ NI_PIX_FMT_8_TILED4X4
@ NI_PIX_FMT_BGRA
@ NI_PIX_FMT_NV16
@ NI_PIX_FMT_UYVY422
@ NI_PIX_FMT_YUV420P10LE
LIB_API ni_retcode_t ni_device_config_qos_allowance(ni_device_handle_t device_handle, ni_device_handle_t device_handle_t, uint32_t allowance)
Set QoS allowance for a specific namespace.
enum _ni_reconfig ni_reconfig_t
This is an enumeration for encoder reconfiguration test settings.
LIB_API ni_retcode_t ni_reconfig_framerate(ni_session_context_t *p_ctx, ni_framerate_t *framerate)
Reconfigure framerate dynamically during encoding.
struct _ni_scaler_drawbox_params_t ni_scaler_drawbox_params_t
LIB_API int ni_device_session_init_framepool(ni_session_context_t *p_ctx, uint32_t pool_size, uint32_t pool)
Send frame pool setup info to device.
struct _ni_extended_dec_metadata ni_extended_dec_metadata_t
_ni_ai_buffer_format_e
@ NI_AI_BUFFER_FORMAT_INT8
@ NI_AI_BUFFER_FORMAT_FP64
@ NI_AI_BUFFER_FORMAT_FP32
@ NI_AI_BUFFER_FORMAT_CHAR
@ NI_AI_BUFFER_FORMAT_UINT16
@ NI_AI_BUFFER_FORMAT_UINT8
@ NI_AI_BUFFER_FORMAT_BFP16
@ NI_AI_BUFFER_FORMAT_FP16
@ NI_AI_BUFFER_FORMAT_INT64
@ NI_AI_BUFFER_FORMAT_UINT32
@ NI_AI_BUFFER_FORMAT_INT32
@ NI_AI_BUFFER_FORMAT_INT16
@ NI_AI_BUFFER_FORMAT_UINT64
struct _ni_rational ni_rational_t
#define NI_ENC_PARAM_GEN_HDRS
LIB_API ni_retcode_t ni_frame_buffer_alloc_nv(ni_frame_t *p_frame, int video_width, int video_height, int linesize[], int extra_len, bool alignment_2pass_wa)
Allocate memory for the frame buffer based on provided parameters taking into account pic line size a...
LIB_API ni_retcode_t ni_packet_buffer_alloc(ni_packet_t *ppacket, int packet_size)
Allocate memory for the packet buffer based on provided packet size.
struct _ni_dec_mastering_display_colour_volume_bytes ni_dec_mastering_display_colour_volume_bytes_t
decoded payload format of HDR SEI mastering display colour volume
LIB_API ni_retcode_t ni_frame_buffer_free(ni_frame_t *pframe)
Free frame buffer that was previously allocated with either ni_frame_buffer_alloc or ni_encoder_frame...
#define NI_MAX_SUPPORT_WATERMARK_NUM
struct _ni_queue_t ni_queue_t
enum ni_codec_hw_actions ni_codec_hw_actions_t
This is an enumeration for hw actions.
#define NI_BITRATE_RECONFIG_FILE_MAX_ENTRIES_PER_LINE
ni_pic_type_t
@ PIC_TYPE_B
@ PIC_TYPE_NIDR
@ PIC_TYPE_IDR
@ DECODER_PIC_TYPE_IDR
@ PIC_TYPE_P
@ PIC_NOT_CODED
@ PIC_TYPE_MAX
@ PIC_TYPE_CRA
@ PIC_TYPE_I
LIB_API ni_retcode_t ni_decoder_frame_buffer_free(ni_frame_t *pframe)
Free decoder frame buffer that was previously allocated with ni_decoder_frame_buffer_alloc,...
struct _ni_network_layer_info ni_network_layer_info_t
struct _ni_pkt_info ni_pkt_info
itu_frame_type
@ ITU_FRAME_TYPE_NONE
@ ITU_FRAME_TYPE_B
@ ITU_FRAME_TYPE_P
@ ITU_FRAME_TYPE_I
struct _ni_sei_header ni_sei_header_t
LIB_API ni_retcode_t ni_reconfig_crf2(ni_session_context_t *p_ctx, float crf)
Reconfigure crf float point value dynamically during encoding.
LIB_API ni_retcode_t ni_device_session_flush(ni_session_context_t *p_ctx, ni_device_type_t device_type)
Send a flush command to the device If device_type is NI_DEVICE_TYPE_DECODER sends EOS command to deco...
LIB_API ni_device_handle_t ni_device_open2(const char *dev, ni_device_mode_t mode)
Open device and return device device_handle if successful.
LIB_API ni_retcode_t ni_scaler_build_kernel(ni_session_context_t *p_session_ctx, uint16_t kernel_array[], int kernel_taps, double param_b, double param_c, int SrcSize, int DstSize)
Build scaler kernal array.
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_device_alloc_and_get_fw_log_artifacts(ni_session_context_t *p_ctx, bool gen_artifacts_file)
Read log artifacts from the device and save to disk.
LIB_API ni_retcode_t ni_custom_packet_buffer_alloc(void *p_buffer, ni_packet_t *p_packet, int buffer_size)
Allocate packet buffer using a user provided pointer, the memory is expected to have already been all...
#define NI_MAX_REF_PIC
#define NI_MAX_VUI_SIZE
LIB_API ni_retcode_t ni_uploader_set_frame_format(ni_session_context_t *p_upl_ctx, int width, int height, ni_pix_fmt_t pixel_format, int isP2P)
Set the frame format for the uploader.
LIB_API ni_retcode_t ni_query_temperature(ni_device_handle_t device_handle, ni_device_temp_t *p_dev_temp, uint8_t fw_rev[])
Query CompositeTemp from device.
struct _ni_buf_t ni_buf_t
enum _ni_pixel_planar_format ni_pixel_planar_format
_ni_param_change_flags
This is an enumeration for encoder parameter change.
@ NI_SET_CHANGE_PARAM_INVALID_REF_FRAME
@ NI_SET_CHANGE_PARAM_RC_TARGET_RATE
@ NI_SET_CHANGE_PARAM_RC_FRAMERATE
@ NI_SET_CHANGE_PARAM_CRF
@ NI_SET_CHANGE_PARAM_LTR_INTERVAL
@ NI_SET_CHANGE_PARAM_RC_BIT_RATIO_LAYER
@ NI_SET_CHANGE_PARAM_CUSTOM_LAMBDA
@ NI_SET_CHANGE_PARAM_VBV
@ NI_SET_CHANGE_PARAM_RC2
@ NI_SET_CHANGE_PARAM_VUI_HRD_PARAM
@ NI_SET_CHANGE_PARAM_RC_MIN_MAX_QP
@ NI_SET_CHANGE_PARAM_NR
@ NI_SET_CHANGE_PARAM_DEPEND_SLICE
@ NI_SET_CHANGE_PARAM_SLICE_ARG
@ NI_SET_CHANGE_PARAM_INTRA_PERIOD
@ NI_SET_CHANGE_PARAM_BG
@ NI_SET_CHANGE_PARAM_PPS
@ NI_SET_CHANGE_PARAM_CUSTOM_MD
@ NI_SET_CHANGE_PARAM_MAX_FRAME_SIZE
@ NI_SET_CHANGE_PARAM_RDO
@ NI_SET_CHANGE_PARAM_INDEPEND_SLICE
LIB_API const char *const g_xcoder_log_names[NI_XCODER_LOG_NAMES_ARRAY_LEN]
LIB_API ni_retcode_t ni_reconfig_max_frame_size(ni_session_context_t *p_ctx, int32_t max_frame_size)
Reconfigure maxFrameSize dynamically during encoding.
enum ni_qos_codes ni_qos_codes_t
LIB_API ni_retcode_t ni_dec_reconfig_ppu_params(ni_session_context_t *p_session_ctx, ni_xcoder_params_t *p_param, ni_ppu_config_t *p_ppu_config)
Send a p_config command to reconfigure decoding ppu params.
LIB_API ni_retcode_t ni_uploader_frame_zerocopy_check(ni_session_context_t *p_upl_ctx, int width, int height, const int linesize[], int pixel_format)
Check if incoming frame is hwupload zero copy compatible or not.
ni_quadra_h264_profile
@ NI_QUADRA_H264_PROFILE_BASELINE
@ NI_QUADRA_H264_PROFILE_HIGH
@ NI_QUADRA_H264_PROFILE_MAIN
@ NI_QUADRA_H264_PROFILE_EXTENDED
struct _ni_queue_node_t ni_queue_node_t
struct _ni_xcoder_params ni_xcoder_params_t
LIB_API ni_retcode_t ni_query_qos_info(ni_device_handle_t device_handle, ni_qos_header_info_log_page_t *p_dev_qos_header, uint8_t fw_rev[])
Query QoS information for the device.
struct _ni_instance_mgr_detail_status ni_instance_mgr_detail_status_t
#define NI_CC_SEI_HDR_HEVC_LEN
struct _ni_custom_gop_params ni_custom_gop_params_t
LIB_API ni_aux_data_t * ni_frame_get_aux_data(const ni_frame_t *frame, ni_aux_data_type_t type)
Retrieve from the frame auxiliary data of a given type if exists.
LIB_API ni_retcode_t ni_enc_frame_buffer_alloc(ni_frame_t *p_frame, int video_width, int video_height, int alignment, int metadata_flag, int factor, int hw_frame_count, int is_planar, ni_pix_fmt_t pix_fmt)
Wrapper function for ni_frame_buffer_alloc. Meant to handle RGBA min. resoulution considerations for ...
LIB_API ni_retcode_t ni_device_config_frame(ni_session_context_t *p_ctx, ni_frame_config_t *p_cfg)
Config a frame on the device for 2D engined to work on based on provided parameters.
struct _ni_scaler_watermark_params_t ni_scaler_watermark_params_t
struct _ni_frameclone_desc ni_frameclone_desc_t
struct _ni_dec_win ni_dec_win_t
LIB_API ni_aux_data_t * ni_frame_new_aux_data_from_raw_data(ni_frame_t *frame, ni_aux_data_type_t type, const uint8_t *raw_data, int data_size)
Add a new auxiliary data to a frame and copy in the raw data.
Public definitions for managing NETINT video processing devices.
ni_aux_data_type_t type
ni_pthread_mutex_t mutex
ni_buf_t * p_free_tail
ni_buf_t * p_used_head
ni_buf_t * p_used_tail
uint32_t number_of_buffers
ni_buf_t * p_free_head
struct _ni_buf_t * p_previous_buffer
struct _ni_buf_pool_t * pool
struct _ni_buf_t * p_next
struct _ni_buf_t * p_prev
struct _ni_buf_t * p_next_buffer
payload format of HDR SEI content light level info
ni_gop_params_t pic_param[NI_MAX_GOP_NUM]
ni_custom_sei_t custom_sei[NI_MAX_CUSTOM_SEI_CNT]
custom sei payload passthrough
uint8_t data[NI_MAX_CUSTOM_SEI_DATA]
ni_custom_sei_location_t location
decoded payload format of H.264 VUI
int8_t chroma_sample_loc_type_bottom_field
uint8_t vcl_hrd_parameters_present_flag
uint8_t motion_vectors_over_pic_boundaries_flag
uint8_t aspect_ratio_info_present_flag
int8_t chroma_sample_loc_type_top_field
uint8_t colour_description_present_flag
uint8_t nal_hrd_parameters_present_flag
uint8_t video_signal_type_present_flag
decoded payload format of H.265 VUI
uint8_t vui_poc_proportional_to_timing_flag
uint8_t restricted_ref_pic_lists_flag
int8_t chroma_sample_loc_type_bottom_field
uint8_t motion_vectors_over_pic_boundaries_flag
uint8_t aspect_ratio_info_present_flag
uint8_t vui_hrd_parameters_present_flag
int8_t chroma_sample_loc_type_top_field
uint8_t neutral_chroma_indication_flag
int16_t vui_num_ticks_poc_diff_one_minus1
uint8_t colour_description_present_flag
uint8_t frame_field_info_present_flag
uint8_t video_signal_type_present_flag
decoded payload format of HDR SEI mastering display colour volume
char cr_expr[NI_MAX_NUM_OF_DECODER_OUTPUTS][4][NI_MAX_PPU_PARAM_EXPR_CHAR+1]
int scale_wh[NI_MAX_NUM_OF_DECODER_OUTPUTS][2]
int scale_resolution_ceil[NI_MAX_NUM_OF_DECODER_OUTPUTS]
int semi_planar[NI_MAX_NUM_OF_DECODER_OUTPUTS]
int scale_round[NI_MAX_NUM_OF_DECODER_OUTPUTS]
int scale_long_short_edge[NI_MAX_NUM_OF_DECODER_OUTPUTS]
int force_8_bit[NI_MAX_NUM_OF_DECODER_OUTPUTS]
int crop_mode[NI_MAX_NUM_OF_DECODER_OUTPUTS]
int crop_whxy[NI_MAX_NUM_OF_DECODER_OUTPUTS][4]
char sc_expr[NI_MAX_NUM_OF_DECODER_OUTPUTS][2][NI_MAX_PPU_PARAM_EXPR_CHAR+1]
device capability type
uint8_t xcoder_cnt[NI_DEVICE_TYPE_XCODER_MAX]
ni_hw_capability_t xcoder_devices[NI_MAX_DEVICES_PER_HW_INSTANCE]
uint8_t fw_branch_name[256]
encoded payload format of HDR SEI mastering display colour volume
ni_custom_gop_params_t custom_gop_params
struct _ni_encoder_cfg_params::@16 rc
int spatialLayerBitrate[NI_MAX_SPATIAL_LAYERS]
int av1OpLevel[NI_MAX_SPATIAL_LAYERS]
This is a data structure for encoding parameters that have changed.
uint16_t rectangle_height
uint16_t force_pic_qp
uint8_t color_trc
uint8_t inconsecutive_transfer
uint32_t data_len[NI_MAX_NUM_DATA_POINTERS]
unsigned int sei_hdr_mastering_display_color_vol_offset
uint8_t * p_buffer
uint32_t crop_top
uint32_t error_ratio
uint32_t vui_time_scale
uint32_t start_of_stream
unsigned int sei_hdr_content_light_level_info_offset
uint16_t sar_width
ni_codec_format_t src_codec
uint8_t color_primaries
unsigned int vui_len
ni_iovec_t * iovec
unsigned int reconf_len
uint8_t preferred_characteristics_data_len
long long dts
uint32_t vui_num_units_in_tick
uint32_t start_len[NI_MAX_NUM_DATA_POINTERS]
uint32_t start_buffer_size
uint8_t aspect_ratio_idc
uint32_t end_of_stream
uint16_t sar_height
uint8_t separate_metadata
unsigned int sei_hdr_plus_len
ni_buf_t * dec_buf
uint64_t pkt_pos
uint32_t metadata_buffer_size
uint32_t crop_right
unsigned int vui_offset
uint32_t crop_bottom
uint32_t video_width
unsigned int sei_hdr_plus_offset
uint8_t timecode_present
long long pts
uint8_t * p_data[NI_MAX_NUM_DATA_POINTERS]
uint32_t total_start_len
uint8_t color_space
uint32_t frame_chunk_idx
unsigned int extra_data_len
uint8_t * p_start_buffer
uint32_t buffer_size
unsigned int sei_total_len
uint8_t separate_start
unsigned int sei_cc_len
unsigned int sei_cc_offset
unsigned int sei_user_data_unreg_len
uint32_t crop_left
ni_pic_type_t ni_pict_type
long long orignal_pts
uint16_t force_headers
uint8_t use_cur_src_as_long_term_pic
ni_custom_sei_set_t * p_custom_sei_set
uint16_t hor_adjust_offset
unsigned int sei_hdr_content_light_level_info_len
uint32_t iovec_num
ni_aux_data_t * aux_data[NI_MAX_NUM_AUX_DATA_PER_FRAME]
uint8_t * p_metadata_buffer
unsigned int sei_hdr_mastering_display_color_vol_len
int video_full_range_flag
unsigned int sei_user_data_unreg_offset
uint8_t use_long_term_ref
uint32_t video_height
unsigned int roi_len
unsigned int sei_alt_transfer_characteristics_len
unsigned int sei_alt_transfer_characteristics_offset
int32_t framerate_denom
int32_t framerate_num
ni_gop_rps_t rps[NI_MAX_REF_PIC]
hardware capability type
uint8_t max_number_of_contexts
uint8_t * p_input_buffer
ni_instance_mgr_detail_status_append_t sInstDetailStatusAppend[NI_MAX_CONTEXTS_PER_HW_INSTANCE]
ni_instance_mgr_detail_status_t sInstDetailStatus[NI_MAX_CONTEXTS_PER_HW_INSTANCE]
uint32_t size
uint32_t fw_share_mem_usage
uint32_t total_pixel_load
ni_context_query_t context_status[NI_MAX_CONTEXTS_PER_HW_INSTANCE]
uint32_t fw_model_load
uint32_t fw_p2p_mem_usage
uint32_t fw_video_shared_mem_usage
uint32_t pcie_throughput
uint32_t current_load
uint32_t total_contexts
uint32_t active_hwuploaders
uint32_t fw_video_mem_usage
uint8_t use_cur_src_as_long_term_pic
ni_network_layer_offset_t * inset
ni_network_layer_info_t linfo
ni_network_layer_offset_t * outset
ni_network_layer_params_t * in_param
ni_network_layer_params_t * out_param
union _ni_network_layer_params_t::@13 quant_data
struct _ni_network_layer_params_t::@13::@15 affine
struct _ni_network_layer_params_t::@13::@14 dfp
uint32_t data_len
uint32_t start_of_stream
long long dts
uint32_t av1_data_len[MAX_AV1_ENCODER_GOP_NUM]
uint32_t end_of_stream
uint64_t pkt_pos
uint8_t scene_change_detected
uint32_t video_width
uint8_t still_image_detected
long long pts
ni_bitstream_features_t bitstream_features
uint8_t * av1_p_buffer[MAX_AV1_ENCODER_GOP_NUM]
uint32_t buffer_size
double average_psnr
uint32_t avg_frame_qp
uint32_t frame_type
ni_custom_sei_set_t * p_custom_sei_set
long long pos
uint8_t * av1_p_data[MAX_AV1_ENCODER_GOP_NUM]
uint32_t video_height
uint32_t av1_buffer_size[MAX_AV1_ENCODER_GOP_NUM]
double reserved[1]
uint16_t ppu_h[NI_MAX_NUM_OF_DECODER_OUTPUTS]
uint16_t ppu_w[NI_MAX_NUM_OF_DECODER_OUTPUTS]
ni_queue_node_t * p_used_tail
ni_queue_node_t * p_free_head
ni_queue_node_t * p_used_head
ni_queue_node_t * p_free_tail
struct _ni_queue_node_t * p_previous_buffer
struct _ni_queue_node_t * p_next_buffer
struct _ni_queue_node_t * p_next
struct _ni_queue_node_t * p_prev
ni_queue_node_t * p_last
ni_queue_node_t * p_first
ni_scaler_drawbox_params_t multi_drawbox_params[NI_MAX_SUPPORT_DRAWBOX_NUM]
ni_scaler_watermark_params_t multi_watermark_params[NI_MAX_SUPPORT_WATERMARK_NUM]
uint16_t kernel_array[2][17 *9]
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
uint8_t itu_t_t35_hdr10p_sei_hdr_av1[NI_HDR10P_SEI_HDR_AV1_LEN]
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
uint8_t itu_t_t35_cc_sei_hdr_av1[NI_CC_SEI_HDR_AV1_LEN]
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_kernel_coeff_fn scaler_coeff_fn
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