libxcoder  5.2.0
ni_av_codec.h File Reference

Audio/video related utility definitions. More...

#include "ni_device_api.h"

Go to the source code of this file.

Data Structures

struct  _ni_hrd_params
 
struct  _ni_mastering_display_metadata
 
struct  _ni_content_light_level
 
struct  _ni_hdr_plus_percentile
 
struct  _ni_hdr_plus_color_transform_params
 
struct  _ni_dynamic_hdr_plus
 
struct  _ni_timecode
 
struct  _ni_ppu_config
 

Macros

#define NI_NUM_PIXEL_ASPECT_RATIO   17
 
#define NI_NAL_VPS_BIT   (0x01)
 
#define NI_NAL_SPS_BIT   (0x01 << 1)
 
#define NI_NAL_PPS_BIT   (0x01 << 2)
 
#define NI_GENERATE_ALL_NAL_HEADER_BIT   (0x01 << 3)
 
#define NI_SEI_TYPE_PPU_RECONFIG   206
 
#define MASTERING_DISP_CHROMA_DEN   50000
 
#define MASTERING_DISP_LUMA_DEN   10000
 

Typedefs

typedef enum _ni_h264_sei_type_t ni_h264_sei_type_t
 
typedef enum _ni_h264_sei_pic_struct_t ni_h264_sei_pic_struct_t
 
typedef enum _ni_color_primaries ni_color_primaries_t
 
typedef enum _ni_color_transfer_characteristic ni_color_transfer_characteristic_t
 
typedef enum _ni_color_space ni_color_space_t
 
typedef struct _ni_hrd_params ni_hrd_params_t
 
typedef struct _ni_mastering_display_metadata ni_mastering_display_metadata_t
 
typedef struct _ni_content_light_level ni_content_light_level_t
 
typedef enum _ni_hdr_plus_overlap_process_option ni_hdr_plus_overlap_process_option_t
 
typedef struct _ni_hdr_plus_percentile ni_hdr_plus_percentile_t
 
typedef struct _ni_hdr_plus_color_transform_params ni_hdr_plus_color_transform_params_t
 
typedef struct _ni_dynamic_hdr_plus ni_dynamic_hdr_plus_t
 
typedef struct _ni_timecode ni_timecode_t
 
typedef struct _ni_ppu_config ni_ppu_config_t
 

Enumerations

enum  _ni_h264_sei_type_t {
  NI_H264_SEI_TYPE_BUFFERING_PERIOD = 0, NI_H264_SEI_TYPE_PIC_TIMING = 1, NI_H264_SEI_TYPE_PAN_SCAN_RECT = 2, NI_H264_SEI_TYPE_FILLER_PAYLOAD = 3,
  NI_H264_SEI_TYPE_USER_DATA_REGISTERED, NI_H264_SEI_TYPE_USER_DATA_UNREGISTERED = 5, NI_H264_SEI_TYPE_RECOVERY_POINT, NI_H264_SEI_TYPE_FRAME_PACKING = 45,
  NI_H264_SEI_TYPE_DISPLAY_ORIENTATION = 47, NI_H264_SEI_TYPE_GREEN_METADATA = 56, NI_H264_SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME, NI_H264_SEI_TYPE_ALTERNATIVE_TRANSFER = 147
}
 
enum  _ni_h264_sei_pic_struct_t {
  NI_H264_SEI_PIC_STRUCT_FRAME = 0, NI_H264_SEI_PIC_STRUCT_TOP_FIELD = 1, NI_H264_SEI_PIC_STRUCT_BOTTOM_FIELD = 2, NI_H264_SEI_PIC_STRUCT_TOP_BOTTOM = 3,
  NI_H264_SEI_PIC_STRUCT_BOTTOM_TOP = 4, NI_H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5, NI_H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6, NI_H264_SEI_PIC_STRUCT_FRAME_DOUBLING = 7,
  NI_H264_SEI_PIC_STRUCT_FRAME_TRIPLING = 8
}
 
