libxcoder  3.5.1
ni_av_codec_logan.h
Go to the documentation of this file.
1 /*!****************************************************************************
2 *
3 * Copyright (C) 2018 NETINT Technologies.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted.
7 *
8 *******************************************************************************/
9 
10 /*!*****************************************************************************
11 * \file ni_av_codec_logan.h
12 *
13 * \brief NETINT audio/video related utility functions
14 *
15 *******************************************************************************/
16 
17 #pragma once
18 
19 #ifdef __cplusplus
20 extern "C"
21 {
22 #endif
23 
24 #include "ni_device_api_logan.h"
25 
26 // libxcoder API related definitions
27 
28 #ifndef QUADRA
29 
30 //Map the gopPresetIdx to gopSize, for customer set this value to -1
31 //customer_gop_size can find in ni_h265_enable_params_t struct
32 static int g_map_preset_to_gopsize[10] = {-1, 1, 1, 1, 2, 4, 4, 4, 8, 1};
33 
34 #define NI_NUM_PIXEL_ASPECT_RATIO 17
35 static const ni_rational_t ni_h264_pixel_aspect_list[NI_NUM_PIXEL_ASPECT_RATIO]=
36 {
37  { 0, 1 },
38  { 1, 1 },
39  { 12, 11 },
40  { 10, 11 },
41  { 16, 11 },
42  { 40, 33 },
43  { 24, 11 },
44  { 20, 11 },
45  { 32, 11 },
46  { 80, 33 },
47  { 18, 11 },
48  { 15, 11 },
49  { 64, 33 },
50  { 160, 99 },
51  { 4, 3 },
52  { 3, 2 },
53  { 2, 1 },
54 };
55 
56 typedef enum _ni_h264_sei_type_t
57 {
58  NI_H264_SEI_TYPE_BUFFERING_PERIOD = 0, // buffering period (H.264, D.1.1)
59  NI_H264_SEI_TYPE_PIC_TIMING = 1, // picture timing
60  NI_H264_SEI_TYPE_PAN_SCAN_RECT = 2, // pan-scan rectangle
61  NI_H264_SEI_TYPE_FILLER_PAYLOAD = 3, // filler data
62  NI_H264_SEI_TYPE_USER_DATA_REGISTERED = 4, // registered user data as specified by Rec. ITU-T T.35
63  NI_H264_SEI_TYPE_USER_DATA_UNREGISTERED = 5, // unregistered user data
64  NI_H264_SEI_TYPE_RECOVERY_POINT = 6, // recovery point (frame # to decoder sync)
65  NI_H264_SEI_TYPE_FRAME_PACKING = 45, // frame packing arrangement
66  NI_H264_SEI_TYPE_DISPLAY_ORIENTATION = 47, // display orientation
67  NI_H264_SEI_TYPE_GREEN_METADATA = 56, // GreenMPEG information
68  NI_H264_SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME = 137, // mastering display properties
69  NI_H264_SEI_TYPE_ALTERNATIVE_TRANSFER = 147, // alternative transfer
71 
72 // pic_struct in picture timing SEI message
74 {
75  NI_H264_SEI_PIC_STRUCT_FRAME = 0, // 0: %frame
76  NI_H264_SEI_PIC_STRUCT_TOP_FIELD = 1, // 1: top field
77  NI_H264_SEI_PIC_STRUCT_BOTTOM_FIELD = 2, // 2: bottom field
78  NI_H264_SEI_PIC_STRUCT_TOP_BOTTOM = 3, // 3: top field, bottom field, in that order
79  NI_H264_SEI_PIC_STRUCT_BOTTOM_TOP = 4, // 4: bottom field, top field, in that order
80  NI_H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5, // 5: top field, bottom field, top field repeated, in that order
81  NI_H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6, // 6: bottom field, top field, bottom field repeated, in that order
82  NI_H264_SEI_PIC_STRUCT_FRAME_DOUBLING = 7, // 7: %frame doubling
83  NI_H264_SEI_PIC_STRUCT_FRAME_TRIPLING = 8 // 8: %frame tripling
85 
90 {
96 
97 /* Chromaticity coordinates of the source primaries.
98  * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1.
99  */
101 {
103  NI_COL_PRI_BT709 = 1, //< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
106  NI_COL_PRI_BT470M = 4, //< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
107 
108  NI_COL_PRI_BT470BG = 5, //< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
109  NI_COL_PRI_SMPTE170M = 6, //< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
110  NI_COL_PRI_SMPTE240M = 7, //< functionally identical to above
111  NI_COL_PRI_FILM = 8, //< colour filters using Illuminant C
112  NI_COL_PRI_BT2020 = 9, //< ITU-R BT2020
113  NI_COL_PRI_SMPTE428 = 10, //< SMPTE ST 428-1 (CIE 1931 XYZ)
115  NI_COL_PRI_SMPTE431 = 11, //< SMPTE ST 431-2 (2011) / DCI P3
116  NI_COL_PRI_SMPTE432 = 12, //< SMPTE ST 432-1 (2010) / P3 D65 / Display P3
117  NI_COL_PRI_JEDEC_P22 = 22, //< JEDEC P22 phosphors
118  NI_COL_PRI_NB //< Not part of ABI
120 
121 /* Color Transfer Characteristic.
122  * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2.
123  */
125 {
127  NI_COL_TRC_BT709 = 1, //< also ITU-R BT1361
130  NI_COL_TRC_GAMMA22 = 4, //< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
131  NI_COL_TRC_GAMMA28 = 5, //< also ITU-R BT470BG
132  NI_COL_TRC_SMPTE170M = 6, //< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
134  NI_COL_TRC_LINEAR = 8, //< "Linear transfer characteristics"
135  NI_COL_TRC_LOG = 9, //< "Logarithmic transfer characteristic (100:1 range)"
136  NI_COL_TRC_LOG_SQRT = 10, //< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
137  NI_COL_TRC_IEC61966_2_4 = 11, //< IEC 61966-2-4
138  NI_COL_TRC_BT1361_ECG = 12, //< ITU-R BT1361 Extended Colour Gamut
139  NI_COL_TRC_IEC61966_2_1 = 13, //< IEC 61966-2-1 (sRGB or sYCC)
140  NI_COL_TRC_BT2020_10 = 14, //< ITU-R BT2020 for 10-bit system
141  NI_COL_TRC_BT2020_12 = 15, //< ITU-R BT2020 for 12-bit system
142  NI_COL_TRC_SMPTE2084 = 16, //< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
144  NI_COL_TRC_SMPTE428 = 17, //< SMPTE ST 428-1
146  NI_COL_TRC_ARIB_STD_B67 = 18, //< ARIB STD-B67, known as "Hybrid log-gamma"
147  NI_COL_TRC_NB //< Not part of ABI
149 
154 typedef enum _ni_color_space
155 {
156  NI_COL_SPC_RGB = 0, //< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
157  NI_COL_SPC_BT709 = 1, //< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
160  NI_COL_SPC_FCC = 4, //< FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
161  NI_COL_SPC_BT470BG = 5, //< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
162  NI_COL_SPC_SMPTE170M = 6, //< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
163  NI_COL_SPC_SMPTE240M = 7, //< functionally identical to above
164  NI_COL_SPC_YCGCO = 8, //< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
166  NI_COL_SPC_BT2020_NCL = 9, //< ITU-R BT2020 non-constant luminance system
167  NI_COL_SPC_BT2020_CL = 10, //< ITU-R BT2020 constant luminance system
168  NI_COL_SPC_SMPTE2085 = 11, //< SMPTE 2085, Y'D'zD'x
169  NI_COL_SPC_CHROMA_DERIVED_NCL = 12, //< Chromaticity-derived non-constant luminance system
170  NI_COL_SPC_CHROMA_DERIVED_CL = 13, //< Chromaticity-derived constant luminance system
171  NI_COL_SPC_ICTCP = 14, //< ITU-R BT.2100-0, ICtCp
172  NI_COL_SPC_NB //< Not part of ABI
174 
175 // struct describing HDR10 mastering display metadata
177 {
178  // CIE 1931 xy chromaticity coords of color primaries (r, g, b order).
180 
181  // CIE 1931 xy chromaticity coords of white point.
183 
184  // Min luminance of mastering display (cd/m^2).
186 
187  // Max luminance of mastering display (cd/m^2).
189 
190  // Flag indicating whether the display primaries (and white point) are set.
192 
193  // Flag indicating whether the luminance (min_ and max_) have been set.
196 
197 // struct describing HDR10 Content light level
199 {
200  // Max content light level (cd/m^2).
201  uint16_t max_cll;
202 
203  // Max average light level per frame (cd/m^2).
204  uint16_t max_fall;
206 
207 // struct and enum for HDR10+
208 // Option for overlapping elliptical pixel selectors in an image.
210 {
214 
215 // struct that represents the percentile at a specific percentage in
216 // a distribution.
218 {
219  // The percentage value corresponding to a specific percentile linearized
220  // RGB value in the processing window in the scene. The value shall be in
221  // the range of 0 to 100, inclusive.
222  uint8_t percentage;
223 
224  // The linearized maxRGB value at a specific percentile in the processing
225  // window in the scene. The value shall be in the range of 0 to 1, inclusive
226  // and in multiples of 0.00001.
229 
230 // struct describing color transform parameters at a processing window in a
231 // dynamic metadata for SMPTE 2094-40.
233 {
234  // The relative x coordinate of the top left pixel of the processing
235  // window. The value shall be in the range of 0 and 1, inclusive and
236  // in multiples of 1/(width of Picture - 1). The value 1 corresponds
237  // to the absolute coordinate of width of Picture - 1. The value for
238  // first processing window shall be 0.
240 
241  // The relative y coordinate of the top left pixel of the processing
242  // window. The value shall be in the range of 0 and 1, inclusive and
243  // in multiples of 1/(height of Picture - 1). The value 1 corresponds
244  // to the absolute coordinate of height of Picture - 1. The value for
245  // first processing window shall be 0.
247 
248  // The relative x coordinate of the bottom right pixel of the processing
249  // window. The value shall be in the range of 0 and 1, inclusive and
250  // in multiples of 1/(width of Picture - 1). The value 1 corresponds
251  // to the absolute coordinate of width of Picture - 1. The value for
252  // first processing window shall be 1.
254 
255  // The relative y coordinate of the bottom right pixel of the processing
256  // window. The value shall be in the range of 0 and 1, inclusive and
257  // in multiples of 1/(height of Picture - 1). The value 1 corresponds
258  // to the absolute coordinate of height of Picture - 1. The value for
259  // first processing window shall be 1.
261 
262  // The x coordinate of the center position of the concentric internal and
263  // external ellipses of the elliptical pixel selector in the processing
264  // window. The value shall be in the range of 0 to (width of Picture - 1),
265  // inclusive and in multiples of 1 pixel.
267 
268  // The y coordinate of the center position of the concentric internal and
269  // external ellipses of the elliptical pixel selector in the processing
270  // window. The value shall be in the range of 0 to (height of Picture - 1),
271  // inclusive and in multiples of 1 pixel.
273 
274  // The clockwise rotation angle in degree of arc with respect to the
275  // positive direction of the x-axis of the concentric internal and external
276  // ellipses of the elliptical pixel selector in the processing window. The
277  // value shall be in the range of 0 to 180, inclusive and in multiples of 1.
278  uint8_t rotation_angle;
279 
280  // The semi-major axis value of the internal ellipse of the elliptical pixel
281  // selector in amount of pixels in the processing window. The value shall be
282  // in the range of 1 to 65535, inclusive and in multiples of 1 pixel.
284 
285  // The semi-major axis value of the external ellipse of the elliptical pixel
286  // selector in amount of pixels in the processing window. The value
287  // shall not be less than semimajor_axis_internal_ellipse of the current
288  // processing window. The value shall be in the range of 1 to 65535,
289  // inclusive and in multiples of 1 pixel.
291 
292  // The semi-minor axis value of the external ellipse of the elliptical pixel
293  // selector in amount of pixels in the processing window. The value shall be
294  // in the range of 1 to 65535, inclusive and in multiples of 1 pixel.
296 
297  // Overlap process option indicates one of the two methods of combining
298  // rendered pixels in the processing window in an image with at least one
299  // elliptical pixel selector. For overlapping elliptical pixel selectors
300  // in an image, overlap_process_option shall have the same value.
302 
303  // The maximum of the color components of linearized RGB values in the
304  // processing window in the scene. The values should be in the range of 0 to
305  // 1, inclusive and in multiples of 0.00001. maxscl[ 0 ], maxscl[ 1 ], and
306  // maxscl[ 2 ] are corresponding to R, G, B color components respectively.
308 
309  // The average of linearized maxRGB values in the processing window in the
310  // scene. The value should be in the range of 0 to 1, inclusive and in
311  // multiples of 0.00001.
313 
314  // The number of linearized maxRGB values at given percentiles in the
315  // processing window in the scene. The maximum value shall be 15.
317 
318  // The linearized maxRGB values at given percentiles in the
319  // processing window in the scene.
321 
322  // The fraction of selected pixels in the image that contains the brightest
323  // pixel in the scene. The value shall be in the range of 0 to 1, inclusive
324  // and in multiples of 0.001.
326 
327  // This flag indicates that the metadata for the tone mapping function in
328  // the processing window is present (for value of 1).
330 
331  // The x coordinate of the separation point between the linear part and the
332  // curved part of the tone mapping function. The value shall be in the range
333  // of 0 to 1, excluding 0 and in multiples of 1/4095.
335 
336  // The y coordinate of the separation point between the linear part and the
337  // curved part of the tone mapping function. The value shall be in the range
338  // of 0 to 1, excluding 0 and in multiples of 1/4095.
340 
341  // The number of the intermediate anchor parameters of the tone mapping
342  // function in the processing window. The maximum value shall be 15.
344 
345  // The intermediate anchor parameters of the tone mapping function in the
346  // processing window in the scene. The values should be in the range of 0
347  // to 1, inclusive and in multiples of 1/1023.
349 
350  // This flag shall be equal to 0 in bitstreams conforming to this version of
351  // this Specification. Other values are reserved for future use.
353 
354  // The color saturation gain in the processing window in the scene. The
355  // value shall be in the range of 0 to 63/8, inclusive and in multiples of
356  // 1/8. The default value shall be 1.
359 
360 // struct representing dynamic metadata for color volume transform -
361 // application 4 of SMPTE 2094-40:2016 standard.
362 typedef struct _ni_dynamic_hdr_plus
363 {
364  // Country code by Rec. ITU-T T.35 Annex A. The value shall be 0xB5.
366 
367  // Application version in the application defining document in ST-2094
368  // suite. The value shall be set to 0.
370 
371  // The number of processing windows. The value shall be in the range
372  // of 1 to 3, inclusive.
373  uint8_t num_windows;
374 
375  // The color transform parameters for every processing window.
377 
378  // The nominal maximum display luminance of the targeted system display,
379  // in units of 0.0001 candelas per square metre. The value shall be in
380  // the range of 0 to 10000, inclusive.
382 
383  // This flag shall be equal to 0 in bit streams conforming to this version
384  // of this Specification. The value 1 is reserved for future use.
386 
387  // The number of rows in the targeted system_display_actual_peak_luminance
388  // array. The value shall be in the range of 2 to 25, inclusive.
390 
391  // The number of columns in the
392  // targeted_system_display_actual_peak_luminance array. The value shall be
393  // in the range of 2 to 25, inclusive.
395 
396  // The normalized actual peak luminance of the targeted system display. The
397  // values should be in the range of 0 to 1, inclusive and in multiples of
398  // 1/15.
400 
401  // This flag shall be equal to 0 in bitstreams conforming to this version of
402  // this Specification. The value 1 is reserved for future use.
404 
405  // The number of rows in the mastering_display_actual_peak_luminance array.
406  // The value shall be in the range of 2 to 25, inclusive.
408 
409  // The number of columns in the mastering_display_actual_peak_luminance
410  // array. The value shall be in the range of 2 to 25, inclusive.
412 
413  // The normalized actual peak luminance of the mastering display used for
414  // mastering the image essence. The values should be in the range of 0 to 1,
415  // inclusive and in multiples of 1/15.
418 
419 #endif // #ifndef QUADRA
420 
421 #define NI_LOGAN_NAL_VPS_BIT (0x01)
422 #define NI_LOGAN_NAL_SPS_BIT (0x01<<1)
423 #define NI_LOGAN_NAL_PPS_BIT (0x01<<2)
424 #define NI_LOGAN_GENERATE_ALL_NAL_HEADER_BIT (0x01<<3)
425 
426 /*
427  * Table 7-1 – NAL unit type codes, syntax element categories, and NAL unit type classes in
428  * T-REC-H.264-201704
429  */
431 {
465 
471 {
537 
538 /*!*****************************************************************************
539  * \brief Whether SEI should be sent together with this frame to encoder
540  *
541  * \param[in] p_enc_ctx encoder session context
542  * \param[in] pic_type frame type
543  * \param[in] p_param encoder parameters
544  *
545  * \return 1 if yes, 0 otherwise
546  ******************************************************************************/
548  ni_logan_session_context_t* p_enc_ctx,
549  ni_logan_pic_type_t pic_type,
550  ni_logan_encoder_params_t *p_param);
551 
552 /*!*****************************************************************************
553  * \brief Set SPS VUI part of encoded stream header
554  *
555  * \param[in/out] p_param encoder parameters, its VUI data member will be
556  * updated.
557  * \param[out] p_ctx session context, its HRD parameters (hrd_params)
558  * may be updated.
559  * \param[in] color_primaries color primaries
560  * \param[in] color_trc color transfer characteristic
561  * \param[in] color_space YUV colorspace type
562  * \param[in] video_full_range_flag
563  * \param[in] sar_num/sar_den sample aspect ration in numerator/denominator
564  * \param[in] codec_format H.264 or H.265
565  *
566  * \return NONE
567  ******************************************************************************/
568 LIB_API void ni_logan_set_vui(ni_logan_encoder_params_t *p_param,
570  ni_color_primaries_t color_primaries,
572  ni_color_space_t color_space,
573  int video_full_range_flag,
574  int sar_num,
575  int sar_den,
576  ni_logan_codec_format_t codec_format);
577 
578 /*!*****************************************************************************
579  * \brief Buffered period sei
580  *
581  * \param[in/out] p_param encoder parameters, its GOP information will be
582  * updated.
583  * \param[in] p_ctx session context, use its HRD parameters (hrd_params).
584  * \param[in] frame_idx frame index
585  * \param[in] buf_len output buffer length
586  * \param[out] p_buf output sei buffer.
587  *
588  * \return put_bit_byte_size
589  ******************************************************************************/
592  uint32_t frame_idx,
593  int buf_len,
594  uint8_t *p_buf);
595 
596 /*!*****************************************************************************
597  * \brief Buffered customer sei
598  *
599  * \param[in] p_data input side data of customer sei
600  * \param[out] p_ctx session context, update its pkt_custom_sei.
601  * \param[in] index fifo index
602  *
603  * \return success return NI_LOGAN_RETCODE_SUCCESS
604  * failure return < 0
605  ******************************************************************************/
606 LIB_API uint32_t ni_logan_enc_buffering_custom_sei(void *p_data,
608  uint32_t index);
609 
610 /*!*****************************************************************************
611  * \brief Generate pic timing sei2
612  *
613  * \param[in/out] p_param encoder parameters, its GOP information will be
614  * updated.
615  * \param[in/out] p_ctx session context, its HRD parameters (hrd_params)
616  * may be updated.
617  * \param[in] is_i_or_idr True if it is i or idr packet.
618  * \param[in] is_idr True if it is idr packet.
619  * \param[in] frame_idx frame index
620  * \param[in] buf_len output buffer length
621  * \param[out] p_buf output sei buffer.
622  *
623  * \return length of pci timing sei2
624  ******************************************************************************/
627  int is_i_or_idr,
628  int is_idr,
629  uint32_t frame_idx,
630  int buf_len,
631  uint8_t *p_buf);
632 
633 /*!*****************************************************************************
634  * \brief Retrieve auxiliary data (close caption, various SEI) associated with
635  * this frame that is returned by decoder, convert them to appropriate
636  * format and save them in the frame's auxiliary data storage for
637  * future use by encoding. Usually they would be sent together with
638  * this frame to encoder at encoding.
639  *
640  * \param[in/out] frame that is returned by decoder
641  *
642  * \return NONE
643  ******************************************************************************/
645 
646 /*!*****************************************************************************
647  * \brief Initialize auxiliary data that should be sent together with this frame
648  * to encoder based on the auxiliary data of the decoded frame.
649  *
650  * \param[in/out] ni_logan_session_data_io_t session data
651  *
652  * \return NONE
653  ******************************************************************************/
655 
656 /*!*****************************************************************************
657  * \brief Prepare auxiliary data that should be sent together with this frame
658  * to encoder based on the auxiliary data of the decoded frame.
659  *
660  * \param[in/out] p_enc_ctx encoder session context whose various SEI type
661  * header can be updated as the result of this function
662  * \param[out] p_enc_frame frame to be sent to encoder
663  * \param[in] p_dec_frame frame that is returned by decoder
664  * \param[in] codec_format H.264 or H.265
665  * \param[in] should_send_sei_with_frame if need to send a certain type of
666  * SEI with this frame
667  * \param[out] mdcv_data SEI for HDR mastering display color volume info
668  * \param[out] cll_data SEI for HDR content light level info
669  * \param[out] cc_data SEI for close caption
670  * \param[out] udu_data SEI for User data unregistered
671  * \param[out] hdrp_data SEI for HDR10+
672  *
673  * \return NONE
674  ******************************************************************************/
676  ni_logan_frame_t *p_enc_frame,
677  ni_logan_frame_t *p_dec_frame,
678  ni_logan_codec_format_t codec_format,
679  int should_send_sei_with_frame,
680  uint8_t *mdcv_data,
681  uint8_t *cll_data,
682  uint8_t *cc_data,
683  uint8_t *udu_data,
684  uint8_t *hdrp_data);
685 
686 /*!*****************************************************************************
687  * \brief Copy auxiliary data that should be sent together with this frame
688  * to encoder.
689  *
690  * \param[in] p_enc_ctx encoder session context
691  * \param[out] p_enc_frame frame to be sent to encoder
692  * \param[in] p_dec_frame frame returned by decoder
693  * \param[in] codec_format H.264 or H.265
694  * \param[in] mdcv_data SEI for HDR mastering display color volume info
695  * \param[in] cll_data SEI for HDR content light level info
696  * \param[in] cc_data SEI for close caption
697  * \param[in] udu_data SEI for User data unregistered
698  * \param[in] hdrp_data SEI for HDR10+
699  *
700  * \return NONE
701  ******************************************************************************/
703  ni_logan_frame_t *p_enc_frame,
704  ni_logan_frame_t *p_dec_frame,
705  ni_logan_codec_format_t codec_format,
706  const uint8_t *mdcv_data,
707  const uint8_t *cll_data,
708  const uint8_t *cc_data,
709  const uint8_t *udu_data,
710  const uint8_t *hdrp_data);
711 
712 /*!*****************************************************************************
713  * \brief Find the next start code
714  *
715  * \param[in] p pointer to buffer start address.
716  * \param[in] end pointer to buffer end address.
717  * \param[state] state pointer to nalu type address
718  *
719  * \return search end address
720  ******************************************************************************/
721 LIB_API const uint8_t *ni_logan_find_start_code(const uint8_t *p,
722  const uint8_t *end,
723  uint32_t *state);
724 
725 /*!*****************************************************************************
726  * \brief Fill reconfig params
727  *
728  * \param[in] p_param encoder parameters.
729  * \param[in/out] p_ctx session context, its enc_change_params may be updated.
730  * \param[in/out] p_api_fme extra_data_len and reconf_len may be updated
731  * \param[in] reconfigCount reconfig count, may be updated.
732  *
733  * \return reconfigCount on success
734  * < 0 on failure, NI_LOGAN_RETCODE_INVALID_PARAM
735  * NI_LOGAN_RETCODE_ERROR_MEM_ALOC
736  ******************************************************************************/
739  ni_logan_frame_t *p_api_fme,
740  int reconfigCount);
741 
742 /*!******************************************************************************
743  * \brief detect custom SEI payload data in Packet data,
744  * custom SEI has two meanings:
745  * a. the SEI type is not in the standard protocol, which is added by customes,
746  * for example SEI type 100, note that custom SEI is not user data unregistered SEI.
747  * b. the SEI NAL location does not conform to protocol. It's after VCL NALs.
748  * So there are cases to handle here:
749  * case a: enable custom_sei, detext custom SEIs before VCL.
750  * case b: enable custom_sei and enable_check_packet, detect custom SEIs before VCL,
751  * and all SEIs after VCL.
752  * all of these SEIs are passthroughed in the same places after encoding.
753  *
754  * \param uint8_t *data - packet data
755  * \param int size - pkt data size
756  * \param ni_logan_session_context_t *p_api_ctx - Netint session context
757  * \param ni_logan_decoder_params_t *api_param - Netint xcoder params
758  * \param ni_logan_packet_t *p_packet - netint internal packet
759  *
760  * \return - 0 on success or not detect correct custom sei, non-0 on failure
761  *******************************************************************************/
762 LIB_API int ni_logan_detect_custom_sei(const uint8_t *data,
763  int size,
764  ni_logan_session_context_t *p_api_ctx,
765  ni_logan_decoder_params_t *p_api_param,
766  ni_logan_packet_t *p_packet);
767 
768 /*!*****************************************************************************
769  * \brief Fill reconfig vfr
770  *
771  * \param[in/out] p_session_ctx session context, some parameters may be updated.
772  * \param[in] p_param encoder parameters.
773  * \param[in/out] ni_frame aux_data may be updated
774  * \param[in] pts frame pts
775  * \param[in] timebase timebase
776  *
777  * \return
778  ******************************************************************************/
779 LIB_API void ni_logan_enc_reconfig_vfr(ni_logan_session_context_t *p_session_ctx,
780  ni_logan_encoder_params_t *p_encoder_params,
781  ni_logan_frame_t *ni_frame,
782  int64_t pts,
783  uint32_t timebase);
784 
785 /*!*****************************************************************************
786  * \brief Reset vui info from decoder
787  *
788  * \param[in] p_param encoder parameters.
789  * \param[in] aux_data aux_data may be updated
790  * \param[in] codec_format encoder format
791  *
792  * \return
793  ******************************************************************************/
794 LIB_API void ni_logan_reset_vui(ni_logan_encoder_params_t *p_param, ni_aux_data_t *aux_data,
795  ni_logan_codec_format_t codec_format);
796 
797 /*!*****************************************************************************
798  * \brief Fill reconfig vui
799  *
800  * \param[in] p_param encoder parameters.
801  * \param[in/out] p_ctx session context, its enc_change_params may be updated.
802  * \param[in/out] p_api_fme extra_data_len and reconf_len may be updated
803  * \param[in] reconfigCount reconfig count, may be updated.
804  * \param[in] aux_data aux_data may be updated
805  *
806  * \return reconfigCount on success
807  * < 0 on failure, NI_LOGAN_RETCODE_INVALID_PARAM
808  * NI_LOGAN_RETCODE_ERROR_MEM_ALOC
809  ******************************************************************************/
812  ni_logan_frame_t *p_api_fme,
813  int reconfigCount,
814  ni_aux_data_t *aux_data);
815 
816 #ifdef __cplusplus
817 }
818 #endif
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...
_ni_color_transfer_characteristic
@ NI_COL_TRC_RESERVED0
@ NI_COL_TRC_SMPTE428
@ NI_COL_TRC_UNSPECIFIED
@ NI_COL_TRC_NB
@ NI_COL_TRC_BT1361_ECG
@ NI_COL_TRC_BT2020_12
@ NI_COL_TRC_IEC61966_2_4
@ NI_COL_TRC_SMPTEST2084
@ NI_COL_TRC_IEC61966_2_1
@ NI_COL_TRC_SMPTE2084
@ NI_COL_TRC_LOG_SQRT
@ NI_COL_TRC_SMPTEST428_1
@ NI_COL_TRC_BT2020_10
@ NI_COL_TRC_BT709
@ NI_COL_TRC_SMPTE170M
@ NI_COL_TRC_RESERVED
@ NI_COL_TRC_ARIB_STD_B67
@ NI_COL_TRC_SMPTE240M
@ NI_COL_TRC_LINEAR
@ NI_COL_TRC_LOG
@ NI_COL_TRC_GAMMA28
@ NI_COL_TRC_GAMMA22
enum _ni_logan_hevc_nalu_type ni_logan_hevc_nalu_type_t
enum _ni_color_primaries ni_color_primaries_t
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...
_ni_color_space
@ NI_COL_SPC_BT470BG
@ NI_COL_SPC_YCOCG
@ NI_COL_SPC_SMPTE240M
@ NI_COL_SPC_ICTCP
@ NI_COL_SPC_SMPTE170M
@ NI_COL_SPC_YCGCO
@ NI_COL_SPC_RESERVED
@ NI_COL_SPC_FCC
@ NI_COL_SPC_CHROMA_DERIVED_CL
@ NI_COL_SPC_NB
@ NI_COL_SPC_BT2020_NCL
@ NI_COL_SPC_SMPTE2085
@ NI_COL_SPC_CHROMA_DERIVED_NCL
@ NI_COL_SPC_UNSPECIFIED
@ NI_COL_SPC_BT709
@ NI_COL_SPC_RGB
@ NI_COL_SPC_BT2020_CL
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.
_ni_color_primaries
@ NI_COL_PRI_SMPTE432
@ NI_COL_PRI_RESERVED0
@ NI_COL_PRI_SMPTE240M
@ NI_COL_PRI_SMPTE431
@ NI_COL_PRI_JEDEC_P22
@ NI_COL_PRI_NB
@ NI_COL_PRI_FILM
@ NI_COL_PRI_BT470BG
@ NI_COL_PRI_UNSPECIFIED
@ NI_COL_PRI_SMPTE428
@ NI_COL_PRI_RESERVED
@ NI_COL_PRI_BT709
@ NI_COL_PRI_BT470M
@ NI_COL_PRI_BT2020
@ NI_COL_PRI_SMPTE170M
@ NI_COL_PRI_SMPTEST428_1
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.
_ni_logan_hevc_nalu_type
@ NI_LOGAN_HEVC_NAL_TRAIL_R
@ NI_LOGAN_HEVC_NAL_RADL_R
@ NI_LOGAN_HEVC_NAL_UNSPEC60
@ NI_LOGAN_HEVC_NAL_RSV_VCL30
@ NI_LOGAN_HEVC_NAL_EOB_NUT
@ NI_LOGAN_HEVC_NAL_VCL_R15
@ NI_LOGAN_HEVC_NAL_UNSPEC48
@ NI_LOGAN_HEVC_NAL_RSV_NVCL47
@ NI_LOGAN_HEVC_NAL_STSA_N
@ NI_LOGAN_HEVC_NAL_UNSPEC50
@ NI_LOGAN_HEVC_NAL_VCL_R11
@ NI_LOGAN_HEVC_NAL_UNSPEC59
@ NI_LOGAN_HEVC_NAL_IDR_W_RADL
@ NI_LOGAN_HEVC_NAL_RSV_VCL25
@ NI_LOGAN_HEVC_NAL_RSV_NVCL44
@ NI_LOGAN_HEVC_NAL_VCL_N12
@ NI_LOGAN_HEVC_NAL_SPS
@ NI_LOGAN_HEVC_NAL_RSV_NVCL41
@ NI_LOGAN_HEVC_NAL_RSV_VCL24
@ NI_LOGAN_HEVC_NAL_TRAIL_N
@ NI_LOGAN_HEVC_NAL_UNSPEC54
@ NI_LOGAN_HEVC_NAL_UNSPEC51
@ NI_LOGAN_HEVC_NAL_RSV_NVCL43
@ NI_LOGAN_HEVC_NAL_VCL_R13
@ NI_LOGAN_HEVC_NAL_RSV_VCL31
@ NI_LOGAN_HEVC_NAL_RSV_VCL26
@ NI_LOGAN_HEVC_NAL_RSV_NVCL42
@ NI_LOGAN_HEVC_NAL_RSV_VCL29
@ NI_LOGAN_HEVC_NAL_SEI_SUFFIX
@ NI_LOGAN_HEVC_NAL_VPS
@ NI_LOGAN_HEVC_NAL_RSV_VCL28
@ NI_LOGAN_HEVC_NAL_BLA_N_LP
@ NI_LOGAN_HEVC_NAL_STSA_R
@ NI_LOGAN_HEVC_NAL_CRA_NUT
@ NI_LOGAN_HEVC_NAL_EOS_NUT
@ NI_LOGAN_HEVC_NAL_RSV_NVCL45
@ NI_LOGAN_HEVC_NAL_RASL_N
@ NI_LOGAN_HEVC_NAL_RSV_IRAP_VCL22
@ NI_LOGAN_HEVC_NAL_UNSPEC55
@ NI_LOGAN_HEVC_NAL_UNSPEC52
@ NI_LOGAN_HEVC_NAL_VCL_N14
@ NI_LOGAN_HEVC_NAL_RSV_IRAP_VCL23
@ NI_LOGAN_HEVC_NAL_TSA_N
@ NI_LOGAN_HEVC_NAL_RSV_NVCL46
@ NI_LOGAN_HEVC_NAL_PPS
@ NI_LOGAN_HEVC_NAL_UNSPEC56
@ NI_LOGAN_HEVC_NAL_FD_NUT
@ NI_LOGAN_HEVC_NAL_IDR_N_LP
@ NI_LOGAN_HEVC_NAL_UNSPEC61
@ NI_LOGAN_HEVC_NAL_UNSPEC49
@ NI_LOGAN_HEVC_NAL_RSV_VCL27
@ NI_LOGAN_HEVC_NAL_TSA_R
@ NI_LOGAN_HEVC_NAL_BLA_W_RADL
@ NI_LOGAN_HEVC_NAL_BLA_W_LP
@ NI_LOGAN_HEVC_NAL_UNSPEC63
@ NI_LOGAN_HEVC_NAL_VCL_N10
@ NI_LOGAN_HEVC_NAL_UNSPEC58
@ NI_LOGAN_HEVC_NAL_UNSPEC53
@ NI_LOGAN_HEVC_NAL_SEI_PREFIX
@ NI_LOGAN_HEVC_NAL_RASL_R
@ NI_LOGAN_HEVC_NAL_RADL_N
@ NI_LOGAN_HEVC_NAL_UNSPEC57
@ NI_LOGAN_HEVC_NAL_AUD
@ NI_LOGAN_HEVC_NAL_UNSPEC62
enum _ni_color_transfer_characteristic ni_color_transfer_characteristic_t
#define NI_NUM_PIXEL_ASPECT_RATIO
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.
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 auxili...
enum _ni_hdr_plus_overlap_process_option ni_hdr_plus_overlap_process_option_t
struct _ni_hdr_plus_percentile ni_hdr_plus_percentile_t
struct _ni_hdr_plus_color_transform_params ni_hdr_plus_color_transform_params_t
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.
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.
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 d...
enum _ni_color_space ni_color_space_t
struct _ni_content_light_level ni_content_light_level_t
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.
_ni_logan_h264_nalu_type
@ NI_LOGAN_H264_NAL_AUD
@ NI_LOGAN_H264_NAL_AUXILIARY_SLICE
@ NI_LOGAN_H264_NAL_END_STREAM
@ NI_LOGAN_H264_NAL_UNSPECIFIED28
@ NI_LOGAN_H264_NAL_UNSPECIFIED24
@ NI_LOGAN_H264_NAL_UNSPECIFIED
@ NI_LOGAN_H264_NAL_UNSPECIFIED26
@ NI_LOGAN_H264_NAL_END_SEQUENCE
@ NI_LOGAN_H264_NAL_UNSPECIFIED30
@ NI_LOGAN_H264_NAL_DPC
@ NI_LOGAN_H264_NAL_UNSPECIFIED29
@ NI_LOGAN_H264_NAL_RESERVED23
@ NI_LOGAN_H264_NAL_RESERVED17
@ NI_LOGAN_H264_NAL_PREFIX
@ NI_LOGAN_H264_NAL_SPS_EXT
@ NI_LOGAN_H264_NAL_DPA
@ NI_LOGAN_H264_NAL_SLICE
@ NI_LOGAN_H264_NAL_SEI
@ NI_LOGAN_H264_NAL_DPS
@ NI_LOGAN_H264_NAL_PPS
@ NI_LOGAN_H264_NAL_DPB
@ NI_LOGAN_H264_NAL_SPS
@ NI_LOGAN_H264_NAL_UNSPECIFIED27
@ NI_LOGAN_H264_NAL_EXTEN_SLICE
@ NI_LOGAN_H264_NAL_IDR_SLICE
@ NI_LOGAN_H264_NAL_RESERVED22
@ NI_LOGAN_H264_NAL_UNSPECIFIED31
@ NI_LOGAN_H264_NAL_RESERVED18
@ NI_LOGAN_H264_NAL_DEPTH_EXTEN_SLICE
@ NI_LOGAN_H264_NAL_UNSPECIFIED25
@ NI_LOGAN_H264_NAL_FILLER_DATA
@ NI_LOGAN_H264_NAL_SUB_SPS
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.
_ni_h264_sei_pic_struct_t
@ NI_H264_SEI_PIC_STRUCT_FRAME_TRIPLING
@ NI_H264_SEI_PIC_STRUCT_TOP_BOTTOM
@ NI_H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP
@ NI_H264_SEI_PIC_STRUCT_FRAME
@ NI_H264_SEI_PIC_STRUCT_BOTTOM_FIELD
@ NI_H264_SEI_PIC_STRUCT_BOTTOM_TOP
@ NI_H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM
@ NI_H264_SEI_PIC_STRUCT_TOP_FIELD
@ NI_H264_SEI_PIC_STRUCT_FRAME_DOUBLING
struct _ni_dynamic_hdr_plus ni_dynamic_hdr_plus_t
enum _ni_logan_h264_nalu_type ni_logan_h264_nalu_type_t
struct _ni_mastering_display_metadata ni_mastering_display_metadata_t
enum _ni_color_range_struct_t ni_color_range_struct_t
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.
_ni_h264_sei_type_t
@ NI_H264_SEI_TYPE_FRAME_PACKING
@ NI_H264_SEI_TYPE_FILLER_PAYLOAD
@ NI_H264_SEI_TYPE_USER_DATA_REGISTERED
@ NI_H264_SEI_TYPE_ALTERNATIVE_TRANSFER
@ NI_H264_SEI_TYPE_PAN_SCAN_RECT
@ NI_H264_SEI_TYPE_DISPLAY_ORIENTATION
@ NI_H264_SEI_TYPE_PIC_TIMING
@ NI_H264_SEI_TYPE_GREEN_METADATA
@ NI_H264_SEI_TYPE_USER_DATA_UNREGISTERED
@ NI_H264_SEI_TYPE_BUFFERING_PERIOD
@ NI_H264_SEI_TYPE_RECOVERY_POINT
@ NI_H264_SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME
_ni_color_range_struct_t
@ NI_COL_RANGE_NB
Not part of ABI.
@ NI_COL_RANGE_MPEG
the normal 219*2^(n-8) "MPEG" YUV ranges
@ NI_COL_RANGE_UNSPECIFIED
@ NI_COL_RANGE_JPEG
the normal 2^n-1 "JPEG" YUV ranges
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.
enum _ni_h264_sei_type_t ni_h264_sei_type_t
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.
enum _ni_h264_sei_pic_struct_t ni_h264_sei_pic_struct_t
_ni_hdr_plus_overlap_process_option
@ NI_HDR_PLUS_OVERLAP_PROCESS_WEIGHTED_AVERAGING
@ NI_HDR_PLUS_OVERLAP_PROCESS_LAYERING
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.
Main NETINT device API header file provides the ability to communicate with NI T-408 type hardware tr...
ni_logan_pic_type_t
enum _ni_logan_codec_format ni_logan_codec_format_t
This is an enumeration for supported codec formats.
uint8_t targeted_system_display_actual_peak_luminance_flag
uint8_t num_cols_targeted_system_display_actual_peak_luminance
uint8_t num_rows_mastering_display_actual_peak_luminance
uint8_t num_rows_targeted_system_display_actual_peak_luminance
uint8_t num_cols_mastering_display_actual_peak_luminance
ni_rational_t targeted_system_display_maximum_luminance
ni_rational_t mastering_display_actual_peak_luminance[25][25]
uint8_t mastering_display_actual_peak_luminance_flag
ni_hdr_plus_color_transform_params_t params[3]
ni_rational_t targeted_system_display_actual_peak_luminance[25][25]
ni_hdr_plus_percentile_t distribution_maxrgb[15]
ni_hdr_plus_overlap_process_option_t overlap_process_option
ni_rational_t display_primaries[3][2]