-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile_camera.h
41 lines (29 loc) · 983 Bytes
/
file_camera.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef file_camera_H
#define file_camera_H
#include <cuda/runtime_api.hpp>
#include <filesystem>
#include <mutex>
namespace cuco {
class file_camera {
public:
file_camera(const std::filesystem::path &image_path);
void start_capture(){};
void stop_capture(){};
std::tuple<cuda::memory::device::unique_ptr<std::uint8_t[]>, unsigned int,
unsigned int, unsigned int>
get_latest_frame();
void return_frame(cuda::memory::device::unique_ptr<std::uint8_t[]> frame) {
std::scoped_lock lk(frame_to_return_mutex);
frame_to_return_device = std::move(frame);
}
private:
cuda::device_t current_cuda_device;
std::size_t frame_size;
cuda::memory::device::unique_ptr<std::uint8_t[]> frame_device;
std::mutex frame_to_return_mutex;
cuda::memory::device::unique_ptr<std::uint8_t[]> frame_to_return_device;
unsigned int width, height;
int channels; // Note this counts the number of packed channels, not planes
};
} // namespace cuco
#endif