enum  _ni_color_primaries {
  NI_COL_PRI_RESERVED0 = 0, NI_COL_PRI_BT709 = 1, NI_COL_PRI_UNSPECIFIED = 2, NI_COL_PRI_RESERVED = 3,
  NI_COL_PRI_BT470M = 4, NI_COL_PRI_BT470BG = 5, NI_COL_PRI_SMPTE170M = 6, NI_COL_PRI_SMPTE240M = 7,
  NI_COL_PRI_FILM = 8, NI_COL_PRI_BT2020 = 9, NI_COL_PRI_SMPTE428 = 10, NI_COL_PRI_SMPTEST428_1 = NI_COL_PRI_SMPTE428,
  NI_COL_PRI_SMPTE431 = 11, NI_COL_PRI_SMPTE432 = 12, NI_COL_PRI_JEDEC_P22 = 22, NI_COL_PRI_NB
}
 
enum  _ni_color_transfer_characteristic {
  NI_COL_TRC_RESERVED0 = 0, NI_COL_TRC_BT709 = 1, NI_COL_TRC_UNSPECIFIED = 2, NI_COL_TRC_RESERVED = 3,
  NI_COL_TRC_GAMMA22, NI_COL_TRC_GAMMA28 = 5, NI_COL_TRC_SMPTE170M, NI_COL_TRC_SMPTE240M = 7,
  NI_COL_TRC_LINEAR = 8, NI_COL_TRC_LOG, NI_COL_TRC_LOG_SQRT, NI_COL_TRC_IEC61966_2_4 = 11,
  NI_COL_TRC_BT1361_ECG = 12, NI_COL_TRC_IEC61966_2_1 = 13, NI_COL_TRC_BT2020_10 = 14, NI_COL_TRC_BT2020_12 = 15,
  NI_COL_TRC_SMPTE2084, NI_COL_TRC_SMPTEST2084 = NI_COL_TRC_SMPTE2084, NI_COL_TRC_SMPTE428 = 17, NI_COL_TRC_SMPTEST428_1 = NI_COL_TRC_SMPTE428,
  NI_COL_TRC_ARIB_STD_B67, NI_COL_TRC_NB
}
 
enum  _ni_color_space {
  NI_COL_SPC_RGB, NI_COL_SPC_BT709, NI_COL_SPC_UNSPECIFIED = 2, NI_COL_SPC_RESERVED = 3,
  NI_COL_SPC_FCC, NI_COL_SPC_BT470BG, NI_COL_SPC_SMPTE170M, NI_COL_SPC_SMPTE240M = 7,
  NI_COL_SPC_YCGCO, NI_COL_SPC_YCOCG = NI_COL_SPC_YCGCO, NI_COL_SPC_BT2020_NCL = 9, NI_COL_SPC_BT2020_CL = 10,
  NI_COL_SPC_SMPTE2085 = 11, NI_COL_SPC_CHROMA_DERIVED_NCL, NI_COL_SPC_CHROMA_DERIVED_CL, NI_COL_SPC_ICTCP = 14,
  NI_COL_SPC_NB
}
 
enum  _ni_hdr_plus_overlap_process_option { NI_HDR_PLUS_OVERLAP_PROCESS_WEIGHTED_AVERAGING = 0, NI_HDR_PLUS_OVERLAP_PROCESS_LAYERING = 1 }
 

Functions

LIB_API int ni_should_send_sei_with_frame (ni_session_context_t *p_enc_ctx, ni_pic_type_t pic_type, ni_xcoder_params_t *p_param)
 Whether SEI should be sent together with this frame to encoder. More...
 
LIB_API void ni_dec_retrieve_aux_data (ni_frame_t *frame)
 Retrieve auxiliary data (close caption, various SEI) associated with this frame that is returned by decoder, convert them to appropriate format and save them in the frame's auxiliary data storage for future use by encoding. Usually they would be sent together with this frame to encoder at encoding. More...
 
LIB_API void ni_enc_prep_aux_data (ni_session_context_t *p_enc_ctx, ni_frame_t *p_enc_frame, ni_frame_t *p_dec_frame, ni_codec_format_t codec_format, int should_send_sei_with_frame, uint8_t *mdcv_data, uint8_t *cll_data, uint8_t *cc_data, uint8_t *udu_data, uint8_t *hdrp_data)
 Prepare auxiliary data that should be sent together with this frame to encoder based on the auxiliary data of the decoded frame. More...
 
