libxcoder 5.9.0
Loading...
Searching...
No Matches
ni_av_codec.h
Go to the documentation of this file.
1/*******************************************************************************
2 *
3 * Copyright (C) 2022 NETINT Technologies
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18 * SOFTWARE.
19 *
20 ******************************************************************************/
21
22/*!*****************************************************************************
23 * \file ni_av_codec.h
24 *
25 * \brief Audio/video related utility definitions
26 ******************************************************************************/
27
28#pragma once
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "ni_device_api.h"
35
36// libxcoder API related definitions
37
38#define NI_NUM_PIXEL_ASPECT_RATIO 17
39#define NI_NAL_VPS_BIT (0x01)
40#define NI_NAL_SPS_BIT (0x01 << 1)
41#define NI_NAL_PPS_BIT (0x01 << 2)
42#define NI_GENERATE_ALL_NAL_HEADER_BIT (0x01 << 3)
43static const ni_rational_t
44 ni_h264_pixel_aspect_list[NI_NUM_PIXEL_ASPECT_RATIO] = {
45 {0, 1}, {1, 1}, {12, 11}, {10, 11}, {16, 11}, {40, 33},
46 {24, 11}, {20, 11}, {32, 11}, {80, 33}, {18, 11}, {15, 11},
47 {64, 33}, {160, 99}, {4, 3}, {3, 2}, {2, 1},
48};
49
50#define NI_SEI_TYPE_PPU_RECONFIG 206
52{
53 NI_H264_SEI_TYPE_BUFFERING_PERIOD = 0, // buffering period (H.264, D.1.1)
54 NI_H264_SEI_TYPE_PIC_TIMING = 1, // picture timing
55 NI_H264_SEI_TYPE_PAN_SCAN_RECT = 2, // pan-scan rectangle
58 4, // registered user data as specified by Rec. ITU-T T.35
59 NI_H264_SEI_TYPE_USER_DATA_UNREGISTERED = 5, // unregistered user data
61 6, // recovery point (frame # to decoder sync)
62 NI_H264_SEI_TYPE_FRAME_PACKING = 45, // frame packing arrangement
63 NI_H264_SEI_TYPE_DISPLAY_ORIENTATION = 47, // display orientation
64 NI_H264_SEI_TYPE_GREEN_METADATA = 56, // GreenMPEG information
66 137, // mastering display properties
67 NI_H264_SEI_TYPE_ALTERNATIVE_TRANSFER = 147, // alternative transfer
69
91
118
122{
124 NI_COL_TRC_BT709 = 1, //< also ITU-R BT1361
128 4, //< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
129 NI_COL_TRC_GAMMA28 = 5, //< also ITU-R BT470BG
131 6, //< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
133 NI_COL_TRC_LINEAR = 8, //< "Linear transfer characteristics"
135 9, //< "Logarithmic transfer characteristic (100:1 range)"
137 10, //< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
138 NI_COL_TRC_IEC61966_2_4 = 11, //< IEC 61966-2-4
139 NI_COL_TRC_BT1361_ECG = 12, //< ITU-R BT1361 Extended Colour Gamut
140 NI_COL_TRC_IEC61966_2_1 = 13, //< IEC 61966-2-1 (sRGB or sYCC)
141 NI_COL_TRC_BT2020_10 = 14, //< ITU-R BT2020 for 10-bit system
142 NI_COL_TRC_BT2020_12 = 15, //< ITU-R BT2020 for 12-bit system
144 16, //< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
146 NI_COL_TRC_SMPTE428 = 17, //< SMPTE ST 428-1
149 18, //< ARIB STD-B67, known as "Hybrid log-gamma"
150 NI_COL_TRC_NB //< Not part of ABI
152
155typedef enum _ni_color_space
156{
158 0, //< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
160 1, //< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
164 4, //< FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
166 5, //< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
168 6, //< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
169 NI_COL_SPC_SMPTE240M = 7, //< functionally identical to above
171 8, //< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
173 NI_COL_SPC_BT2020_NCL = 9, //< ITU-R BT2020 non-constant luminance system
174 NI_COL_SPC_BT2020_CL = 10, //< ITU-R BT2020 constant luminance system
175 NI_COL_SPC_SMPTE2085 = 11, //< SMPTE 2085, Y'D'zD'x
177 12, //< Chromaticity-derived non-constant luminance system
179 13, //< Chromaticity-derived constant luminance system
180 NI_COL_SPC_ICTCP = 14, //< ITU-R BT.2100-0, ICtCp
181 NI_COL_SPC_NB //< Not part of ABI
183
194
195// struct describing HDR10 mastering display metadata
197{
198 // CIE 1931 xy chromaticity coords of color primaries (r, g, b order).
200
201 // CIE 1931 xy chromaticity coords of white point.
203
204 // Min luminance of mastering display (cd/m^2).
206
207 // Max luminance of mastering display (cd/m^2).
209
210 // Flag indicating whether the display primaries (and white point) are set.
212
213 // Flag indicating whether the luminance (min_ and max_) have been set.
216
217#define MASTERING_DISP_CHROMA_DEN 50000 // H.264/H.265 denominator value (0.00002 units)
218#define MASTERING_DISP_LUMA_DEN 10000 // H.264/H.265 denominator value (0.0001 units)
219
220#define AV1_MASTERING_DISP_CHROMA_DEN 65536 // AV1 0.16 fixed-point (2^16)
221#define AV1_MASTERING_DISP_LUMA_MAX_DEN 256 // AV1 24.8 fixed-point (2^8)
222#define AV1_MASTERING_DISP_LUMA_MIN_DEN 16384 // AV1 18.14 fixed-point (2^14)
223
224// struct describing HDR10 Content light level
226{
227 // Max content light level (cd/m^2).
228 uint16_t max_cll;
229
230 // Max average light level per frame (cd/m^2).
231 uint16_t max_fall;
233
234// struct and enum for HDR10+
235// Option for overlapping elliptical pixel selectors in an image.
241
242// struct that represents the percentile at a specific percentage in
243// a distribution.
245{
246 // The percentage value corresponding to a specific percentile linearized
247 // RGB value in the processing window in the scene. The value shall be in
248 // the range of 0 to 100, inclusive.
249 uint8_t percentage;
250
251 // The linearized maxRGB value at a specific percentile in the processing
252 // window in the scene. The value shall be in the range of 0 to 1, inclusive
253 // and in multiples of 0.00001.
256
257// struct describing color transform parameters at a processing window in a
258// dynamic metadata for SMPTE 2094-40.
260{
261 // The relative x coordinate of the top left pixel of the processing
262 // window. The value shall be in the range of 0 and 1, inclusive and
263 // in multiples of 1/(width of Picture - 1). The value 1 corresponds
264 // to the absolute coordinate of width of Picture - 1. The value for
265 // first processing window shall be 0.
267
268 // The relative y coordinate of the top left pixel of the processing
269 // window. The value shall be in the range of 0 and 1, inclusive and
270 // in multiples of 1/(height of Picture - 1). The value 1 corresponds
271 // to the absolute coordinate of height of Picture - 1. The value for
272 // first processing window shall be 0.
274
275 // The relative x coordinate of the bottom right pixel of the processing
276 // window. The value shall be in the range of 0 and 1, inclusive and
277 // in multiples of 1/(width of Picture - 1). The value 1 corresponds
278 // to the absolute coordinate of width of Picture - 1. The value for
279 // first processing window shall be 1.
281
282 // The relative y coordinate of the bottom right pixel of the processing
283 // window. The value shall be in the range of 0 and 1, inclusive and
284 // in multiples of 1/(height of Picture - 1). The value 1 corresponds
285 // to the absolute coordinate of height of Picture - 1. The value for
286 // first processing window shall be 1.
288
289 // The x coordinate of the center position of the concentric internal and
290 // external ellipses of the elliptical pixel selector in the processing
291 // window. The value shall be in the range of 0 to (width of Picture - 1),
292 // inclusive and in multiples of 1 pixel.
294
295 // The y coordinate of the center position of the concentric internal and
296 // external ellipses of the elliptical pixel selector in the processing
297 // window. The value shall be in the range of 0 to (height of Picture - 1),
298 // inclusive and in multiples of 1 pixel.
300
301 // The clockwise rotation angle in degree of arc with respect to the
302 // positive direction of the x-axis of the concentric internal and external
303 // ellipses of the elliptical pixel selector in the processing window. The
304 // value shall be in the range of 0 to 180, inclusive and in multiples of
305 // 1.
307
308 // The semi-major axis value of the internal ellipse of the elliptical
309 // pixel selector in amount of pixels in the processing window. The value
310 // shall be in the range of 1 to 65535, inclusive and in multiples of 1
311 // pixel.
313
314 // The semi-major axis value of the external ellipse of the elliptical
315 // pixel selector in amount of pixels in the processing window. The value
316 // shall not be less than semimajor_axis_internal_ellipse of the current
317 // processing window. The value shall be in the range of 1 to 65535,
318 // inclusive and in multiples of 1 pixel.
320
321 // The semi-minor axis value of the external ellipse of the elliptical
322 // pixel selector in amount of pixels in the processing window. The value
323 // shall be in the range of 1 to 65535, inclusive and in multiples of 1
324 // pixel.
326
327 // Overlap process option indicates one of the two methods of combining
328 // rendered pixels in the processing window in an image with at least one
329 // elliptical pixel selector. For overlapping elliptical pixel selectors
330 // in an image, overlap_process_option shall have the same value.
332
333 // The maximum of the color components of linearized RGB values in the
334 // processing window in the scene. The values should be in the range of 0
335 // to 1, inclusive and in multiples of 0.00001. maxscl[ 0 ], maxscl[ 1 ],
336 // and maxscl[ 2 ] are corresponding to R, G, B color components
337 // respectively.
339
340 // The average of linearized maxRGB values in the processing window in the
341 // scene. The value should be in the range of 0 to 1, inclusive and in
342 // multiples of 0.00001.
344
345 // The number of linearized maxRGB values at given percentiles in the
346 // processing window in the scene. The maximum value shall be 15.
348
349 // The linearized maxRGB values at given percentiles in the
350 // processing window in the scene.
352
353 // The fraction of selected pixels in the image that contains the brightest
354 // pixel in the scene. The value shall be in the range of 0 to 1, inclusive
355 // and in multiples of 0.001.
357
358 // This flag indicates that the metadata for the tone mapping function in
359 // the processing window is present (for value of 1).
361
362 // The x coordinate of the separation point between the linear part and the
363 // curved part of the tone mapping function. The value shall be in the
364 // range of 0 to 1, excluding 0 and in multiples of 1/4095.
366
367 // The y coordinate of the separation point between the linear part and the
368 // curved part of the tone mapping function. The value shall be in the
369 // range of 0 to 1, excluding 0 and in multiples of 1/4095.
371
372 // The number of the intermediate anchor parameters of the tone mapping
373 // function in the processing window. The maximum value shall be 15.
375
376 // The intermediate anchor parameters of the tone mapping function in the
377 // processing window in the scene. The values should be in the range of 0
378 // to 1, inclusive and in multiples of 1/1023.
380
381 // This flag shall be equal to 0 in bitstreams conforming to this version
382 // of this Specification. Other values are reserved for future use.
384
385 // The color saturation gain in the processing window in the scene. The
386 // value shall be in the range of 0 to 63/8, inclusive and in multiples of
387 // 1/8. The default value shall be 1.
390
391// struct representing dynamic metadata for color volume transform -
392// application 4 of SMPTE 2094-40:2016 standard.
394{
395 // Country code by Rec. ITU-T T.35 Annex A. The value shall be 0xB5.
397
398 // Application version in the application defining document in ST-2094
399 // suite. The value shall be set to 0.
401
402 // The number of processing windows. The value shall be in the range
403 // of 1 to 3, inclusive.
404 uint8_t num_windows;
405
406 // The color transform parameters for every processing window.
408
409 // The nominal maximum display luminance of the targeted system display,
410 // in units of 0.0001 candelas per square metre. The value shall be in
411 // the range of 0 to 10000, inclusive.
413
414 // This flag shall be equal to 0 in bit streams conforming to this version
415 // of this Specification. The value 1 is reserved for future use.
417
418 // The number of rows in the targeted system_display_actual_peak_luminance
419 // array. The value shall be in the range of 2 to 25, inclusive.
421
422 // The number of columns in the
423 // targeted_system_display_actual_peak_luminance array. The value shall be
424 // in the range of 2 to 25, inclusive.
426
427 // The normalized actual peak luminance of the targeted system display. The
428 // values should be in the range of 0 to 1, inclusive and in multiples of
429 // 1/15.
431
432 // This flag shall be equal to 0 in bitstreams conforming to this version
433 // of this Specification. The value 1 is reserved for future use.
435
436 // The number of rows in the mastering_display_actual_peak_luminance array.
437 // The value shall be in the range of 2 to 25, inclusive.
439
440 // The number of columns in the mastering_display_actual_peak_luminance
441 // array. The value shall be in the range of 2 to 25, inclusive.
443
444 // The normalized actual peak luminance of the mastering display used for
445 // mastering the image essence. The values should be in the range of 0 to
446 // 1, inclusive and in multiples of 1/15.
449
450// All the fields in the following struct follow the same names and definition
451// as set out by the H264/H265 specifications
452typedef struct _ni_timecode
453{
459 uint16_t n_frames;
460 uint8_t seconds_flag; // ignored when full_timestamp_flag is set
462 uint8_t minutes_flag; // ignored when full_timestamp_flag is set
464 uint8_t hours_flag; // ignored when full_timestamp_flag is set
465 uint8_t hours_value;
469
470/*!*****************************************************************************
471 * \brief Whether SEI should be sent together with this frame to encoder
472 *
473 * \param[in] p_enc_ctx encoder session context
474 * \param[in] pic_type frame type
475 * \param[in] p_param encoder parameters
476 *
477 * \return 1 if yes, 0 otherwise
478 ******************************************************************************/
480 ni_pic_type_t pic_type,
481 ni_xcoder_params_t *p_param);
482
483/*!*****************************************************************************
484 * \brief Retrieve auxiliary data (close caption, various SEI) associated with
485 * this frame that is returned by decoder, convert them to appropriate
486 * format and save them in the frame's auxiliary data storage for
487 * future use by encoding. Usually they would be sent together with
488 * this frame to encoder at encoding.
489 *
490 * \param[in/out] frame that is returned by decoder
491 *
492 * \return NONE
493 ******************************************************************************/
495
496/*!*****************************************************************************
497 * \brief Prepare auxiliary data that should be sent together with this frame
498 * to encoder based on the auxiliary data of the decoded frame.
499 *
500 * \param[in/out] p_enc_ctx encoder session context whose various SEI type
501 * header can be updated as the result of this function
502 * \param[out] p_enc_frame frame to be sent to encoder
503 * \param[in] p_dec_frame frame that is returned by decoder
504 * \param[in] codec_format H.264 or H.265
505 * \param[in] should_send_sei_with_frame if need to send a certain type of
506 * SEI with this frame
507 * \param[out] mdcv_data SEI for HDR mastering display color volume info
508 * \param[out] cll_data SEI for HDR content light level info
509 * \param[out] cc_data SEI for close caption
510 * \param[out] udu_data SEI for User data unregistered
511 * \param[out] hdrp_data SEI for HDR10+
512 *
513 * \return NONE
514 ******************************************************************************/
515LIB_API void
517 ni_frame_t *p_dec_frame, ni_codec_format_t codec_format,
518 int should_send_sei_with_frame, uint8_t *mdcv_data,
519 uint8_t *cll_data, uint8_t *cc_data, uint8_t *udu_data,
520 uint8_t *hdrp_data);
521
522/*!*****************************************************************************
523 * \brief Copy auxiliary data that should be sent together with this frame
524 * to encoder.
525 *
526 * \param[in] p_enc_ctx encoder session context
527 * \param[out] p_enc_frame frame to be sent to encoder
528 * \param[in] p_dec_frame frame returned by decoder
529 * \param[in] codec_format H.264 or H.265
530 * \param[in] mdcv_data SEI for HDR mastering display color volume info
531 * \param[in] cll_data SEI for HDR content light level info
532 * \param[in] cc_data SEI for close caption
533 * \param[in] udu_data SEI for User data unregistered
534 * \param[in] hdrp_data SEI for HDR10+
535 * \param[in] is_hwframe, must be 0 (sw frame) or 1 (hw frame)
536 * \param[in] is_semiplanar, must be 1 (semiplanar frame) or 0 (not)
537 *
538 * \return NONE
539 ******************************************************************************/
540LIB_API void
542 ni_frame_t *p_dec_frame, ni_codec_format_t codec_format,
543 const uint8_t *mdcv_data, const uint8_t *cll_data,
544 const uint8_t *cc_data, const uint8_t *udu_data,
545 const uint8_t *hdrp_data, int is_hwframe,
546 int is_semiplanar);
547
548/*!*****************************************************************************
549 * \brief Insert timecode data into picture timing SEI (H264) or time code SEI (H265)
550 *
551 * \note This function must be callled after all other aux data has been processed by
552 * ni_enc_prep_aux_data and ni_enc_copy_aux_data. Otherwise the timecode SEI data
553 * might be overwritten
554 *
555 * \param[in] p_enc_ctx encoder session context
556 * \param[out] p_enc_frame frame to be sent to encoder
557 * \param[in] p_timecode the timecode data to be written along with the frame
558 *
559 * \return NI_RETCODE_SUCCESS on success, NI_RETCODE_FAILURE on failure
560 ******************************************************************************/
562 ni_timecode_t *p_timecode);
563
564/*!*****************************************************************************
565 * \brief Send an input data frame to the encoder with YUV data given in
566 * the inputs.
567 *
568 * For ideal performance memory should be 4k aligned. If it is not 4K aligned
569 * then a temporary 4k aligned memory will be used to copy data to and from
570 * when writing and reading. This will negatively impact performance.
571 *
572 * Any metadata to be sent with the frame should be attached to p_enc_frame
573 * as aux data (e.g. using ni_frame_new_aux_data()).
574 *
575 * \param[in] p_ctx Encoder session context
576 * \param[in] p_enc_frame Struct holding information about the frame
577 * to be sent to the encoder
578 * \param[in] p_yuv_buffer Caller allocated buffer holding YUV data
579 * for the frame
580 *
581 * \return On success
582 * Total number of bytes written
583 * On failure
584 * NI_RETCODE_INVALID_PARAM
585 * NI_RETCODE_ERROR_MEM_ALOC
586 * NI_RETCODE_ERROR_NVME_CMD_FAILED
587 * NI_RETCODE_ERROR_INVALID_SESSION
588 *****************************************************************************/
590 ni_frame_t *p_enc_frame,
591 uint8_t *p_yuv_buffer);
592
593/*!******************************************************************************
594 * \brief Extract custom sei payload data from pkt_data,
595 * and save it to ni_packet_t
596 *
597 * \param uint8_t *pkt_data - FFmpeg AVPacket data
598 * \param int pkt_size - packet size
599 * \param long index - pkt data index of custom sei first byte after SEI type
600 * \param ni_packet_t *p_packet - libxcoder internal packet
601 * \param uint8_t sei_type - type of SEI
602 * \param int vcl_found - whether got vcl in the pkt data, 1 means got
603 *
604 * \return - 0 on success, non-0 on failure
605 ********************************************************************************/
606LIB_API int ni_extract_custom_sei(uint8_t *pkt_data, int pkt_size, long index,
607 ni_packet_t *p_packet, uint8_t sei_type, int vcl_found);
608
609/*!******************************************************************************
610 * \brief Decode parse packet
611 *
612 * \param[in] p_session_ctx Pointer to a caller allocated
613 * ni_session_context_t struct
614 * \param[in] p_param Pointer to a caller allocated
615 * ni_xcoder_params_t struct
616 * \param[in] *data FFmpeg AVPacket data
617 * \param[in] size packet size
618 * \param[in] p_packet Pointer to a caller allocated
619 * ni_packet_t struct
620 * \param[in] low_delay FFmpeg lowdelay
621 * \param[in] codec_format enum ni_codec_format_t
622 * \param[in] pkt_nal_bitmap pkt_nal_bitmap
623 * \param[in] custom_sei_type custom_sei_type
624 * \param[in] *svct_skip_next_packet svct_skip_next_packet int*
625 * \param[in] *is_lone_sei_pkt is_lone_sei_pkt int*
626 *
627 * \return - 0 on success, non-0 on failure
628 ********************************************************************************/
630 ni_xcoder_params_t *p_param, uint8_t *data, int size,
631 ni_packet_t *p_packet, int low_delay, int codec_format,
632 int pkt_nal_bitmap, int custom_sei_type,
633 int *svct_skip_next_packet, int *is_lone_sei_pkt);
634
635/*!******************************************************************************
636 * \brief Decode parse packet
637 *
638 * \param[in] p_session_ctx Pointer to a caller allocated
639 * ni_session_context_t struct
640 * \param[in] p_param Pointer to a caller allocated
641 * ni_xcoder_params_t struct
642 * \param[in] *data FFmpeg AVPacket data
643 * \param[in] size packet size
644 * \param[in] p_packet Pointer to a caller allocated
645 * ni_packet_t struct
646 * \param[in] low_delay FFmpeg lowdelay
647 * \param[in] codec_format enum ni_codec_format_t
648 * \param[in] *p_pkt_nal_bitmap p_pkt_nal_bitmap int*
649 * \param[in] custom_sei_type custom_sei_type
650 * \param[in] *svct_skip_next_packet svct_skip_next_packet int*
651 * \param[in] *is_lone_sei_pkt is_lone_sei_pkt int*
652 *
653 * \return - 0 on success, non-0 on failure
654 ********************************************************************************/
656 ni_xcoder_params_t *p_param, uint8_t *data, int size,
657 ni_packet_t *p_packet, int low_delay, int codec_format,
658 int *p_pkt_nal_bitmap, int custom_sei_type,
659 int *svct_skip_next_packet, int *is_lone_sei_pkt);
660
661/*!******************************************************************************
662 * \brief Expand frame form src frame
663 *
664 * \param[in] dst Pointer to a caller allocated ni_frame_t struct
665 * \param[in] src Pointer to a caller allocated ni_frame_t struct
666 * \param[in] dst_stride int dst_stride[]
667 * \param[in] raw_width frame width
668 * \param[in] raw_height frame height
669 * \param[in] ni_fmt ni_pix_fmt_t type for ni pix_fmt
670 * \param[in] nb_planes int nb_planes
671 *
672 * \return - 0 on success, NI_RETCODE_FAILURE on failure
673 ********************************************************************************/
674LIB_API int ni_expand_frame(ni_frame_t *dst, ni_frame_t *src, int dst_stride[],
675 int raw_width, int raw_height, int ni_fmt, int nb_planes);
676
677/*!******************************************************************************
678 * \brief Reset decoder ppu resolution
679 *
680 * \param[in] p_session_ctx Pointer to a caller allocated
681 * ni_session_context_t struct
682 * \param[in] p_param Pointer to a caller allocated
683 * ni_xcoder_params_t struct
684 * \param[in] ppu_config Pointer to a caller allocated
685 * ni_ppu_config_t struct
686 *
687 * \return - 0 on success, NI_RETCODE_FAILURE on failure
688 ********************************************************************************/
690 ni_xcoder_params_t *p_param, ni_ppu_config_t *ppu_config);
691#ifdef __cplusplus
692}
693#endif
_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
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.
struct _ni_hrd_params ni_hrd_params_t
enum _ni_color_primaries ni_color_primaries_t
_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 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...
_ni_color_primaries
Definition ni_av_codec.h:95
@ NI_COL_PRI_SMPTE432
@ NI_COL_PRI_RESERVED0
Definition ni_av_codec.h:96
@ NI_COL_PRI_SMPTE240M
functionally identical to above
@ NI_COL_PRI_SMPTE431
SMPTE ST 431-2 (2011) / DCI P3.
@ NI_COL_PRI_JEDEC_P22
JEDEC P22 phosphors.
@ NI_COL_PRI_NB
Not part of ABI.
@ NI_COL_PRI_FILM
colour filters using Illuminant C
@ NI_COL_PRI_BT470BG
@ NI_COL_PRI_UNSPECIFIED
Definition ni_av_codec.h:99
@ NI_COL_PRI_SMPTE428
SMPTE ST 428-1 (CIE 1931 XYZ)
@ NI_COL_PRI_RESERVED
@ NI_COL_PRI_BT709
Definition ni_av_codec.h:97
@ NI_COL_PRI_BT470M
@ NI_COL_PRI_BT2020
ITU-R BT2020.
@ NI_COL_PRI_SMPTE170M
@ NI_COL_PRI_SMPTEST428_1
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.
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.
enum _ni_color_transfer_characteristic ni_color_transfer_characteristic_t
#define NI_NUM_PIXEL_ASPECT_RATIO
Definition ni_av_codec.h:38
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_dec_retrieve_aux_data(ni_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_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.
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.
_ni_h264_sei_pic_struct_t
Definition ni_av_codec.h:72
@ NI_H264_SEI_PIC_STRUCT_FRAME_TRIPLING
frame tripling
Definition ni_av_codec.h:89
@ NI_H264_SEI_PIC_STRUCT_TOP_BOTTOM
Definition ni_av_codec.h:76
@ NI_H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP
Definition ni_av_codec.h:80
@ NI_H264_SEI_PIC_STRUCT_FRAME
frame
Definition ni_av_codec.h:73
@ NI_H264_SEI_PIC_STRUCT_BOTTOM_FIELD
bottom field
Definition ni_av_codec.h:75
@ NI_H264_SEI_PIC_STRUCT_BOTTOM_TOP
Definition ni_av_codec.h:78
@ NI_H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM
Definition ni_av_codec.h:84
@ NI_H264_SEI_PIC_STRUCT_TOP_FIELD
top field
Definition ni_av_codec.h:74
@ NI_H264_SEI_PIC_STRUCT_FRAME_DOUBLING
frame doubling
Definition ni_av_codec.h:88
LIB_API int ni_dec_packet_parse2(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 *p_pkt_nal_bitmap, int custom_sei_type, int *svct_skip_next_packet, int *is_lone_sei_pkt)
Decode parse packet.
struct _ni_dynamic_hdr_plus ni_dynamic_hdr_plus_t
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)
struct _ni_mastering_display_metadata ni_mastering_display_metadata_t
LIB_API NI_DEPRECATED 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.
_ni_h264_sei_type_t
Definition ni_av_codec.h:52
@ NI_H264_SEI_TYPE_FRAME_PACKING
Definition ni_av_codec.h:62
@ NI_H264_SEI_TYPE_FILLER_PAYLOAD
Definition ni_av_codec.h:56
@ NI_H264_SEI_TYPE_USER_DATA_REGISTERED
Definition ni_av_codec.h:57
@ NI_H264_SEI_TYPE_ALTERNATIVE_TRANSFER
Definition ni_av_codec.h:67
@ NI_H264_SEI_TYPE_PAN_SCAN_RECT
Definition ni_av_codec.h:55
@ NI_H264_SEI_TYPE_DISPLAY_ORIENTATION
Definition ni_av_codec.h:63
@ NI_H264_SEI_TYPE_PIC_TIMING
Definition ni_av_codec.h:54
@ NI_H264_SEI_TYPE_GREEN_METADATA
Definition ni_av_codec.h:64
@ NI_H264_SEI_TYPE_USER_DATA_UNREGISTERED
Definition ni_av_codec.h:59
@ NI_H264_SEI_TYPE_BUFFERING_PERIOD
Definition ni_av_codec.h:53
@ NI_H264_SEI_TYPE_RECOVERY_POINT
Definition ni_av_codec.h:60
@ NI_H264_SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME
Definition ni_av_codec.h:65
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.
enum _ni_h264_sei_type_t ni_h264_sei_type_t
struct _ni_timecode ni_timecode_t
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
#define NI_DEPRECATED
Definition ni_defs.h:80
Public definitions for operating NETINT video processing devices for video processing.
enum _ni_codec_format ni_codec_format_t
This is an enumeration for supported codec formats.
ni_pic_type_t
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 itu_t_t35_country_code
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 percentile
int64_t bit_rate_unscale
int64_t cpb_size_unscale
uint32_t initial_cpb_removal_delay_length_minus1
uint32_t au_cpb_removal_delay_minus1
uint32_t dpb_output_delay_length_minus1
uint32_t au_cpb_removal_delay_length_minus1
ni_rational_t display_primaries[3][2]
uint8_t minutes_value
uint32_t time_offset_value
uint8_t counting_type
uint8_t hours_flag
uint16_t n_frames
uint8_t minutes_flag
uint8_t hours_value
uint8_t full_timestamp_flag
uint8_t nuit_field_based_flag
uint8_t time_offset_length
uint8_t seconds_flag
uint8_t discontinuity_flag
uint8_t seconds_value
uint8_t cnt_dropped_flag