NVIDIA DRIVE OS Linux SDK API Reference

5.1.6.0 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
NvRosImgPipeline.h
Go to the documentation of this file.
1 /*Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
2 
3 NVIDIA CORPORATION and its licensors retain all intellectual property
4 and proprietary rights in and to this software, related documentation
5 and any modifications thereto. Any use, reproduction, disclosure or
6 distribution of this software and related documentation without an express
7 license agreement from NVIDIA CORPORATION is strictly prohibited.*/
8 
9 #ifndef __NVROSIMGPIPELINE_H_
10 #define __NVROSIMGPIPELINE_H_
11 
12 #include "nvmedia_core.h"
13 #include "nvmedia_surface.h"
14 #include "nvmedia_image.h"
15 #include "nvmedia_ipp.h"
16 #include "nvmedia_isp.h"
17 #include "nvmedia_vop.h"
18 #include "img_dev.h"
19 #include "nvmedia_eglstream.h"
20 
21 #include "nvroscommon.h"
22 #include "nvros_egl_utils/nvros_egl_utils.h"
23 
24 #include <thread>
25 #include <deque>
26 
27 #define MAX_AGGREGATE_IMAGES 4
28 #define MAX_STRING_SIZE 256
29 #define IMAGE_BUFFERS_POOL_SIZE 3
30 #define CAMERA_PORTS 4
31 
45 namespace nvros
46 {
61  typedef struct _CaptureConfigParams
62  {
71  unsigned int i2cDevice;
72  unsigned int csiLanes;
73  unsigned int embeddedDataLinesTop;
75  unsigned int desAddr;
76  unsigned int brdcstSerAddr;
78  unsigned int brdcstSensorAddr;
80  unsigned int e2pPhysicalAddr;
82  unsigned int inputOrder;
83 
93 {
94  private:
95 
96  // Surface parameters
97  NvMediaSurfaceType outSurfaceType;
98  NvMediaSurfaceType inSurfaceType;
99  NvMediaSurfaceType ispOutSurfaceType;
100  NvMediaISPSelect ispSelect;
101  unsigned int surfaceAttr;
102  unsigned int outputWidth;
103  unsigned int outputHeight;
104  unsigned int inputWidth;
105  unsigned int inputHeight;
106  unsigned int ispOutWidth;
107  unsigned int ispOutHeight;
108  unsigned int ispOutColorStd;
109 
110  // Capture configuration
111  const char* configFile;
112  CaptureConfigParams* mCaptureConfigParams;
113  unsigned int mCaptureConfigSetsNum;
114  unsigned int cameraGrp;
115  unsigned int numOfCameras;
116  ExtImgDevMapInfo cameraMap;
117  ExtImgDevice* mExtImgDevice;
118 
119  // NvMedia IPP specific private variables
120  bool isIspEnabled[MAX_AGGREGATE_IMAGES];
121  bool isOutputEnabled[MAX_AGGREGATE_IMAGES];
122  bool isControlAlgoEnabled[MAX_AGGREGATE_IMAGES];
123  unsigned int rawBytesPerPixel;
124 
125  // NvMediaDevice handle for IPP
126  NvMediaDevice* mNvmediaDevice;
127 
128  //IPP manager
129  NvMediaIPPManager* mIppManager;
130 
131  // IPP pipeline
133 
134  //IPP components
136 
137  //ISP components
139 
140  //ICP components
142 
143  //Control algo. components
145 
146  //output component
148 
149  //ICP settings
150  NvMediaICPSettings mIcpSettings;
151 
152  //component number
153  unsigned int componentNumber[NVMEDIA_MAX_PIPELINES_PER_MANAGER];
154 
155  //Pixel order
156  unsigned int pixelOrder;
157  char* inPixelOrder;
158  unsigned int bitsPerPixel;
159 
160  // NvRosEglUtil instance
161  NvRosEglUtil* mNvRosEglUtil = new NvRosEglUtil(IMAGE_PRODUCER, EGLDEVICE, MAILBOX);
162  EglUtilState* mEglUtilState;
163  EglUtilOptions* mEglUtilOptions;
164  EGLStreamKHR mEglStreams[MAX_AGGREGATE_IMAGES];
165 
166  // EGL Producer related private variables
167  NvMediaEGLStreamProducer* cameraStreamEglProducer[MAX_AGGREGATE_IMAGES];
168  std::thread imgProducerThread;
169  NvMediaImage* eglStreamImages[MAX_AGGREGATE_IMAGES];
170 
171  //socket paths
172  const char* eglStreamSocketPath[CAMERA_PORTS][MAX_AGGREGATE_IMAGES] =
173  {
174  {
175  "/tmp/nvros_cam_0_0",
176  "/tmp/nvros_cam_0_1",
177  "/tmp/nvros_cam_0_2",
178  "/tmp/nvros_cam_0_3"
179  },
180 
181  {
182  "/tmp/nvros_cam_1_0",
183  "/tmp/nvros_cam_1_1",
184  "/tmp/nvros_cam_1_2",
185  "/tmp/nvros_cam_1_3"
186  },
187 
188  {
189  "/tmp/nvros_cam_2_0",
190  "/tmp/nvros_cam_2_1",
191  "/tmp/nvros_cam_2_2",
192  "/tmp/nvros_cam_2_3"
193 
194  },
195 
196  {
197  "/tmp/nvros_cam_3_0",
198  "/tmp/nvros_cam_3_1",
199  "/tmp/nvros_cam_3_2",
200  "/tmp/nvros_cam_3_3"
201  }
202  };
203 
204  // Pipeline control variables
205  bool runPipeline;
206  bool shutdownPipeline;
207 
208  //Private methods
209  const char* GetCaptureConfigFile();
210  const char* GetEglStreamSocketPath();
211  NvRosErr ConfigParserInterface();
212  NvRosErr InitNvMediaIPP();
213  NvRosErr IPPSetCaptureSettings();
214  NvRosErr CreateIPPPipeline();
215  NvRosErr CreateSensorControlComponent();
216  NvRosErr CreateCaptureComponent();
217  NvRosErr CreateISPComponent();
218  NvRosErr CreateControlAlgoComponent();
219  NvRosErr CreateOutputComponent();
220  NvRosErr AddComponentsIntoPipeline();
221  NvRosErr SetICPBufferPoolConfig(NvMediaIPPBufferPoolParamsNew* poolConfig);
222  NvRosErr SetISPBufferPoolConfig(NvMediaIPPBufferPoolParamsNew* poolConfig,
223  NvMediaIPPBufferPoolParamsNew *poolStatsConfig);
224  NvRosErr SetControlAlgorithmBufferPoolConfig(NvMediaIPPBufferPoolParamsNew *poolConfig);
225  NvRosErr ImgProducerLoop();
226 
227  public:
228 
249  NvRosErr SetCaptureConfig(const char* cfgFilePath, const unsigned int camGrp,
250  const unsigned int cameras);
251 
261 
270 
294 
303 
304 }; // NvRosImgPipeline
305 
307 }
308 #endif // __NVROSIMGPIPELINE_H_
#define CAMERA_PORTS
Holds a handle representing image objects.
Definition: nvmedia_image.h:69
#define NvMediaSurfaceType
Defines the set of NvMedia surface types.
void NvMediaIPPManager
A handle representing IPP manager object.
Definition: nvmedia_ipp.h:63
void NvMediaIPPPipeline
A handle representing IPP pipeline object.
Definition: nvmedia_ipp.h:80
Holds image capture settings for the CSI format.
Definition: nvmedia_icp.h:209
char inputFormat[MAX_STRING_SIZE]
Class to initialize the EGLStream for the following roles: EGLOUTPUT_CONSUMER, CUDA_CONSUMER, CUDA_PRODUCER, IMAGE_PRODUCER.
EGLStream in mailbox mode.
NVIDIA Media Interface: Surface Handling
Holds configuration parameters for capturing image frames.
NVIDIA Media Interface: Image Processing
char interface[MAX_STRING_SIZE]
NvRosErr InitPipeline()
Initializes the NvRosImgPipeline which internally initializes the NvMediaIPPPipeline.
char description[MAX_STRING_SIZE]
struct NvMediaDevice NvMediaDevice
An opaque handle representing an NvMediaDevice object.
Definition: nvmedia_core.h:337
unsigned int serAddr[MAX_AGGREGATE_IMAGES]
#define MAX_AGGREGATE_IMAGES
struct nvros::_CaptureConfigParams CaptureConfigParams
Holds configuration parameters for capturing image frames.
void NvMediaIPPComponent
A handle representing an IPP component object.
Definition: nvmedia_ipp.h:85
Image producer.
Holds new buffer pool parameters for initializing an IPP component.
Definition: nvmedia_ipp.h:1047
NVIDIA Media Interface: Core
#define NVMEDIA_MAX_PIPELINES_PER_MANAGER
Maximum number of IPP pipelines in IPP manager.
Definition: nvmedia_ipp.h:75
Creates image capture pipelines for NvROS on the NVIDIA DRIVEā„¢ AGX platform through AR0231 imaging s...
NVIDIA Media Interface: Image Processing Pipeline API
NvRosErr ShutdownPipeline()
Shuts down the NvRosImgPipeline and uninitializes all settings prior to starting the pipeline...
char resolution[MAX_STRING_SIZE]
char board[MAX_STRING_SIZE]
NVIDIA Media Interface: EGL Stream
Holds required window system related parameters when initializing EGLStream.
#define MAX_STRING_SIZE
Egldevice window system.
A handle representing an EGL stream producer object.
#define NVMEDIA_MAX_COMPONENTS_PER_PIPELINE
Maximum number of IPP components in IPP pipeline.
Definition: nvmedia_ipp.h:69
NvRosErr SetCaptureConfig(const char *cfgFilePath, const unsigned int camGrp, const unsigned int cameras)
Sets the configuration parameters for an image capture pipeline and must be called first after the Nv...
unsigned int e2pAddr[MAX_AGGREGATE_IMAGES]
NvRosErr StartPipeline()
Starts the NvRosImgPipeline and must be called after SetCaptureConfig and InitPipeline.
NvRosErr StopPipeline()
Stops the NvRosImgPipeline put into execution by StartPipeline.
enum nvros::_NvRosErrCode NvRosErr
Declares error codes for all NvROS modules and packages.
char name[MAX_STRING_SIZE]
char surfaceFormat[MAX_STRING_SIZE]
NVIDIA Media Interface: Video Output Processing (VOP)
Holds EGL related parameters.
char inputDevice[MAX_STRING_SIZE]
NVIDIA Robot Operating System : Common Enums, Macros, and Constants
unsigned int sensorAddr[MAX_AGGREGATE_IMAGES]