LIB_API void ni_enc_copy_aux_data (ni_session_context_t *p_enc_ctx, ni_frame_t *p_enc_frame, ni_frame_t *p_dec_frame, ni_codec_format_t codec_format, const uint8_t *mdcv_data, const uint8_t *cll_data, const uint8_t *cc_data, const uint8_t *udu_data, const uint8_t *hdrp_data, int is_hwframe, int is_semiplanar)
 Copy auxiliary data that should be sent together with this frame to encoder. More...
 
LIB_API int ni_enc_insert_timecode (ni_session_context_t *p_enc_ctx, ni_frame_t *p_enc_frame, ni_timecode_t *p_timecode)
 Insert timecode data into picture timing SEI (H264) or time code SEI (H265) More...
 
LIB_API int ni_enc_write_from_yuv_buffer (ni_session_context_t *p_ctx, ni_frame_t *p_enc_frame, uint8_t *p_yuv_buffer)
 Send an input data frame to the encoder with YUV data given in the inputs. More...
 
LIB_API int ni_extract_custom_sei (uint8_t *pkt_data, int pkt_size, long index, ni_packet_t *p_packet, uint8_t sei_type, int vcl_found)
 Extract custom sei payload data from pkt_data, and save it to ni_packet_t. More...
 
LIB_API int ni_dec_packet_parse (ni_session_context_t *p_session_ctx, ni_xcoder_params_t *p_param, uint8_t *data, int size, ni_packet_t *p_packet, int low_delay, int codec_format, int pkt_nal_bitmap, int custom_sei_type, int *svct_skip_next_packet, int *is_lone_sei_pkt)
 Decode parse packet. More...
 
LIB_API int ni_expand_frame (ni_frame_t *dst, ni_frame_t *src, int dst_stride[], int raw_width, int raw_height, int ni_fmt, int nb_planes)
 Expand frame form src frame. More...
 
LIB_API int ni_reconfig_ppu_output (ni_session_context_t *p_session_ctx, ni_xcoder_params_t *p_param, ni_ppu_config_t *ppu_config)
 Reset decoder ppu resolution. More...
 

Detailed Description

Audio/video related utility definitions.


Definition in file ni_av_codec.h.

Macro Definition Documentation

◆ MASTERING_DISP_CHROMA_DEN

#define MASTERING_DISP_CHROMA_DEN   50000

Definition at line 217 of file ni_av_codec.h.

◆ MASTERING_DISP_LUMA_DEN

#define MASTERING_DISP_LUMA_DEN   10000

Definition at line 218 of file ni_av_codec.h.

◆ NI_GENERATE_ALL_NAL_HEADER_BIT

#define NI_GENERATE_ALL_NAL_HEADER_BIT   (0x01 << 3)

Definition at line 42 of file ni_av_codec.h.

◆ NI_NAL_PPS_BIT

#define NI_NAL_PPS_BIT   (0x01 << 2)

Definition at line 41 of file ni_av_codec.h.

◆ NI_NAL_SPS_BIT

#define NI_NAL_SPS_BIT   (0x01 << 1)

Definition at line 40 of file ni_av_codec.h.

◆ NI_NAL_VPS_BIT

#define NI_NAL_VPS_BIT   (0x01)

Definition at line 39 of file ni_av_codec.h.

◆ NI_NUM_PIXEL_ASPECT_RATIO

#define NI_NUM_PIXEL_ASPECT_RATIO   17

Definition at line 38 of file ni_av_codec.h.

◆ NI_SEI_TYPE_PPU_RECONFIG

#define NI_SEI_TYPE_PPU_RECONFIG   206

Definition at line 50 of file ni_av_codec.h.

Typedef Documentation

◆ ni_color_primaries_t

Chromaticity coordinates of the source primaries. These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1.

◆ ni_color_space_t

YUV colorspace type. These values match the ones defined by ISO/IEC 23001-8_2013 § 7.3.

◆ ni_color_transfer_characteristic_t

Color Transfer Characteristic. These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2.

◆ ni_content_light_level_t

◆ ni_dynamic_hdr_plus_t

◆ ni_h264_sei_pic_struct_t

pic_struct in picture timing SEI message

