diff options
Diffstat (limited to 'video-ps3eye/shm-layout.hpp')
-rw-r--r-- | video-ps3eye/shm-layout.hpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/video-ps3eye/shm-layout.hpp b/video-ps3eye/shm-layout.hpp index 577021b9..65b0a4f1 100644 --- a/video-ps3eye/shm-layout.hpp +++ b/video-ps3eye/shm-layout.hpp @@ -3,11 +3,13 @@ namespace ps3eye { +static constexpr unsigned num_channels = 3; + struct shm_in { enum class mode : uint8_t { qvga, vga, }; uint32_t settings_updated; - uint8_t framerate; + uint8_t framerate, channels; mode resolution; //uint8_t sharpness, contrast, brightness hue, saturation; uint8_t gain, exposure, auto_gain, test_pattern; @@ -23,18 +25,14 @@ struct shm_out status status_; char error_string[256]; union { - uint8_t data_320x240[320][240][3]; - uint8_t data_640x480[640][480][3]; + uint8_t data_320x240[320][240][num_channels]; + uint8_t data_640x480[640][480][num_channels]; }; }; -struct shm { - static constexpr unsigned _cacheline_len = 64; - static constexpr unsigned _padding_len = - (_cacheline_len - (sizeof(shm_in) & (_cacheline_len - 1))) & (_cacheline_len - 1); - +struct alignas(64) shm { shm_out out; - const char* _padding[_padding_len]; + [[maybe_unused]] const char _padding[128 - sizeof(shm_out) % 128]; // NOLINT shm_in in; }; |