|
libxcoder
3.5.4
|
Example code on how to programmatically work with NI T-408 using libxcoder API. More...
#include <stdio.h>#include <string.h>#include <stdlib.h>#include <stdint.h>#include <fcntl.h>#include <errno.h>#include "ni_device_api_logan.h"#include "ni_rsrc_api_logan.h"#include "ni_util_logan.h"#include "ni_device_test_logan.h"#include "ni_bitstream_logan.h"Go to the source code of this file.
Data Structures | |
| struct | _ni_logan_err_rc_txt_entry |
| struct | _ni_logan_h264_pps_t |
Macros | |
| #define | MAX_LOG2_MAX_FRAME_NUM (12 + 4) |
| #define | MIN_LOG2_MAX_FRAME_NUM 4 |
| #define | EXTENDED_SAR 255 |
| #define | QP_MAX_NUM (51 + 6*6) |
| #define | MAX_YUV_FRAME_SIZE (7680 * 4320 * 3 / 2) |
Typedefs | |
| typedef struct _ni_logan_err_rc_txt_entry | ni_logan_err_rc_txt_entry_t |
| typedef struct _ni_logan_h264_pps_t | ni_logan_h264_pps_t |
Functions | |
| void | arg_error_exit (char *arg_name, char *param) |
| int | read_next_chunk (uint8_t *p_dst, uint32_t to_read) |
| void | reset_data_buf_pos (void) |
| void | rewind_data_buf_pos_by (int nb_bytes) |
| int | find_h264_next_nalu (uint8_t *p_dst, int *nal_type) |
| int | parse_hrd (ni_bitstream_reader_t *br, ni_logan_h264_sps_t *sps) |
| int | parse_vui (ni_bitstream_reader_t *br, ni_logan_h264_sps_t *sps) |
| int | parse_scaling_list (ni_bitstream_reader_t *br, uint8_t *factors, int size, const uint8_t *jvt_list, const uint8_t *fallback_list) |
| int | parse_scaling_matrices (ni_bitstream_reader_t *br, const ni_logan_h264_sps_t *sps, const ni_logan_h264_pps_t *pps, int is_sps, uint8_t(*scaling_matrix4)[16], uint8_t(*scaling_matrix8)[64]) |
| int | parse_sps (uint8_t *buf, int size_bytes, ni_logan_h264_sps_t *sps) |
| int | parse_sei (uint8_t *buf, int size_bytes, ni_logan_h264_sps_t *sps, int *sei_type, int *is_interlaced) |
| int | probe_h264_stream_info (ni_logan_h264_sps_t *sps) |
| int | parse_h264_slice_header (uint8_t *buf, int size_bytes, ni_logan_h264_sps_t *sps, int32_t *frame_num, unsigned int *first_mb_in_slice) |
| int | ni_logan_device_dec_session_write (ni_logan_session_context_t *p_ctx, ni_logan_session_data_io_t *p_data) |
| Sends data to decoder device. The data is assumed to be a full encoded frame that will be scanned, and stream headers if available will be saved/updated in the session context, to be used for contin- uous decoding once ni_logan_device_dec_session_flush is executed. More... | |
| ni_logan_retcode_t | decoder_send_data (ni_logan_session_context_t *p_dec_ctx, ni_logan_session_data_io_t *p_in_data, int input_video_width, int input_video_height, int packet_size, unsigned long *total_bytes_sent, int print_time, device_state_t *p_device_state, ni_logan_h264_sps_t *sps) |
| Send decoder input data. More... | |
| int | decoder_receive_data (ni_logan_session_context_t *p_dec_ctx, ni_logan_session_data_io_t *p_out_data, int output_video_width, int output_video_height, FILE *p_file, unsigned long long *total_bytes_received, int print_time, device_state_t *p_device_state) |
| Receive decoded output data from decoder. More... | |
| int | encoder_send_data (ni_logan_session_context_t *p_enc_ctx, ni_logan_session_data_io_t *p_in_data, int input_video_width, int input_video_height, unsigned long *bytes_sent, device_state_t *p_device_state) |
| Send encoder input data, read from input file. More... | |
| int | encoder_send_data2 (ni_logan_session_context_t *p_enc_ctx, ni_logan_session_context_t *p_dec_ctx, ni_logan_session_data_io_t *p_dec_out_data, ni_logan_session_data_io_t *p_enc_in_data, int input_video_width, int input_video_height, unsigned long *bytes_sent, device_state_t *p_device_state) |
| int | encoder_receive_data (ni_logan_session_context_t *p_enc_ctx, ni_logan_session_data_io_t *p_out_data, int output_video_width, int output_video_height, FILE *p_file, unsigned long long *total_bytes_received, int print_time) |
| Receive output data from encoder. More... | |
| int | encoder_open_session (ni_logan_session_context_t *p_enc_ctx, int dst_codec_format, int xcoder_id, const char *xcoder_name, ni_logan_encoder_params_t *p_enc_params, int src_bit_depth, int width, int height, 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) |
| Encoder session open. More... | |
| void | print_usage (void) |
| int | main (int argc, char *argv[]) |
| main More... | |
Variables | |
| volatile int | send_fin_flag = 0 |
| volatile int | receive_fin_flag = 0 |
| volatile int | flush_fin_flag = 0 |
| volatile int | err_flag = 0 |
| volatile uint32_t | number_of_frames = 0 |
| volatile uint32_t | number_of_packets = 0 |
| struct timeval start_time previous_time | current_time |
| time_t | start_timestamp = 0 |
| time_t | privious_timestamp = 0 |
| time_t | current_timestamp = 0 |
| volatile long | total_file_size = 0 |
| volatile uint32_t | data_left_size = 0 |
| const uint8_t | ni_logan_zigzag_direct [64] |
| const uint8_t | ni_logan_zigzag_scan [16+1] |
Example code on how to programmatically work with NI T-408 using libxcoder API.
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_device_test_logan.c.
| #define EXTENDED_SAR 255 |
Definition at line 133 of file ni_device_test_logan.c.
| #define MAX_LOG2_MAX_FRAME_NUM (12 + 4) |
Definition at line 131 of file ni_device_test_logan.c.
| #define MAX_YUV_FRAME_SIZE (7680 * 4320 * 3 / 2) |
Definition at line 181 of file ni_device_test_logan.c.
| #define MIN_LOG2_MAX_FRAME_NUM 4 |
Definition at line 132 of file ni_device_test_logan.c.
| #define QP_MAX_NUM (51 + 6*6) |
Definition at line 134 of file ni_device_test_logan.c.
| typedef struct _ni_logan_err_rc_txt_entry ni_logan_err_rc_txt_entry_t |
| typedef struct _ni_logan_h264_pps_t ni_logan_h264_pps_t |
Picture parameter set
| void arg_error_exit | ( | char * | arg_name, |
| char * | param | ||
| ) |
Definition at line 203 of file ni_device_test_logan.c.
| int decoder_receive_data | ( | ni_logan_session_context_t * | p_dec_ctx, |
| ni_logan_session_data_io_t * | p_out_data, | ||
| int | output_video_width, | ||
| int | output_video_height, | ||
| FILE * | p_file, | ||
| unsigned long long * | total_bytes_received, | ||
| int | print_time, | ||
| device_state_t * | p_device_state | ||
| ) |
Receive decoded output data from decoder.
| <br> |
Definition at line 1481 of file ni_device_test_logan.c.
| ni_logan_retcode_t decoder_send_data | ( | ni_logan_session_context_t * | p_dec_ctx, |
| ni_logan_session_data_io_t * | p_in_data, | ||
| int | input_video_width, | ||
| int | input_video_height, | ||
| int | packet_size, | ||
| unsigned long * | total_bytes_sent, | ||
| int | print_time, | ||
| device_state_t * | p_device_state, | ||
| ni_logan_h264_sps_t * | sps | ||
| ) |
Send decoder input data.
| <br> |
Definition at line 1244 of file ni_device_test_logan.c.
| int encoder_open_session | ( | ni_logan_session_context_t * | p_enc_ctx, |
| int | dst_codec_format, | ||
| int | xcoder_id, | ||
| const char * | xcoder_name, | ||
| ni_logan_encoder_params_t * | p_enc_params, | ||
| int | src_bit_depth, | ||
| int | width, | ||
| int | height, | ||
| 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 | ||
| ) |
Encoder session open.
| [out] | p_enc_ctx | pointer to an encoder session context [in] dst_codec_format AVC or HEVC |
Definition at line 2175 of file ni_device_test_logan.c.
| int encoder_receive_data | ( | ni_logan_session_context_t * | p_enc_ctx, |
| ni_logan_session_data_io_t * | p_out_data, | ||
| int | output_video_width, | ||
| int | output_video_height, | ||
| FILE * | p_file, | ||
| unsigned long long * | total_bytes_received, | ||
| int | print_time | ||
| ) |
Receive output data from encoder.
| <br> |
Definition at line 2077 of file ni_device_test_logan.c.
| int encoder_send_data | ( | ni_logan_session_context_t * | p_enc_ctx, |
| ni_logan_session_data_io_t * | p_in_data, | ||
| int | input_video_width, | ||
| int | input_video_height, | ||
| unsigned long * | bytes_sent, | ||
| device_state_t * | p_device_state | ||
| ) |
Send encoder input data, read from input file.
| <br> |
Definition at line 1626 of file ni_device_test_logan.c.
| int encoder_send_data2 | ( | ni_logan_session_context_t * | p_enc_ctx, |
| ni_logan_session_context_t * | p_dec_ctx, | ||
| ni_logan_session_data_io_t * | p_dec_out_data, | ||
| ni_logan_session_data_io_t * | p_enc_in_data, | ||
| int | input_video_width, | ||
| int | input_video_height, | ||
| unsigned long * | bytes_sent, | ||
| device_state_t * | p_device_state | ||
| ) |
Definition at line 1824 of file ni_device_test_logan.c.
| int find_h264_next_nalu | ( | uint8_t * | p_dst, |
| int * | nal_type | ||
| ) |
Definition at line 257 of file ni_device_test_logan.c.
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
| int ni_logan_device_dec_session_write | ( | ni_logan_session_context_t * | p_ctx, |
| ni_logan_session_data_io_t * | p_data | ||
| ) |
Sends data to decoder device. The data is assumed to be a full encoded frame that will be scanned, and stream headers if available will be saved/updated in the session context, to be used for contin- uous decoding once ni_logan_device_dec_session_flush is executed.
| [in] | p_ctx | Pointer to a caller allocated ni_logan_session_context_t struct |
| [in] | p_data | Pointer to a caller allocated ni_logan_session_data_io_t struct which contains a ni_logan_packet_t data packet to send |
Definition at line 1181 of file ni_device_test_logan.c.
| int parse_h264_slice_header | ( | uint8_t * | buf, |
| int | size_bytes, | ||
| ni_logan_h264_sps_t * | sps, | ||
| int32_t * | frame_num, | ||
| unsigned int * | first_mb_in_slice | ||
| ) |
Definition at line 1036 of file ni_device_test_logan.c.
| int parse_hrd | ( | ni_bitstream_reader_t * | br, |
| ni_logan_h264_sps_t * | sps | ||
| ) |
Definition at line 368 of file ni_device_test_logan.c.
| int parse_scaling_list | ( | ni_bitstream_reader_t * | br, |
| uint8_t * | factors, | ||
| int | size, | ||
| const uint8_t * | jvt_list, | ||
| const uint8_t * | fallback_list | ||
| ) |
Definition at line 532 of file ni_device_test_logan.c.
| int parse_scaling_matrices | ( | ni_bitstream_reader_t * | br, |
| const ni_logan_h264_sps_t * | sps, | ||
| const ni_logan_h264_pps_t * | pps, | ||
| int | is_sps, | ||
| uint8_t(*) | scaling_matrix4[16], | ||
| uint8_t(*) | scaling_matrix8[64] | ||
| ) |
Definition at line 569 of file ni_device_test_logan.c.
| int parse_sei | ( | uint8_t * | buf, |
| int | size_bytes, | ||
| ni_logan_h264_sps_t * | sps, | ||
| int * | sei_type, | ||
| int * | is_interlaced | ||
| ) |
Definition at line 831 of file ni_device_test_logan.c.
| int parse_sps | ( | uint8_t * | buf, |
| int | size_bytes, | ||
| ni_logan_h264_sps_t * | sps | ||
| ) |
Definition at line 626 of file ni_device_test_logan.c.
| int parse_vui | ( | ni_bitstream_reader_t * | br, |
| ni_logan_h264_sps_t * | sps | ||
| ) |
Definition at line 397 of file ni_device_test_logan.c.
| void print_usage | ( | void | ) |
Definition at line 2267 of file ni_device_test_logan.c.
| int probe_h264_stream_info | ( | ni_logan_h264_sps_t * | sps | ) |
Definition at line 922 of file ni_device_test_logan.c.
| int read_next_chunk | ( | uint8_t * | p_dst, |
| uint32_t | to_read | ||
| ) |
Definition at line 211 of file ni_device_test_logan.c.
| void reset_data_buf_pos | ( | void | ) |
Definition at line 236 of file ni_device_test_logan.c.
| void rewind_data_buf_pos_by | ( | int | nb_bytes | ) |
Definition at line 243 of file ni_device_test_logan.c.
| struct timeval start_time previous_time current_time |
Definition at line 175 of file ni_device_test_logan.c.
| time_t current_timestamp = 0 |
Definition at line 177 of file ni_device_test_logan.c.
| volatile uint32_t data_left_size = 0 |
Definition at line 187 of file ni_device_test_logan.c.
| volatile int err_flag = 0 |
Definition at line 169 of file ni_device_test_logan.c.
| volatile int flush_fin_flag = 0 |
Definition at line 169 of file ni_device_test_logan.c.
| const uint8_t ni_logan_zigzag_direct[64] |
Definition at line 347 of file ni_device_test_logan.c.
| const uint8_t ni_logan_zigzag_scan[16+1] |
Definition at line 359 of file ni_device_test_logan.c.
| volatile uint32_t number_of_frames = 0 |
Definition at line 170 of file ni_device_test_logan.c.
| volatile uint32_t number_of_packets = 0 |
Definition at line 171 of file ni_device_test_logan.c.
| time_t privious_timestamp = 0 |
Definition at line 177 of file ni_device_test_logan.c.
| volatile int receive_fin_flag = 0 |
Definition at line 169 of file ni_device_test_logan.c.
| volatile int send_fin_flag = 0 |
Definition at line 169 of file ni_device_test_logan.c.
| time_t start_timestamp = 0 |
Definition at line 177 of file ni_device_test_logan.c.
| volatile long total_file_size = 0 |
Definition at line 186 of file ni_device_test_logan.c.