◆ ni_h264_sei_type_t

◆ ni_hdr_plus_color_transform_params_t

◆ ni_hdr_plus_overlap_process_option_t

◆ ni_hdr_plus_percentile_t

◆ ni_hrd_params_t

HRD parameters

◆ ni_mastering_display_metadata_t

◆ ni_ppu_config_t

◆ ni_timecode_t

typedef struct _ni_timecode ni_timecode_t

Enumeration Type Documentation

◆ _ni_color_primaries

Chromaticity coordinates of the source primaries. These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1.

Enumerator
NI_COL_PRI_RESERVED0 
NI_COL_PRI_BT709 

also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B

NI_COL_PRI_UNSPECIFIED 
NI_COL_PRI_RESERVED 
NI_COL_PRI_BT470M 

also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)

NI_COL_PRI_BT470BG 

also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM

NI_COL_PRI_SMPTE170M 

also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC

NI_COL_PRI_SMPTE240M 

functionally identical to above

NI_COL_PRI_FILM 

colour filters using Illuminant C

NI_COL_PRI_BT2020 

ITU-R BT2020.

NI_COL_PRI_SMPTE428 

SMPTE ST 428-1 (CIE 1931 XYZ)

NI_COL_PRI_SMPTEST428_1 
NI_COL_PRI_SMPTE431 

SMPTE ST 431-2 (2011) / DCI P3.

NI_COL_PRI_SMPTE432 

SMPTE ST 432-1 (2010) / P3 D65 / Display P3

NI_COL_PRI_JEDEC_P22 

JEDEC P22 phosphors.

NI_COL_PRI_NB 

Not part of ABI.

Definition at line 94 of file ni_av_codec.h.

◆ _ni_color_space

YUV colorspace type. These values match the ones defined by ISO/IEC 23001-8_2013 § 7.3.

Enumerator
NI_COL_SPC_RGB 
NI_COL_SPC_BT709 
NI_COL_SPC_UNSPECIFIED 
NI_COL_SPC_RESERVED 
NI_COL_SPC_FCC 
NI_COL_SPC_BT470BG 
NI_COL_SPC_SMPTE170M 
NI_COL_SPC_SMPTE240M 
NI_COL_SPC_YCGCO 
NI_COL_SPC_YCOCG 
NI_COL_SPC_BT2020_NCL 
NI_COL_SPC_BT2020_CL 
NI_COL_SPC_SMPTE2085 
NI_COL_SPC_CHROMA_DERIVED_NCL 
NI_COL_SPC_CHROMA_DERIVED_CL 
NI_COL_SPC_ICTCP 
NI_COL_SPC_NB 

Definition at line 155 of file ni_av_codec.h.

◆ _ni_color_transfer_characteristic

Color Transfer Characteristic. These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2.

Enumerator
NI_COL_TRC_RESERVED0 
NI_COL_TRC_BT709 
NI_COL_TRC_UNSPECIFIED 
NI_COL_TRC_RESERVED 
NI_COL_TRC_GAMMA22 
NI_COL_TRC_GAMMA28 
NI_COL_TRC_SMPTE170M 
NI_COL_TRC_SMPTE240M 
NI_COL_TRC_LINEAR 
NI_COL_TRC_LOG 
NI_COL_TRC_LOG_SQRT 
NI_COL_TRC_IEC61966_2_4 
NI_COL_TRC_BT1361_ECG 
NI_COL_TRC_IEC61966_2_1 
NI_COL_TRC_BT2020_10 
NI_COL_TRC_BT2020_12 
NI_COL_TRC_SMPTE2084 
NI_COL_TRC_SMPTEST2084 
NI_COL_TRC_SMPTE428 
NI_COL_TRC_SMPTEST428_1 
NI_COL_TRC_ARIB_STD_B67 
NI_COL_TRC_NB 

Definition at line 121 of file ni_av_codec.h.

◆ _ni_h264_sei_pic_struct_t

pic_struct in picture timing SEI message

Enumerator
NI_H264_SEI_PIC_STRUCT_FRAME 

frame

NI_H264_SEI_PIC_STRUCT_TOP_FIELD 

top field

NI_H264_SEI_PIC_STRUCT_BOTTOM_FIELD 

