7#if defined(HERMES_BUILD_CUDA)
28 std::vector<std::string> display_names();
64 void *alloc_host(std::size_t size);
67 void free_host(
void *ptr);
70typedef struct cudaArray *cudaArray_t;
72 #if !defined(__CUDACC__)
73typedef struct CUstream_st *cudaStream_t;
74typedef unsigned long long cudaTextureObject_t;
76typedef __location__(device_builtin)
struct CUstream_st *cudaStream_t;
77typedef __location__(device_builtin)
unsigned long long cudaTextureObject_t;
84 void operator()(
void *ptr);
87 class freeCudaStream_t {
89 void operator()(cudaStream_t ptr);
92 using ptr_t = std::unique_ptr<void, freeCudaPtr_t>;
93 using stream_t = std::unique_ptr<CUstream_st, freeCudaStream_t>;
95 stream_t make_stream(
int flags = 0);
111 static std::optional<tex_t> make(
int height,
int pitch, pixel::layout_e layout = pixel::layout_e::bgra8);
116 tex_t &operator=(tex_t &&other);
120 int copy(std::uint8_t *src,
int height,
int pitch);
123 pixel::layout_e layout {pixel::layout_e::bgra8};
126 cudaTextureObject_t point;
127 cudaTextureObject_t linear;
134 sws_t(
int in_width,
int in_height,
int out_width,
int out_height,
int pitch,
int threadsPerBlock, ptr_t &&color_matrix);
142 static std::optional<sws_t> make(
int in_width,
int in_height,
int out_width,
int out_height,
int pitch);
148 static std::optional<sws_t> make(
int in_width,
int in_height,
int out_width,
int out_height,
int pitch, pixel::layout_e layout,
int output_bits);
151 int convert(std::uint8_t *Y, std::uint8_t *UV, std::uint32_t pitchY, std::uint32_t pitchUV, cudaTextureObject_t texture, stream_t::pointer stream);
152 int convert(std::uint8_t *Y, std::uint8_t *UV, std::uint32_t pitchY, std::uint32_t pitchUV, cudaTextureObject_t texture, stream_t::pointer stream,
const viewport_t &viewport);
154 void apply_colorspace(
const video::sunshine_colorspace_t &colorspace);
156 int load_ram(platf::img_t &img, cudaArray_t array);
164 pixel::layout_e layout {pixel::layout_e::bgra8};
std::unique_ptr< platf::avcodec_encode_device_t > make_avcodec_gl_encode_device(int width, int height, int offset_x, int offset_y)
Create a GL->CUDA encoding device for consuming captured dmabufs.
Pixel decoding and YUV encoding shared by the CUDA converter and its host-side tests.
layout_e
How the 32-bit little-endian words of a CPU-copied frame hold their channels.
@ bgra8
DRM XRGB8888 / ARGB8888: bytes B, G, R, X.
Declarations for colorspace functions.