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