bottom field

NI_H264_SEI_PIC_STRUCT_TOP_BOTTOM 

top field, bottom field, in that order

NI_H264_SEI_PIC_STRUCT_BOTTOM_TOP 

bottom field, top field, in that order

NI_H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP 

top field, bottom field, top field repeated, in that order

NI_H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM 

bottom field, top field, bottom field repeated, in that order

NI_H264_SEI_PIC_STRUCT_FRAME_DOUBLING 

frame doubling

NI_H264_SEI_PIC_STRUCT_FRAME_TRIPLING 

frame tripling

Definition at line 71 of file ni_av_codec.h.

◆ _ni_h264_sei_type_t

Enumerator
NI_H264_SEI_TYPE_BUFFERING_PERIOD 
NI_H264_SEI_TYPE_PIC_TIMING 
NI_H264_SEI_TYPE_PAN_SCAN_RECT 
NI_H264_SEI_TYPE_FILLER_PAYLOAD 
NI_H264_SEI_TYPE_USER_DATA_REGISTERED 
NI_H264_SEI_TYPE_USER_DATA_UNREGISTERED 
NI_H264_SEI_TYPE_RECOVERY_POINT 
NI_H264_SEI_TYPE_FRAME_PACKING 
NI_H264_SEI_TYPE_DISPLAY_ORIENTATION 
NI_H264_SEI_TYPE_GREEN_METADATA 
NI_H264_SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME 
NI_H264_SEI_TYPE_ALTERNATIVE_TRANSFER 

Definition at line 51 of file ni_av_codec.h.

◆ _ni_hdr_plus_overlap_process_option

Enumerator
NI_HDR_PLUS_OVERLAP_PROCESS_WEIGHTED_AVERAGING 
NI_HDR_PLUS_OVERLAP_PROCESS_LAYERING 

Definition at line 232 of file ni_av_codec.h.

Function Documentation

◆ ni_dec_packet_parse()

LIB_API int ni_dec_packet_parse ( ni_session_context_t p_session_ctx,
ni_xcoder_params_t p_param,
uint8_t *  data,
int  size,
ni_packet_t p_packet,
int  low_delay,
int  codec_format,
int  pkt_nal_bitmap,
int  custom_sei_type,
int *  svct_skip_next_packet,
int *  is_lone_sei_pkt 
)

Decode parse packet.


Parameters
[in]p_session_ctxPointer to a caller allocated ni_session_context_t struct
[in]p_paramPointer to a caller allocated ni_xcoder_params_t struct
[in]*dataFFmpeg AVPacket data
[in]sizepacket size
[in]p_packetPointer to a caller allocated ni_packet_t struct
[in]low_delayFFmpeg lowdelay
[in]codec_formatenum ni_codec_format_t
[in]pkt_nal_bitmappkt_nal_bitmap
[in]custom_sei_typecustom_sei_type
[in]<em>svct_skip_next_packetsvct_skip_next_packet int
[in]<em>is_lone_sei_pktis_lone_sei_pkt int
Returns
- 0 on success, non-0 on failure

Definition at line 3065 of file ni_av_codec.c.

◆ ni_dec_retrieve_aux_data()

LIB_API void ni_dec_retrieve_aux_data ( ni_frame_t frame)

Retrieve auxiliary data (close caption, various SEI) associated with this frame that is returned by decoder, convert them to appropriate format and save them in the frame's auxiliary data storage for future use by encoding. Usually they would be sent together with this frame to encoder at encoding.


Parameters
[in/out]frame that is returned by decoder
Returns
NONE

Definition at line 237 of file ni_av_codec.c.

◆ ni_enc_copy_aux_data()

LIB_API void ni_enc_copy_aux_data ( ni_session_context_t p_enc_ctx,
ni_frame_t p_enc_frame,
ni_frame_t p_dec_frame,
ni_codec_format_t  codec_format,
const uint8_t *  mdcv_data,
const uint8_t *  cll_data,
const uint8_t *  cc_data,
const uint8_t *  udu_data,
const uint8_t *  hdrp_data,
int  is_hwframe,
int  is_semiplanar 
)

Copy auxiliary data that should be sent together with this frame to encoder.


