![]() |
libxcoder
5.2.0
|
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 |
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... | |
#define MASTERING_DISP_CHROMA_DEN 50000 |
Definition at line 217 of file ni_av_codec.h.
#define MASTERING_DISP_LUMA_DEN 10000 |
Definition at line 218 of file ni_av_codec.h.
#define NI_GENERATE_ALL_NAL_HEADER_BIT (0x01 << 3) |
Definition at line 42 of file ni_av_codec.h.
#define NI_NAL_PPS_BIT (0x01 << 2) |
Definition at line 41 of file ni_av_codec.h.
#define NI_NAL_SPS_BIT (0x01 << 1) |
Definition at line 40 of file ni_av_codec.h.
#define NI_NAL_VPS_BIT (0x01) |
Definition at line 39 of file ni_av_codec.h.
#define NI_NUM_PIXEL_ASPECT_RATIO 17 |
Definition at line 38 of file ni_av_codec.h.
#define NI_SEI_TYPE_PPU_RECONFIG 206 |
Definition at line 50 of file ni_av_codec.h.
typedef enum _ni_color_primaries ni_color_primaries_t |
Chromaticity coordinates of the source primaries. These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1.
typedef enum _ni_color_space ni_color_space_t |
YUV colorspace type. These values match the ones defined by ISO/IEC 23001-8_2013 § 7.3.
Color Transfer Characteristic. These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2.
typedef struct _ni_content_light_level ni_content_light_level_t |
typedef struct _ni_dynamic_hdr_plus ni_dynamic_hdr_plus_t |
typedef enum _ni_h264_sei_pic_struct_t ni_h264_sei_pic_struct_t |
pic_struct in picture timing SEI message
typedef enum _ni_h264_sei_type_t ni_h264_sei_type_t |
typedef struct _ni_hdr_plus_percentile ni_hdr_plus_percentile_t |
typedef struct _ni_hrd_params ni_hrd_params_t |
HRD parameters
typedef struct _ni_mastering_display_metadata ni_mastering_display_metadata_t |
typedef struct _ni_ppu_config ni_ppu_config_t |
typedef struct _ni_timecode ni_timecode_t |
enum _ni_color_primaries |
Chromaticity coordinates of the source primaries. These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1.
Definition at line 94 of file ni_av_codec.h.
enum _ni_color_space |
YUV colorspace type. These values match the ones defined by ISO/IEC 23001-8_2013 § 7.3.
Definition at line 155 of file ni_av_codec.h.
Color Transfer Characteristic. These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2.
Definition at line 121 of file ni_av_codec.h.
pic_struct in picture timing SEI message
Definition at line 71 of file ni_av_codec.h.
enum _ni_h264_sei_type_t |
Definition at line 51 of file ni_av_codec.h.
Enumerator | |
---|---|
NI_HDR_PLUS_OVERLAP_PROCESS_WEIGHTED_AVERAGING | |
NI_HDR_PLUS_OVERLAP_PROCESS_LAYERING |
Definition at line 232 of file ni_av_codec.h.
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.
[in] | p_session_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | p_param | Pointer to a caller allocated ni_xcoder_params_t struct |
[in] | *data | FFmpeg AVPacket data |
[in] | size | packet size |
[in] | p_packet | Pointer to a caller allocated ni_packet_t struct |
[in] | low_delay | FFmpeg lowdelay |
[in] | codec_format | enum ni_codec_format_t |
[in] | pkt_nal_bitmap | pkt_nal_bitmap |
[in] | custom_sei_type | custom_sei_type |
[in] | <em>svct_skip_next_packet | svct_skip_next_packet int |
[in] | <em>is_lone_sei_pkt | is_lone_sei_pkt int |
Definition at line 3065 of file ni_av_codec.c.
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.
[in/out] | frame that is returned by decoder |
Definition at line 237 of file ni_av_codec.c.
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.
[in] | p_enc_ctx | encoder session context |
[out] | p_enc_frame | frame to be sent to encoder |
[in] | p_dec_frame | frame returned by decoder |
[in] | codec_format | H.264 or H.265 |
[in] | mdcv_data | SEI for HDR mastering display color volume info |
[in] | cll_data | SEI for HDR content light level info |
[in] | cc_data | SEI for close caption |
[in] | udu_data | SEI for User data unregistered |
[in] | hdrp_data | SEI for HDR10+ |
[in] | is_hwframe,must | be 0 (sw frame) or 1 (hw frame) |
[in] | is_semiplanar,must | be 1 (semiplanar frame) or 0 (not) |
[in] | p_enc_ctx | encoder session context |
[out] | p_enc_frame | frame to be sent to encoder |
[in] | p_dec_frame | frame returned by decoder |
[in] | mdcv_data | SEI for HDR mastering display color volume info |
[in] | cll_data | SEI for HDR content light level info |
[in] | cc_data | SEI for close caption |
[in] | udu_data | SEI for User data unregistered |
[in] | hdrp_data | SEI for HDR10+ |
[in] | is_hwframe,must | be 0 (sw frame) or 1 (hw frame) |
[in] | is_semiplanar,must | be 1 (semiplanar frame) or 0 (not) |
Definition at line 2267 of file ni_av_codec.c.
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)
[in] | p_enc_ctx | encoder session context |
[out] | p_enc_frame | frame to be sent to encoder |
[in] | p_timecode | the timecode data to be written along with the frame |
Definition at line 2453 of file ni_av_codec.c.
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.
[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_frame | frame to be sent to encoder |
[in] | p_dec_frame | frame that is returned by decoder |
[in] | codec_format | H.264 or H.265 |
[in] | should_send_sei_with_frame | if need to send a certain type of SEI with this frame |
[out] | mdcv_data | SEI for HDR mastering display color volume info |
[out] | cll_data | SEI for HDR content light level info |
[out] | cc_data | SEI for close caption |
[out] | udu_data | SEI for User data unregistered |
[out] | hdrp_data | SEI for HDR10+ |
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.
[in/out] | p_enc_ctx encoder session contextwhose various SEI type header can be updated as the result of this function | |
[out] | p_enc_frame | frame to be sent to encoder |
[in] | p_dec_frame | frame that is returned by decoder |
[in] | codec_format | H.264 or H.265 |
[in] | should_send_sei_with_frame | if need to send a certain type of SEI with this frame |
[out] | mdcv_data | SEI for HDR mastering display color volume info |
[out] | cll_data | SEI for HDR content light level info |
[out] | cc_data | SEI for close caption |
[out] | udu_data | SEI for User data unregistered |
[out] | hdrp_data | SEI for HDR10+ |
Definition at line 858 of file ni_av_codec.c.
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()).
[in] | p_ctx | Encoder session context |
[in] | p_enc_frame | Struct holding information about the frame to be sent to the encoder |
[in] | p_yuv_buffer | Caller allocated buffer holding YUV data for the frame |
Definition at line 2625 of file ni_av_codec.c.
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.
[in] | dst | Pointer to a caller allocated ni_frame_t struct |
[in] | src | Pointer to a caller allocated ni_frame_t struct |
[in] | dst_stride | int dst_stride[] |
[in] | raw_width | frame width |
[in] | raw_height | frame height |
[in] | ni_fmt | ni_pix_fmt_t type for ni pix_fmt |
[in] | nb_planes | int nb_planes |
Definition at line 3289 of file ni_av_codec.c.
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.
uint8_t | *pkt_data - FFmpeg AVPacket data |
int | pkt_size - packet size |
long | index - pkt data index of custom sei first byte after SEI type |
ni_packet_t | *p_packet - libxcoder internal packet |
uint8_t | sei_type - type of SEI |
int | vcl_found - whether got vcl in the pkt data, 1 means got |
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.
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.
[in] | p_session_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | p_param | Pointer to a caller allocated ni_xcoder_params_t struct |
[in] | ppu_config | Pointer to a caller allocated ni_ppu_config_t struct |
Definition at line 3485 of file ni_av_codec.c.
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.
[in] | p_enc_ctx | encoder session context |
[in] | pic_type | frame type |
[in] | p_param | encoder parameters |
Whether SEI should be sent together with this frame to encoder.
[in] | p_enc_ctx | encoder session context |
[in] | pic_type | frame type |
[in] | p_param | encoder parameters |
Definition at line 186 of file ni_av_codec.c.