libxcoder 5.9.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
265
267{
269 uint32_t frame_type;
270 uint64_t frame_tstamp;
271 uint32_t frame_cycle;
272 uint32_t avg_frame_qp;
275} ni_metadata_enc_bstream_rev61_t; // Revision 61 or lower
276
278{
280 uint32_t frame_type;
281 uint64_t frame_tstamp;
282 uint32_t frame_cycle;
283 uint32_t avg_frame_qp;
286 //Added for Revision 61
287 uint32_t ssimY;
288 uint32_t ssimU;
289 uint32_t ssimV;
290 //Added for Revision 6p
291 int16_t max_mv_x[2]; // 1/4 pixel unit
292 int16_t min_mv_x[2]; // 1/4 pixel unit
293 int16_t max_mv_y[2]; // 1/4 pixel unit
294 int16_t min_mv_y[2]; // 1/4 pixel unit
295 uint16_t frame_size;
296 uint16_t inter_total_count; // the inter includ the skip mode
298 uint8_t gop_size;
299 uint8_t ppsInitQp; //Utilize reserved in Revision 6sM
300 uint8_t reserved_byte[2];
301 uint16_t ui16psnr_y;
308 //Added fro Revision 6rc
311 uint8_t ui8Reserved[2];
313 uint32_t cuInfoSize; //Utilize reserved in Revision 6sM
314 uint32_t skipCu8Num; //Utilize reserved in Revision 6sM
315 //Added fro Revision 6sM
317 uint16_t aqInfoSize;
319
344
345/*!****** encoder paramters *********************************************/
346
347#define TUNE_BFRAME_VISUAL_MEDIUM 1
348#define TUNE_BFRAME_VISUAL_HIGH 2
349
351{
354 -1, /*!*< Default, gop decided by gopSize. E.g gopSize=0 is Adpative gop, gopsize adjusted dynamically */
356 GOP_PRESET_IDX_ALL_I = 1, /*!*< All Intra, gopsize = 1 */
357 GOP_PRESET_IDX_IPP = 2, /*!*< Consecutive P, cyclic gopsize = 1 */
358 GOP_PRESET_IDX_IBBB = 3, /*!*< Consecutive B, cyclic gopsize = 1 */
359 GOP_PRESET_IDX_IBPBP = 4, /*!*< gopsize = 2 */
360 GOP_PRESET_IDX_IBBBP = 5, /*!*< gopsize = 4 */
361 GOP_PRESET_IDX_IPPPP = 6, /*!*< Consecutive P, cyclic gopsize = 4 */
362 GOP_PRESET_IDX_IBBBB = 7, /*!*< Consecutive B, cyclic gopsize = 4 */
363 GOP_PRESET_IDX_RA_IB = 8, /*!*< Random Access, cyclic gopsize = 8 */
364 GOP_PRESET_IDX_SP = 9, /*!*< Consecutive P, gopsize=1, similar to 2 but */
365 /* uses 1 instead of 2 reference frames */
366 GOP_PRESET_IDX_HIERARCHICAL_IPPPP = 10, /*!*< Hierarchical P, cyclic gopsize = 4 */
368
369/*!*
370* \brief
371@verbatim
372This is an enumeration for declaring codec standard type variables. Currently,
373VPU supports many different video standards such as H.265/HEVC, MPEG4 SP/ASP, H.263 Profile 3, H.264/AVC
374BP/MP/HP, VC1 SP/MP/AP, Divx3, MPEG1, MPEG2, RealVideo 8/9/10, AVS Jizhun/Guangdian profile, AVS2,
375 Theora, VP3, VP8/VP9 and SVAC.
376
377NOTE: MPEG-1 decoder operation is handled as a special case of MPEG2 decoder.
378STD_THO must be always 9.
379@endverbatim
380*/
402
403typedef struct _ni_t408_config_t
404{
405 int32_t profile;
406 int32_t level;
407 int32_t tier;
409 int32_t losslessEnable; /*!*< It enables lossless coding. */
410 int32_t constIntraPredFlag; /*!*< It enables constrained intra prediction. */
413 int32_t intra_qp; /*!*< A quantization parameter of intra picture */
414 int32_t intra_period; /*!*< A period of intra picture in GOP size */
415 int32_t conf_win_top; /*!*< A top offset of conformance window */
416 int32_t conf_win_bottom; /*!*< A bottom offset of conformance window */
417 int32_t conf_win_left; /*!*< A left offset of conformance window */
418 int32_t conf_win_right; /*!*< A right offset of conformance window */
420 int32_t independSliceModeArg; /*!*< The number of CTU for a slice when independSliceMode is set with 1 */
422 int32_t dependSliceModeArg; /*!*< The number of CTU or bytes for a slice when dependSliceMode is set with 1 or 2 */
426 int32_t scalingListEnable; /*!*< It enables a scaling list. */
428 int32_t tmvpEnable; /*!*< It enables temporal motion vector prediction. */
429 int32_t wppEnable; /*!*< It enables WPP (T408-front Parallel Processing). WPP is unsupported in ring buffer mode of bitstream buffer. */
430 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. */
431 int32_t disableDeblk; /*!*< It disables in-loop deblocking filtering. */
432 int32_t lfCrossSliceBoundaryEnable; /*!*< It enables filtering across slice boundaries for in-loop deblocking. */
433 int32_t betaOffsetDiv2; /*!*< It sets BetaOffsetDiv2 for deblocking filter. */
434 int32_t tcOffsetDiv2; /*!*< It sets TcOffsetDiv3 for deblocking filter. */
435 int32_t skipIntraTrans; /*!*< It enables transform skip for an intra CU. */
436 int32_t saoEnable; /*!*< It enables SAO (Sample Adaptive Offset). */
437 int32_t intraNxNEnable; /*!*< It enables intra NxN PUs. */
440 int32_t enable_cu_level_rate_control; /*!*< It enable CU level rate control. */
441 int32_t enable_hvs_qp; /*!*< It enable CU QP adjustment for subjective quality enhancement. */
442 int32_t hvs_qp_scale; /*!*< A QP scaling factor for CU QP adjustment when enable_hvs_qp_scale is 1 */
443 int32_t max_delta_qp; /*!*< A maximum delta QP for rate control */
444
445 // CUSTOM_GOP
446 ni_custom_gop_params_t custom_gop_params; /*!*< <<vpuapi_h_CustomGopParam>> */
447 int32_t roiEnable; /*!*< It enables ROI map. NOTE: It is valid when rate control is on. */
448
449 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. */
450 uint32_t timeScale; /*!*< It specifies the number of time units that pass in one second. This is used to to calculate frame_rate syntax. */
451 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. */
452
453 int32_t chromaCbQpOffset; /*!*< The value of chroma(Cb) QP offset */
454 int32_t chromaCrQpOffset; /*!*< The value of chroma(Cr) QP offset */
455
456 int32_t initialRcQp; /*!*< The value of initial QP by HOST application. This value is meaningless if INITIAL_RC_QP is 63.*/
457
458 uint32_t nrYEnable; /*!*< It enables noise reduction algorithm to Y component. */
459 uint32_t nrCbEnable; /*!*< It enables noise reduction algorithm to Cb component. */
460 uint32_t nrCrEnable; /*!*< It enables noise reduction algorithm to Cr component. */
461
462 // ENC_NR_WEIGHT
463 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. */
464 uint32_t nrIntraWeightCb; /*!*< A weight to Cb noise level for intra picture (0 ~ 31) */
465 uint32_t nrIntraWeightCr; /*!*< A weight to Cr noise level for intra picture (0 ~ 31) */
466 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. */
467 uint32_t nrInterWeightCb; /*!*< A weight to Cb noise level for inter picture (0 ~ 31) */
468 uint32_t nrInterWeightCr; /*!*< A weight to Cr noise level for inter picture (0 ~ 31) */
469
470 uint32_t nrNoiseEstEnable; /*!*< It enables noise estimation for noise reduction. When this is disabled, host carries out noise estimation with nrNoiseSigmaY/Cb/Cr. */
471 uint32_t nrNoiseSigmaY; /*!*< It specifies Y noise standard deviation when nrNoiseEstEnable is 0. */
472 uint32_t nrNoiseSigmaCb; /*!*< It specifies Cb noise standard deviation when nrNoiseEstEnable is 0. */
473 uint32_t nrNoiseSigmaCr; /*!*< It specifies Cr noise standard deviation when nrNoiseEstEnable is 0. */
474
475 uint32_t useLongTerm; /*!*< It enables long-term reference function. */
476
477 // newly added for T408
478 uint32_t monochromeEnable; /*!*< It enables monochrome encoding mode. */
479 uint32_t strongIntraSmoothEnable; /*!*< It enables strong intra smoothing. */
480
481 uint32_t weightPredEnable; /*!*< It enables to use weighted prediction.*/
482 uint32_t bgDetectEnable; /*!*< It enables background detection. */
483 uint32_t bgThrDiff; /*!*< It specifies the threshold of max difference that is used in s2me block. It is valid when background detection is on. */
484 uint32_t bgThrMeanDiff; /*!*< It specifies the threshold of mean difference that is used in s2me block. It is valid when background detection is on. */
485 uint32_t bgLambdaQp; /*!*< It specifies the minimum lambda QP value to be used in the background area. */
486 int32_t bgDeltaQp; /*!*< It specifies the difference between the lambda QP value of background and the lambda QP value of foreground. */
487
488 uint32_t customLambdaEnable; /*!*< It enables custom lambda table. */
489 uint32_t customMDEnable; /*!*< It enables custom mode decision. */
490 int32_t pu04DeltaRate; /*!*< A value which is added to the total cost of 4x4 blocks */
491 int32_t pu08DeltaRate; /*!*< A value which is added to the total cost of 8x8 blocks */
492 int32_t pu16DeltaRate; /*!*< A value which is added to the total cost of 16x16 blocks */
493 int32_t pu32DeltaRate; /*!*< A value which is added to the total cost of 32x32 blocks */
494 int32_t pu04IntraPlanarDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 4x4 Planar intra prediction mode. */
495 int32_t pu04IntraDcDeltaRate; /*!*< A value which is added to rate when calculating cost (=distortion + rate) in 4x4 DC intra prediction mode. */
496 int32_t pu04IntraAngleDeltaRate; /*!*< A value which is added to rate when calculating cost (=distortion + rate) in 4x4 Angular intra prediction mode. */
497 int32_t pu08IntraPlanarDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 8x8 Planar intra prediction mode.*/
498 int32_t pu08IntraDcDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 8x8 DC intra prediction mode.*/
499 int32_t pu08IntraAngleDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 8x8 Angular intra prediction mode. */
500 int32_t pu16IntraPlanarDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 16x16 Planar intra prediction mode. */
501 int32_t pu16IntraDcDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 16x16 DC intra prediction mode */
502 int32_t pu16IntraAngleDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 16x16 Angular intra prediction mode */
503 int32_t pu32IntraPlanarDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 32x32 Planar intra prediction mode */
504 int32_t pu32IntraDcDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 32x32 DC intra prediction mode */
505 int32_t pu32IntraAngleDeltaRate; /*!*< A value which is added to rate when calculating cost(=distortion + rate) in 32x32 Angular intra prediction mode */
506 int32_t cu08IntraDeltaRate; /*!*< A value which is added to rate when calculating cost for intra CU8x8 */
507 int32_t cu08InterDeltaRate; /*!*< A value which is added to rate when calculating cost for inter CU8x8 */
508 int32_t cu08MergeDeltaRate; /*!*< A value which is added to rate when calculating cost for merge CU8x8 */
509 int32_t cu16IntraDeltaRate; /*!*< A value which is added to rate when calculating cost for intra CU16x16 */
510 int32_t cu16InterDeltaRate; /*!*< A value which is added to rate when calculating cost for inter CU16x16 */
511 int32_t cu16MergeDeltaRate; /*!*< A value which is added to rate when calculating cost for merge CU16x16 */
512 int32_t cu32IntraDeltaRate; /*!*< A value which is added to rate when calculating cost for intra CU32x32 */
513 int32_t cu32InterDeltaRate; /*!*< A value which is added to rate when calculating cost for inter CU32x32 */
514 int32_t cu32MergeDeltaRate; /*!*< A value which is added to rate when calculating cost for merge CU32x32 */
515 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. */
516 int32_t minQpI; /*!*< A minimum QP of I picture for rate control */
517 int32_t maxQpI; /*!*< A maximum QP of I picture for rate control */
518 int32_t minQpP; /*!*< A minimum QP of P picture for rate control */
519 int32_t maxQpP; /*!*< A maximum QP of P picture for rate control */
520 int32_t minQpB; /*!*< A minimum QP of B picture for rate control */
521 int32_t maxQpB; /*!*< A maximum QP of B picture for rate control */
522
523 // for H.264 on T408
524 int32_t avcIdrPeriod; /*!*< A period of IDR picture (0 ~ 1024) 0 - implies an infinite period */
525 int32_t rdoSkip; /*!*< It skips RDO(rate distortion optimization). */
526 int32_t lambdaScalingEnable; /*!*< It enables lambda scaling using custom GOP. */
527 int32_t enable_transform_8x8; /*!*< It enables 8x8 intra prediction and 8x8 transform. */
528 int32_t slice_mode;
529 int32_t slice_arg; /*!*< The number of MB for a slice when slice_mode is set with 1 */
532 int32_t enable_mb_level_rc; /*!*< It enables MB-level rate control. */
534
536 // forcedHeaderEnable = 2:Every IRAP frame includes headers(VPS, SPS, PPS)
537 // forcedHeaderEnable = 1:Every IDR frame includes headers (VPS,SPS, PPS).
538 // forcedHeaderEnable = 0:First IDR frame includes headers (VPS,SPS, PPS).
541
543{
544 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. */
545 int32_t i32picWidth; /*!*< The width of a picture to be encoded in unit of sample. */
546 int32_t i32picHeight; /*!*< The height of a picture to be encoded in unit of sample. */
547 int32_t i32meBlkMode; // (AVC ONLY)
548 uint8_t ui8sliceMode; /*!*< <<vpuapi_h_EncSliceMode>> */
552 // AVC only
553 int32_t i32maxIntraSize; /*!*< The maximum bit size for intra frame. (H.264/AVC only) */
554 int32_t i32userMaxDeltaQp; /*!*< The maximum delta QP for encoding process. (H.264/AVC only) */
555 int32_t i32userMinDeltaQp; /*!*< The minimum delta QP for encoding process. (H.264/AVC only) */
556 int32_t i32userQpMin; /*!*< The minimum quantized step parameter for encoding process. (H.264/AVC only) */
557 int32_t i32bitRate;
559 uint8_t ui8rcEnable;
560 int32_t i32srcBitDepth; /*!*< A bit-depth of source image */
561 uint8_t ui8enablePTS; /*!*< An enable flag to report PTS(Presentation Timestamp) */
562 uint8_t ui8lowLatencyMode; /*!*< 2bits low latency mode setting. bit[1]: low latency interrupt enable, bit[0]: fast bitstream-packing enable (only for T408_5) */
563
564 ni_t408_config_t niParamT408; /*!*< <<vpuapi_h_EncT408Param>> */
565
566 /*!*< endianess of 10 bit source YUV. 0: little (default) 1: big */
568
570 uint32_t hdrEnableVUI; /* Ignored by Quadra. Kept for backward and forward compatibility. */
573 int32_t i32hwframes;
574 uint8_t ui8EnableAUD;
576 uint8_t ui8rdoLevel; /*Number of candidates to use for rate distortion optimization*/
577 int8_t i8crf; /*constant rate factor mode*/
578 uint16_t ui16HDR10MaxLight; /*Max content light level*/
579 uint16_t ui16HDR10AveLight; /*Max picture Average content light level*/
580 uint8_t ui8HDR10CLLEnable; /*Max picture Average content light level*/
581 uint8_t ui8EnableRdoQuant; /*Enables RDO quant*/
582 uint8_t ui8repeatHeaders; /*Repeat the headers every Iframe*/
583 uint8_t ui8ctbRcMode; /*CTB QP adjustment mode for Rate Control and Subjective Quality*/
584 uint8_t ui8gopSize; /*Specifies GOP size, 0 is adaptive*/
585 uint8_t ui8useLowDelayPocType; /*picture_order_count_type in the H.264 SPS */
586 uint8_t ui8gopLowdelay; /*Use low delay GOP configuration*/
587 uint16_t ui16gdrDuration; /*intra Refresh period*/
588 uint8_t ui8hrdEnable; /*Enables hypothetical Reference Decoder compliance*/
591 uint8_t ui8colorTrc;
595 uint16_t ui16rootBufId; /*Non zero values override frame buffer allocation to match this buffer*/
597 uint8_t ui8PixelFormat; /* pixel format */
608 uint32_t ui32setLongTermInterval; /* sets long-term reference interval */
609 uint32_t ui32QLevel; /* JPEG Quantization scale (0-9) */
614 // experimental parameters, not to be set by user --->
617 // <--- experimental parameters, not to be set by user
619 uint8_t ui8LowDelay;
620 uint8_t ui8setLongTermCount; /* sets long-term reference frames count */
630 uint16_t ui16hdr10_wx;
631 uint16_t ui16hdr10_wy;
644 uint8_t ui8NewRCEnable; // <--- experimental parameters, not to be set by user
655 int8_t i8crfMax; // <--- experimental parameters, not to be set by user /* prevent quadra from reducing the ratefactor below the given value */
656 int32_t i32qcomp;
657 // experimental parameters, not to be set by user --->
658 uint8_t ui8noMbtree;
661 // <--- experimental parameters, not to be set by user
662 int32_t i32ipRatio;
663 int32_t i32pbRatio;
668 int8_t i8pass1Qp; // <--- experimental parameters, not to be set by user
687 uint8_t ui8avccHvcc;
708
709
710// ----- Quadra encoder CU info -----
711#define CU_INFO_OUTPUT_SIZE_V1 26 //208 bits
712#define CU_INFO_OUTPUT_SIZE_V2 16 //128 bits
713#define CU_INFO_OUTPUT_SIZE_V3 19 //152 bits
714
715// HEVC & AV1
716#define CU_LOCATION_HOR_BIT_OFFSET (0)
717#define CU_LOCATION_HOR_BYTE_OFFSET (CU_LOCATION_HOR_BIT_OFFSET / 8)
718#define CU_LOCATION_HOR_BIT_POSITION (CU_LOCATION_HOR_BIT_OFFSET % 8)
719#define CU_LOCATION_HOR_BITS (3)
720
721#define CU_LOCATION_VER_BIT_OFFSET (3)
722#define CU_LOCATION_VER_BYTE_OFFSET (CU_LOCATION_VER_BIT_OFFSET / 8)
723#define CU_LOCATION_VER_BIT_POSITION (CU_LOCATION_VER_BIT_OFFSET % 8)
724#define CU_LOCATION_VER_BITS (3)
725
726#define CU_SIZE_BIT_OFFSET (6)
727#define CU_SIZE_BYTE_OFFSET (CU_SIZE_BIT_OFFSET / 8)
728#define CU_SIZE_BIT_POSITION (CU_SIZE_BIT_OFFSET % 8)
729#define CU_SIZE_BITS (2)
730
731#define CU_MODE_BIT_OFFSET (8)
732#define CU_MODE_BYTE_OFFSET (CU_MODE_BIT_OFFSET / 8)
733#define CU_MODE_BIT_POSITION (CU_MODE_BIT_OFFSET % 8)
734#define CU_MODE_BITS (1)
735
736#define RDCOST_BIT_OFFSET (9)
737#define RDCOST_BYTE_OFFSET (RDCOST_BIT_OFFSET / 8)
738#define RDCOST_BIT_POSITION (RDCOST_BIT_OFFSET % 8)
739#define RDCOST_BITS (25)
740
741#define INTER_PRED_IDC_BIT_OFFSET (34)
742#define INTER_PRED_IDC_BYTE_OFFSET (INTER_PRED_IDC_BIT_OFFSET / 8)
743#define INTER_PRED_IDC_BIT_POSITION (INTER_PRED_IDC_BIT_OFFSET % 8)
744#define INTER_PRED_IDC_BITS (2)
745
746#define MV0_REFIDX_BIT_OFFSET (36)
747#define MV0_REFIDX_BYTE_OFFSET (MV0_REFIDX_BIT_OFFSET / 8)
748#define MV0_REFIDX_BIT_POSITION (MV0_REFIDX_BIT_OFFSET % 8)
749#define MV0_REFIDX_BITS (2)
750
751#define MV0_MVX_BIT_OFFSET (38)
752#define MV0_MVX_BYTE_OFFSET (MV0_MVX_BIT_OFFSET / 8)
753#define MV0_MVX_BIT_POSITION (MV0_MVX_BIT_OFFSET % 8)
754#define MV0_MVX_BITS (14)
755
756#define MV0_MVY_BIT_OFFSET (52)
757#define MV0_MVY_BYTE_OFFSET (MV0_MVY_BIT_OFFSET / 8)
758#define MV0_MVY_BIT_POSITION (MV0_MVY_BIT_OFFSET % 8)
759#define MV0_MVY_BITS (14)
760
761#define MV1_REFIDX_BIT_OFFSET (66)
762#define MV1_REFIDX_BYTE_OFFSET (MV1_REFIDX_BIT_OFFSET / 8)
763#define MV1_REFIDX_BIT_POSITION (MV1_REFIDX_BIT_OFFSET % 8)
764#define MV1_REFIDX_BITS (2)
765
766#define MV1_MVX_BIT_OFFSET (68)
767#define MV1_MVX_BYTE_OFFSET (MV1_MVX_BIT_OFFSET / 8)
768#define MV1_MVX_BIT_POSITION (MV1_MVX_BIT_OFFSET % 8)
769#define MV1_MVX_BITS (14)
770
771#define MV1_MVY_BIT_OFFSET (82)
772#define MV1_MVY_BYTE_OFFSET (MV1_MVY_BIT_OFFSET / 8)
773#define MV1_MVY_BIT_POSITION (MV1_MVY_BIT_OFFSET % 8)
774#define MV1_MVY_BITS (14)
775
776#define INTRA_PART_MODE_BIT_OFFSET (34)
777#define INTRA_PART_MODE_BYTE_OFFSET (INTRA_PART_MODE_BIT_OFFSET / 8)
778#define INTRA_PART_MODE_BIT_POSITION (INTRA_PART_MODE_BIT_OFFSET % 8)
779#define INTRA_PART_MODE_BITS (1)
780
781#define INTRA_PRED_MODE0_BIT_OFFSET (35)
782#define INTRA_PRED_MODE0_BYTE_OFFSET (INTRA_PRED_MODE0_BIT_OFFSET / 8)
783#define INTRA_PRED_MODE0_BIT_POSITION (INTRA_PRED_MODE0_BIT_OFFSET % 8)
784#define INTRA_PRED_MODE0_BITS (6)
785
786#define INTRA_PRED_MODE1_BIT_OFFSET (41)
787#define INTRA_PRED_MODE1_BYTE_OFFSET (INTRA_PRED_MODE1_BIT_OFFSET / 8)
788#define INTRA_PRED_MODE1_BIT_POSITION (INTRA_PRED_MODE1_BIT_OFFSET % 8)
789#define INTRA_PRED_MODE1_BITS (6)
790
791#define INTRA_PRED_MODE2_BIT_OFFSET (47)
792#define INTRA_PRED_MODE2_BYTE_OFFSET (INTRA_PRED_MODE2_BIT_OFFSET / 8)
793#define INTRA_PRED_MODE2_BIT_POSITION (INTRA_PRED_MODE2_BIT_OFFSET % 8)
794#define INTRA_PRED_MODE2_BITS (6)
795
796#define INTRA_PRED_MODE3_BIT_OFFSET (53)
797#define INTRA_PRED_MODE3_BYTE_OFFSET (INTRA_PRED_MODE3_BIT_OFFSET / 8)
798#define INTRA_PRED_MODE3_BIT_POSITION (INTRA_PRED_MODE3_BIT_OFFSET % 8)
799#define INTRA_PRED_MODE3_BITS (6)
800
801#define MEAN_BIT_OFFSET (96)
802#define MEAN_BYTE_OFFSET (MEAN_BIT_OFFSET / 8)
803#define MEAN_BIT_POSITION (MEAN_BIT_OFFSET % 8)
804#define MEAN_BITS (10)
805
806#define VARIANCE_BIT_OFFSET (106)
807#define VARIANCE_BYTE_OFFSET (VARIANCE_BIT_OFFSET / 8)
808#define VARIANCE_BIT_POSITION (VARIANCE_BIT_OFFSET % 8)
809#define VARIANCE_BITS (18)
810
811#define QP_BIT_OFFSET (124)
812#define QP_BYTE_OFFSET (QP_BIT_OFFSET / 8)
813#define QP_BIT_POSITION (QP_BIT_OFFSET % 8)
814#define QP_BITS (6)
815
816#define RDCOST_OTHER_BIT_OFFSET (130)
817#define RDCOST_OTHER_BYTE_OFFSET (RDCOST_OTHER_BIT_OFFSET / 8)
818#define RDCOST_OTHER_BIT_POSITION (RDCOST_OTHER_BIT_OFFSET % 8)
819#define RDCOST_OTHER_BITS (25)
820
821#define INTRACOST_BIT_OFFSET (155)
822#define INTRACOST_BYTE_OFFSET (INTRACOST_BIT_OFFSET / 8)
823#define INTRACOST_BIT_POSITION (INTRACOST_BIT_OFFSET % 8)
824#define INTRACOST_BITS (25)
825
826#define INTERCOST_BIT_OFFSET (180)
827#define INTERCOST_BYTE_OFFSET (INTERCOST_BIT_OFFSET / 8)
828#define INTERCOST_BIT_POSITION (INTERCOST_BIT_OFFSET % 8)
829#define INTERCOST_BITS (25)
830
831#define DUMMY_BIT_OFFSET (205)
832#define DUMMY_BYTE_OFFSET (DUMMY_BIT_OFFSET / 8)
833#define DUMMY_BIT_POSITION (DUMMY_BIT_OFFSET % 8)
834#define DUMMY_BITS (3)
835
836// AVC
837#define AVC_MB_MODE_BIT_OFFSET (0)
838#define AVC_MB_MODE_BYTE_OFFSET (AVC_MB_MODE_BIT_OFFSET / 8)
839#define AVC_MB_MODE_BIT_POSITION (AVC_MB_MODE_BIT_OFFSET % 8)
840#define AVC_MB_MODE_BITS (1)
841
842#define AVC_RDCOST_BIT_OFFSET (1)
843#define AVC_RDCOST_BYTE_OFFSET (AVC_RDCOST_BIT_OFFSET / 8)
844#define AVC_RDCOST_BIT_POSITION (AVC_RDCOST_BIT_OFFSET % 8)
845#define AVC_RDCOST_BITS (25)
846
847#define AVC_INTER_PRED_IDC_BIT_OFFSET (26)
848#define AVC_INTER_PRED_IDC_BYTE_OFFSET (AVC_INTER_PRED_IDC_BIT_OFFSET / 8)
849#define AVC_INTER_PRED_IDC_BIT_POSITION (AVC_INTER_PRED_IDC_BIT_OFFSET % 8)
850#define AVC_INTER_PRED_IDC_BITS (2)
851
852#define AVC_MV0_REFIDX_BIT_OFFSET (28)
853#define AVC_MV0_REFIDX_BYTE_OFFSET (AVC_MV0_REFIDX_BIT_OFFSET / 8)
854#define AVC_MV0_REFIDX_BIT_POSITION (AVC_MV0_REFIDX_BIT_OFFSET % 8)
855#define AVC_MV0_REFIDX_BITS (2)
856
857#define AVC_MV0_MVX_BIT_OFFSET (30)
858#define AVC_MV0_MVX_BYTE_OFFSET (AVC_MV0_MVX_BIT_OFFSET / 8)
859#define AVC_MV0_MVX_BIT_POSITION (AVC_MV0_MVX_BIT_OFFSET % 8)
860#define AVC_MV0_MVX_BITS (14)
861
862#define AVC_MV0_MVY_BIT_OFFSET (44)
863#define AVC_MV0_MVY_BYTE_OFFSET (AVC_MV0_MVY_BIT_OFFSET / 8)
864#define AVC_MV0_MVY_BIT_POSITION (AVC_MV0_MVY_BIT_OFFSET % 8)
865#define AVC_MV0_MVY_BITS (14)
866
867#define AVC_MV1_REFIDX_BIT_OFFSET (58)
868#define AVC_MV1_REFIDX_BYTE_OFFSET (AVC_MV1_REFIDX_BIT_OFFSET / 8)
869#define AVC_MV1_REFIDX_BIT_POSITION (AVC_MV1_REFIDX_BIT_OFFSET % 8)
870#define AVC_MV1_REFIDX_BITS (2)
871
872#define AVC_MV1_MVX_BIT_OFFSET (60)
873#define AVC_MV1_MVX_BYTE_OFFSET (AVC_MV1_MVX_BIT_OFFSET / 8)
874#define AVC_MV1_MVX_BIT_POSITION (AVC_MV1_MVX_BIT_OFFSET % 8)
875#define AVC_MV1_MVX_BITS (14)
876
877#define AVC_MV1_MVY_BIT_OFFSET (74)
878#define AVC_MV1_MVY_BYTE_OFFSET (AVC_MV1_MVY_BIT_OFFSET / 8)
879#define AVC_MV1_MVY_BIT_POSITION (AVC_MV1_MVY_BIT_OFFSET % 8)
880#define AVC_MV1_MVY_BITS (14)
881
882#define AVC_INTRA_PART_MODE_BIT_OFFSET (26)
883#define AVC_INTRA_PART_MODE_BYTE_OFFSET (AVC_INTRA_PART_MODE_BIT_OFFSET / 8)
884#define AVC_INTRA_PART_MODE_BIT_POSITION (AVC_INTRA_PART_MODE_BIT_OFFSET % 8)
885#define AVC_INTRA_PART_MODE_BITS (2)
886
887// AVC CU info matches HEVC CU info starting from MEAN_BIT_OFFSET
888
889typedef struct
890{
891 uint8_t refIdx; /* reference idx in reference list */
892 int16_t mvX; /* horiazontal motion in 1/4 pixel */
893 int16_t mvY; /* vertical motion in 1/4 pixel */
895
896typedef struct
897{
898 uint8_t cuLocationX;
899 uint8_t cuLocationY;
900 uint8_t cuSize;
901 uint8_t cuMode;
902 uint32_t cost;
904 uint32_t costIntraSatd;
905 uint32_t costInterSatd;
906 uint8_t interPredIdc;
911 uint8_t intraPredMode[16];
915 uint8_t qp;
916 uint32_t mean;
917 uint32_t variance;
919// ----- Quadra encoder CU info -----
920
932
933// struct describing resolution change.
934typedef struct _ni_resolution
935{
936 // width
937 int32_t width;
938
939 // height
940 int32_t height;
941
942 // bit depth factor
944
948
949#define NI_MINIMUM_CROPPED_LENGTH 48
955
956typedef struct {
957 uint16_t ui16X;
958 uint16_t ui16Y;
959 uint16_t ui16W;
960 uint16_t ui16H;
962
963typedef struct {
964 int16_t i16Height;
965 int16_t i16Width;
967
968typedef struct {
969 uint8_t ui8Enabled;
971 uint8_t ui8CropMode;
974 // ui8EnablePpuScaleAdapt 0: disable 1: enable long-edge adapt 2: enable short-edge adapt
975 // 3: enable long-edge adapt 4: enable short-edge adapt
976 // 1 and 2 is that default rounding down to 2, and don't check change in area before and after
977 // 3 and 4 is that default rounding up to 2, and will check change in area before and after
980 uint8_t ui8ScaleResCeil; // even is up, odd is down (odd+1)
984
1009
1015
1016typedef struct _ni_segment {
1017 uint32_t ui32RelLba;
1018 uint32_t ui32Size;
1020
1022{
1024 uint16_t ui16Width;
1025 uint16_t ui16Height;
1026 uint16_t ui16Option;
1027 union {
1028 struct {
1030 uint8_t ui8MultiIn;
1031 uint16_t ui16FrameIdx[4];
1032 };
1033 struct {
1034#define NI_MAX_SEGMENT_NUM 4 //at lease 2 inputs once
1038 };
1039 };
1041
1042/*
1043 * ni_scaler_config_t — firmware wire format.
1044 *
1045 * DMA'd directly to the firmware and read as InstScalerParams
1046 * (firmware/fp/inc/scaler_manager.h). Binary layout MUST be identical:
1047 *
1048 * offset 0 filterblit (ui8FilterBlitType)
1049 * offset 1 numInputs (ui8NumberOfInputs)
1050 * offset 2 scaler_param_b (ui16ScaleParamB)
1051 * offset 4 scaler_param_c (ui16ScaleParamC)
1052 * offset 6 kernel_taps (ui8KernelTaps)
1053 * offset 7 ui8Reserved
1054 * offset 8 kernel_array[] (ui16KernelArray, 306 bytes)
1055 */
1056typedef struct _ni_scaler_config
1057{
1058 uint8_t filterblit;
1059 uint8_t numInputs;
1062 uint8_t kernel_taps; /* USER_KERNEL: active taps (1..5) */
1065 uint16_t ui16Reserved[2];
1067
1073
1074// the following enum and struct are copied from firmware/nvme/vpuapi/vpuapi.h
1075/*!*
1076* \brief
1077@verbatim
1078This is an enumeration for declaring SET_PARAM command options. (_T400_ENC encoder only)
1079Depending on this, SET_PARAM command parameter registers from 0x15C have different meanings.
1080
1081@endverbatim
1082*/
1090
1091#define FRAME_CHUNK_INDEX_SIZE 4096
1092#define NI_SESSION_CLOSE_RETRY_MAX 10
1093#define NI_SESSION_CLOSE_RETRY_INTERVAL_US 500000
1094
1095/* This value must agree with the membin size in Quadra firmware */
1096#define NI_HWDESC_UNIFIED_MEMBIN_SIZE 0x187000
1097
1098#define NI_QUADRA_MEMORY_CONFIG_DR 0
1099#define NI_QUADRA_MEMORY_CONFIG_SR 1
1100#define NI_QUADRA_MEMORY_CONFIG_SR2_REMOVE_P2P 2
1101#define NI_QUADRA_MEMORY_CONFIG_SR_4G 3
1102
1103#define NI_P2P_RECV 0
1104#define NI_P2P_SEND 1
1105#define NI_MAX_P2P_SGL_ENTRIES 128
1106/* Maximum bytes per (main) DMA descriptor entry 24 bits wide */
1107#define NI_DMA_SGL_MAX_XFER_SIZE 0x00FFFFFFu
1108
1109#define NI_MAX_AI_NETWORK_BINARY_BUFFER_QUERY_RETRIES 300000
1110#define NI_MAX_DEC_SESSION_READ_QUERY_EOS_RETRIES 15000
1111#define NI_RETRY_INTERVAL_200US 200
1112#define NI_RETRY_INTERVAL_100US 100
1113
1114// size of meta data sent together with bitstream: from f/w encoder to app for FW/SW before rev 6.1
1115#define NI_FW_ENC_BITSTREAM_META_DATA_SIZE 32
1116// size of meta data sent together with bitstream: from f/w encoder to app for FW/SW before rev 6.o
1117#define NI_FW_ENC_BITSTREAM_META_DATA_SIZE_UNDER_MAJOR_6_MINOR_o 48
1118// size of meta data sent together with bitstream: from f/w encoder to app for FW/SW before rev 6rc
1119#define NI_FW_ENC_BITSTREAM_META_DATA_SIZE_UNDER_MAJOR_6_MINOR_rc 88
1120// size of meta data sent together with bitstream: from f/w encoder to app for FW/SW before rev 6sM
1121#define NI_FW_ENC_BITSTREAM_META_DATA_SIZE_UNDER_MAJOR_6_MINOR_sM 112
1122
1123// Log delimiter definitions
1124#define FW_LOG_START_DELIMITER_0 0x5A
1125#define FW_LOG_START_DELIMITER_1 0xA5
1126#define FW_LOG_END_DELIMITER_0 0xA5
1127#define FW_LOG_END_DELIMITER_1 0x5A
1128
1132typedef struct {
1133 uint8_t start_marker[2];
1134 uint8_t timestamp[8]; // Little-endian timestamp
1135 uint8_t key[4];
1137
1141typedef struct {
1142 uint8_t end_marker[2];
1144
1148typedef struct {
1149 const uint8_t* start_ptr; // Pointer to log start
1150 const uint8_t* end_ptr; // Pointer after end marker
1151 uint64_t timestamp; // Extracted timestamp
1154
1155
1156int ni_create_frame(ni_frame_t* p_frame, uint32_t read_length,
1157 uint64_t* frame_offset, uint32_t* frame_dropped, bool is_hw_frame);
1158
1160 ni_encoder_config_t *p_cfg,
1161 ni_xcoder_params_t *p_src);
1163 ni_decoder_config_t *p_cfg,
1164 ni_xcoder_params_t *p_src,
1165 uint32_t max_pkt_size);
1168 ni_encoder_config_t *p_cfg,
1169 ni_xcoder_params_t *p_src,
1170 char *p_param_err,
1171 uint32_t max_err_len);
1173 ni_session_context_t *p_ctx,
1174 ni_decoder_config_t *p_cfg,
1175 char *p_param_err,
1176 uint32_t max_err_len);
1177
1179 ni_xcoder_params_t *p_src, char *param_err,
1180 uint32_t max_err_len);
1181ni_retcode_t ni_check_ratecontrol_params(ni_encoder_config_t* p_cfg, char* param_err, uint32_t max_err_len);
1182
1183void ni_params_print(ni_xcoder_params_t *const p_encoder_params);
1184
1185int32_t ni_get_frame_index(uint32_t* value);
1187 ni_device_handle_t device_handle, bool device_in_ctxt);
1188
1190 ni_device_type_t device_type);
1192 ni_device_type_t device_type, void *detail_data, int ver);
1193
1199
1202
1209//int ni_encoder_session_reconfig(ni_session_context_t *p_ctx, ni_session_config_t *p_config, ni_param_change_flags_t change_flags);
1210
1212ni_retcode_t ni_query_detail_status(ni_session_context_t* p_ctx, ni_device_type_t device_type, void* p_detail_status, int ver);
1213
1216
1218ni_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);
1221 ni_device_type_t device_type,
1222 ni_session_statistic_t *p_session_statistic);
1223
1224ni_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);
1233void ni_encoder_set_vui(uint8_t* vui, ni_encoder_config_t *p_cfg);
1234void *ni_session_keep_alive_thread(void *arguments);
1235ni_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);
1236void ni_fix_VUI(uint8_t *vui, int pos, int value);
1237
1238/*!******************************************************************************
1239* \brief Copy a xcoder decoder worker thread info and card info
1240*
1241* \param
1242*
1243* \return
1244*******************************************************************************/
1246/*!******************************************************************************
1247* \brief Copy a xcoder decoder worker thread info and card info
1248*
1249* \param
1250*
1251* \return
1252*******************************************************************************/
1254/*!******************************************************************************
1255* \brief Open a xcoder uploader instance
1256*
1257* \param p_ctx - pointer to caller allocated uploader session context
1258*
1259* \return
1260* On success
1261* NI_RETCODE_SUCCESS
1262*
1263* On failure
1264* NI_RETCODE_INVALID_PARAM
1265* NI_RETCODE_ERROR_MEM_ALOC
1266* NI_RETCODE_ERROR_INVALID_SESSION
1267* NI_RETCODE_FAILURE
1268*******************************************************************************/
1270
1271/*!******************************************************************************
1272* \brief Close an xcoder upload instance
1273*
1274* \param p_ctx pointer to uploader session context
1275*
1276* \return NI_RETCODE_SUCCESS
1277*******************************************************************************/
1279
1280
1281/*!******************************************************************************
1282* \brief Query and acquire buffer from xcoder scale instance
1283*
1284* \param p_ctx pointer to scaler session context
1285*
1286* \return
1287* On success
1288* NI_RETCODE_SUCCESS
1289* On failure
1290* NI_RETCODE_ERROR_INVALID_SESSION
1291* NI_RETCODE_ERROR_MEM_ALOC
1292* NI_RETCODE_ERROR_NVME_CMD_FAILED
1293* NI_RETCODE_FAILURE
1294*******************************************************************************/
1296
1297
1298/*!******************************************************************************
1299* \brief Query and acquire buffer from xcoder upload instance
1300*
1301* \param p_ctx pointer to uploader session context
1302*
1303* \return
1304* On success
1305* NI_RETCODE_SUCCESS
1306* On error
1307* NI_RETCODE_ERROR_INVALID_SESSION
1308* NI_RETCODE_ERROR_MEM_ALOC
1309*******************************************************************************/
1311
1312
1313/*!******************************************************************************
1314* \brief Send a YUV p_frame to upload session
1315*
1316* \param
1317*
1318* \return
1319*******************************************************************************/
1321 niFrameSurface1_t *hwdesc);
1322
1323/*!******************************************************************************
1324* \brief Retrieve a HW descriptor of uploaded frame
1325*
1326* \param p_ctx pointer to uploader session context
1327* hwdesc pointer to hw descriptor
1328*
1329* \return
1330* On success
1331* NI_RETCODE_SUCCESS
1332* On failure
1333* NI_RETCODE_INVALID_PARAM
1334* NI_RETCODE_ERROR_INVALID_SESSION
1335* NI_RETCODE_FAILURE
1336*******************************************************************************/
1338 niFrameSurface1_t *hwdesc);
1339
1340/*!******************************************************************************
1341* \brief Retrieve a YUV p_frame from decoder
1342*
1343* \param
1344*
1345* \return
1346*******************************************************************************/
1348
1349/*!******************************************************************************
1350* \brief Retrieve a YUV p_frame by frame index
1351*
1352* \param
1353*
1354* \return
1355*******************************************************************************/
1356int ni_hwdownload_by_frame_idx(niFrameSurface1_t* hwdesc, ni_frame_t* p_frame, int is_auto_dl);
1357
1358/*!******************************************************************************
1359* \brief Copy a src hw frame to a dst hw frame
1360*
1361* \param
1362*
1363* \return
1364*******************************************************************************/
1366 ni_frameclone_desc_t *p_frameclone_desc);
1367
1368/*!*****************************************************************************
1369* \brief clear a particular xcoder instance buffer/data
1370*
1371* \param niFrameSurface1_t* surface - target hardware descriptor
1372*
1373* \return - NI_RETCODE_SUCCESS on success, NI_RETCODE_ERROR_INVALID_SESSION,
1374* or NI_RETCODE_ERROR_NVME_CMD_FAILED on
1375* failure
1376******************************************************************************/
1378
1379/*!******************************************************************************
1380 * \brief condif a scaler instance
1381 *
1382 * \param[in] p_ctx pointer to session context
1383 * \param[in] p_params pointer to scaler parameters
1384 *
1385 * \return NI_RETCODE_INVALID_PARAM
1386 * NI_RETCODE_ERROR_INVALID_SESSION
1387 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1388 * NI_RETCODE_ERROR_MEM_ALOC
1389 *******************************************************************************/
1391 ni_scaler_params_t *p_params);
1392
1393/*!******************************************************************************
1394 * \brief allocate a frame in the scaler
1395 *
1396 * \param[in] p_ctx pointer to session context
1397 * \param[in] width width in pixels
1398 * \param[in] height height in pixels
1399 * \param[in] format pixel format
1400 * \param[in] options option flags
1401 * \param[in] rectangle_width clipping rectangle width in pixels
1402 * \param[in] rectangle_height clipping rectangle height in pixels
1403 * \param[in] rectangle_x clipping rectangle x position
1404 * \param[in] rectangle_y clipping rectangle y position
1405 * \param[in] rgba_color background colour (only used by pad filter)
1406 * \param[in] frame_index frame index (only for hardware frames)
1407 *
1408 * \return NI_RETCODE_INVALID_PARAM
1409 * NI_RETCODE_ERROR_INVALID_SESSION
1410 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1411 * NI_RETCODE_ERROR_MEM_ALOC
1412 *******************************************************************************/
1414 int height, int format, int options,
1415 int rectangle_width,int rectangle_height,
1416 int rectangle_x, int rectangle_y,
1417 int rgba_color, int frame_index);
1418
1419/*!******************************************************************************
1420 * \brief config frame in the scaler
1421 *
1422 * \param[in] p_ctx pointer to session context
1423 * \param[in] p_cfg pointer to frame config
1424 *
1425 * \return NI_RETCODE_INVALID_PARAM
1426 * NI_RETCODE_ERROR_INVALID_SESSION
1427 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1428 * NI_RETCODE_ERROR_MEM_ALOC
1429 *******************************************************************************/
1431 ni_frame_config_t *p_cfg);
1432
1433/*!******************************************************************************
1434 * \brief config multi frames in the scaler
1435 *
1436 * \param[in] p_ctx pointer to session context
1437 * \param[in] p_cfg_in pointer to input frame config array
1438 * \param[in] numInCfgs number of input frame configs in p_cfg_in array
1439 * \param[in] p_cfg_out pointer to output frame config
1440 *
1441 * \return NI_RETCODE_INVALID_PARAM
1442 * NI_RETCODE_ERROR_INVALID_SESSION
1443 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1444 * NI_RETCODE_ERROR_MEM_ALOC
1445 *******************************************************************************/
1447 ni_frame_config_t p_cfg_in[],
1448 int numInCfgs,
1449 ni_frame_config_t *p_cfg_out);
1450
1451/*!******************************************************************************
1452 * \brief Open a xcoder scaler instance
1453 *
1454 * \param[in] p_ctx pointer to session context
1455 *
1456 * \return NI_RETCODE_INVALID_PARAM
1457 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1458 * NI_RETCODE_ERROR_INVALID_SESSION
1459 * NI_RETCODE_ERROR_MEM_ALOC
1460 *******************************************************************************/
1462
1463/*!******************************************************************************
1464 * \brief close a scaler session
1465 *
1466 * \param[in] p_ctx pointer to session context
1467 * \param[in] eos_received (not used)
1468 *
1469 * \return NI_RETCODE_INVALID_PARAM
1470 * NI_RETCODE_ERROR_INVALID_SESSION
1471 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1472 *******************************************************************************/
1474
1475/*!******************************************************************************
1476* \brief Send a p_config command to configure uploading parameters.
1477*
1478* \param ni_session_context_t p_ctx - xcoder Context
1479* \param[in] pool_size pool size to create
1480* \param[in] pool 0 = normal pool, 1 = P2P pool
1481*
1482* \return - NI_RETCODE_SUCCESS on success,
1483* NI_RETCODE_ERROR_INVALID_SESSION
1484* NI_RETCODE_ERROR_NVME_CMD_FAILED on failure
1485*******************************************************************************/
1487 uint32_t pool_size,
1488 uint32_t pool);
1489
1490/*!******************************************************************************
1491 * \brief read a hardware descriptor from a scaler session
1492 *
1493 * \param[in] p_ctx pointer to session context
1494 * \param[out] p_frame pointer to frame to write hw descriptor
1495 *
1496 * \return NI_RETCODE_INVALID_PARAM
1497 * NI_RETCODE_ERROR_INVALID_SESSION
1498 * NI_RETCODE_ERROR_MEM_ALOC
1499 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1500 * NI_RETCODE_FAILURE
1501 *******************************************************************************/
1503 ni_session_context_t *p_ctx,
1504 ni_frame_t *p_frame);
1505
1506/*!******************************************************************************
1507* \brief Grab bitdepth factor from NI_PIX_FMT
1508*
1509* \param[in] pix_fmt ni_pix_fmt_t
1510*
1511* \return 1 or 2
1512*******************************************************************************/
1513int ni_get_bitdepth_factor_from_pixfmt(int pix_fmt);
1514
1515/*!******************************************************************************
1516* \brief Grab planar info from NI_PIX_FMT
1517*
1518* \param[in] pix_fmt ni_pix_fmt_t
1519*
1520* \return 0 or 1 for success, -1 for error
1521*******************************************************************************/
1522int ni_get_planar_from_pixfmt(int pix_fmt);
1523
1524#ifndef _WIN32
1525/*!*****************************************************************************
1526 * \brief Get an address offset from a hw descriptor
1527 *
1528 * \param[in] p_ctx ni_session_context_t to be referenced
1529 * \param[in] hwdesc Pointer to caller allocated niFrameSurface1_t
1530 * \param[out] p_offset Value of offset
1531 *
1532 * \return On success NI_RETCODE_SUCCESS
1533 * On failure NI_RETCODE_INVALID_PARAM
1534 ******************************************************************************/
1536 uint32_t *p_offset);
1537
1538#endif
1539
1540/*!*****************************************************************************
1541 * \brief Get DDR configuration of Quadra device
1542 *
1543 * \param[in/out] p_ctx pointer to a session context with valid file handle
1544 *
1545 * \return On success NI_RETCODE_SUCCESS
1546 * On failure NI_RETCODE_INVALID_PARAM
1547 * NI_RETCODE_ERROR_MEM_ALOC
1548 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1549 ******************************************************************************/
1551
1552/*!*****************************************************************************
1553 * \brief Set DDR configuration of Quadra device
1554 *
1555 * \param[in] p_ctx pointer to a session context with valid file handle
1556 * \param[in] ddr_priority_mode ddr priority mode
1557 *
1558 * \return On success NI_RETCODE_SUCCESS
1559 * On failure NI_RETCODE_INVALID_PARAM
1560 * NI_RETCODE_ERROR_MEM_ALOC
1561 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1562 ******************************************************************************/
1564 uint8_t ddr_priority_mode);
1565
1566
1567#define NI_AI_HW_ALIGN_SIZE 64
1568
1570ni_retcode_t ni_ai_session_close(ni_session_context_t *p_ctx, int eos_received);
1572 void *nb_data, uint32_t nb_size);
1576 ni_frame_t *p_frame);
1578 ni_packet_t *p_packet);
1580 ni_network_data_t *p_network);
1582 int height, int options, int pool_size,
1583 int frame_index);
1585 niFrameSurface1_t *p_out_surface);
1587 ni_frame_config_t p_cfg_in[],
1588 int numInCfgs,
1589 ni_frame_config_t *p_cfg_out);
1590
1592 ni_frame_t *p_frame);
1593/*!*****************************************************************************
1594 * \brief Allocate memory for the metadata header and auxillary data for
1595 * encoder input data.
1596 *
1597 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
1598 *
1599 * \param[in] extra_len Length header and auxillary data
1600 *
1601 * \return On success
1602 * NI_RETCODE_SUCCESS
1603 * On failure
1604 * NI_RETCODE_INVALID_PARAM
1605 * NI_RETCODE_ERROR_MEM_ALOC
1606 *****************************************************************************/
1608 int extra_len);
1609
1611
1613 ni_network_perf_metrics_t *p_metrics);
1614
1615
1616/*!*****************************************************************************
1617 * \brief Send namespace num / Opmode and SRIOv index/value to the device with
1618 * specified logic block address.
1619 *
1620 * \param[in] device_handle Device handle obtained by calling ni_device_open
1621 * \param[in] Key Represents either namespace num or opmode
1622 * \param[in] Value Represents either SRIOv index or opmode value
1623 *
1624 * \return On success
1625 * NI_RETCODE_SUCCESS
1626 * On failure
1627 * NI_RETCODE_ERROR_MEM_ALOC
1628 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1629 ******************************************************************************/
1630ni_retcode_t ni_device_config_ns_qos(ni_device_handle_t device_handle,
1631 uint32_t key, uint32_t value);
1632
1633ni_retcode_t ni_dump_log_single_core(ni_session_context_t *p_ctx, void* p_data, uint32_t core_id, bool gen_log_file);
1634ni_retcode_t ni_dump_log_all_cores(ni_session_context_t *p_ctx, void* p_data, bool gen_log_file);
1635ni_retcode_t ni_dump_log_artifacts(ni_session_context_t *p_ctx, bool gen_artifacts_file);
1636ni_retcode_t ni_send_to_target_v2(ni_session_context_t *pSession, ni_frame_t *pSrcFrame, const ni_p2p_sgl_t *dmaAddrs);
1637ni_retcode_t ni_recv_from_target(ni_session_context_t *pSession, const ni_p2p_sgl_t *dmaAddrs, ni_frame_t *pDstFrame);
1638int lower_pixel_rate(const ni_load_query_t *pQuery, uint32_t ui32CurrentLowest);
1640 void *p_dec_ppu_config, int buffer_size);
1641
1642/*!******************************************************************************
1643 * \brief set cpu affinity based on numa node
1644 *
1645 * \param[in] p_ctx pointer to session context
1646 *
1647 * \return NI_RETCODE_SUCCESS
1648 * NI_RETCODE_ERROR_MEM_ALOC
1649 *******************************************************************************/
1651
1652#ifdef __cplusplus
1653}
1654#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:447
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_SCALER_KERNEL_SLOTS
#define NI_MAX_SPATIAL_LAYERS
#define NI_SCALER_KERNEL_POSITIONS
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:1660
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)
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_dump_log_artifacts(ni_session_context_t *p_ctx, bool gen_artifacts_file)
Read log artifacts (tar.gz) from the device via NVMe and write them to "artifacts_slot_s_dddd....
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.
struct _ni_enc_timecode_raw ni_timecode_raw_t
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]
uint16_t kernel_array[2][NI_SCALER_KERNEL_POSITIONS *NI_SCALER_KERNEL_SLOTS]
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