libxcoder 5.8.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;
707
708
709// ----- Quadra encoder CU info -----
710#define CU_INFO_OUTPUT_SIZE_V1 26 //208 bits
711#define CU_INFO_OUTPUT_SIZE_V2 16 //128 bits
712#define CU_INFO_OUTPUT_SIZE_V3 19 //152 bits
713
714// HEVC & AV1
715#define CU_LOCATION_HOR_BIT_OFFSET (0)
716#define CU_LOCATION_HOR_BYTE_OFFSET (CU_LOCATION_HOR_BIT_OFFSET / 8)
717#define CU_LOCATION_HOR_BIT_POSITION (CU_LOCATION_HOR_BIT_OFFSET % 8)
718#define CU_LOCATION_HOR_BITS (3)
719
720#define CU_LOCATION_VER_BIT_OFFSET (3)
721#define CU_LOCATION_VER_BYTE_OFFSET (CU_LOCATION_VER_BIT_OFFSET / 8)
722#define CU_LOCATION_VER_BIT_POSITION (CU_LOCATION_VER_BIT_OFFSET % 8)
723#define CU_LOCATION_VER_BITS (3)
724
725#define CU_SIZE_BIT_OFFSET (6)
726#define CU_SIZE_BYTE_OFFSET (CU_SIZE_BIT_OFFSET / 8)
727#define CU_SIZE_BIT_POSITION (CU_SIZE_BIT_OFFSET % 8)
728#define CU_SIZE_BITS (2)
729
730#define CU_MODE_BIT_OFFSET (8)
731#define CU_MODE_BYTE_OFFSET (CU_MODE_BIT_OFFSET / 8)
732#define CU_MODE_BIT_POSITION (CU_MODE_BIT_OFFSET % 8)
733#define CU_MODE_BITS (1)
734
735#define RDCOST_BIT_OFFSET (9)
736#define RDCOST_BYTE_OFFSET (RDCOST_BIT_OFFSET / 8)
737#define RDCOST_BIT_POSITION (RDCOST_BIT_OFFSET % 8)
738#define RDCOST_BITS (25)
739
740#define INTER_PRED_IDC_BIT_OFFSET (34)
741#define INTER_PRED_IDC_BYTE_OFFSET (INTER_PRED_IDC_BIT_OFFSET / 8)
742#define INTER_PRED_IDC_BIT_POSITION (INTER_PRED_IDC_BIT_OFFSET % 8)
743#define INTER_PRED_IDC_BITS (2)
744
745#define MV0_REFIDX_BIT_OFFSET (36)
746#define MV0_REFIDX_BYTE_OFFSET (MV0_REFIDX_BIT_OFFSET / 8)
747#define MV0_REFIDX_BIT_POSITION (MV0_REFIDX_BIT_OFFSET % 8)
748#define MV0_REFIDX_BITS (2)
749
750#define MV0_MVX_BIT_OFFSET (38)
751#define MV0_MVX_BYTE_OFFSET (MV0_MVX_BIT_OFFSET / 8)
752#define MV0_MVX_BIT_POSITION (MV0_MVX_BIT_OFFSET % 8)
753#define MV0_MVX_BITS (14)
754
755#define MV0_MVY_BIT_OFFSET (52)
756#define MV0_MVY_BYTE_OFFSET (MV0_MVY_BIT_OFFSET / 8)
757#define MV0_MVY_BIT_POSITION (MV0_MVY_BIT_OFFSET % 8)
758#define MV0_MVY_BITS (14)
759
760#define MV1_REFIDX_BIT_OFFSET (66)
761#define MV1_REFIDX_BYTE_OFFSET (MV1_REFIDX_BIT_OFFSET / 8)
762#define MV1_REFIDX_BIT_POSITION (MV1_REFIDX_BIT_OFFSET % 8)
763#define MV1_REFIDX_BITS (2)
764
765#define MV1_MVX_BIT_OFFSET (68)
766#define MV1_MVX_BYTE_OFFSET (MV1_MVX_BIT_OFFSET / 8)
767#define MV1_MVX_BIT_POSITION (MV1_MVX_BIT_OFFSET % 8)
768#define MV1_MVX_BITS (14)
769
770#define MV1_MVY_BIT_OFFSET (82)
771#define MV1_MVY_BYTE_OFFSET (MV1_MVY_BIT_OFFSET / 8)
772#define MV1_MVY_BIT_POSITION (MV1_MVY_BIT_OFFSET % 8)
773#define MV1_MVY_BITS (14)
774
775#define INTRA_PART_MODE_BIT_OFFSET (34)
776#define INTRA_PART_MODE_BYTE_OFFSET (INTRA_PART_MODE_BIT_OFFSET / 8)
777#define INTRA_PART_MODE_BIT_POSITION (INTRA_PART_MODE_BIT_OFFSET % 8)
778#define INTRA_PART_MODE_BITS (1)
779
780#define INTRA_PRED_MODE0_BIT_OFFSET (35)
781#define INTRA_PRED_MODE0_BYTE_OFFSET (INTRA_PRED_MODE0_BIT_OFFSET / 8)
782#define INTRA_PRED_MODE0_BIT_POSITION (INTRA_PRED_MODE0_BIT_OFFSET % 8)
783#define INTRA_PRED_MODE0_BITS (6)
784
785#define INTRA_PRED_MODE1_BIT_OFFSET (41)
786#define INTRA_PRED_MODE1_BYTE_OFFSET (INTRA_PRED_MODE1_BIT_OFFSET / 8)
787#define INTRA_PRED_MODE1_BIT_POSITION (INTRA_PRED_MODE1_BIT_OFFSET % 8)
788#define INTRA_PRED_MODE1_BITS (6)
789
790#define INTRA_PRED_MODE2_BIT_OFFSET (47)
791#define INTRA_PRED_MODE2_BYTE_OFFSET (INTRA_PRED_MODE2_BIT_OFFSET / 8)
792#define INTRA_PRED_MODE2_BIT_POSITION (INTRA_PRED_MODE2_BIT_OFFSET % 8)
793#define INTRA_PRED_MODE2_BITS (6)
794
795#define INTRA_PRED_MODE3_BIT_OFFSET (53)
796#define INTRA_PRED_MODE3_BYTE_OFFSET (INTRA_PRED_MODE3_BIT_OFFSET / 8)
797#define INTRA_PRED_MODE3_BIT_POSITION (INTRA_PRED_MODE3_BIT_OFFSET % 8)
798#define INTRA_PRED_MODE3_BITS (6)
799
800#define MEAN_BIT_OFFSET (96)
801#define MEAN_BYTE_OFFSET (MEAN_BIT_OFFSET / 8)
802#define MEAN_BIT_POSITION (MEAN_BIT_OFFSET % 8)
803#define MEAN_BITS (10)
804
805#define VARIANCE_BIT_OFFSET (106)
806#define VARIANCE_BYTE_OFFSET (VARIANCE_BIT_OFFSET / 8)
807#define VARIANCE_BIT_POSITION (VARIANCE_BIT_OFFSET % 8)
808#define VARIANCE_BITS (18)
809
810#define QP_BIT_OFFSET (124)
811#define QP_BYTE_OFFSET (QP_BIT_OFFSET / 8)
812#define QP_BIT_POSITION (QP_BIT_OFFSET % 8)
813#define QP_BITS (6)
814
815#define RDCOST_OTHER_BIT_OFFSET (130)
816#define RDCOST_OTHER_BYTE_OFFSET (RDCOST_OTHER_BIT_OFFSET / 8)
817#define RDCOST_OTHER_BIT_POSITION (RDCOST_OTHER_BIT_OFFSET % 8)
818#define RDCOST_OTHER_BITS (25)
819
820#define INTRACOST_BIT_OFFSET (155)
821#define INTRACOST_BYTE_OFFSET (INTRACOST_BIT_OFFSET / 8)
822#define INTRACOST_BIT_POSITION (INTRACOST_BIT_OFFSET % 8)
823#define INTRACOST_BITS (25)
824
825#define INTERCOST_BIT_OFFSET (180)
826#define INTERCOST_BYTE_OFFSET (INTERCOST_BIT_OFFSET / 8)
827#define INTERCOST_BIT_POSITION (INTERCOST_BIT_OFFSET % 8)
828#define INTERCOST_BITS (25)
829
830#define DUMMY_BIT_OFFSET (205)
831#define DUMMY_BYTE_OFFSET (DUMMY_BIT_OFFSET / 8)
832#define DUMMY_BIT_POSITION (DUMMY_BIT_OFFSET % 8)
833#define DUMMY_BITS (3)
834
835// AVC
836#define AVC_MB_MODE_BIT_OFFSET (0)
837#define AVC_MB_MODE_BYTE_OFFSET (AVC_MB_MODE_BIT_OFFSET / 8)
838#define AVC_MB_MODE_BIT_POSITION (AVC_MB_MODE_BIT_OFFSET % 8)
839#define AVC_MB_MODE_BITS (1)
840
841#define AVC_RDCOST_BIT_OFFSET (1)
842#define AVC_RDCOST_BYTE_OFFSET (AVC_RDCOST_BIT_OFFSET / 8)
843#define AVC_RDCOST_BIT_POSITION (AVC_RDCOST_BIT_OFFSET % 8)
844#define AVC_RDCOST_BITS (25)
845
846#define AVC_INTER_PRED_IDC_BIT_OFFSET (26)
847#define AVC_INTER_PRED_IDC_BYTE_OFFSET (AVC_INTER_PRED_IDC_BIT_OFFSET / 8)
848#define AVC_INTER_PRED_IDC_BIT_POSITION (AVC_INTER_PRED_IDC_BIT_OFFSET % 8)
849#define AVC_INTER_PRED_IDC_BITS (2)
850
851#define AVC_MV0_REFIDX_BIT_OFFSET (28)
852#define AVC_MV0_REFIDX_BYTE_OFFSET (AVC_MV0_REFIDX_BIT_OFFSET / 8)
853#define AVC_MV0_REFIDX_BIT_POSITION (AVC_MV0_REFIDX_BIT_OFFSET % 8)
854#define AVC_MV0_REFIDX_BITS (2)
855
856#define AVC_MV0_MVX_BIT_OFFSET (30)
857#define AVC_MV0_MVX_BYTE_OFFSET (AVC_MV0_MVX_BIT_OFFSET / 8)
858#define AVC_MV0_MVX_BIT_POSITION (AVC_MV0_MVX_BIT_OFFSET % 8)
859#define AVC_MV0_MVX_BITS (14)
860
861#define AVC_MV0_MVY_BIT_OFFSET (44)
862#define AVC_MV0_MVY_BYTE_OFFSET (AVC_MV0_MVY_BIT_OFFSET / 8)
863#define AVC_MV0_MVY_BIT_POSITION (AVC_MV0_MVY_BIT_OFFSET % 8)
864#define AVC_MV0_MVY_BITS (14)
865
866#define AVC_MV1_REFIDX_BIT_OFFSET (58)
867#define AVC_MV1_REFIDX_BYTE_OFFSET (AVC_MV1_REFIDX_BIT_OFFSET / 8)
868#define AVC_MV1_REFIDX_BIT_POSITION (AVC_MV1_REFIDX_BIT_OFFSET % 8)
869#define AVC_MV1_REFIDX_BITS (2)
870
871#define AVC_MV1_MVX_BIT_OFFSET (60)
872#define AVC_MV1_MVX_BYTE_OFFSET (AVC_MV1_MVX_BIT_OFFSET / 8)
873#define AVC_MV1_MVX_BIT_POSITION (AVC_MV1_MVX_BIT_OFFSET % 8)
874#define AVC_MV1_MVX_BITS (14)
875
876#define AVC_MV1_MVY_BIT_OFFSET (74)
877#define AVC_MV1_MVY_BYTE_OFFSET (AVC_MV1_MVY_BIT_OFFSET / 8)
878#define AVC_MV1_MVY_BIT_POSITION (AVC_MV1_MVY_BIT_OFFSET % 8)
879#define AVC_MV1_MVY_BITS (14)
880
881#define AVC_INTRA_PART_MODE_BIT_OFFSET (26)
882#define AVC_INTRA_PART_MODE_BYTE_OFFSET (AVC_INTRA_PART_MODE_BIT_OFFSET / 8)
883#define AVC_INTRA_PART_MODE_BIT_POSITION (AVC_INTRA_PART_MODE_BIT_OFFSET % 8)
884#define AVC_INTRA_PART_MODE_BITS (2)
885
886// AVC CU info matches HEVC CU info starting from MEAN_BIT_OFFSET
887
888typedef struct
889{
890 uint8_t refIdx; /* reference idx in reference list */
891 int16_t mvX; /* horiazontal motion in 1/4 pixel */
892 int16_t mvY; /* vertical motion in 1/4 pixel */
894
895typedef struct
896{
897 uint8_t cuLocationX;
898 uint8_t cuLocationY;
899 uint8_t cuSize;
900 uint8_t cuMode;
901 uint32_t cost;
903 uint32_t costIntraSatd;
904 uint32_t costInterSatd;
905 uint8_t interPredIdc;
910 uint8_t intraPredMode[16];
914 uint8_t qp;
915 uint32_t mean;
916 uint32_t variance;
918// ----- Quadra encoder CU info -----
919
931
932// struct describing resolution change.
933typedef struct _ni_resolution
934{
935 // width
936 int32_t width;
937
938 // height
939 int32_t height;
940
941 // bit depth factor
943
947
948#define NI_MINIMUM_CROPPED_LENGTH 48
954
955typedef struct {
956 uint16_t ui16X;
957 uint16_t ui16Y;
958 uint16_t ui16W;
959 uint16_t ui16H;
961
962typedef struct {
963 int16_t i16Height;
964 int16_t i16Width;
966
967typedef struct {
968 uint8_t ui8Enabled;
970 uint8_t ui8CropMode;
973 // ui8EnablePpuScaleAdapt 0: disable 1: enable long-edge adapt 2: enable short-edge adapt
974 // 3: enable long-edge adapt 4: enable short-edge adapt
975 // 1 and 2 is that default rounding down to 2, and don't check change in area before and after
976 // 3 and 4 is that default rounding up to 2, and will check change in area before and after
979 uint8_t ui8ScaleResCeil; // even is up, odd is down (odd+1)
983
1008
1014
1015typedef struct _ni_segment {
1016 uint32_t ui32RelLba;
1017 uint32_t ui32Size;
1019
1021{
1023 uint16_t ui16Width;
1024 uint16_t ui16Height;
1025 uint16_t ui16Option;
1026 union {
1027 struct {
1029 uint8_t ui8MultiIn;
1030 uint16_t ui16FrameIdx[4];
1031 };
1032 struct {
1033#define NI_MAX_SEGMENT_NUM 4 //at lease 2 inputs once
1037 };
1038 };
1040
1041/*
1042 * ni_scaler_config_t — firmware wire format.
1043 *
1044 * DMA'd directly to the firmware and read as InstScalerParams
1045 * (firmware/fp/inc/scaler_manager.h). Binary layout MUST be identical:
1046 *
1047 * offset 0 filterblit (ui8FilterBlitType)
1048 * offset 1 numInputs (ui8NumberOfInputs)
1049 * offset 2 scaler_param_b (ui16ScaleParamB)
1050 * offset 4 scaler_param_c (ui16ScaleParamC)
1051 * offset 6 kernel_taps (ui8KernelTaps)
1052 * offset 7 ui8Reserved
1053 * offset 8 kernel_array[] (ui16KernelArray, 306 bytes)
1054 */
1055typedef struct _ni_scaler_config
1056{
1057 uint8_t filterblit;
1058 uint8_t numInputs;
1061 uint8_t kernel_taps; /* USER_KERNEL: active taps (1..5) */
1064 uint16_t ui16Reserved[2];
1066
1072
1073// the following enum and struct are copied from firmware/nvme/vpuapi/vpuapi.h
1074/*!*
1075* \brief
1076@verbatim
1077This is an enumeration for declaring SET_PARAM command options. (_T400_ENC encoder only)
1078Depending on this, SET_PARAM command parameter registers from 0x15C have different meanings.
1079
1080@endverbatim
1081*/
1089
1090#define FRAME_CHUNK_INDEX_SIZE 4096
1091#define NI_SESSION_CLOSE_RETRY_MAX 10
1092#define NI_SESSION_CLOSE_RETRY_INTERVAL_US 500000
1093
1094/* This value must agree with the membin size in Quadra firmware */
1095#define NI_HWDESC_UNIFIED_MEMBIN_SIZE 0x187000
1096
1097#define NI_QUADRA_MEMORY_CONFIG_DR 0
1098#define NI_QUADRA_MEMORY_CONFIG_SR 1
1099#define NI_QUADRA_MEMORY_CONFIG_SR2_REMOVE_P2P 2
1100#define NI_QUADRA_MEMORY_CONFIG_SR_4G 3
1101
1102#define NI_P2P_RECV 0
1103#define NI_P2P_SEND 1
1104#define NI_MAX_P2P_SGL_ENTRIES 128
1105/* Maximum bytes per (main) DMA descriptor entry 24 bits wide */
1106#define NI_DMA_SGL_MAX_XFER_SIZE 0x00FFFFFFu
1107
1108#define NI_MAX_AI_NETWORK_BINARY_BUFFER_QUERY_RETRIES 300000
1109#define NI_MAX_DEC_SESSION_READ_QUERY_EOS_RETRIES 15000
1110#define NI_RETRY_INTERVAL_200US 200
1111#define NI_RETRY_INTERVAL_100US 100
1112
1113// size of meta data sent together with bitstream: from f/w encoder to app for FW/SW before rev 6.1
1114#define NI_FW_ENC_BITSTREAM_META_DATA_SIZE 32
1115// size of meta data sent together with bitstream: from f/w encoder to app for FW/SW before rev 6.o
1116#define NI_FW_ENC_BITSTREAM_META_DATA_SIZE_UNDER_MAJOR_6_MINOR_o 48
1117// size of meta data sent together with bitstream: from f/w encoder to app for FW/SW before rev 6rc
1118#define NI_FW_ENC_BITSTREAM_META_DATA_SIZE_UNDER_MAJOR_6_MINOR_rc 88
1119// size of meta data sent together with bitstream: from f/w encoder to app for FW/SW before rev 6sM
1120#define NI_FW_ENC_BITSTREAM_META_DATA_SIZE_UNDER_MAJOR_6_MINOR_sM 112
1121
1122// Log delimiter definitions
1123#define FW_LOG_START_DELIMITER_0 0x5A
1124#define FW_LOG_START_DELIMITER_1 0xA5
1125#define FW_LOG_END_DELIMITER_0 0xA5
1126#define FW_LOG_END_DELIMITER_1 0x5A
1127
1131typedef struct {
1132 uint8_t start_marker[2];
1133 uint8_t timestamp[8]; // Little-endian timestamp
1134 uint8_t key[4];
1136
1140typedef struct {
1141 uint8_t end_marker[2];
1143
1147typedef struct {
1148 const uint8_t* start_ptr; // Pointer to log start
1149 const uint8_t* end_ptr; // Pointer after end marker
1150 uint64_t timestamp; // Extracted timestamp
1153
1154
1155int ni_create_frame(ni_frame_t* p_frame, uint32_t read_length,
1156 uint64_t* frame_offset, uint32_t* frame_dropped, bool is_hw_frame);
1157
1159 ni_encoder_config_t *p_cfg,
1160 ni_xcoder_params_t *p_src);
1162 ni_decoder_config_t *p_cfg,
1163 ni_xcoder_params_t *p_src,
1164 uint32_t max_pkt_size);
1167 ni_encoder_config_t *p_cfg,
1168 ni_xcoder_params_t *p_src,
1169 char *p_param_err,
1170 uint32_t max_err_len);
1172 ni_session_context_t *p_ctx,
1173 ni_decoder_config_t *p_cfg,
1174 char *p_param_err,
1175 uint32_t max_err_len);
1176
1178 ni_xcoder_params_t *p_src, char *param_err,
1179 uint32_t max_err_len);
1180ni_retcode_t ni_check_ratecontrol_params(ni_encoder_config_t* p_cfg, char* param_err, uint32_t max_err_len);
1181
1182void ni_params_print(ni_xcoder_params_t *const p_encoder_params);
1183
1184int32_t ni_get_frame_index(uint32_t* value);
1186 ni_device_handle_t device_handle, bool device_in_ctxt);
1187
1189 ni_device_type_t device_type);
1191 ni_device_type_t device_type, void *detail_data, int ver);
1192
1198
1201
1208//int ni_encoder_session_reconfig(ni_session_context_t *p_ctx, ni_session_config_t *p_config, ni_param_change_flags_t change_flags);
1209
1211ni_retcode_t ni_query_detail_status(ni_session_context_t* p_ctx, ni_device_type_t device_type, void* p_detail_status, int ver);
1212
1215
1217ni_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);
1220 ni_device_type_t device_type,
1221 ni_session_statistic_t *p_session_statistic);
1222
1223ni_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);
1232void ni_encoder_set_vui(uint8_t* vui, ni_encoder_config_t *p_cfg);
1233void *ni_session_keep_alive_thread(void *arguments);
1234ni_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);
1235void ni_fix_VUI(uint8_t *vui, int pos, int value);
1236
1237/*!******************************************************************************
1238* \brief Copy a xcoder decoder worker thread info and card info
1239*
1240* \param
1241*
1242* \return
1243*******************************************************************************/
1245/*!******************************************************************************
1246* \brief Copy a xcoder decoder worker thread info and card info
1247*
1248* \param
1249*
1250* \return
1251*******************************************************************************/
1253/*!******************************************************************************
1254* \brief Open a xcoder uploader instance
1255*
1256* \param p_ctx - pointer to caller allocated uploader session context
1257*
1258* \return
1259* On success
1260* NI_RETCODE_SUCCESS
1261*
1262* On failure
1263* NI_RETCODE_INVALID_PARAM
1264* NI_RETCODE_ERROR_MEM_ALOC
1265* NI_RETCODE_ERROR_INVALID_SESSION
1266* NI_RETCODE_FAILURE
1267*******************************************************************************/
1269
1270/*!******************************************************************************
1271* \brief Close an xcoder upload instance
1272*
1273* \param p_ctx pointer to uploader session context
1274*
1275* \return NI_RETCODE_SUCCESS
1276*******************************************************************************/
1278
1279
1280/*!******************************************************************************
1281* \brief Query and acquire buffer from xcoder scale instance
1282*
1283* \param p_ctx pointer to scaler session context
1284*
1285* \return
1286* On success
1287* NI_RETCODE_SUCCESS
1288* On failure
1289* NI_RETCODE_ERROR_INVALID_SESSION
1290* NI_RETCODE_ERROR_MEM_ALOC
1291* NI_RETCODE_ERROR_NVME_CMD_FAILED
1292* NI_RETCODE_FAILURE
1293*******************************************************************************/
1295
1296
1297/*!******************************************************************************
1298* \brief Query and acquire buffer from xcoder upload instance
1299*
1300* \param p_ctx pointer to uploader session context
1301*
1302* \return
1303* On success
1304* NI_RETCODE_SUCCESS
1305* On error
1306* NI_RETCODE_ERROR_INVALID_SESSION
1307* NI_RETCODE_ERROR_MEM_ALOC
1308*******************************************************************************/
1310
1311
1312/*!******************************************************************************
1313* \brief Send a YUV p_frame to upload session
1314*
1315* \param
1316*
1317* \return
1318*******************************************************************************/
1320 niFrameSurface1_t *hwdesc);
1321
1322/*!******************************************************************************
1323* \brief Retrieve a HW descriptor of uploaded frame
1324*
1325* \param p_ctx pointer to uploader session context
1326* hwdesc pointer to hw descriptor
1327*
1328* \return
1329* On success
1330* NI_RETCODE_SUCCESS
1331* On failure
1332* NI_RETCODE_INVALID_PARAM
1333* NI_RETCODE_ERROR_INVALID_SESSION
1334* NI_RETCODE_FAILURE
1335*******************************************************************************/
1337 niFrameSurface1_t *hwdesc);
1338
1339/*!******************************************************************************
1340* \brief Retrieve a YUV p_frame from decoder
1341*
1342* \param
1343*
1344* \return
1345*******************************************************************************/
1347
1348/*!******************************************************************************
1349* \brief Retrieve a YUV p_frame by frame index
1350*
1351* \param
1352*
1353* \return
1354*******************************************************************************/
1355int ni_hwdownload_by_frame_idx(niFrameSurface1_t* hwdesc, ni_frame_t* p_frame, int is_auto_dl);
1356
1357/*!******************************************************************************
1358* \brief Copy a src hw frame to a dst hw frame
1359*
1360* \param
1361*
1362* \return
1363*******************************************************************************/
1365 ni_frameclone_desc_t *p_frameclone_desc);
1366
1367/*!*****************************************************************************
1368* \brief clear a particular xcoder instance buffer/data
1369*
1370* \param niFrameSurface1_t* surface - target hardware descriptor
1371*
1372* \return - NI_RETCODE_SUCCESS on success, NI_RETCODE_ERROR_INVALID_SESSION,
1373* or NI_RETCODE_ERROR_NVME_CMD_FAILED on
1374* failure
1375******************************************************************************/
1377
1378/*!******************************************************************************
1379 * \brief condif a scaler instance
1380 *
1381 * \param[in] p_ctx pointer to session context
1382 * \param[in] p_params pointer to scaler parameters
1383 *
1384 * \return NI_RETCODE_INVALID_PARAM
1385 * NI_RETCODE_ERROR_INVALID_SESSION
1386 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1387 * NI_RETCODE_ERROR_MEM_ALOC
1388 *******************************************************************************/
1390 ni_scaler_params_t *p_params);
1391
1392/*!******************************************************************************
1393 * \brief allocate a frame in the scaler
1394 *
1395 * \param[in] p_ctx pointer to session context
1396 * \param[in] width width in pixels
1397 * \param[in] height height in pixels
1398 * \param[in] format pixel format
1399 * \param[in] options option flags
1400 * \param[in] rectangle_width clipping rectangle width in pixels
1401 * \param[in] rectangle_height clipping rectangle height in pixels
1402 * \param[in] rectangle_x clipping rectangle x position
1403 * \param[in] rectangle_y clipping rectangle y position
1404 * \param[in] rgba_color background colour (only used by pad filter)
1405 * \param[in] frame_index frame index (only for hardware frames)
1406 *
1407 * \return NI_RETCODE_INVALID_PARAM
1408 * NI_RETCODE_ERROR_INVALID_SESSION
1409 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1410 * NI_RETCODE_ERROR_MEM_ALOC
1411 *******************************************************************************/
1413 int height, int format, int options,
1414 int rectangle_width,int rectangle_height,
1415 int rectangle_x, int rectangle_y,
1416 int rgba_color, int frame_index);
1417
1418/*!******************************************************************************
1419 * \brief config frame in the scaler
1420 *
1421 * \param[in] p_ctx pointer to session context
1422 * \param[in] p_cfg pointer to frame config
1423 *
1424 * \return NI_RETCODE_INVALID_PARAM
1425 * NI_RETCODE_ERROR_INVALID_SESSION
1426 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1427 * NI_RETCODE_ERROR_MEM_ALOC
1428 *******************************************************************************/
1430 ni_frame_config_t *p_cfg);
1431
1432/*!******************************************************************************
1433 * \brief config multi frames in the scaler
1434 *
1435 * \param[in] p_ctx pointer to session context
1436 * \param[in] p_cfg_in pointer to input frame config array
1437 * \param[in] numInCfgs number of input frame configs in p_cfg_in array
1438 * \param[in] p_cfg_out pointer to output frame config
1439 *
1440 * \return NI_RETCODE_INVALID_PARAM
1441 * NI_RETCODE_ERROR_INVALID_SESSION
1442 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1443 * NI_RETCODE_ERROR_MEM_ALOC
1444 *******************************************************************************/
1446 ni_frame_config_t p_cfg_in[],
1447 int numInCfgs,
1448 ni_frame_config_t *p_cfg_out);
1449
1450/*!******************************************************************************
1451 * \brief Open a xcoder scaler instance
1452 *
1453 * \param[in] p_ctx pointer to session context
1454 *
1455 * \return NI_RETCODE_INVALID_PARAM
1456 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1457 * NI_RETCODE_ERROR_INVALID_SESSION
1458 * NI_RETCODE_ERROR_MEM_ALOC
1459 *******************************************************************************/
1461
1462/*!******************************************************************************
1463 * \brief close a scaler session
1464 *
1465 * \param[in] p_ctx pointer to session context
1466 * \param[in] eos_received (not used)
1467 *
1468 * \return NI_RETCODE_INVALID_PARAM
1469 * NI_RETCODE_ERROR_INVALID_SESSION
1470 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1471 *******************************************************************************/
1473
1474/*!******************************************************************************
1475* \brief Send a p_config command to configure uploading parameters.
1476*
1477* \param ni_session_context_t p_ctx - xcoder Context
1478* \param[in] pool_size pool size to create
1479* \param[in] pool 0 = normal pool, 1 = P2P pool
1480*
1481* \return - NI_RETCODE_SUCCESS on success,
1482* NI_RETCODE_ERROR_INVALID_SESSION
1483* NI_RETCODE_ERROR_NVME_CMD_FAILED on failure
1484*******************************************************************************/
1486 uint32_t pool_size,
1487 uint32_t pool);
1488
1489/*!******************************************************************************
1490 * \brief read a hardware descriptor from a scaler session
1491 *
1492 * \param[in] p_ctx pointer to session context
1493 * \param[out] p_frame pointer to frame to write hw descriptor
1494 *
1495 * \return NI_RETCODE_INVALID_PARAM
1496 * NI_RETCODE_ERROR_INVALID_SESSION
1497 * NI_RETCODE_ERROR_MEM_ALOC
1498 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1499 * NI_RETCODE_FAILURE
1500 *******************************************************************************/
1502 ni_session_context_t *p_ctx,
1503 ni_frame_t *p_frame);
1504
1505/*!******************************************************************************
1506* \brief Grab bitdepth factor from NI_PIX_FMT
1507*
1508* \param[in] pix_fmt ni_pix_fmt_t
1509*
1510* \return 1 or 2
1511*******************************************************************************/
1512int ni_get_bitdepth_factor_from_pixfmt(int pix_fmt);
1513
1514/*!******************************************************************************
1515* \brief Grab planar info from NI_PIX_FMT
1516*
1517* \param[in] pix_fmt ni_pix_fmt_t
1518*
1519* \return 0 or 1 for success, -1 for error
1520*******************************************************************************/
1521int ni_get_planar_from_pixfmt(int pix_fmt);
1522
1523#ifndef _WIN32
1524/*!*****************************************************************************
1525 * \brief Get an address offset from a hw descriptor
1526 *
1527 * \param[in] p_ctx ni_session_context_t to be referenced
1528 * \param[in] hwdesc Pointer to caller allocated niFrameSurface1_t
1529 * \param[out] p_offset Value of offset
1530 *
1531 * \return On success NI_RETCODE_SUCCESS
1532 * On failure NI_RETCODE_INVALID_PARAM
1533 ******************************************************************************/
1535 uint32_t *p_offset);
1536
1537#endif
1538
1539/*!*****************************************************************************
1540 * \brief Get DDR configuration of Quadra device
1541 *
1542 * \param[in/out] p_ctx pointer to a session context with valid file handle
1543 *
1544 * \return On success NI_RETCODE_SUCCESS
1545 * On failure NI_RETCODE_INVALID_PARAM
1546 * NI_RETCODE_ERROR_MEM_ALOC
1547 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1548 ******************************************************************************/
1550
1551/*!*****************************************************************************
1552 * \brief Set DDR configuration of Quadra device
1553 *
1554 * \param[in] p_ctx pointer to a session context with valid file handle
1555 * \param[in] ddr_priority_mode ddr priority mode
1556 *
1557 * \return On success NI_RETCODE_SUCCESS
1558 * On failure NI_RETCODE_INVALID_PARAM
1559 * NI_RETCODE_ERROR_MEM_ALOC
1560 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1561 ******************************************************************************/
1563 uint8_t ddr_priority_mode);
1564
1565
1566#define NI_AI_HW_ALIGN_SIZE 64
1567
1569ni_retcode_t ni_ai_session_close(ni_session_context_t *p_ctx, int eos_received);
1571 void *nb_data, uint32_t nb_size);
1575 ni_frame_t *p_frame);
1577 ni_packet_t *p_packet);
1579 ni_network_data_t *p_network);
1581 int height, int options, int pool_size,
1582 int frame_index);
1584 niFrameSurface1_t *p_out_surface);
1586 ni_frame_config_t p_cfg_in[],
1587 int numInCfgs,
1588 ni_frame_config_t *p_cfg_out);
1589
1591 ni_frame_t *p_frame);
1592/*!*****************************************************************************
1593 * \brief Allocate memory for the metadata header and auxillary data for
1594 * encoder input data.
1595 *
1596 * \param[in] p_frame Pointer to a caller allocated ni_frame_t struct
1597 *
1598 * \param[in] extra_len Length header and auxillary data
1599 *
1600 * \return On success
1601 * NI_RETCODE_SUCCESS
1602 * On failure
1603 * NI_RETCODE_INVALID_PARAM
1604 * NI_RETCODE_ERROR_MEM_ALOC
1605 *****************************************************************************/
1607 int extra_len);
1608
1610
1612 ni_network_perf_metrics_t *p_metrics);
1613
1614
1615/*!*****************************************************************************
1616 * \brief Send namespace num / Opmode and SRIOv index/value to the device with
1617 * specified logic block address.
1618 *
1619 * \param[in] device_handle Device handle obtained by calling ni_device_open
1620 * \param[in] Key Represents either namespace num or opmode
1621 * \param[in] Value Represents either SRIOv index or opmode value
1622 *
1623 * \return On success
1624 * NI_RETCODE_SUCCESS
1625 * On failure
1626 * NI_RETCODE_ERROR_MEM_ALOC
1627 * NI_RETCODE_ERROR_NVME_CMD_FAILED
1628 ******************************************************************************/
1629ni_retcode_t ni_device_config_ns_qos(ni_device_handle_t device_handle,
1630 uint32_t key, uint32_t value);
1631
1632ni_retcode_t ni_dump_log_single_core(ni_session_context_t *p_ctx, void* p_data, uint32_t core_id, bool gen_log_file);
1633ni_retcode_t ni_dump_log_all_cores(ni_session_context_t *p_ctx, void* p_data, bool gen_log_file);
1634ni_retcode_t ni_dump_log_artifacts(ni_session_context_t *p_ctx, bool gen_artifacts_file);
1635ni_retcode_t ni_send_to_target_v2(ni_session_context_t *pSession, ni_frame_t *pSrcFrame, const ni_p2p_sgl_t *dmaAddrs);
1636ni_retcode_t ni_recv_from_target(ni_session_context_t *pSession, const ni_p2p_sgl_t *dmaAddrs, ni_frame_t *pDstFrame);
1637int lower_pixel_rate(const ni_load_query_t *pQuery, uint32_t ui32CurrentLowest);
1639 void *p_dec_ppu_config, int buffer_size);
1640
1641/*!******************************************************************************
1642 * \brief set cpu affinity based on numa node
1643 *
1644 * \param[in] p_ctx pointer to session context
1645 *
1646 * \return NI_RETCODE_SUCCESS
1647 * NI_RETCODE_ERROR_MEM_ALOC
1648 *******************************************************************************/
1650
1651#ifdef __cplusplus
1652}
1653#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)
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_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