Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
cuda_pixel.h File Reference

Pixel decoding and YUV encoding shared by the CUDA converter and its host-side tests. More...

#include <cstdint>
Include dependency graph for cuda_pixel.h:

Go to the source code of this file.

Classes

struct  cuda::pixel::rgb_t
 Colour channels normalized to [0, 1]. More...
struct  cuda::pixel::vec4_t
struct  cuda::pixel::matrix_t
 Layout-compatible with video::color_t. More...

Macros

#define CUDA_PIXEL_FN   inline

Enumerations

enum class  cuda::pixel::layout_e : int { bgra8 , rgb10 , bgr10 }
 How the 32-bit little-endian words of a CPU-copied frame hold their channels. More...

Functions

rgb_t cuda::pixel::unpack (layout_e layout, std::uint32_t word)
rgb_t cuda::pixel::mix (rgb_t a, rgb_t b, float t)
rgb_t cuda::pixel::average (rgb_t a, rgb_t b, rgb_t c, rgb_t d)
float cuda::pixel::encode (const vec4_t &vec, rgb_t p)
std::uint32_t cuda::pixel::quantize (float value, std::uint32_t max_code)
 Truncate a rounded code value into [0, max_code]; NaN becomes 0.
template<class sample_t>
sample_t cuda::pixel::store (std::uint32_t code)
 A sample as stored in the plane: 8-bit codes as they are, P010 codes in bits 15:6.
template<>
std::uint8_t cuda::pixel::store< std::uint8_t > (std::uint32_t code)
template<>
std::uint16_t cuda::pixel::store< std::uint16_t > (std::uint32_t code)

Detailed Description

Pixel decoding and YUV encoding shared by the CUDA converter and its host-side tests.

Nothing here depends on CUDA, so the arithmetic the kernels perform can be checked on machines without an NVIDIA GPU.

Definition in file cuda_pixel.h.

Macro Definition Documentation

◆ CUDA_PIXEL_FN

#define CUDA_PIXEL_FN   inline

Definition at line 15 of file cuda_pixel.h.

Enumeration Type Documentation

◆ layout_e

enum class cuda::pixel::layout_e : int
strong

How the 32-bit little-endian words of a CPU-copied frame hold their channels.

Enumerator
bgra8 

DRM XRGB8888 / ARGB8888: bytes B, G, R, X.

rgb10 

DRM XRGB2101010 / ARGB2101010: R in bits 29:20, G in 19:10, B in 9:0.

bgr10 

DRM XBGR2101010 / ABGR2101010: B in bits 29:20, G in 19:10, R in 9:0.

Definition at line 21 of file cuda_pixel.h.

Function Documentation

◆ average()

rgb_t cuda::pixel::average ( rgb_t a,
rgb_t b,
rgb_t c,
rgb_t d )
inline

Definition at line 48 of file cuda_pixel.h.

◆ encode()

float cuda::pixel::encode ( const vec4_t & vec,
rgb_t p )
inline

Definition at line 67 of file cuda_pixel.h.

◆ mix()

rgb_t cuda::pixel::mix ( rgb_t a,
rgb_t b,
float t )
inline

Definition at line 44 of file cuda_pixel.h.

◆ quantize()

std::uint32_t cuda::pixel::quantize ( float value,
std::uint32_t max_code )
inline

Truncate a rounded code value into [0, max_code]; NaN becomes 0.

Definition at line 72 of file cuda_pixel.h.

◆ store< std::uint16_t >()

template<>
std::uint16_t cuda::pixel::store< std::uint16_t > ( std::uint32_t code)
inline

Definition at line 92 of file cuda_pixel.h.

◆ store< std::uint8_t >()

template<>
std::uint8_t cuda::pixel::store< std::uint8_t > ( std::uint32_t code)
inline

Definition at line 87 of file cuda_pixel.h.

◆ unpack()

rgb_t cuda::pixel::unpack ( layout_e layout,
std::uint32_t word )
inline

Definition at line 32 of file cuda_pixel.h.