libxcoder 5.7.0
Loading...
Searching...
No Matches
ni_device_api_priv.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_priv.h
24 *
25 * \brief Private definitions used by ni_device_api.c for video processing
26 * tasks
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
45
57// mapping of a subset of NI_RETCODE_NVME_SC_* of ni_retcode_t, returned by
58// fw in regular i/o environment.
60{
62 ni_xcoder_request_pending = 1, // NVME SC 0x305
63 ni_xcoder_resource_recovery = 0xFFFD, // NVME SC 0x3FD
64 ni_xcoder_resource_insufficient = 0xFFFE, // NVME SC 0x3FE
65 ni_xcoder_general_error = 0xFFFF, // NVME SC 0x3FF
67
78
80{
81 uint8_t active_sub_instances_cnt; // Number of active sub-instance in that instance
82 uint8_t process_load_percent; // Processing load in percentage
83 union{
84 uint8_t error_count;
85 uint8_t pcie_load;
86 };
87 union{
88 uint8_t fatal_error;
90 };
91 uint32_t fw_model_load;
96 uint8_t active_hwupload_sub_inst_cnt; // number of hwuploader instances
97 uint8_t fw_load;
99 uint8_t process_load_percent_upper; // Processing load upper 8 bits
100 uint8_t process_load_percent_overall; // Processing load among all namespaces
101 uint8_t active_sub_instances_cnt_overall ; // Number of active sub-instance among all namespaces
104 uint32_t fw_model_load_overall; // Model load among all namespaces
105 uint8_t admin_nsid; // declares if there is info from admin namespace
106 uint8_t tp_fw_load; //uint8_t rsrv;
111
112#define NI_VERSION_CHARACTER_COUNT 8
113
121
123{
124 uint16_t picture_width; // Picture Width
125 uint16_t picture_height; // Picture Height
126 uint16_t transfer_frame_stride; // Transfer Frame Stride
127 uint16_t transfer_frame_height; // Transfer Frame Height(Not VPU Frame Height)
128 uint16_t frame_rate; // Sequence Frame Rate
129 uint16_t is_flushed; // Is decoder/encoder flushed or still has data to process
130 uint8_t pix_format; // Pixel format from decoder Vendor
133 uint8_t reserved[1];
135
136typedef struct _ni_session_stats
137{
144 uint32_t ui32Session_timestamp_high; // session start timestamp high
145 uint32_t ui32Session_timestamp_low; // session start timestamp low
146 uint32_t reserved[1];
147} ni_session_stats_t; // 32 bytes (has to be 8 byte aligned)
148
150{
151 char error_flag[16];
152 uint8_t check_flag[4];
153 uint32_t reserved[3];
154} ni_global_session_stats_t; // 32 bytes (has to be 8 byte aligned)
155
175
177{
178 uint16_t is_flushed; // Is decoder/encoder flushed or still has data to process
179 uint16_t data_bytes_available; // How much data is available to read/write
181
183{
184 int16_t buffer_avail; // 1 == avail, else not avail
185 int16_t frame_index; // memory bin ID
187
189{
190 union
191 {
192 uint32_t buf_avail_size; // available size of space/data for write/read
194 };
196
198{
199 uint16_t force_picture_type; //flag to force the pic type
200 uint16_t data_format; // In Env write this is usually set to NI_DATA_FORMAT_YUV_FRAME
201 uint16_t picture_type; // This is set to either XCODER_PIC_TYPE_I or XCODER_PIC_TYPE_CRA or XCODER_PIC_TYPE_IDR
202 uint16_t video_width;
203 uint16_t video_height;
204 uint32_t timestamp;
206
207// 24 bytes
209{
210 uint16_t crop_left;
211 uint16_t crop_right;
212 uint16_t crop_top;
213 uint16_t crop_bottom;
214 union
215 {
216 uint64_t frame_offset;
217 uint64_t frame_tstamp;
219 uint16_t frame_width;
220 uint16_t frame_height;
221 uint8_t frame_type;
222 uint8_t num_frame_dropped; /* frame dropped since the last good frame */
223 uint8_t has_b_frame;
226
227// 48 bytes
239
240// 56 bytes
264
266{
268 uint32_t frame_type;
269 uint64_t frame_tstamp;
270 uint32_t frame_cycle;
271 uint32_t avg_frame_qp;
274} ni_metadata_enc_bstream_rev61_t; // Revision 61 or lower
275
277{
279 uint32_t frame_type;
280 uint64_t frame_tstamp;
281 uint32_t frame_cycle;
282 uint32_t avg_frame_qp;
285 //Added for Revision 61
286 uint32_t ssimY;
287 uint32_t ssimU;
288 uint32_t ssimV;
289 //Added for Revision 6p
290 int16_t max_mv_x[2]; // 1/4 pixel unit
291 int16_t min_mv_x[2]; // 1/4 pixel unit
292 int16_t max_mv_y[2]; // 1/4 pixel unit
293 int16_t min_mv_y[2]; // 1/4 pixel unit
294 uint16_t frame_size;
295 uint16_t inter_total_count; // the inter includ the skip mode
297 uint8_t gop_size;
298 uint8_t ppsInitQp; //Utilize reserved in Revision 6sM
299 uint8_t reserved_byte[2];
300 uint16_t ui16psnr_y;
307 //Added fro Revision 6rc
310 uint8_t ui8Reserved[2];
312 uint32_t cuInfoSize; //Utilize reserved in Revision 6sM
313 uint32_t skipCu8Num; //Utilize reserved in Revision 6sM
314 //Added fro Revision 6sM
316 uint16_t aqInfoSize;
318
319/*!****** encoder paramters *********************************************/
320
321#define TUNE_BFRAME_VISUAL_MEDIUM 1
322#define TUNE_BFRAME_VISUAL_HIGH 2
323
325{
328 -1, /*!*< Default, gop decided by gopSize. E.g gopSize=0 is Adpative gop, gopsize adjusted dynamically */
330 GOP_PRESET_IDX_ALL_I = 1, /*!*< All Intra, gopsize = 1 */
331 GOP_PRESET_IDX_IPP = 2, /*!*< Consecutive P, cyclic gopsize = 1 */
332 GOP_PRESET_IDX_IBBB = 3, /*!*< Consecutive B, cyclic gopsize = 1 */
333 GOP_PRESET_IDX_IBPBP = 4, /*!*< gopsize = 2 */
334 GOP_PRESET_IDX_IBBBP = 5, /*!*< gopsize = 4 */
335 GOP_PRESET_IDX_IPPPP = 6, /*!*< Consecutive P, cyclic gopsize = 4 */
336 GOP_PRESET_IDX_IBBBB = 7, /*!*< Consecutive B, cyclic gopsize = 4 */
337 GOP_PRESET_IDX_RA_IB = 8, /*!*< Random Access, cyclic gopsize = 8 */
338 GOP_PRESET_IDX_SP = 9, /*!*< Consecutive P, gopsize=1, similar to 2 but */
339 /* uses 1 instead of 2 reference frames */
340 GOP_PRESET_IDX_HIERARCHICAL_IPPPP = 10, /*!*< Hierarchical P, cyclic gopsize = 4 */
342
343/*!*
344* \brief
345@verbatim
346This is an enumeration for declaring codec standard type variables. Currently,
347VPU supports many different video standards such as H.265/HEVC, MPEG4 SP/ASP, H.263 Profile 3, H.264/AVC
348BP/MP/HP, VC1 SP/MP/AP, Divx3, MPEG1, MPEG2, RealVideo 8/9/10, AVS Jizhun/Guangdian profile, AVS2,
349 Theora, VP3, VP8/VP9 and SVAC.
350
351NOTE: MPEG-1 decoder operation is handled as a special case of MPEG2 decoder.
352STD_THO must be always 9.
353@endverbatim
354*/
376
377typedef struct _ni_t408_config_t
378{
379 int32_t profile;
380 int32_t level;
381 int32_t tier;
383 int32_t losslessEnable; /*!*< It enables lossless coding. */
384 int32_t constIntraPredFlag; /*!*< It enables constrained intra prediction. */
387 int32_t intra_qp; /*!*< A quantization parameter of intra picture */
388 int32_t intra_period; /*!*< A period of intra picture in GOP size */
389 int32_t conf_win_top; /*!*< A top offset of conformance window */
390 int32_t conf_win_bottom; /*!*< A bottom offset of conformance window */
391 int32_t conf_win_left; /*!*< A left offset of conformance window */
392 int32_t conf_win_right; /*!*< A right offset of conformance window */
394 int32_t independSliceModeArg; /*!*< The number of CTU for a slice when independSliceMode is set with 1 */
396 int32_t dependSliceModeArg; /*!*< The number of CTU or bytes for a slice when dependSliceMode is set with 1 or 2 */
400 int32_t scalingListEnable; /*!*< It enables a scaling list. */
402 int32_t tmvpEnable; /*!*< It enables temporal motion vector prediction. */
403 int32_t wppEnable; /*!*< It enables WPP (T408-front Parallel Processing). WPP is unsupported in ring buffer mode of bitstream buffer. */
404 int32_t max_num_merge; /*!*< It specifies the number of merge candidates in RDO (1 or 2). 2 of max_num_merge (default) offers better quality of encoded picture, while 1 of max_num_merge improves encoding performance. */
405 int32_t disableDeblk; /*!*< It disables in-loop deblocking filtering. */
406 int32_t lfCrossSliceBoundaryEnable; /*!*< It enables filtering across slice boundaries for in-loop deblocking. */
407 int32_t betaOffsetDiv2; /*!*< It sets BetaOffsetDiv2 for deblocking filter. */
408 int32_t tcOffsetDiv2; /*!*< It sets TcOffsetDiv3 for deblocking filter. */
409 int32_t skipIntraTrans; /*!*< It enables transform skip for an intra CU. */
410 int32_t saoEnable; /*!*< It enables SAO (Sample Adaptive Offset). */
411 int32_t intraNxNEnable; /*!*< It enables intra NxN PUs. */
414 int32_t enable_cu_level_rate_control; /*!*< It enable CU level rate control. */
415 int32_t enable_hvs_qp; /*!*< It enable CU QP adjustment for subjective quality enhancement. */
416 int32_t hvs_qp_scale; /*!*< A QP scaling factor for CU QP adjustment when enable_hvs_qp_scale is 1 */
417 int32_t max_delta_qp; /*!*< A maximum delta QP for rate control */
418
419 // CUSTOM_GOP
420 ni_custom_gop_params_t custom_gop_params; /*!*< <<vpuapi_h_CustomGopParam>> */
421 int32_t roiEnable; /*!*< It enables ROI map. NOTE: It is valid when rate control is on. */
422
423 uint32_t numUnitsInTick; /*!*< It specifies the number of time units of a clock operating at the frequency time_scale Hz. This is used to to calculate frame_rate syntax. */
424 uint32_t timeScale; /*!*< It specifies the number of time units that pass in one second. This is used to to calculate frame_rate syntax. */
425 uint32_t numTicksPocDiffOne; /*!*< It specifies the number of clock ticks corresponding to a difference of picture order count values equal to 1. This is used to calculate frame_rate syntax. */
426
427 int32_t chromaCbQpOffset; /*!*< The value of chroma(Cb) QP offset */
428 int32_t chromaCrQpOffset; /*!*< The value of chroma(Cr) QP offset */
429
430 int32_t initialRcQp; /*!*< The value of initial QP by HOST application. This value is meaningless if INITIAL_RC_QP is 63.*/
431
432 uint32_t nrYEnable; /*!*< It enables noise reduction algorithm to Y component. */
433 uint32_t nrCbEnable; /*!*< It enables noise reduction algorithm to Cb component. */
434 uint32_t nrCrEnable; /*!*< It enables noise reduction algorithm to Cr component. */
435
436 // ENC_NR_WEIGHT
437 uint32_t nrIntraWeightY; /*!*< A weight to Y noise level for intra picture (0 ~ 31). nrIntraWeight/4 is multiplied to the noise level that has been estimated. This weight is put for intra frame to be filtered more strongly or more weakly than just with the estimated noise level. */
438 uint32_t nrIntraWeightCb; /*!*< A weight to Cb noise level for intra picture (0 ~ 31) */
439 uint32_t nrIntraWeightCr; /*!*< A weight to Cr noise level for intra picture (0 ~ 31) */
440 uint32_t nrInterWeightY; /*!*< A weight to Y noise level for inter picture (0 ~ 31). nrInterWeight/4 is multiplied to the noise level that has been estimated. This weight is put for inter frame to be filtered more strongly or more weakly than just with the estimated noise level. */
441 uint32_t nrInterWeightCb; /*!*< A weight to Cb noise level for inter picture (0 ~ 31) */
442 uint32_t nrInterWeightCr; /*!*< A weight to Cr noise level for inter picture (0 ~ 31) */
443
444 uint32_t nrNoiseEstEnable; /*!*< It enables noise estimation for noise reduction. When this is disabled, host carries out noise estimation with nrNoiseSigmaY/Cb/Cr. */
445 uint32_t nrNoiseSigmaY; /*!*< It specifies Y noise standard deviation when nrNoiseEstEnable is 0. */
446 uint32_t nrNoiseSigmaCb; /*!*< It specifies Cb noise standard deviation when nrNoiseEstEnable is 0. */
447 uint32_t nrNoiseSigmaCr; /*!*< It specifies Cr noise standard deviation when nrNoiseEstEnable is 0. */
448
449 uint32_t useLongTerm; /*!*< It enables long-term reference function. */
450
451 // newly added for T408
452 uint32_t monochromeEnable; /*!*< It enables monochrome encoding mode. */
453 uint32_t strongIntraSmoothEnable; /*!*< It enables strong intra smoothing. */
454
455 uint32_t weightPredEnable; /*!*< It enables to use weighted prediction.*/
456 uint32_t bgDetectEnable; /*!*< It enables background detection. */
457 uint32_t bgThrDiff; /*!*< It specifies the threshold of max difference that is used in s2me block. It is valid when background detection is on. */
458 uint32_t bgThrMeanDiff; /*!*< It specifies the threshold of mean difference that is used in s2me block. It is valid when background detection is on. */
459 uint32_t bgLambdaQp; /*!*< It specifies the minimum lambda QP value to be used in the background area. */
460 int32_t bgDeltaQp; /*!*< It specifies the difference between the lambda QP value of background and the lambda QP value of foreground. */
461
462 uint32_t customLambdaEnable; /*!*< It enables custom lambda table. */
463 uint32_t customMDEnable; /*!*< It enables custom mode decision. */
464 int32_t pu04DeltaRate; /*!*< A value which is added to the total cost of 4x4 blocks */
465 int32_t pu08DeltaRate; /*!*< A value which is added to the total cost of 8x8 blocks */
466 int32_t pu16DeltaRate; /*!*< A value which is added to the total cost of 16x16 blocks */
467 int32_t pu32DeltaRate; /*!*< A value which is added to the total cost of 32x32 blocks */
468 int32_t pu04IntraPlanarDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 4x4 Planar intra prediction mode. */
469 int32_t pu04IntraDcDeltaRate; /*!*< A value which is added to rate when calculating cost (=distortion + rate) in 4x4 DC intra prediction mode. */
470 int32_t pu04IntraAngleDeltaRate; /*!*< A value which is added to rate when calculating cost (=distortion + rate) in 4x4 Angular intra prediction mode. */
471 int32_t pu08IntraPlanarDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 8x8 Planar intra prediction mode.*/
472 int32_t pu08IntraDcDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 8x8 DC intra prediction mode.*/
473 int32_t pu08IntraAngleDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 8x8 Angular intra prediction mode. */
474 int32_t pu16IntraPlanarDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 16x16 Planar intra prediction mode. */
475 int32_t pu16IntraDcDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 16x16 DC intra prediction mode */
476 int32_t pu16IntraAngleDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 16x16 Angular intra prediction mode */
477 int32_t pu32IntraPlanarDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 32x32 Planar intra prediction mode */
478 int32_t pu32IntraDcDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 32x32 DC intra prediction mode */
479 int32_t pu32IntraAngleDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 32x32 Angular intra prediction mode */
480 int32_t cu08IntraDeltaRate; /*!*< A value which is added to rate when calculating cost for intra CU8x8 */
481 int32_t cu08InterDeltaRate; /*!*< A value which is added to rate when calculating cost for inter CU8x8 */
482 int32_t cu08MergeDeltaRate; /*!*< A value which is added to rate when calculating cost for merge CU8x8 */
483 int32_t cu16IntraDeltaRate; /*!*< A value which is added to rate when calculating cost for intra CU16x16 */
484 int32_t cu16InterDeltaRate; /*!*< A value which is added to rate when calculating cost for inter CU16x16 */
485 int32_t cu16MergeDeltaRate; /*!*< A value which is added to rate when calculating cost for merge CU16x16 */
486 int32_t cu32IntraDeltaRate; /*!*< A value which is added to rate when calculating cost for intra CU32x32 */
487 int32_t cu32InterDeltaRate; /*!*< A value which is added to rate when calculating cost for inter CU32x32 */
488 int32_t cu32MergeDeltaRate; /*!*< A value which is added to rate when calculating cost for merge CU32x32 */
489 int32_t coefClearDisable; /*!*< It disables the transform coefficient clearing algorithm for P or B picture. If this is 1, all-zero coefficient block is not evaluated in RDO. */
490 int32_t minQpI; /*!*< A minimum QP of I picture for rate control */
491 int32_t maxQpI; /*!*< A maximum QP of I picture for rate control */
492 int32_t minQpP; /*!*< A minimum QP of P picture for rate control */
493 int32_t maxQpP; /*!*< A maximum QP of P picture for rate control */
494 int32_t minQpB; /*!*< A minimum QP of B picture for rate control */
495 int32_t maxQpB; /*!*< A maximum QP of B picture for rate control */
496
497 // for H.264 on T408
498 int32_t avcIdrPeriod; /*!*< A period of IDR picture (0 ~ 1024) 0 - implies an infinite period */
499 int32_t rdoSkip; /*!*< It skips RDO(rate distortion optimization). */
500 int32_t lambdaScalingEnable; /*!*< It enables lambda scaling using custom GOP. */
501 int32_t enable_transform_8x8; /*!*< It enables 8x8 intra prediction and 8x8 transform. */
502 int32_t slice_mode;
503 int32_t slice_arg; /*!*< The number of MB for a slice when slice_mode is set with 1 */
506 int32_t enable_mb_level_rc; /*!*< It enables MB-level rate control. */
508
510 // forcedHeaderEnable = 2:Every IRAP frame includes headers(VPS, SPS, PPS)
511 // forcedHeaderEnable = 1:Every IDR frame includes headers (VPS,SPS, PPS).
512 // forcedHeaderEnable = 0:First IDR frame includes headers (VPS,SPS, PPS).
515
517{
518 uint8_t ui8bitstreamFormat; /*!*< The standard type of bitstream in encoder operation. It is one of STD_AVC and STD_HEVC, use enums from ni_bitstream_format_t. */
519 int32_t i32picWidth; /*!*< The width of a picture to be encoded in unit of sample. */
520 int32_t i32picHeight; /*!*< The height of a picture to be encoded in unit of sample. */
521 int32_t i32meBlkMode; // (AVC ONLY)
522 uint8_t ui8sliceMode; /*!*< <<vpuapi_h_EncSliceMode>> */
526 // AVC only
527 int32_t i32maxIntraSize; /*!*< The maximum bit size for intra frame. (H.264/AVC only) */
528 int32_t i32userMaxDeltaQp; /*!*< The maximum delta QP for encoding process. (H.264/AVC only) */
529 int32_t i32userMinDeltaQp; /*!*< The minimum delta QP for encoding process. (H.264/AVC only) */
530 int32_t i32userQpMin; /*!*< The minimum quantized step parameter for encoding process. (H.264/AVC only) */
531 int32_t i32bitRate;
533 uint8_t ui8rcEnable;
534 int32_t i32srcBitDepth; /*!*< A bit-depth of source image */
535 uint8_t ui8enablePTS; /*!*< An enable flag to report PTS(Presentation Timestamp) */
536 uint8_t ui8lowLatencyMode; /*!*< 2bits low latency mode setting. bit[1]: low latency interrupt enable, bit[0]: fast bitstream-packing enable (only for T408_5) */
537
538 ni_t408_config_t niParamT408; /*!*< <<vpuapi_h_EncT408Param>> */
539
540 /*!*< endianess of 10 bit source YUV. 0: little (default) 1: big */
542
544 uint32_t hdrEnableVUI; /* Ignored by Quadra. Kept for backward and forward compatibility. */
547 int32_t i32hwframes;
548 uint8_t ui8EnableAUD;
550 uint8_t ui8rdoLevel; /*Number of candidates to use for rate distortion optimization*/
551 int8_t i8crf; /*constant rate factor mode*/
552 uint16_t ui16HDR10MaxLight; /*Max content light level*/
553 uint16_t ui16HDR10AveLight; /*Max picture Average content light level*/
554 uint8_t ui8HDR10CLLEnable; /*Max picture Average content light level*/
555 uint8_t ui8EnableRdoQuant; /*Enables RDO quant*/
556 uint8_t ui8repeatHeaders; /*Repeat the headers every Iframe*/
557 uint8_t ui8ctbRcMode; /*CTB QP adjustment mode for Rate Control and Subjective Quality*/
558 uint8_t ui8gopSize; /*Specifies GOP size, 0 is adaptive*/
559 uint8_t ui8useLowDelayPocType; /*picture_order_count_type in the H.264 SPS */
560 uint8_t ui8gopLowdelay; /*Use low delay GOP configuration*/
561 uint16_t ui16gdrDuration; /*intra Refresh period*/
562 uint8_t ui8hrdEnable; /*Enables hypothetical Reference Decoder compliance*/
565 uint8_t ui8colorTrc;
569 uint16_t ui16rootBufId; /*Non zero values override frame buffer allocation to match this buffer*/
571 uint8_t ui8PixelFormat; /* pixel format */
582 uint32_t ui32setLongTermInterval; /* sets long-term reference interval */
583 uint32_t ui32QLevel; /* JPEG Quantization scale (0-9) */
588 // experimental parameters, not to be set by user --->
591 // <--- experimental parameters, not to be set by user
593 uint8_t ui8LowDelay;
594 uint8_t ui8setLongTermCount; /* sets long-term reference frames count */
604 uint16_t ui16hdr10_wx;
605 uint16_t ui16hdr10_wy;
618 uint8_t ui8NewRCEnable; // <--- experimental parameters, not to be set by user
629 int8_t i8crfMax; // <--- experimental parameters, not to be set by user /* prevent quadra from reducing the ratefactor below the given value */
630 int32_t i32qcomp;
631 // experimental parameters, not to be set by user --->
632 uint8_t ui8noMbtree;
635 // <--- experimental parameters, not to be set by user
636 int32_t i32ipRatio;
637 int32_t i32pbRatio;
642 int8_t i8pass1Qp; // <--- experimental parameters, not to be set by user
661 uint8_t ui8avccHvcc;
681
682
683// ----- Quadra encoder CU info -----
684#define CU_INFO_OUTPUT_SIZE_V1 26 //208 bits
685#define CU_INFO_OUTPUT_SIZE_V2 16 //128 bits
686#define CU_INFO_OUTPUT_SIZE_V3 19 //152 bits
687
688// HEVC & AV1
689#define CU_LOCATION_HOR_BIT_OFFSET (0)
690#define CU_LOCATION_HOR_BYTE_OFFSET (CU_LOCATION_HOR_BIT_OFFSET / 8)
691#define CU_LOCATION_HOR_BIT_POSITION (CU_LOCATION_HOR_BIT_OFFSET % 8)
692#define CU_LOCATION_HOR_BITS (3)
693
694#define CU_LOCATION_VER_BIT_OFFSET (3)
695#define CU_LOCATION_VER_BYTE_OFFSET (CU_LOCATION_VER_BIT_OFFSET / 8)
696#define CU_LOCATION_VER_BIT_POSITION (CU_LOCATION_VER_BIT_OFFSET % 8)
697#define CU_LOCATION_VER_BITS (3)
698
699#define CU_SIZE_BIT_OFFSET (6)
700#define CU_SIZE_BYTE_OFFSET (CU_SIZE_BIT_OFFSET / 8)
701#define CU_SIZE_BIT_POSITION (CU_SIZE_BIT_OFFSET % 8)
702#define CU_SIZE_BITS (2)
703
704#define CU_MODE_BIT_OFFSET (8)
705#define CU_MODE_BYTE_OFFSET (CU_MODE_BIT_OFFSET / 8)
706#define CU_MODE_BIT_POSITION (CU_MODE_BIT_OFFSET % 8)
707#define CU_MODE_BITS (1)
708
709#define RDCOST_BIT_OFFSET (9)
710#define RDCOST_BYTE_OFFSET (RDCOST_BIT_OFFSET / 8)
711#define RDCOST_BIT_POSITION (RDCOST_BIT_OFFSET % 8)
712#define RDCOST_BITS (25)
713
714#define INTER_PRED_IDC_BIT_OFFSET (34)
715#define INTER_PRED_IDC_BYTE_OFFSET (INTER_PRED_IDC_BIT_OFFSET / 8)
716#define INTER_PRED_IDC_BIT_POSITION (INTER_PRED_IDC_BIT_OFFSET % 8)
717#define INTER_PRED_IDC_BITS (2)
718
719#define MV0_REFIDX_BIT_OFFSET (36)
720#define MV0_REFIDX_BYTE_OFFSET (MV0_REFIDX_BIT_OFFSET / 8)
721#define MV0_REFIDX_BIT_POSITION (MV0_REFIDX_BIT_OFFSET % 8)
722#define MV0_REFIDX_BITS (2)
723
724#define MV0_MVX_BIT_OFFSET (38)
725#define MV0_MVX_BYTE_OFFSET (MV0_MVX_BIT_OFFSET / 8)
726#define MV0_MVX_BIT_POSITION (MV0_MVX_BIT_OFFSET % 8)
727#define MV0_MVX_BITS (14)
728
729#define MV0_MVY_BIT_OFFSET (52)
730#define MV0_MVY_BYTE_OFFSET (MV0_MVY_BIT_OFFSET / 8)
731#define MV0_MVY_BIT_POSITION (MV0_MVY_BIT_OFFSET % 8)
732#define MV0_MVY_BITS (14)
733
734#define MV1_REFIDX_BIT_OFFSET (66)
735#define MV1_REFIDX_BYTE_OFFSET (MV1_REFIDX_BIT_OFFSET / 8)
736#define MV1_REFIDX_BIT_POSITION (MV1_REFIDX_BIT_OFFSET % 8)
737#define MV1_REFIDX_BITS (2)
738
739#define MV1_MVX_BIT_OFFSET (68)
740#define MV1_MVX_BYTE_OFFSET (MV1_MVX_BIT_OFFSET / 8)
741#define MV1_MVX_BIT_POSITION (MV1_MVX_BIT_OFFSET % 8)
742#define MV1_MVX_BITS (14)
743
744#define MV1_MVY_BIT_OFFSET (82)
745#define MV1_MVY_BYTE_OFFSET (MV1_MVY_BIT_OFFSET / 8)
746#define MV1_MVY_BIT_POSITION (MV1_MVY_BIT_OFFSET % 8)
747#define MV1_MVY_BITS (14)
748
749#define INTRA_PART_MODE_BIT_OFFSET (34)
750#define INTRA_PART_MODE_BYTE_OFFSET (INTRA_PART_MODE_BIT_OFFSET / 8)
751#define INTRA_PART_MODE_BIT_POSITION (INTRA_PART_MODE_BIT_OFFSET % 8)
752#define INTRA_PART_MODE_BITS (1)
753
754#define INTRA_PRED_MODE0_BIT_OFFSET (35)
755#define INTRA_PRED_MODE0_BYTE_OFFSET (INTRA_PRED_MODE0_BIT_OFFSET / 8)
756#define INTRA_PRED_MODE0_BIT_POSITION (INTRA_PRED_MODE0_BIT_OFFSET % 8)
757#define INTRA_PRED_MODE0_BITS (6)
758
759#define INTRA_PRED_MODE1_BIT_OFFSET (41)
760#define INTRA_PRED_MODE1_BYTE_OFFSET (INTRA_PRED_MODE1_BIT_OFFSET / 8)
761#define INTRA_PRED_MODE1_BIT_POSITION (INTRA_PRED_MODE1_BIT_OFFSET % 8)
762#define INTRA_PRED_MODE1_BITS (6)
763
764#define INTRA_PRED_MODE2_BIT_OFFSET (47)
765#define INTRA_PRED_MODE2_BYTE_OFFSET (INTRA_PRED_MODE2_BIT_OFFSET / 8)
766#define INTRA_PRED_MODE2_BIT_POSITION (INTRA_PRED_MODE2_BIT_OFFSET % 8)
767#define INTRA_PRED_MODE2_BITS (6)
768
769#define INTRA_PRED_MODE3_BIT_OFFSET (53)
770#define INTRA_PRED_MODE3_BYTE_OFFSET (INTRA_PRED_MODE3_BIT_OFFSET / 8)
771#define INTRA_PRED_MODE3_BIT_POSITION (INTRA_PRED_MODE3_BIT_OFFSET % 8)
772#define INTRA_PRED_MODE3_BITS (6)
773
774#define MEAN_BIT_OFFSET (96)
775#define MEAN_BYTE_OFFSET (MEAN_BIT_OFFSET / 8)
776#define MEAN_BIT_POSITION (MEAN_BIT_OFFSET % 8)
777#define MEAN_BITS (10)
778
779#define VARIANCE_BIT_OFFSET (106)
780#define VARIANCE_BYTE_OFFSET (VARIANCE_BIT_OFFSET / 8)
781#define VARIANCE_BIT_POSITION (VARIANCE_BIT_OFFSET % 8)
782#define VARIANCE_BITS (18)
783
784#define QP_BIT_OFFSET (124)
785#define QP_BYTE_OFFSET (QP_BIT_OFFSET / 8)
786#define QP_BIT_POSITION (QP_BIT_OFFSET % 8)
787#define QP_BITS (6)
788
789#define RDCOST_OTHER_BIT_OFFSET (130)
790#define RDCOST_OTHER_BYTE_OFFSET (RDCOST_OTHER_BIT_OFFSET / 8)
791#define RDCOST_OTHER_BIT_POSITION (RDCOST_OTHER_BIT_OFFSET % 8)
792#define RDCOST_OTHER_BITS (25)
793
794#define INTRACOST_BIT_OFFSET (155)
795#define INTRACOST_BYTE_OFFSET (INTRACOST_BIT_OFFSET / 8)
796#define INTRACOST_BIT_POSITION (INTRACOST_BIT_OFFSET % 8)
797#define INTRACOST_BITS (25)
798
799#define INTERCOST_BIT_OFFSET (180)
800#define INTERCOST_BYTE_OFFSET (INTERCOST_BIT_OFFSET / 8)
801#define INTERCOST_BIT_POSITION (INTERCOST_BIT_OFFSET % 8)
802#define INTERCOST_BITS (25)
803
804#define DUMMY_BIT_OFFSET (205)
805#define DUMMY_BYTE_OFFSET (DUMMY_BIT_OFFSET / 8)
806#define DUMMY_BIT_POSITION (DUMMY_BIT_OFFSET % 8)
807#define DUMMY_BITS (3)
808
809// AVC
810#define AVC_MB_MODE_BIT_OFFSET (0)
811#define AVC_MB_MODE_BYTE_OFFSET (AVC_MB_MODE_BIT_OFFSET / 8)
812#define AVC_MB_MODE_BIT_POSITION (AVC_MB_MODE_BIT_OFFSET % 8)
813#define AVC_MB_MODE_BITS (1)
814
815#define AVC_RDCOST_BIT_OFFSET (1)
816#define AVC_RDCOST_BYTE_OFFSET (AVC_RDCOST_BIT_OFFSET / 8)
817#define AVC_RDCOST_BIT_POSITION (AVC_RDCOST_BIT_OFFSET % 8)
818#define AVC_RDCOST_BITS (25)
819
820#define AVC_INTER_PRED_IDC_BIT_OFFSET (26)
821#define AVC_INTER_PRED_IDC_BYTE_OFFSET (AVC_INTER_PRED_IDC_BIT_OFFSET / 8)
822#define AVC_INTER_PRED_IDC_BIT_POSITION (AVC_INTER_PRED_IDC_BIT_OFFSET % 8)
823#define AVC_INTER_PRED_IDC_BITS (2)
824
825#define AVC_MV0_REFIDX_BIT_OFFSET (28)
826#define AVC_MV0_REFIDX_BYTE_OFFSET (AVC_MV0_REFIDX_BIT_OFFSET / 8)
827#define AVC_MV0_REFIDX_BIT_POSITION (AVC_MV0_REFIDX_BIT_OFFSET % 8)
828#define AVC_MV0_REFIDX_BITS (2)
829
830#define AVC_MV0_MVX_BIT_OFFSET (30)
831#define AVC_MV0_MVX_BYTE_OFFSET (AVC_MV0_MVX_BIT_OFFSET / 8)
832#define AVC_MV0_MVX_BIT_POSITION (AVC_MV0_MVX_BIT_OFFSET % 8)
833#define AVC_MV0_MVX_BITS (14)
834
835#define AVC_MV0_MVY_BIT_OFFSET (44)
836#define AVC_MV0_MVY_BYTE_OFFSET (AVC_MV0_MVY_BIT_OFFSET / 8)
837#define AVC_MV0_MVY_BIT_POSITION (AVC_MV0_MVY_BIT_OFFSET % 8)
838#define AVC_MV0_MVY_BITS (14)
839
840#define AVC_MV1_REFIDX_BIT_OFFSET (58)
841#define AVC_MV1_REFIDX_BYTE_OFFSET (AVC_MV1_REFIDX_BIT_OFFSET / 8)
842#define AVC_MV1_REFIDX_BIT_POSITION (AVC_MV1_REFIDX_BIT_OFFSET % 8)
843#define AVC_MV1_REFIDX_BITS (2)
844
845#define AVC_MV1_MVX_BIT_OFFSET (60)
846#define AVC_MV1_MVX_BYTE_OFFSET (AVC_MV1_MVX_BIT_OFFSET / 8)
847#define AVC_MV1_MVX_BIT_POSITION (AVC_MV1_MVX_BIT_OFFSET % 8)
848#define AVC_MV1_MVX_BITS (14)
849
850#define AVC_MV1_MVY_BIT_OFFSET (74)
851#define AVC_MV1_MVY_BYTE_OFFSET (AVC_MV1_MVY_BIT_OFFSET / 8)
852#define AVC_MV1_MVY_BIT_POSITION (AVC_MV1_MVY_BIT_OFFSET % 8)
853#define AVC_MV1_MVY_BITS (14)
854
855#define AVC_INTRA_PART_MODE_BIT_OFFSET (26)
856#define AVC_INTRA_PART_MODE_BYTE_OFFSET (AVC_INTRA_PART_MODE_BIT_OFFSET / 8)
857#define AVC_INTRA_PART_MODE_BIT_POSITION (AVC_INTRA_PART_MODE_BIT_OFFSET % 8)
858#define AVC_INTRA_PART_MODE_BITS (2)
859
860// AVC CU info matches HEVC CU info starting from MEAN_BIT_OFFSET
861
862typedef struct
863{
864 uint8_t refIdx; /* reference idx in reference list */
865 int16_t mvX; /* horiazontal motion in 1/4 pixel */
866 int16_t mvY; /* vertical motion in 1/4 pixel */
868
869typedef struct
870{
871 uint8_t cuLocationX;
872 uint8_t cuLocationY;
873 uint8_t cuSize;
874 uint8_t cuMode;
875 uint32_t cost;
877 uint32_t costIntraSatd;
878 uint32_t costInterSatd;
879 uint8_t interPredIdc;
884 uint8_t intraPredMode[16];
888 uint8_t qp;
889 uint32_t mean;
890 uint32_t variance;
892// ----- Quadra encoder CU info -----
893
905
906// struct describing resolution change.
907typedef struct _ni_resolution
908{
909 // width
910 int32_t width;
911
912 // height
913 int32_t height;
914
915 // bit depth factor
917
921
922#define NI_MINIMUM_CROPPED_LENGTH 48
928
929typedef struct {
930 uint16_t ui16X;
931 uint16_t ui16Y;
932 uint16_t ui16W;
933 uint16_t ui16H;
935
936typedef struct {
937 int16_t i16Height;
938 int16_t i16Width;
940
941typedef struct {
942 uint8_t ui8Enabled;
944 uint8_t ui8CropMode;
947 // ui8EnablePpuScaleAdapt 0: disable 1: enable long-edge adapt 2: enable short-edge adapt
948 // 3: enable long-edge adapt 4: enable short-edge adapt
949 // 1 and 2 is that default rounding down to 2, and don't check change in area before and after
950 // 3 and 4 is that default rounding up to 2, and will check change in area before and after
953 uint8_t ui8ScaleResCeil; // even is up, odd is down (odd+1)
957
980
986
987typedef struct _ni_segment {
988 uint32_t ui32RelLba;
989 uint32_t ui32Size;
991
993{
995 uint16_t ui16Width;
996 uint16_t ui16Height;
997 uint16_t ui16Option;
998 union {
999 struct {
1001 uint8_t ui8MultiIn;
1002 uint16_t ui16FrameIdx[4];
1003 };
1004 struct {
1005#define NI_MAX_SEGMENT_NUM 4 //at lease 2 inputs once
1009 };
1010 };
1012
1022
1028
1029// the following enum and struct are copied from firmware/nvme/vpuapi/vpuapi.h
1030/*!*
1031* \brief
1032@verbatim
1033This is an enumeration for declaring SET_PARAM command options. (_T400_ENC encoder only)
1034Depending on this, SET_PARAM command parameter registers from 0x15C have different meanings.
1035
1036@endverbatim
1037*/
1045
1046#define FRAME_CHUNK_INDEX_SIZE 4096
1047#define NI_SESSION_CLOSE_RETRY_MAX 10
1048#define NI_SESSION_CLOSE_RETRY_INTERVAL_US 500000
1049
1050/* This value must agree with the membin size in Quadra firmware */
1051#define NI_HWDESC_UNIFIED_MEMBIN_SIZE 0x187000
1052
1053#define NI_QUADRA_MEMORY_CONFIG_DR 0
1054#define NI_QUADRA_MEMORY_CONFIG_SR 1
1055#define NI_QUADRA_MEMORY_CONFIG_SR2_REMOVE_P2P 2
1056#define NI_QUADRA_MEMORY_CONFIG_SR_4G 3
1057
1058#define NI_P2P_RECV 0
1059#define NI_P2P_SEND 1
1060#define NI_MAX_P2P_SGL_ENTRIES 128
1061/* Maximum bytes per (main) DMA descriptor entry 24 bits wide */
1062#define NI_DMA_SGL_MAX_XFER_SIZE 0x00FFFFFFu
1063
1064#define NI_MAX_AI_NETWORK_BINARY_BUFFER_QUERY_RETRIES 300000
1065#define NI_MAX_DEC_SESSION_READ_QUERY_EOS_RETRIES 15000
1066#define NI_RETRY_INTERVAL_200US 200
1067#define NI_RETRY_INTERVAL_100US 100
1068
1069// size of meta data sent together with bitstream: from f/w encoder to app for FW/SW before rev 6.1
1070#define NI_FW_ENC_BITSTREAM_META_DATA_SIZE 32
1071// size of meta data sent together with bitstream: from f/w encoder to app for FW/SW before rev 6.o
1072#define NI_FW_ENC_BITSTREAM_META_DATA_SIZE_UNDER_MAJOR_6_MINOR_o 48
1073// size of meta data sent together with bitstream: from f/w encoder to app for FW/SW before rev 6rc
1074#define NI_FW_ENC_BITSTREAM_META_DATA_SIZE_UNDER_MAJOR_6_MINOR_rc 88
1075// size of meta data sent together with bitstream: from f/w encoder to app for FW/SW before rev 6sM
1076#define NI_FW_ENC_BITSTREAM_META_DATA_SIZE_UNDER_MAJOR_6_MINOR_sM 112
1077
1078// Log delimiter definitions
1079#define FW_LOG_START_DELIMITER_0 0x5A
1080#define FW_LOG_START_DELIMITER_1 0xA5
1081#define FW_LOG_END_DELIMITER_0 0xA5
1082#define FW_LOG_END_DELIMITER_1 0x5A
1083
1087typedef struct {
1088 uint8_t start_marker[2];
1089 uint8_t timestamp[8]; // Little-endian timestamp
1090 uint8_t key[4];
1092
1096typedef struct {
1097 uint8_t end_marker[2];
1099
1103typedef struct {
1104 const uint8_t* start_ptr; // Pointer to log start
1105 const uint8_t* end_ptr; // Pointer after end marker
1106 uint64_t timestamp; // Extracted timestamp
1109
1110
1111int ni_create_frame(ni_frame_t* p_frame, uint32_t read_length,
1112 uint64_t* frame_offset, uint32_t* frame_dropped, bool is_hw_frame);
1113
1115 ni_encoder_config_t *p_cfg,
1116 ni_xcoder_params_t *p_src);
1118 ni_decoder_config_t *p_cfg,
1119 ni_xcoder_params_t *p_src,
1120 uint32_t max_pkt_size);
1123 ni_encoder_config_t *p_cfg,
1124 ni_xcoder_params_t *p_src,
1125 char *p_param_err,
1126 uint32_t max_err_len);
1128 ni_session_context_t *p_ctx,
1129 ni_decoder_config_t *p_cfg,
1130 char *p_param_err,
1131 uint32_t max_err_len);
1132
1134 ni_xcoder_params_t *p_src, char *param_err,
1135 uint32_t max_err_len);
1136ni_retcode_t ni_check_ratecontrol_params(ni_encoder_config_t* p_cfg, char* param_err, uint32_t max_err_len);
1137
1138void ni_params_print(ni_xcoder_params_t *const p_encoder_params);
1139
1140int32_t ni_get_frame_index(uint32_t* value);
1142 ni_device_handle_t device_handle, bool device_in_ctxt);
1143
1145 ni_device_type_t device_type);
1147 ni_device_type_t device_type, void *detail_data, int ver);
1148
1154
1157
1164//int ni_encoder_session_reconfig(ni_session_context_t *p_ctx, ni_session_config_t *p_config, ni_param_change_flags_t change_flags);
1165
1167ni_retcode_t ni_query_detail_status(ni_session_context_t* p_ctx, ni_device_type_t device_type, void* p_detail_status, int ver);
1168
1171
1173ni_retcode_t ni_query_session_stats(ni_session_context_t* p_ctx, ni_device_type_t device_type, ni_session_stats_t* p_session_stats, int rc, int opcode);
1176 ni_device_type_t device_type,
1177 ni_session_statistic_t *p_session_statistic);
1178
1179ni_retcode_t ni_config_session_rw(ni_session_context_t* p_ctx, ni_session_config_rw_type_t rw_type, uint8_t enable, uint8_t hw_action, uint16_t frame_id);
1188void ni_encoder_set_vui(uint8_t* vui, ni_encoder_config_t *p_cfg);
1189void *ni_session_keep_alive_thread(void *arguments);
1190ni_retcode_t ni_send_session_keep_alive(uint32_t session_id, ni_device_handle_t device_handle, ni_event_handle_t event_handle, void *p_data);
1191void ni_fix_VUI(uint8_t *vui, int pos, int value);
1192
1193/*!******************************************************************************
1194* \brief Copy a xcoder decoder worker thread info and card info
1195*
1196* \param
1197*
1198* \return
1199*******************************************************************************/
1201/*!******************************************************************************
1202* \brief Copy a xcoder decoder worker thread info and card info
1203*
1204* \param
1205*
1206* \return
1207*******************************************************************************/
1209/*!******************************************************************************
1210* \brief Open a xcoder uploader instance
1211*
1212* \param p_ctx - pointer to caller allocated uploader session context
1213*
1214* \return
1215* On success
1216* NI_RETCODE_SUCCESS
1217*
1218* On failure
1219* NI_RETCODE_INVALID_PARAM
1220* NI_RETCODE_ERROR_MEM_ALOC
1221* NI_RETCODE_ERROR_INVALID_SESSION
1222* NI_RETCODE_FAILURE
1223*******************************************************************************/
1225
1226/*!******************************************************************************
1227* \brief Close an xcoder upload instance
1228*
1229* \param p_ctx pointer to uploader session context
1230*
1231* \return NI_RETCODE_SUCCESS
1232*******************************************************************************/
1234
1235
1236/*!******************************************************************************
1237* \brief Query and acquire buffer from xcoder scale instance
1238*
1239* \param p_ctx pointer to scaler session context
1240*
1241* \return
1242* On success
1243* NI_RETCODE_SUCCESS
1244* On failure
1245* NI_RETCODE_ERROR_INVALID_SESSION
1246* NI_RETCODE_ERROR_MEM_ALOC
1247* NI_RETCODE_ERROR_NVME_CMD_FAILED
1248* NI_RETCODE_FAILURE
1249*******************************************************************************/
1251
1252
1253/*!******************************************************************************
1254* \brief Query and acquire buffer from xcoder upload instance
1255*
1256* \param p_ctx pointer to uploader session context
1257*
1258* \return
1259* On success
1260* NI_RETCODE_SUCCESS
1261* On error
1262* NI_RETCODE_ERROR_INVALID_SESSION
1263* NI_RETCODE_ERROR_MEM_ALOC
1264*******************************************************************************/
1266
1267
1268/*!******************************************************************************
1269* \brief Send a YUV p_frame to upload session
1270*
1271* \param
1272*
1273* \return
1274*******************************************************************************/
1276 niFrameSurface1_t *hwdesc);
1277
1278/*!******************************************************************************
1279* \brief Retrieve a HW descriptor of uploaded frame
1280*
1281* \param p_ctx pointer to uploader session context
1282* hwdesc pointer to hw descriptor
1283*
1284* \return
1285* On success
1286* NI_RETCODE_SUCCESS
1287* On failure
1288* NI_RETCODE_INVALID_PARAM
1289* NI_RETCODE_ERROR_INVALID_SESSION
1290* NI_RETCODE_FAILURE
1291*******************************************************************************/
1293 niFrameSurface1_t *hwdesc);
1294
1295/*!******************************************************************************
1296* \brief Retrieve a YUV p_frame from decoder
1297*
1298* \param
1299*
1300* \return
1301*******************************************************************************/
1303
1304/*!******************************************************************************
1305* \brief Retrieve a YUV p_frame by frame index
1306*
1307* \param
1308*
1309* \return
1310*******************************************************************************/
1311int ni_hwdownload_by_frame_idx(niFrameSurface1_t* hwdesc, ni_frame_t* p_frame, int is_auto_dl);
1312
1313/*!******************************************************************************
1314* \brief Copy a src hw frame to a dst hw frame
1315*
1316* \param
1317*
1318* \return
1319*******************************************************************************/
1321 ni_frameclone_desc_t *p_frameclone_desc);
1322
1323/*!*****************************************************************************
1324* \brief clear a particular xcoder instance buffer/data
1325*
1326* \param niFrameSurface1_t* surface - target hardware descriptor
1327*
1328* \return - NI_RETCODE_SUCCESS on success, NI_RETCODE_ERROR_INVALID_SESSION,
1329* or NI_RETCODE_ERROR_NVME_CMD_FAILED on
1330* failure
1331******************************************************************************/
1333
1334/*!******************************************************************************
1335 * \brief condif a scaler instance
1336 *
1337 * \param[in] p_ctx pointer to session context
1338 * \param[in] p_params pointer to scaler parameters
1339 *
1340 * \return NI_RETCODE_INVALID_PARAM
1341 * NI_RETCODE_ERROR_INVALID_SESSION
1342 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1343 * NI_RETCODE_ERROR_MEM_ALOC
1344 *******************************************************************************/
1346 ni_scaler_params_t *p_params);
1347
1348/*!******************************************************************************
1349 * \brief allocate a frame in the scaler
1350 *
1351 * \param[in] p_ctx pointer to session context
1352 * \param[in] width width in pixels
1353 * \param[in] height height in pixels
1354 * \param[in] format pixel format
1355 * \param[in] options option flags
1356 * \param[in] rectangle_width clipping rectangle width in pixels
1357 * \param[in] rectangle_height clipping rectangle height in pixels
1358 * \param[in] rectangle_x clipping rectangle x position
1359 * \param[in] rectangle_y clipping rectangle y position
1360 * \param[in] rgba_color background colour (only used by pad filter)
1361 * \param[in] frame_index frame index (only for hardware frames)
1362 *
1363 * \return NI_RETCODE_INVALID_PARAM
1364 * NI_RETCODE_ERROR_INVALID_SESSION
1365 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1366 * NI_RETCODE_ERROR_MEM_ALOC
1367 *******************************************************************************/
1369 int height, int format, int options,
1370 int rectangle_width,int rectangle_height,
1371 int rectangle_x, int rectangle_y,
1372 int rgba_color, int frame_index);
1373
1374/*!******************************************************************************
1375 * \brief config frame in the scaler
1376 *
1377 * \param[in] p_ctx pointer to session context
1378 * \param[in] p_cfg pointer to frame config
1379 *
1380 * \return NI_RETCODE_INVALID_PARAM
1381 * NI_RETCODE_ERROR_INVALID_SESSION
1382 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1383 * NI_RETCODE_ERROR_MEM_ALOC
1384 *******************************************************************************/
1386 ni_frame_config_t *p_cfg);
1387
1388/*!******************************************************************************
1389 * \brief config multi frames in the scaler
1390 *
1391 * \param[in] p_ctx pointer to session context
1392 * \param[in] p_cfg_in pointer to input frame config array
1393 * \param[in] numInCfgs number of input frame configs in p_cfg_in array
1394 * \param[in] p_cfg_out pointer to output frame config
1395 *
1396 * \return NI_RETCODE_INVALID_PARAM
1397 * NI_RETCODE_ERROR_INVALID_SESSION
1398 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1399 * NI_RETCODE_ERROR_MEM_ALOC
1400 *******************************************************************************/
1402 ni_frame_config_t p_cfg_in[],
1403 int numInCfgs,
1404 ni_frame_config_t *p_cfg_out);
1405
1406/*!******************************************************************************
1407 * \brief Open a xcoder scaler instance
1408 *
1409 * \param[in] p_ctx pointer to session context
1410 *
1411 * \return NI_RETCODE_INVALID_PARAM
1412 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1413 * NI_RETCODE_ERROR_INVALID_SESSION
1414 * NI_RETCODE_ERROR_MEM_ALOC
1415 *******************************************************************************/
1417
1418/*!******************************************************************************
1419 * \brief close a scaler session
1420 *
1421 * \param[in] p_ctx pointer to session context
1422 * \param[in] eos_received (not used)
1423 *
1424 * \return NI_RETCODE_INVALID_PARAM
1425 * NI_RETCODE_ERROR_INVALID_SESSION
1426 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1427 *******************************************************************************/
1429
1430/*!******************************************************************************
1431* \brief Send a p_config command to configure uploading parameters.
1432*
1433* \param ni_session_context_t p_ctx - xcoder Context
1434* \param[in] pool_size pool size to create
1435* \param[in] pool 0 = normal pool, 1 = P2P pool
1436*
1437* \return - NI_RETCODE_SUCCESS on success,
1438* NI_RETCODE_ERROR_INVALID_SESSION
1439* NI_RETCODE_ERROR_NVME_CMD_FAILED on failure
1440*******************************************************************************/
1442 uint32_t pool_size,
1443 uint32_t pool);
1444
1445/*!******************************************************************************
1446 * \brief read a hardware descriptor from a scaler session
1447 *
1448 * \param[in] p_ctx pointer to session context
1449 * \param[out] p_frame pointer to frame to write hw descriptor
1450 *
1451 * \return NI_RETCODE_INVALID_PARAM
1452 * NI_RETCODE_ERROR_INVALID_SESSION
1453 * NI_RETCODE_ERROR_MEM_ALOC
1454 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1455 * NI_RETCODE_FAILURE
1456 *******************************************************************************/
1458 ni_session_context_t *p_ctx,
1459 ni_frame_t *p_frame);
1460
1461/*!******************************************************************************
1462* \brief Grab bitdepth factor from NI_PIX_FMT
1463*
1464* \param[in] pix_fmt ni_pix_fmt_t
1465*
1466* \return 1 or 2
1467*******************************************************************************/
1468int ni_get_bitdepth_factor_from_pixfmt(int pix_fmt);
1469
1470/*!******************************************************************************
1471* \brief Grab planar info from NI_PIX_FMT
1472*
1473* \param[in] pix_fmt ni_pix_fmt_t
1474*
1475* \return 0 or 1 for success, -1 for error
1476*******************************************************************************/
1477int ni_get_planar_from_pixfmt(int pix_fmt);
1478
1479#ifndef _WIN32
1480/*!*****************************************************************************
1481 * \brief Get an address offset from a hw descriptor
1482 *
1483 * \param[in] p_ctx ni_session_context_t to be referenced
1484 * \param[in] hwdesc Pointer to caller allocated niFrameSurface1_t
1485 * \param[out] p_offset Value of offset
1486 *
1487 * \return On success NI_RETCODE_SUCCESS
1488 * On failure NI_RETCODE_INVALID_PARAM
1489 ******************************************************************************/
1491 uint32_t *p_offset);
1492
1493#endif
1494
1495/*!*****************************************************************************
1496 * \brief Get DDR configuration of Quadra device
1497 *
1498 * \param[in/out] p_ctx pointer to a session context with valid file handle
1499 *
1500 * \return On success NI_RETCODE_SUCCESS
1501 * On failure NI_RETCODE_INVALID_PARAM
1502 * NI_RETCODE_ERROR_MEM_ALOC
1503 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1504 ******************************************************************************/
1506
1507/*!*****************************************************************************
1508 * \brief Set DDR configuration of Quadra device
1509 *
1510 * \param[in] p_ctx pointer to a session context with valid file handle
1511 * \param[in] ddr_priority_mode ddr priority mode
1512 *
1513 * \return On success NI_RETCODE_SUCCESS
1514 * On failure NI_RETCODE_INVALID_PARAM
1515 * NI_RETCODE_ERROR_MEM_ALOC
1516 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1517 ******************************************************************************/
1519 uint8_t ddr_priority_mode);
1520
1521
1522#define NI_AI_HW_ALIGN_SIZE 64
1523
1525ni_retcode_t ni_ai_session_close(ni_session_context_t *p_ctx, int eos_received);
1527 void *nb_data, uint32_t nb_size);
1531 ni_frame_t *p_frame);
1533 ni_packet_t *p_packet);
1535 ni_network_data_t *p_network);
1537 int height, int options, int pool_size,
1538 int frame_index);
1540 niFrameSurface1_t *p_out_surface);
1542 ni_frame_config_t p_cfg_in[],
1543 int numInCfgs,
1544 ni_frame_config_t *p_cfg_out);
1545
1547 ni_frame_t *p_frame);
1548/*!*****************************************************************************
1549 * \brief Allocate memory for the metadata header and auxillary data for
1550 * encoder input data.
1551 *
1552 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
1553 *
1554 * \param[in] extra_len Length header and auxillary data
1555 *
1556 * \return On success
1557 * NI_RETCODE_SUCCESS
1558 * On failure
1559 * NI_RETCODE_INVALID_PARAM
1560 * NI_RETCODE_ERROR_MEM_ALOC
1561 *****************************************************************************/
1563 int extra_len);
1564
1566
1568 ni_network_perf_metrics_t *p_metrics);
1569
1570
1571/*!*****************************************************************************
1572 * \brief Send namespace num / Opmode and SRIOv index/value to the device with
1573 * specified logic block address.
1574 *
1575 * \param[in] device_handle Device handle obtained by calling ni_device_open
1576 * \param[in] Key Represents either namespace num or opmode
1577 * \param[in] Value Represents either SRIOv index or opmode value
1578 *
1579 * \return On success
1580 * NI_RETCODE_SUCCESS
1581 * On failure
1582 * NI_RETCODE_ERROR_MEM_ALOC
1583 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1584 ******************************************************************************/
1585ni_retcode_t ni_device_config_ns_qos(ni_device_handle_t device_handle,
1586 uint32_t key, uint32_t value);
1587
1588ni_retcode_t ni_dump_log_single_core(ni_session_context_t *p_ctx, void* p_data, uint32_t core_id, bool gen_log_file);
1589ni_retcode_t ni_dump_log_all_cores(ni_session_context_t *p_ctx, void* p_data, bool gen_log_file);
1590ni_retcode_t ni_send_to_target_v2(ni_session_context_t *pSession, ni_frame_t *pSrcFrame, const ni_p2p_sgl_t *dmaAddrs);
1591ni_retcode_t ni_recv_from_target(ni_session_context_t *pSession, const ni_p2p_sgl_t *dmaAddrs, ni_frame_t *pDstFrame);
1592int lower_pixel_rate(const ni_load_query_t *pQuery, uint32_t ui32CurrentLowest);
1594 void *p_dec_ppu_config, int buffer_size);
1595
1596/*!******************************************************************************
1597 * \brief set cpu affinity based on numa node
1598 *
1599 * \param[in] p_ctx pointer to session context
1600 *
1601 * \return NI_RETCODE_SUCCESS
1602 * NI_RETCODE_ERROR_MEM_ALOC
1603 *******************************************************************************/
1605
1606#ifdef __cplusplus
1607}
1608#endif
Common NETINT definitions used by all modules.
#define NI_MAX_NUM_OF_DECODER_OUTPUTS
Definition ni_defs.h:255
ni_device_type_t
Definition ni_defs.h:356
ni_retcode_t
Definition ni_defs.h:445
enum _ni_param_change_flags ni_param_change_flags_t
This is an enumeration for encoder parameter change.
#define NI_MAX_GOP_NUM
#define NI_MAX_SPATIAL_LAYERS
struct _ni_log_fl_fw_versions ni_log_fl_fw_versions_t
ni_retcode_t ni_encoder_session_open(ni_session_context_t *p_ctx)
Open a xcoder encoder instance.
struct _ni_metadata_enc_frame ni_metadata_enc_frame_t
ni_retcode_t ni_ai_alloc_hwframe(ni_session_context_t *p_ctx, int width, int height, int options, int pool_size, int frame_index)
ni_retcode_t ni_config_instance_set_decoder_ppu_params(ni_session_context_t *p_ctx, void *p_dec_ppu_config, int buffer_size)
Send a p_config command to configure decoding parameters.
ni_retcode_t ni_get_memory_offset(ni_session_context_t *p_ctx, const niFrameSurface1_t *hwdesc, uint32_t *p_offset)
Get an address offset from a hw descriptor.
ni_retcode_t ni_scaler_config_frame(ni_session_context_t *p_ctx, ni_frame_config_t *p_cfg)
config frame in the scaler
struct _ni_global_session_stats ni_global_session_stats_t
struct _ni_instance_mgr_stream_complete ni_instance_mgr_stream_complete_t
ni_retcode_t ni_scaler_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 multi frames in the scaler
_ni_gop_preset_idx
@ GOP_PRESET_IDX_CUSTOM
@ GOP_PRESET_IDX_HIERARCHICAL_IPPPP
@ GOP_PRESET_IDX_SP
@ GOP_PRESET_IDX_IBPBP
@ GOP_PRESET_IDX_IBBBB
@ GOP_PRESET_IDX_DEFAULT
@ GOP_PRESET_IDX_RA_IB
@ GOP_PRESET_IDX_IPPPP
@ GOP_PRESET_IDX_NONE
@ GOP_PRESET_IDX_ALL_I
@ GOP_PRESET_IDX_IBBBP
@ GOP_PRESET_IDX_IPP
@ GOP_PRESET_IDX_IBBB
ni_retcode_t ni_decoder_session_copy_internal(ni_session_context_t *src_p_ctx, ni_session_context_t *dst_p_ctx)
Copy a xcoder decoder worker thread info and card info.
int ni_hwupload_session_write(ni_session_context_t *p_ctx, ni_frame_t *p_frame, niFrameSurface1_t *hwdesc)
Send a YUV p_frame to upload session.
struct _ni_network_buffer_info ni_network_buffer_info_t
int ni_decoder_session_write(ni_session_context_t *p_ctx, ni_packet_t *p_packet)
Send a video p_packet to decoder.
ni_retcode_t ni_config_instance_set_encoder_frame_params(ni_session_context_t *p_ctx, ni_encoder_frame_params_t *p_params)
Send a p_config command to configure encoding p_frame parameters.
ni_retcode_t ni_decoder_session_close(ni_session_context_t *p_ctx, int eos_recieved)
Close a xcoder decoder instance.
void ni_populate_device_capability_struct(ni_device_capability_t *p_cap, void *p_data, ni_device_handle_t device_handle, bool device_in_ctxt)
Get info from received xcoder capability.
ni_retcode_t ni_config_instance_set_write_len(ni_session_context_t *p_ctx, ni_device_type_t device_type, uint32_t len)
Send a p_config command to set the length for the incoming write packet.
ni_retcode_t ni_encoder_session_sequence_change(ni_session_context_t *p_ctx, ni_resolution_t *p_resoluion)
Send sequnce change to a xcoder encoder instance.
ni_retcode_t ni_config_instance_set_sequence_change(ni_session_context_t *p_ctx, ni_device_type_t device_type, ni_resolution_t *p_resolution)
Send a p_config command to inform encoder sequence change.
ni_retcode_t ni_hwupload_session_query_buffer_avail(ni_session_context_t *p_ctx)
Query and acquire buffer from xcoder upload instance.
ni_retcode_t ni_scaler_session_close(ni_session_context_t *p_ctx, int eos_received)
close a scaler session
ni_retcode_t ni_ai_session_write(ni_session_context_t *p_ctx, ni_frame_t *p_frame)
ni_retcode_t ni_config_instance_hvsplus(ni_session_context_t *p_ctx)
ni_session_config_rw_type_t
@ SESSION_WRITE_CONFIG
@ SESSION_READ_CONFIG
ni_retcode_t ni_scaler_session_query_buffer_avail(ni_session_context_t *p_ctx)
Query and acquire buffer from xcoder scale instance.
ni_retcode_t ni_set_cpu_affinity(ni_session_context_t *p_ctx)
set cpu affinity based on numa node
struct _ni_session_config_rw ni_session_config_rw_t
struct _ni_metadata_enc_bstream_rev61 ni_metadata_enc_bstream_rev61_t
struct _ni_ai_config_t ni_ai_config_t
ni_retcode_t ni_config_instance_sos(ni_session_context_t *p_ctx, ni_device_type_t device_type)
Send a p_config command for Start Of Stream.
ni_retcode_t ni_encoder_session_close(ni_session_context_t *p_ctx, int eos_recieved)
Close a xcoder encoder instance.
ni_retcode_t ni_ai_session_query_metrics(ni_session_context_t *p_ctx, ni_network_perf_metrics_t *p_metrics)
struct _ni_decoder_config_t ni_decoder_config_t
struct _ni_instance_mgr_stream_info ni_instance_mgr_stream_info_t
int32_t ni_get_frame_index(uint32_t *value)
Get xcoder instance id.
Definition ni_util.c:1643
struct _ni_instance_buf_info ni_instance_buf_info_t
ni_retcode_t ni_dump_log_single_core(ni_session_context_t *p_ctx, void *p_data, uint32_t core_id, bool gen_log_file)
ni_retcode_t ni_encoder_session_send_eos(ni_session_context_t *p_ctx)
Flush encoder output.
ni_retcode_t ni_config_read_inout_layers(ni_session_context_t *p_ctx, ni_network_data_t *p_network)
int ni_decoder_session_read(ni_session_context_t *p_ctx, ni_frame_t *p_frame)
Retrieve a YUV p_frame from decoder.
ni_retcode_t ni_encoder_metadata_buffer_alloc(ni_frame_t *p_frame, int extra_len)
Allocate memory for the metadata header and auxillary data for encoder input data.
ni_retcode_t ni_send_to_target_v2(ni_session_context_t *pSession, ni_frame_t *pSrcFrame, const ni_p2p_sgl_t *dmaAddrs)
Generates and writes a nvme command with sgl list.
void ni_set_custom_dec_template(ni_session_context_t *p_ctx, ni_decoder_config_t *p_cfg, ni_xcoder_params_t *p_src, uint32_t max_pkt_size)
Setup all xcoder configurations with custom parameters (Rev. B)
ni_retcode_t ni_ai_session_read(ni_session_context_t *p_ctx, ni_packet_t *p_packet)
struct _ni_segment ni_segment_t
struct _ni_metadata_dec_frame ni_metadata_dec_frame_t
ni_retcode_t ni_hwframe_clone(ni_session_context_t *p_ctx, ni_frameclone_desc_t *p_frameclone_desc)
Copy a src hw frame to a dst hw frame.
struct _ni_instance_upload_ret_hwdesc ni_instance_upload_ret_hwdesc_t
int ni_xcoder_session_query_detail(ni_session_context_t *p_ctx, ni_device_type_t device_type, void *detail_data, int ver)
Query current xcoder status.
ni_retcode_t ni_ai_alloc_dst_frame(ni_session_context_t *p_ctx, niFrameSurface1_t *p_out_surface)
struct _ni_scaler_config ni_scaler_config_t
enum _ni_xcoder_mgr_retcode ni_xcoder_mgr_retcode_t
ni_retcode_t ni_check_ratecontrol_params(ni_encoder_config_t *p_cfg, char *param_err, uint32_t max_err_len)
struct _ni_session_stats ni_session_stats_t
ni_retcode_t ni_config_instance_set_uploader_params(ni_session_context_t *p_ctx, uint32_t pool_size, uint32_t pool)
Send a p_config command to configure uploading parameters.
struct _ni_metadata_common ni_metadata_common_t
ni_retcode_t ni_decoder_session_open(ni_session_context_t *p_ctx)
Open a xcoder decoder instance.
enum _ni_gop_preset_idx ni_gop_preset_idx_t
ni_retcode_t ni_encoder_start_buffer_alloc(ni_frame_t *p_frame)
Allocate memory for the non-4k-aligned part at the start of YUV data for encoder input data.
ni_retcode_t ni_scaler_session_read_hwdesc(ni_session_context_t *p_ctx, ni_frame_t *p_frame)
read a hardware descriptor from a scaler session
ni_retcode_t ni_uploader_session_close(ni_session_context_t *p_ctx)
Close an xcoder upload instance.
ni_retcode_t ni_scaler_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)
allocate a frame in the scaler
ni_set_param_option_t
@ OPT_CUSTOM_GOP
void * ni_session_keep_alive_thread(void *arguments)
decoder keep alive thread function triggers every 1 second
ni_retcode_t ni_query_detail_status(ni_session_context_t *p_ctx, ni_device_type_t device_type, void *p_detail_status, int ver)
Query a particular xcoder instance to get DetailStatus data.
ni_retcode_t ni_device_config_ns_qos(ni_device_handle_t device_handle, uint32_t key, uint32_t value)
Send namespace num / Opmode and SRIOv index/value to the device with specified logic block address.
ni_retcode_t ni_check_common_params(ni_t408_config_t *p_param, ni_xcoder_params_t *p_src, char *param_err, uint32_t max_err_len)
ni_retcode_t ni_config_instance_network_binary(ni_session_context_t *p_ctx, void *nb_data, uint32_t nb_size)
ni_retcode_t ni_query_instance_buf_info(ni_session_context_t *p_ctx, ni_instance_buf_info_rw_type_t rw_type, ni_device_type_t device_type, ni_instance_buf_info_t *p_inst_buf_info)
Query a particular xcoder instance to get buffer/data Info data.
int ni_create_frame(ni_frame_t *p_frame, uint32_t read_length, uint64_t *frame_offset, uint32_t *frame_dropped, bool is_hw_frame)
Get info from received p_frame.
int ni_get_planar_from_pixfmt(int pix_fmt)
Grab planar info from NI_PIX_FMT.
ni_retcode_t ni_query_eos(ni_session_context_t *p_ctx, ni_device_type_t device_type, ni_instance_mgr_stream_complete_t *p_stream_complete)
Query a particular xcoder instance to get End of Output data.
ni_retcode_t ni_query_stream_info(ni_session_context_t *p_ctx, ni_device_type_t device_type, ni_instance_mgr_stream_info_t *p_stream_info)
Query a particular xcoder instance to get Stream Info data.
_ni_xcoder_mgr_retcode
@ ni_xcoder_request_success
@ ni_xcoder_request_pending
@ ni_xcoder_resource_recovery
@ ni_xcoder_resource_insufficient
@ ni_xcoder_general_error
ni_retcode_t ni_device_set_ddr_configuration(ni_session_context_t *p_ctx, uint8_t ddr_priority_mode)
Set DDR configuration of Quadra device.
int ni_hwupload_session_read_hwdesc(ni_session_context_t *p_ctx, niFrameSurface1_t *hwdesc)
Retrieve a HW descriptor of uploaded frame.
void ni_set_custom_template(ni_session_context_t *p_ctx, ni_encoder_config_t *p_cfg, ni_xcoder_params_t *p_src)
Setup all xcoder configurations with custom parameters (Rev. B)
ni_retcode_t ni_send_session_keep_alive(uint32_t session_id, ni_device_handle_t device_handle, ni_event_handle_t event_handle, void *p_data)
send a keep alive message to firmware
ni_retcode_t ni_validate_custom_template(ni_session_context_t *p_ctx, ni_encoder_config_t *p_cfg, ni_xcoder_params_t *p_src, char *p_param_err, uint32_t max_err_len)
Perform validation on custom parameters (Rev. B)
ni_retcode_t ni_ai_session_close(ni_session_context_t *p_ctx, int eos_received)
struct _ni_encoder_config_t ni_encoder_config_t
int ni_xcoder_session_query(ni_session_context_t *p_ctx, ni_device_type_t device_type)
Query current xcoder status.
ni_retcode_t ni_config_instance_set_scaler_params(ni_session_context_t *p_ctx, ni_scaler_params_t *p_params)
condif a scaler instance
ni_retcode_t ni_device_get_ddr_configuration(ni_session_context_t *p_ctx)
Get DDR configuration of Quadra device.
struct _ni_metadata_enc_bstream ni_metadata_enc_bstream_t
struct _ni_t408_config_t ni_t408_config_t
ni_retcode_t ni_config_instance_eos(ni_session_context_t *p_ctx, ni_device_type_t device_type)
Send a p_config command for End Of Stream.
ni_retcode_t ni_ai_session_read_hwdesc(ni_session_context_t *p_ctx, ni_frame_t *p_frame)
read a hardware descriptor from a scaler session
struct _ni_instance_mgr_allocation_info ni_instance_mgr_allocation_info_t
ni_retcode_t ni_ai_query_network_ready(ni_session_context_t *p_ctx)
struct _ni_ddr_priority_config ni_ddr_priority_config_t
void ni_encoder_set_vui(uint8_t *vui, ni_encoder_config_t *p_cfg)
ni_retcode_t ni_config_instance_flush(ni_session_context_t *p_ctx, ni_device_type_t device_type)
Send a p_config command to flush the stream.
struct _ni_encoder_frame_params ni_encoder_frame_params_t
ni_retcode_t ni_config_session_rw(ni_session_context_t *p_ctx, ni_session_config_rw_type_t rw_type, uint8_t enable, uint8_t hw_action, uint16_t frame_id)
Configure the read/write pipe for a session to control its behavior.
ni_retcode_t ni_decoder_session_send_eos(ni_session_context_t *p_ctx)
Send end of stream signal to the decoder.
ni_retcode_t ni_config_instance_set_decoder_params(ni_session_context_t *p_ctx, uint32_t max_pkt_size)
Send a p_config command to configure decoding parameters.
int ni_encoder_session_read(ni_session_context_t *p_ctx, ni_packet_t *p_packet)
ni_retcode_t ni_validate_custom_dec_template(ni_xcoder_params_t *p_src, ni_session_context_t *p_ctx, ni_decoder_config_t *p_cfg, char *p_param_err, uint32_t max_err_len)
Perform validation on custom dec parameters (Rev. B)
struct _ni_uploader_config_t ni_uploader_config_t
ni_retcode_t ni_query_general_status(ni_session_context_t *p_ctx, ni_device_type_t device_type, ni_instance_mgr_general_status_t *p_gen_status)
Query a particular xcoder instance to get GeneralStatus data.
ni_decoder_crop_mode
@ CROP_DISABLED
@ CROP_MANUAL
@ CROP_AUTO
struct _ni_instance_mgr_general_status ni_instance_mgr_general_status_t
ni_retcode_t ni_uploader_session_open(ni_session_context_t *p_ctx)
Open a xcoder uploader instance.
int ni_decoder_session_read_desc(ni_session_context_t *p_ctx, ni_frame_t *p_frame)
Copy a xcoder decoder worker thread info and card info.
struct _ni_resolution ni_resolution_t
ni_retcode_t ni_ai_session_open(ni_session_context_t *p_ctx)
ni_retcode_t ni_config_instance_set_encoder_params(ni_session_context_t *p_ctx)
Send a p_config command to configure encoding parameters.
ni_retcode_t ni_clear_instance_buf(niFrameSurface1_t *surface)
clear a particular xcoder instance buffer/data
ni_retcode_t ni_query_session_statistic_info(ni_session_context_t *p_ctx, ni_device_type_t device_type, ni_session_statistic_t *p_session_statistic)
Query a particular xcoder session to get session statistics.
ni_retcode_t ni_recv_from_target(ni_session_context_t *pSession, const ni_p2p_sgl_t *dmaAddrs, ni_frame_t *pDstFrame)
ni_instance_buf_info_rw_type_t
@ INST_BUF_INFO_RW_WRITE
@ INST_BUF_INFO_RW_READ
@ INST_BUF_INFO_R_ACQUIRE
@ INST_BUF_INFO_RW_WRITE_BUSY
@ INST_BUF_INFO_RW_UPLOAD
@ INST_BUF_INFO_RW_WRITE_BY_EP
@ INST_BUF_INFO_RW_READ_BY_AI
@ INST_BUF_INFO_RW_READ_BUSY
void ni_params_print(ni_xcoder_params_t *const p_encoder_params)
Print xcoder user configurations.
ni_retcode_t ni_config_instance_update_encoder_params(ni_session_context_t *p_ctx, ni_param_change_flags_t change_flags)
ni_retcode_t ni_ai_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)
void ni_set_default_template(ni_session_context_t *p_ctx, ni_encoder_config_t *p_config)
Setup and initialize all xcoder configuration to default (Rev. B)
int lower_pixel_rate(const ni_load_query_t *pQuery, uint32_t ui32CurrentLowest)
#define NI_MAX_SEGMENT_NUM
void ni_fix_VUI(uint8_t *vui, int pos, int value)
insert the 32 bits of integer value at bit position pos
int ni_get_bitdepth_factor_from_pixfmt(int pix_fmt)
Grab bitdepth factor from NI_PIX_FMT.
int ni_hwdownload_session_read(ni_session_context_t *p_ctx, ni_frame_t *p_frame, niFrameSurface1_t *hwdesc)
Retrieve a YUV p_frame from decoder.
ni_retcode_t ni_decoder_session_flush(ni_session_context_t *p_ctx)
Flush decoder output.
ni_retcode_t ni_query_session_stats(ni_session_context_t *p_ctx, ni_device_type_t device_type, ni_session_stats_t *p_session_stats, int rc, int opcode)
Query a particular session to get the stats info.
ni_retcode_t ni_dump_log_all_cores(ni_session_context_t *p_ctx, void *p_data, bool gen_log_file)
int ni_scaler_session_open(ni_session_context_t *p_ctx)
Open a xcoder scaler instance.
#define NI_VERSION_CHARACTER_COUNT
int ni_encoder_session_write(ni_session_context_t *p_ctx, ni_frame_t *p_frame)
Send a YUV p_frame to encoder.
ni_bitstream_format_t
@ STD_MPEG4
@ STD_MPEG2
int ni_hwdownload_by_frame_idx(niFrameSurface1_t *hwdesc, ni_frame_t *p_frame, int is_auto_dl)
Retrieve a YUV p_frame by frame index.
Public definitions for managing NETINT video processing devices.
ni_decoder_output_config_t asOutputConfig[NI_MAX_NUM_OF_DECODER_OUTPUTS]
device capability type
uint8_t ui8av1OpLevel[NI_MAX_SPATIAL_LAYERS]
int32_t i32spatialLayerBitrate[NI_MAX_SPATIAL_LAYERS]
ni_t408_config_t niParamT408
ni_instance_upload_ret_hwdesc_t hw_inst_ind
uint8_t current_fw_revision[NI_VERSION_CHARACTER_COUNT]
uint8_t nor_flash_fw_revision[NI_VERSION_CHARACTER_COUNT]
uint8_t last_ran_fl_version[NI_VERSION_CHARACTER_COUNT]
uint8_t nor_flash_fl_version[NI_VERSION_CHARACTER_COUNT]
union _ni_metadata_common::@27 ui64_data
ni_sei_header_t first_sei_header
ni_metadata_common_t metadata_common
ni_metadata_common_t metadata_common
ni_segment_t segment[NI_MAX_SEGMENT_NUM]
union _ni_session_config_rw::@20 uHWAccessField
uint32_t ui32Session_timestamp_high
uint32_t ui32LastTransactionCompletionStatus
uint32_t ui32LastErrorTransactionId
int32_t fixedBitRatio[NI_MAX_GOP_NUM]
ni_custom_gop_params_t custom_gop_params
Log entry header structure.
Log entry information structure.
const uint8_t * start_ptr
uint64_t timestamp
bool wrap_around
const uint8_t * end_ptr
Log entry trailer structure.
ni_decoder_output_picture_size sOutputPictureSize
ni_decode_cropping_rectangle sCroppingRectable