![]() |
libxcoder
3.5.1
|
NETINT audio/video related utility functions. More...
#include "ni_device_api_logan.h"
Go to the source code of this file.
Data Structures | |
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 |
Macros | |
#define | NI_NUM_PIXEL_ASPECT_RATIO 17 |
#define | NI_LOGAN_NAL_VPS_BIT (0x01) |
#define | NI_LOGAN_NAL_SPS_BIT (0x01<<1) |
#define | NI_LOGAN_NAL_PPS_BIT (0x01<<2) |
#define | NI_LOGAN_GENERATE_ALL_NAL_HEADER_BIT (0x01<<3) |
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_range_struct_t | ni_color_range_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_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 enum _ni_logan_h264_nalu_type | ni_logan_h264_nalu_type_t |
typedef enum _ni_logan_hevc_nalu_type | ni_logan_hevc_nalu_type_t |
Functions | |
LIB_API int | ni_logan_should_send_sei_with_frame (ni_logan_session_context_t *p_enc_ctx, ni_logan_pic_type_t pic_type, ni_logan_encoder_params_t *p_param) |
Whether SEI should be sent together with this frame to encoder. More... | |
LIB_API void | ni_logan_set_vui (ni_logan_encoder_params_t *p_param, ni_logan_session_context_t *p_ctx, ni_color_primaries_t color_primaries, ni_color_transfer_characteristic_t color_trc, ni_color_space_t color_space, int video_full_range_flag, int sar_num, int sar_den, ni_logan_codec_format_t codec_format) |
Set SPS VUI part of encoded stream header. More... | |
LIB_API uint32_t | ni_logan_enc_buffering_period_sei (ni_logan_encoder_params_t *p_param, ni_logan_session_context_t *p_ctx, uint32_t frame_idx, int buf_len, uint8_t *p_buf) |
Buffered period sei. More... | |
LIB_API uint32_t | ni_logan_enc_buffering_custom_sei (void *p_data, ni_logan_session_context_t *p_ctx, uint32_t index) |
Buffered customer sei. More... | |
LIB_API uint32_t | ni_logan_enc_pic_timing_sei2 (ni_logan_encoder_params_t *p_param, ni_logan_session_context_t *p_ctx, int is_i_or_idr, int is_idr, uint32_t frame_idx, int buf_len, uint8_t *p_buf) |
Generate pic timing sei2. More... | |
LIB_API void | ni_logan_dec_retrieve_aux_data (ni_logan_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_logan_enc_init_aux_params (ni_logan_session_data_io_t *p_api_fme) |
Initialize 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_logan_enc_prep_aux_data (ni_logan_session_context_t *p_enc_ctx, ni_logan_frame_t *p_enc_frame, ni_logan_frame_t *p_dec_frame, ni_logan_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_logan_enc_copy_aux_data (ni_logan_session_context_t *p_enc_ctx, ni_logan_frame_t *p_enc_frame, ni_logan_frame_t *p_dec_frame, ni_logan_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) |
Copy auxiliary data that should be sent together with this frame to encoder. More... | |
LIB_API const uint8_t * | ni_logan_find_start_code (const uint8_t *p, const uint8_t *end, uint32_t *state) |
Find the next start code. More... | |
LIB_API int | ni_logan_enc_fill_reconfig_params (ni_logan_encoder_params_t *p_param, ni_logan_session_context_t *p_ctx, ni_logan_frame_t *p_api_fme, int reconfigCount) |
Fill reconfig params. More... | |
LIB_API int | ni_logan_detect_custom_sei (const uint8_t *data, int size, ni_logan_session_context_t *p_api_ctx, ni_logan_decoder_params_t *p_api_param, ni_logan_packet_t *p_packet) |
detect custom SEI payload data in Packet data, custom SEI has two meanings: a. the SEI type is not in the standard protocol, which is added by customes, for example SEI type 100, note that custom SEI is not user data unregistered SEI. b. the SEI NAL location does not conform to protocol. It's after VCL NALs. So there are cases to handle here: case a: enable custom_sei, detext custom SEIs before VCL. case b: enable custom_sei and enable_check_packet, detect custom SEIs before VCL, and all SEIs after VCL. all of these SEIs are passthroughed in the same places after encoding. More... | |
LIB_API void | ni_logan_enc_reconfig_vfr (ni_logan_session_context_t *p_session_ctx, ni_logan_encoder_params_t *p_encoder_params, ni_logan_frame_t *ni_frame, int64_t pts, uint32_t timebase) |
Fill reconfig vfr. More... | |
LIB_API void | ni_logan_reset_vui (ni_logan_encoder_params_t *p_param, ni_aux_data_t *aux_data, ni_logan_codec_format_t codec_format) |
Reset vui info from decoder. More... | |
LIB_API int | ni_logan_enc_fill_reconfig_vui (ni_logan_encoder_params_t *p_param, ni_logan_session_context_t *p_ctx, ni_logan_frame_t *p_api_fme, int reconfigCount, ni_aux_data_t *aux_data) |
Fill reconfig vui. More... | |
NETINT audio/video related utility functions.
Copyright (C) 2018 NETINT Technologies.
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
Definition in file ni_av_codec_logan.h.
#define NI_LOGAN_GENERATE_ALL_NAL_HEADER_BIT (0x01<<3) |
Definition at line 424 of file ni_av_codec_logan.h.
#define NI_LOGAN_NAL_PPS_BIT (0x01<<2) |
Definition at line 423 of file ni_av_codec_logan.h.
#define NI_LOGAN_NAL_SPS_BIT (0x01<<1) |
Definition at line 422 of file ni_av_codec_logan.h.
#define NI_LOGAN_NAL_VPS_BIT (0x01) |
Definition at line 421 of file ni_av_codec_logan.h.
#define NI_NUM_PIXEL_ASPECT_RATIO 17 |
Definition at line 34 of file ni_av_codec_logan.h.
typedef enum _ni_color_primaries ni_color_primaries_t |
typedef enum _ni_color_range_struct_t ni_color_range_struct_t |
MPEG vs JPEG YUV range.
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.
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 |
typedef enum _ni_h264_sei_type_t ni_h264_sei_type_t |
typedef struct _ni_hdr_plus_percentile ni_hdr_plus_percentile_t |
typedef enum _ni_logan_h264_nalu_type ni_logan_h264_nalu_type_t |
typedef enum _ni_logan_hevc_nalu_type ni_logan_hevc_nalu_type_t |
Table 7-1 – NAL unit type codes and NAL unit type classes in T-REC-H.265-201802
typedef struct _ni_mastering_display_metadata ni_mastering_display_metadata_t |
enum _ni_color_primaries |
Definition at line 100 of file ni_av_codec_logan.h.
MPEG vs JPEG YUV range.
Enumerator | |
---|---|
NI_COL_RANGE_UNSPECIFIED | |
NI_COL_RANGE_MPEG | the normal 219*2^(n-8) "MPEG" YUV ranges |
NI_COL_RANGE_JPEG | the normal 2^n-1 "JPEG" YUV ranges |
NI_COL_RANGE_NB | Not part of ABI. |
Definition at line 89 of file ni_av_codec_logan.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 154 of file ni_av_codec_logan.h.
Definition at line 124 of file ni_av_codec_logan.h.
Definition at line 73 of file ni_av_codec_logan.h.
enum _ni_h264_sei_type_t |
Definition at line 56 of file ni_av_codec_logan.h.
Enumerator | |
---|---|
NI_HDR_PLUS_OVERLAP_PROCESS_WEIGHTED_AVERAGING | |
NI_HDR_PLUS_OVERLAP_PROCESS_LAYERING |
Definition at line 209 of file ni_av_codec_logan.h.
Definition at line 430 of file ni_av_codec_logan.h.
Table 7-1 – NAL unit type codes and NAL unit type classes in T-REC-H.265-201802
Definition at line 470 of file ni_av_codec_logan.h.
LIB_API void ni_logan_dec_retrieve_aux_data | ( | ni_logan_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 1405 of file ni_av_codec_logan.c.
LIB_API int ni_logan_detect_custom_sei | ( | const uint8_t * | data, |
int | size, | ||
ni_logan_session_context_t * | p_api_ctx, | ||
ni_logan_decoder_params_t * | p_api_param, | ||
ni_logan_packet_t * | p_packet | ||
) |
detect custom SEI payload data in Packet data, custom SEI has two meanings: a. the SEI type is not in the standard protocol, which is added by customes, for example SEI type 100, note that custom SEI is not user data unregistered SEI. b. the SEI NAL location does not conform to protocol. It's after VCL NALs. So there are cases to handle here: case a: enable custom_sei, detext custom SEIs before VCL. case b: enable custom_sei and enable_check_packet, detect custom SEIs before VCL, and all SEIs after VCL. all of these SEIs are passthroughed in the same places after encoding.
uint8_t | *data - packet data |
int | size - pkt data size |
ni_logan_session_context_t | *p_api_ctx - Netint session context |
ni_logan_decoder_params_t | *api_param - Netint xcoder params |
ni_logan_packet_t | *p_packet - netint internal packet |
Definition at line 3511 of file ni_av_codec_logan.c.
LIB_API uint32_t ni_logan_enc_buffering_custom_sei | ( | void * | p_data, |
ni_logan_session_context_t * | p_ctx, | ||
uint32_t | index | ||
) |
Buffered customer sei.
[in] | p_data | input side data of customer sei |
[out] | p_ctx | session context, update its pkt_custom_sei. |
[in] | index | fifo index |
Definition at line 1170 of file ni_av_codec_logan.c.
LIB_API uint32_t ni_logan_enc_buffering_period_sei | ( | ni_logan_encoder_params_t * | p_param, |
ni_logan_session_context_t * | p_ctx, | ||
uint32_t | frame_idx, | ||
int | buf_len, | ||
uint8_t * | p_buf | ||
) |
Buffered period sei.
[in/out] | p_param encoder parameters, its GOP information will be updated. | |
[in] | p_ctx | session context, use its HRD parameters (hrd_params). |
[in] | frame_idx | frame index |
[in] | buf_len | output buffer length |
[out] | p_buf | output sei buffer. |
Definition at line 1052 of file ni_av_codec_logan.c.
LIB_API void ni_logan_enc_copy_aux_data | ( | ni_logan_session_context_t * | p_enc_ctx, |
ni_logan_frame_t * | p_enc_frame, | ||
ni_logan_frame_t * | p_dec_frame, | ||
ni_logan_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 | ||
) |
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] | 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+ |
Definition at line 2948 of file ni_av_codec_logan.c.
LIB_API int ni_logan_enc_fill_reconfig_params | ( | ni_logan_encoder_params_t * | p_param, |
ni_logan_session_context_t * | p_ctx, | ||
ni_logan_frame_t * | p_api_fme, | ||
int | reconfigCount | ||
) |
Fill reconfig params.
[in] | p_param | encoder parameters. |
[in/out] | p_ctx session context, its enc_change_params may be updated. | |
[in/out] | p_api_fme extra_data_len and reconf_len may be updated | |
[in] | reconfigCount | reconfig count, may be updated. |
Definition at line 3084 of file ni_av_codec_logan.c.
LIB_API int ni_logan_enc_fill_reconfig_vui | ( | ni_logan_encoder_params_t * | p_param, |
ni_logan_session_context_t * | p_ctx, | ||
ni_logan_frame_t * | p_api_fme, | ||
int | reconfigCount, | ||
ni_aux_data_t * | aux_data | ||
) |
Fill reconfig vui.
[in] | p_param | encoder parameters. |
[in/out] | p_ctx session context, its enc_change_params may be updated. | |
[in/out] | p_api_fme extra_data_len and reconf_len may be updated | |
[in] | reconfigCount | reconfig count, may be updated. |
[in] | aux_data | aux_data may be updated |
Definition at line 3290 of file ni_av_codec_logan.c.
LIB_API void ni_logan_enc_init_aux_params | ( | ni_logan_session_data_io_t * | p_api_fme | ) |
Initialize auxiliary data that should be sent together with this frame to encoder based on the auxiliary data of the decoded frame.
[in/out] | ni_logan_session_data_io_t session data |
Definition at line 2084 of file ni_av_codec_logan.c.
LIB_API uint32_t ni_logan_enc_pic_timing_sei2 | ( | ni_logan_encoder_params_t * | p_param, |
ni_logan_session_context_t * | p_ctx, | ||
int | is_i_or_idr, | ||
int | is_idr, | ||
uint32_t | frame_idx, | ||
int | buf_len, | ||
uint8_t * | p_buf | ||
) |
Generate pic timing sei2.
[in/out] | p_param encoder parameters, its GOP information will be updated. | |
[in/out] | p_ctx session context, its HRD parameters (hrd_params) may be updated. | |
[in] | is_i_or_idr | True if it is i or idr packet. |
[in] | is_idr | True if it is idr packet. |
[in] | frame_idx | frame index |
[in] | buf_len | output buffer length |
[out] | p_buf | output sei buffer. |
Definition at line 1297 of file ni_av_codec_logan.c.
LIB_API void ni_logan_enc_prep_aux_data | ( | ni_logan_session_context_t * | p_enc_ctx, |
ni_logan_frame_t * | p_enc_frame, | ||
ni_logan_frame_t * | p_dec_frame, | ||
ni_logan_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 2132 of file ni_av_codec_logan.c.
LIB_API void ni_logan_enc_reconfig_vfr | ( | ni_logan_session_context_t * | p_session_ctx, |
ni_logan_encoder_params_t * | p_encoder_params, | ||
ni_logan_frame_t * | ni_frame, | ||
int64_t | pts, | ||
uint32_t | timebase | ||
) |
Fill reconfig vfr.
[in/out] | p_session_ctx session context, some parameters may be updated. | |
[in] | p_param | encoder parameters. |
[in/out] | ni_frame aux_data may be updated | |
[in] | pts | frame pts |
[in] | timebase | timebase |
Definition at line 3716 of file ni_av_codec_logan.c.
LIB_API const uint8_t* ni_logan_find_start_code | ( | const uint8_t * | p, |
const uint8_t * | end, | ||
uint32_t * | state | ||
) |
Find the next start code.
[in] | p | pointer to buffer start address. |
[in] | end | pointer to buffer end address. |
[state] | state pointer to nalu type address |
Definition at line 3341 of file ni_av_codec_logan.c.
LIB_API void ni_logan_reset_vui | ( | ni_logan_encoder_params_t * | p_param, |
ni_aux_data_t * | aux_data, | ||
ni_logan_codec_format_t | codec_format | ||
) |
Reset vui info from decoder.
[in] | p_param | encoder parameters. |
[in] | aux_data | aux_data may be updated |
[in] | codec_format | encoder format |
Definition at line 793 of file ni_av_codec_logan.c.
LIB_API void ni_logan_set_vui | ( | ni_logan_encoder_params_t * | p_param, |
ni_logan_session_context_t * | p_ctx, | ||
ni_color_primaries_t | color_primaries, | ||
ni_color_transfer_characteristic_t | color_trc, | ||
ni_color_space_t | color_space, | ||
int | video_full_range_flag, | ||
int | sar_num, | ||
int | sar_den, | ||
ni_logan_codec_format_t | codec_format | ||
) |
Set SPS VUI part of encoded stream header.
[in/out] | p_param encoder parameters, its VUI data member will be updated. | |
[out] | p_ctx | session context, its HRD parameters (hrd_params) may be updated. |
[in] | color_primaries | color primaries |
[in] | color_trc | color transfer characteristic |
[in] | color_space | YUV colorspace type |
[in] | video_full_range_flag | |
[in] | sar_num/sar_den | sample aspect ration in numerator/denominator |
[in] | codec_format | H.264 or H.265 |
Definition at line 464 of file ni_av_codec_logan.c.
LIB_API int ni_logan_should_send_sei_with_frame | ( | ni_logan_session_context_t * | p_enc_ctx, |
ni_logan_pic_type_t | pic_type, | ||
ni_logan_encoder_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 409 of file ni_av_codec_logan.c.