Parameters
[in]p_enc_ctxencoder session context
[out]p_enc_frameframe to be sent to encoder
[in]p_dec_frameframe returned by decoder
[in]codec_formatH.264 or H.265
[in]mdcv_dataSEI for HDR mastering display color volume info
[in]cll_dataSEI for HDR content light level info
[in]cc_dataSEI for close caption
[in]udu_dataSEI for User data unregistered
[in]hdrp_dataSEI for HDR10+
[in]is_hwframe,mustbe 0 (sw frame) or 1 (hw frame)
[in]is_semiplanar,mustbe 1 (semiplanar frame) or 0 (not)
Returns
NONE

Parameters
[in]p_enc_ctxencoder session context
[out]p_enc_frameframe to be sent to encoder
[in]p_dec_frameframe returned by decoder
[in]mdcv_dataSEI for HDR mastering display color volume info
[in]cll_dataSEI for HDR content light level info
[in]cc_dataSEI for close caption
[in]udu_dataSEI for User data unregistered
[in]hdrp_dataSEI for HDR10+
[in]is_hwframe,mustbe 0 (sw frame) or 1 (hw frame)
[in]is_semiplanar,mustbe 1 (semiplanar frame) or 0 (not)
Returns
NONE

Definition at line 2267 of file ni_av_codec.c.

◆ ni_enc_insert_timecode()

LIB_API int ni_enc_insert_timecode ( ni_session_context_t p_enc_ctx,
ni_frame_t p_enc_frame,
ni_timecode_t p_timecode 
)

Insert timecode data into picture timing SEI (H264) or time code SEI (H265)


Note
This function must be callled after all other aux data has been processed by ni_enc_prep_aux_data and ni_enc_copy_aux_data. Otherwise the timecode SEI data might be overwritten
Parameters
[in]p_enc_ctxencoder session context
[out]p_enc_frameframe to be sent to encoder
[in]p_timecodethe timecode data to be written along with the frame
Returns
NI_RETCODE_SUCCESS on success, NI_RETCODE_FAILURE on failure

Definition at line 2453 of file ni_av_codec.c.

◆ ni_enc_prep_aux_data()

LIB_API void ni_enc_prep_aux_data ( ni_session_context_t p_enc_ctx,
ni_frame_t p_enc_frame,
ni_frame_t p_dec_frame,
ni_codec_format_t  codec_format,
int  should_send_sei_with_frame,
uint8_t *  mdcv_data,
uint8_t *  cll_data,
uint8_t *  cc_data,
uint8_t *  udu_data,
uint8_t *  hdrp_data 
)

Prepare auxiliary data that should be sent together with this frame to encoder based on the auxiliary data of the decoded frame.


Parameters
[in/out]p_enc_ctx encoder session context whose various SEI type header can be updated as the result of this function
[out]p_enc_frameframe to be sent to encoder
[in]p_dec_frameframe that is returned by decoder
[in]codec_formatH.264 or H.265
[in]should_send_sei_with_frameif need to send a certain type of SEI with this frame
[out]mdcv_dataSEI for HDR mastering display color volume info
[out]cll_dataSEI for HDR content light level info
[out]cc_dataSEI for close caption
[out]udu_dataSEI for User data unregistered
[out]hdrp_dataSEI for HDR10+
Returns
NONE

Note: Some of the SEI (e.g. HDR) will be updated and stored in encoder context whenever received through decoded frame; they will be sent out with the encoded frame to encoder only when appropriate, i.e. should_send_sei_with_frame is true. When a type of aux data is to be sent, its associated length will be set in the encoder frame.

Parameters
[in/out]p_enc_ctx encoder session contextwhose various SEI type header can be updated as the result of this function
[out]p_enc_frameframe to be sent to encoder
[in]p_dec_frameframe that is returned by decoder
[in]codec_formatH.264 or H.265
[in]should_send_sei_with_frameif need to send a certain type of SEI with this frame
[out]mdcv_dataSEI for HDR mastering display color volume info
[out]cll_dataSEI for HDR content light level info
[out]cc_dataSEI for close caption
[out]udu_dataSEI for User data unregistered
[out]hdrp_dataSEI for HDR10+
Returns
NONE

