NVIDIA DRIVE 5.0 Linux SDK API Reference

5.0.10.3 Release

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nvmedia_icp.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved. All
3  * information contained herein is proprietary and confidential to NVIDIA
4  * Corporation. Any use, reproduction, or disclosure without the written
5  * permission of NVIDIA Corporation is prohibited.
6  */
7 
15 #ifndef _NVMEDIA_ICP_H
16 #define _NVMEDIA_ICP_H
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #include "nvmedia_core.h"
23 #include "nvmedia_surface.h"
24 #include "nvmedia_image.h"
25 
42 #define NVMEDIA_ICP_VERSION_MAJOR 4
43 
44 #define NVMEDIA_ICP_VERSION_MINOR 7
45 
50 #define NVMEDIA_IMAGE_CAPTURE_TIMEOUT_INFINITE 0xFFFFFFFF
51 
53 #define NVMEDIA_ICP_MAX_VIRTUAL_GROUPS 4
54 
56 #define NVMEDIA_ICP_MAX_VIRTUAL_CHANNELS 3
57 
62 #define NVMEDIA_ICP_HANDLER(icpEx, groupIdx) (icpEx->icp[groupIdx].hIcp)
63 
70 #define NVMEDIA_ICP_SETTINGS_HANDLER(icpSettingsEx, groupIdx, vcIdx) \
71  (&icpSettingsEx.virtualGroups[groupIdx].virtualChannels[vcIdx].icpSettings)
72 
73 #define NVMEDIA_ICP_ERROR(_type_, _error_, _value_, _desc_) \
74  NVMEDIA_ICP_##_type_##_ERROR_##_error_ = _value_,
75 
79 typedef enum {
105 
109 typedef enum {
151 
155 typedef struct {
162 
166 typedef enum {
167  /* CSI is in Dphy mode */
169  /* CSI is in CPHY mode */
172 
176 typedef struct {
184  uint16_t width;
186  uint16_t height;
188  uint16_t startX;
190  uint16_t startY;
194  uint32_t interfaceLanes;
197  uint32_t pixelFrequency;
199  uint32_t mipiSpeed;
201  uint16_t thsSettle;
206  uint8_t tpgEnable;
210 
215 typedef struct {
221  uint32_t interfaceLanes;
222  struct {
223  struct {
224  /* Holds the virtual Channel Index from CSI TX. */
226  /* Holds the image capture settings for CSI format. */
228  /* Holds the clipping rectangle. */
230  } virtualChannels[NVMEDIA_ICP_MAX_VIRTUAL_CHANNELS];
233  } virtualGroups[NVMEDIA_ICP_MAX_VIRTUAL_GROUPS];
239 
243 typedef void NvMediaICP;
244 
248 typedef struct {
249  /* Holds the number of virtual groups used. */
251  struct {
252  /* Holds the virtual Group Index. */
253  uint16_t virtualGroupId;
254  /* Holds the image capture handler. */
255  NvMediaICP *hIcp;
257 } NvMediaICPEx;
258 
262 typedef enum {
263  /* Unrecognized or no errors */
264  NVMEDIA_ICP_ERROR(CAPTURE, NONE, 0x0000, "Either no error occurred or error could not be translated")
265 
266  /* CSI mux frame errors */
267  NVMEDIA_ICP_ERROR(CSI, FS_FAULT, 0x0001, "A frame start occurred before previous frame end")
268  NVMEDIA_ICP_ERROR(CSI, FE_CSI_FAULT, 0x0002, "A NVCSI fault received at frame end")
269  NVMEDIA_ICP_ERROR(CSI, FE_FRAMEID_FAULT, 0x0003, "Frame ID for FE packet does not match that of FS packet")
270  NVMEDIA_ICP_ERROR(CSI, FE_FORCED_FAULT, 0x0004, "A frame end was injected by the CSI hardware")
271  NVMEDIA_ICP_ERROR(CSI, PXL_ENABLE_FAULT , 0x0005, "An illegal pixel encoding has been detected")
272 
273  /* VI channel sel errors */
274  NVMEDIA_ICP_ERROR(VI, SHORT_FRAME, 0x0010, "FE packet arrived before the normal number of pixels has appeared ")
275  NVMEDIA_ICP_ERROR(VI, FAULT_FE, 0x0011, "Data specific fault occurred on a channel")
276 
277  /* VI channel sel faults */
278  NVMEDIA_ICP_ERROR(VI, PXL_MISSING_LE, 0x0100, "Two LS packets were detected without a LE packet between them")
279  NVMEDIA_ICP_ERROR(VI, PXL_RUNAWAY, 0x0101, "More lines were received than expected")
280  NVMEDIA_ICP_ERROR(VI, PXL_SPURIOUS, 0x0102, "A pixel data packet was received without a LS packet first")
281  NVMEDIA_ICP_ERROR(VI, PXL_LONG_LINE, 0x0103, "More pixels were received than expected in a line")
282  NVMEDIA_ICP_ERROR(VI, PXL_SHORT_LINE, 0x0104, "Fewer pixels were received than expected in a line")
283  NVMEDIA_ICP_ERROR(VI, EMB_MISSING_LE, 0x0105, "Two LS packets were detected without a LE packet between them in emb data")
284  NVMEDIA_ICP_ERROR(VI, EMB_RUNAWAY, 0x0106, "More lines were received than expected in emb data")
285  NVMEDIA_ICP_ERROR(VI, EMB_SPURIOUS, 0x0107, "A pixel data packet was received without a LS packet first in emb data")
286  NVMEDIA_ICP_ERROR(VI, EMB_LONG_LINE, 0x0108, "More pixels were received than expected in a line in emb data")
287  NVMEDIA_ICP_ERROR(VI, EMB_INFRINGE, 0x0109, "Embedded data was received on a frame where no embedded data was expected")
288  NVMEDIA_ICP_ERROR(VI, DTYPE_MISMATCH, 0x010A, "The pixel datatype changed in the middle of the line")
290 
294 typedef struct {
295  /* Holds the CSI stream index. */
296  uint32_t csiStreamId;
297  /* Holds the CSI frame index generated by CSI Tx */
298  uint32_t csiFrameId;
299  /* Holds the virtual channel index. */
301  /* Holds the CSI error status. */
304 
318  NvMediaVersion *version
319 );
320 
334 NvMediaICPEx *
336  NvMediaICPSettingsEx *settings
337 );
338 
344 void
346  NvMediaICPEx *icpEx
347 );
348 
363  NvMediaICP *icp,
364  NvMediaImage *image,
365  uint32_t millisecondTimeout
366 );
367 
382  NvMediaICP *icp,
383  NvMediaImageGroup *imageGrp,
384  unsigned int millisecondTimeout
385 );
386 
403  NvMediaICP *icp
404 );
405 
420  NvMediaICP *icp);
421 
448  NvMediaICP *icp,
449  uint32_t millisecondTimeout,
450  NvMediaImage **image
451 );
452 
472  NvMediaICP *icp,
473  uint32_t millisecondTimeout,
474  NvMediaImageGroup **imageGrp
475 );
476 
493  NvMediaICP *icp,
494  NvMediaImage **image
495 );
496 
512  NvMediaICP *icp,
513  NvMediaImageGroup **imageGrp
514 );
515 
531  NvMediaICP *icp,
532  NvMediaICPErrorInfo *icpErrorInfo
533 );
534 
535 /*
536  * \defgroup history_nvmedia_icp History
537  * Provides change history for the NvMedia ICP API.
538  *
539  * \section history_nvmedia_icp Version History
540  *
541  * <b> Version 2.0 </b> April 4, 2016
542  * - Initial release
543  *
544  * <b> Version 2.1 </b> May 11, 2016
545  * - Added \ref NvMediaICPCheckVersion API
546  *
547  * <b> Version 2.2 </b> August 17, 2016
548  * - Added \ref NVMEDIA_IMAGE_CAPTURE_INPUT_FORMAT_TYPE_UYVY image capture input
549  * format type
550  *
551  * <b> Version 2.3 </b> August 31, 2016
552  * - Added option for enabling embeddedDataType in \ref NvMediaICPSettings
553  *
554  * <b> Version 2.4 </b> Jan 23, 2017
555  * - Added \ref NvMediaICPErrorInfo and \ref NvMediaICPGetErrorInfo
556  *
557  * <b> Version 2.5 </b> March 16, 2017
558  * - Added \ref NVMEDIA_IMAGE_CAPTURE_INPUT_FORMAT_TYPE_USER ,
559  * \ref NvMediaICPUserFormatType and option for enabling userFormatType in
560  * \ref NvMediaICPInputFormat
561  *
562  * <b> Version 3.0 </b> April 19, 2017
563  * Updated to use stdint.h instead of "unsigned int",
564  * "int", "unsigned short" and "char".
565  * NvMediaICPCreate and NvMediaICPDestroy are now deprecated.
566  * NvMediaICPGetFrame is now deprecated.
567  * NvMediaICPInterfaceFormat is now deprecated, it will be always CSI.
568  *
569  * <b> Version 3.1 </b> May 12, 2017
570  * - Added \ref NvMediaICPGetVersion API to get the version of NvMedia ICP library
571  * - NvMediaICPCheckVersion is deprecated. Use NvMediaICPGetVersion() instead
572  *
573  * <b> Version 3.2 </b> May 19, 2017
574  * Removed \ref NvMediaICPSurfaceFormatType
575  * NvMediaICPSettings now takes NvMediaSurfaceType to indicate capture surface format
576  * Removed NVMEDIA_IMAGE_CAPTURE_CSI_INTERFACE_TYPE_TPG0
577  * Combined NvMediaICPUserFormatType with NvMediaICPInputFormatType
578  * Removed NVMEDIA_IMAGE_CAPTURE_INPUT_FORMAT_TYPE_YUV420
579  * from \ref NvMediaICPInputFormatType
580  * Added RAW6/RAW7/RAW8/RAW10/RAW12/RAW14 in NvMediaICPInputFormatType
581  * Removed pixelOrder from \ref NvMediaICPInputFormat
582  * Added tpgEnagle in \ref NvMediaICPSettings
583  *
584  * <b> Version 4.2 </b> June 12, 2017
585  * Added virtualGroupIndex inside \ref NvMediaICPSettingsEx
586  * Renamed virtualChannel to virtualGroup inside \ref NvMediaICPEx
587  * Added \ref NvMediaICPFeedImageGroup and \ref NvMediaICPGetImageGroup APIs
588  *
589  * <b> Version 4.3 </b> October 5, 2017
590  * - Added \ref NvMediaICPResume API
591  *
592  * <b> Version 4.4 </b> October 11, 2017
593  * Changed the prototypes for \ref NvMediaICPGetImageGroup and
594  * \ref NvMediaICPReleaseImageGroup to accept double pointer to imageGrp
595  *
596  * <b> Version 4.5 </b> November 10, 2017
597  * Added YUV422_10, RAW16, RAW20 support in \ref NvMediaICPInputFormatType
598  * \ref NVMEDIA_IMAGE_CAPTURE_INPUT_FORMAT_TYPE_YUV422_10,
599  * \ref NVMEDIA_IMAGE_CAPTURE_INPUT_FORMAT_TYPE_RAW16,
600  * \ref NVMEDIA_IMAGE_CAPTURE_INPUT_FORMAT_TYPE_RAW20
601  *
602  * <b> Version 4.6 </b> November 18, 2017
603  * Added additional CSI interfaces, CSI phy mode parameter to \ref NvMediaICPSettingsEX
604  *
605  * <b> Version 4.7 </b> March 16, 2018
606  * Added mipiSpeed in \ref NvMediaICPSettings
607  *
608  */
611 #ifdef __cplusplus
612 }; /* extern "C" */
613 #endif
614 
615 #endif /* _NVMEDIA_ICP_H */
NvMediaICPInputFormat inputFormat
Holds the input format.
Definition: nvmedia_icp.h:180
A handle representing image objects.
Definition: nvmedia_image.h:75
NvMediaICPInterfaceType
Determines the image capture interface type for CSI interface.
Definition: nvmedia_icp.h:79
#define NvMediaSurfaceType
Defines the set of NvMedia surface types.
NvMediaStatus NvMediaICPFeedImageGroup(NvMediaICP *icp, NvMediaImageGroup *imageGrp, unsigned int millisecondTimeout)
Adds an image group to the image capture pool.
NvMediaStatus NvMediaICPFeedFrame(NvMediaICP *icp, NvMediaImage *image, uint32_t millisecondTimeout)
Adds an image to the image capture pool.
uint16_t thsSettle
Holds the MIPI THS-SETTLE time.
Definition: nvmedia_icp.h:201
NvMediaICPInputFormatType inputFormatType
Capture input format type.
Definition: nvmedia_icp.h:157
Input format type : User defined 6 (0x35)
Definition: nvmedia_icp.h:145
uint32_t NvMediaBool
A boolean value, holding NVMEDIA_TRUE or NVMEDIA_FALSE.
Definition: nvmedia_core.h:79
Input format type : User defined 4 (0x33)
Definition: nvmedia_icp.h:141
Holds image capture settings for the CSI format.
Definition: nvmedia_icp.h:176
Input format type : User defined 3 (0x32)
Definition: nvmedia_icp.h:139
NvMediaStatus NvMediaICPGetImageGroup(NvMediaICP *icp, uint32_t millisecondTimeout, NvMediaImageGroup **imageGrp)
Gets a captured image group with frame status.
Input format type : User defined 5 (0x34)
Definition: nvmedia_icp.h:143
NVIDIA Media Interface: Surface Handling
uint16_t width
Holds the capture width.
Definition: nvmedia_icp.h:184
NVIDIA Media Interface: Image Processing
NvMediaICPInterfaceType interfaceType
Holds the interface type.
Definition: nvmedia_icp.h:178
#define NVMEDIA_ICP_MAX_VIRTUAL_CHANNELS
Defines the maximum number of virtual channels per virtual group.
Definition: nvmedia_icp.h:56
Holds NvMedia Version information.
Definition: nvmedia_core.h:242
Holds the image capture settings for the CSI format.
Definition: nvmedia_icp.h:215
Input format type : User defined 7 (0x36)
Definition: nvmedia_icp.h:147
uint16_t startX
Holds the horizontal start position.
Definition: nvmedia_icp.h:188
Input format type : YUV 4:2:2 8bits.
Definition: nvmedia_icp.h:111
uint16_t embeddedDataLines
Holds the embedded data lines.
Definition: nvmedia_icp.h:192
uint16_t numVirtualGroups
Definition: nvmedia_icp.h:250
uint16_t startY
Holds the vertical start position.
Definition: nvmedia_icp.h:190
NvMediaICPSettings icpSettings
Definition: nvmedia_icp.h:227
#define NVMEDIA_ICP_MAX_VIRTUAL_GROUPS
Defines the maximum number of virtual groups.
Definition: nvmedia_icp.h:53
NvMediaBitsPerPixel bitsPerPixel
Number of bits per pixel It is used when the bits per pixel doesn't match with input format type...
Definition: nvmedia_icp.h:160
NvMediaStatus NvMediaICPResume(NvMediaICP *icp)
Resumes the image capture.
NvMediaICPEx * NvMediaICPCreateEx(NvMediaICPSettingsEx *settings)
Creates an image capture object used to capture various formats of input into an NvMediaImage.
NvMediaStatus NvMediaICPReleaseImageGroup(NvMediaICP *icp, NvMediaImageGroup **imageGrp)
Gets an image group from the internal pool that the client previously supplied with NvMediaICPFeedIma...
A handle representing an image group.
NVIDIA Media Interface: Core
NvMediaStatus
The set of all possible error codes.
Definition: nvmedia_core.h:189
Input format type : YUV 4:2:2 10bits.
Definition: nvmedia_icp.h:113
uint16_t numVirtualChannels
Holds the number of virtual channels per group.
Definition: nvmedia_icp.h:232
Capture input format.
Definition: nvmedia_icp.h:155
NvMediaICPCsiPhyMode phyMode
Holds the CSI phy mode.
Definition: nvmedia_icp.h:208
NvMediaStatus NvMediaICPGetErrorInfo(NvMediaICP *icp, NvMediaICPErrorInfo *icpErrorInfo)
Gets the capture error information.
Holds a rectangular region of a surface.
Definition: nvmedia_core.h:146
NvMediaRect clipRect
Definition: nvmedia_icp.h:229
Input format type : User defined 8 (0x37)
Definition: nvmedia_icp.h:149
NvMediaICPInputFormatType
Determines the image capture input format type.
Definition: nvmedia_icp.h:109
uint16_t virtualChannelIndex
Definition: nvmedia_icp.h:225
NvMediaICPErrorStatus errorStatus
Definition: nvmedia_icp.h:302
Holds the capture error information populated by NvMediaICPGetErrorInfo.
Definition: nvmedia_icp.h:294
NvMediaBool embeddedDataType
Holds the flag of embedded data type.
Definition: nvmedia_icp.h:204
uint16_t numVirtualGroups
Holds the number of virtual groups.
Definition: nvmedia_icp.h:235
NvMediaStatus NvMediaICPStop(NvMediaICP *icp)
Stops the image capture.
uint32_t pixelFrequency
Holds the pixel clock frequency.
Definition: nvmedia_icp.h:197
void NvMediaICP
Image capture object per virtual group.
Definition: nvmedia_icp.h:243
uint32_t interfaceLanes
Holds the number of CSI interface lanes active.
Definition: nvmedia_icp.h:194
uint32_t virtualChannelId
Definition: nvmedia_icp.h:300
NvMediaICPCsiPhyMode phyMode
Holds the CSI phy mode.
Definition: nvmedia_icp.h:237
NvMediaICPErrorStatus
Capture error status.
Definition: nvmedia_icp.h:262
uint16_t height
Holds the capture height.
Definition: nvmedia_icp.h:186
Input format type : YUV 4:4:4.
Definition: nvmedia_icp.h:115
uint32_t interfaceLanes
Holds the number of active CSI interface lanes.
Definition: nvmedia_icp.h:221
NvMediaICPCsiPhyMode
Specifies CSI phy mode.
Definition: nvmedia_icp.h:166
NvMediaBitsPerPixel
Bits per pixel.
NvMediaStatus NvMediaICPGetFrameEx(NvMediaICP *icp, uint32_t millisecondTimeout, NvMediaImage **image)
Gets a captured frame with frame status.
uint16_t virtualGroupId
Definition: nvmedia_icp.h:253
Input format type : User defined 1 (0x30)
Definition: nvmedia_icp.h:135
Input format type : User defined 2 (0x31)
Definition: nvmedia_icp.h:137
uint32_t mipiSpeed
Holds the mipi speed in kHz.
Definition: nvmedia_icp.h:199
NvMediaICPInterfaceType interfaceType
Holds the interface type.
Definition: nvmedia_icp.h:217
NvMediaStatus NvMediaICPReleaseFrame(NvMediaICP *icp, NvMediaImage **image)
Gets a frame from the internal pool that the client previously supplied with NvMediaICPFeedFrame().
NvMediaICP * hIcp
Definition: nvmedia_icp.h:255
NvMediaSurfaceType surfaceType
Holds the capture surface type.
Definition: nvmedia_icp.h:182
NvMediaStatus NvMediaICPGetVersion(NvMediaVersion *version)
Checks the version compatibility for the NvMedia ICP library.
Holds the image capture object created by NvMediaICPCreateEx.
Definition: nvmedia_icp.h:248
uint8_t tpgEnable
TPG enabled.
Definition: nvmedia_icp.h:206
#define NVMEDIA_ICP_ERROR(_type_, _error_, _value_, _desc_)
Definition: nvmedia_icp.h:73
void NvMediaICPDestroyEx(NvMediaICPEx *icpEx)
Destroys the image capture object created by NvMediaICPCreateEx.