Logo
ApraPipes 1.0
Loading...
Searching...
No Matches
V4L2CUYUV420Converter.h
1#pragma once
2
3#include "CommonDefs.h"
4#include "AV4L2Buffer.h"
5
6#include "ApraEGLDisplay.h" // this is added to address the following issue: https://github.com/opencv/opencv/issues/7113
7#include "cudaEGL.h"
8#include "npp.h"
9
10#include <deque>
11#include <mutex>
12
14{
15public:
16 V4L2CUYUV420Converter(uint32_t srcWidth, uint32_t srcHeight, struct v4l2_format &format);
17 virtual ~V4L2CUYUV420Converter();
18
19 // YUV420 data - stride is expected to match width
20 virtual void process(frame_sp& frame, AV4L2Buffer *buffer);
21
22 virtual void releaseFrame() {}
23
24protected:
25 uint32_t mBytesUsedY;
26 uint32_t mBytesUsedUV;
27 struct v4l2_format mFormat;
28 uint32_t mHeightY;
29 uint32_t mHeightUV;
30
31 uint32_t mWidthY;
32 uint32_t mWidthUV;
33};
34
36{
37public:
38 V4L2CUDMABufYUV420Converter(uint32_t srcWidth, uint32_t srcHeight, struct v4l2_format &format);
40
41 // YUV420 data - stride is expected to match width
42 void process(frame_sp& frame, AV4L2Buffer *buffer);
43 void releaseFrame();
44
45private:
46 std::deque<frame_sp> mCache;
47 std::mutex mCacheMutex;
48};
49
51{
52public:
53 V4L2CURGBToYUV420Converter(uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStep, struct v4l2_format &format);
55
56 void process(frame_sp& frame, AV4L2Buffer *buffer);
57
58private:
59 EGLDisplay eglDisplay;
60 CUresult status;
61 CUeglFrame eglFrame;
62 CUgraphicsResource pResource;
63 EGLImageKHR eglImage;
64
65 Npp8u *dst[3];
66 NppiSize oSizeROI;
67 int dstPitch[3];
69};
Definition AV4L2Buffer.h:17
Definition V4L2CUYUV420Converter.h:36
~V4L2CUDMABufYUV420Converter()
Definition V4L2CUYUV420Converter.cpp:68
std::mutex mCacheMutex
Definition V4L2CUYUV420Converter.h:47
void releaseFrame()
Definition V4L2CUYUV420Converter.cpp:83
void process(frame_sp &frame, AV4L2Buffer *buffer)
Definition V4L2CUYUV420Converter.cpp:73
V4L2CUDMABufYUV420Converter(uint32_t srcWidth, uint32_t srcHeight, struct v4l2_format &format)
Definition V4L2CUYUV420Converter.cpp:63
std::deque< frame_sp > mCache
Definition V4L2CUYUV420Converter.h:46
Definition V4L2CUYUV420Converter.h:51
CUgraphicsResource pResource
Definition V4L2CUYUV420Converter.h:62
EGLImageKHR eglImage
Definition V4L2CUYUV420Converter.h:63
V4L2CURGBToYUV420Converter(uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStep, struct v4l2_format &format)
Definition V4L2CUYUV420Converter.cpp:89
CUeglFrame eglFrame
Definition V4L2CUYUV420Converter.h:61
CUresult status
Definition V4L2CUYUV420Converter.h:60
int dstPitch[3]
Definition V4L2CUYUV420Converter.h:67
~V4L2CURGBToYUV420Converter()
Definition V4L2CUYUV420Converter.cpp:102
int nsrcStep
Definition V4L2CUYUV420Converter.h:68
EGLDisplay eglDisplay
Definition V4L2CUYUV420Converter.h:59
void process(frame_sp &frame, AV4L2Buffer *buffer)
Definition V4L2CUYUV420Converter.cpp:107
Npp8u * dst[3]
Definition V4L2CUYUV420Converter.h:65
NppiSize oSizeROI
Definition V4L2CUYUV420Converter.h:66
Definition V4L2CUYUV420Converter.h:14
uint32_t mBytesUsedY
Definition V4L2CUYUV420Converter.h:25
virtual void process(frame_sp &frame, AV4L2Buffer *buffer)
Definition V4L2CUYUV420Converter.cpp:26
uint32_t mHeightUV
Definition V4L2CUYUV420Converter.h:29
uint32_t mWidthY
Definition V4L2CUYUV420Converter.h:31
uint32_t mBytesUsedUV
Definition V4L2CUYUV420Converter.h:26
uint32_t mHeightY
Definition V4L2CUYUV420Converter.h:28
uint32_t mWidthUV
Definition V4L2CUYUV420Converter.h:32
virtual ~V4L2CUYUV420Converter()
Definition V4L2CUYUV420Converter.cpp:22
V4L2CUYUV420Converter(uint32_t srcWidth, uint32_t srcHeight, struct v4l2_format &format)
Definition V4L2CUYUV420Converter.cpp:10
struct v4l2_format mFormat
Definition V4L2CUYUV420Converter.h:27
virtual void releaseFrame()
Definition V4L2CUYUV420Converter.h:22