Definition at line 858 of file ni_av_codec.c.

◆ ni_enc_write_from_yuv_buffer()

LIB_API int ni_enc_write_from_yuv_buffer ( ni_session_context_t p_ctx,
ni_frame_t p_enc_frame,
uint8_t *  p_yuv_buffer 
)

Send an input data frame to the encoder with YUV data given in the inputs.


For ideal performance memory should be 4k aligned. If it is not 4K aligned then a temporary 4k aligned memory will be used to copy data to and from when writing and reading. This will negatively impact performance.

Any metadata to be sent with the frame should be attached to p_enc_frame as aux data (e.g. using ni_frame_new_aux_data()).

Parameters
[in]p_ctxEncoder session context
[in]p_enc_frameStruct holding information about the frame to be sent to the encoder
[in]p_yuv_bufferCaller allocated buffer holding YUV data for the frame
Returns
On success Total number of bytes written On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_INVALID_SESSION

Definition at line 2625 of file ni_av_codec.c.

◆ ni_expand_frame()

LIB_API int ni_expand_frame ( ni_frame_t dst,
ni_frame_t src,
int  dst_stride[],
int  raw_width,
int  raw_height,
int  ni_fmt,
int  nb_planes 
)

Expand frame form src frame.


Parameters
[in]dstPointer to a caller allocated ni_frame_t struct
[in]srcPointer to a caller allocated ni_frame_t struct
[in]dst_strideint dst_stride[]
[in]raw_widthframe width
[in]raw_heightframe height
[in]ni_fmtni_pix_fmt_t type for ni pix_fmt
[in]nb_planesint nb_planes
Returns
- 0 on success, NI_RETCODE_FAILURE on failure

Definition at line 3289 of file ni_av_codec.c.

◆ ni_extract_custom_sei()

LIB_API int ni_extract_custom_sei ( uint8_t *  pkt_data,
int  pkt_size,
long  index,
ni_packet_t p_packet,
uint8_t  sei_type,
int  vcl_found 
)

Extract custom sei payload data from pkt_data, and save it to ni_packet_t.


Parameters
uint8_t*pkt_data - FFmpeg AVPacket data
intpkt_size - packet size
longindex - pkt data index of custom sei first byte after SEI type
ni_packet_t*p_packet - libxcoder internal packet
uint8_tsei_type - type of SEI
intvcl_found - whether got vcl in the pkt data, 1 means got
Returns
- 0 on success, non-0 on failure

extract SEI payload size. the first byte after SEI type is the SEI payload size. if the first byte is 255(0xFF), it means the SEI payload size is more than 255. in this case, to get the SEI payload size is to do a summation. the end of SEI size is the first non-0xFF value. for example, 0xFF 0xFF 0x08, the SEI payload size equals to (0xFF+0xFF+0x08).

Definition at line 2944 of file ni_av_codec.c.

◆ ni_reconfig_ppu_output()

LIB_API int ni_reconfig_ppu_output ( ni_session_context_t p_session_ctx,
ni_xcoder_params_t p_param,
ni_ppu_config_t ppu_config 
)

Reset decoder ppu resolution.


Parameters
[in]p_session_ctxPointer to a caller allocated ni_session_context_t struct
[in]p_paramPointer to a caller allocated ni_xcoder_params_t struct
[in]ppu_configPointer to a caller allocated ni_ppu_config_t struct
Returns
- 0 on success, NI_RETCODE_FAILURE on failure

Definition at line 3485 of file ni_av_codec.c.

◆ ni_should_send_sei_with_frame()

LIB_API int ni_should_send_sei_with_frame ( ni_session_context_t p_enc_ctx,
ni_pic_type_t  pic_type,
ni_xcoder_params_t p_param 
)

Whether SEI should be sent together with this frame to encoder.


Parameters
[in]p_enc_ctxencoder session context
[in]pic_typeframe type
[in]p_paramencoder parameters
Returns
1 if yes, 0 otherwise

Whether SEI should be sent together with this frame to encoder.


Parameters
[in]p_enc_ctxencoder session context
[in]pic_typeframe type
[in]p_paramencoder parameters
Returns
1 if yes, 0 otherwise

Definition at line 186 of file ni_av_codec.c.