Frame¶
-
class Frame¶
Frame class to represent a single frame of data. Not much more than a pointer and some info. Limited interface to accept frames from many sources.
Public Functions
-
Frame(uint32_t rows, uint32_t cols, Dtype dtype)¶
Construct a new Frame.
Note
the data is initialized to zero
- Parameters:
rows – number of rows
cols – number of columns
dtype – data type of the pixels
-
Frame(const std::byte *bytes, uint32_t rows, uint32_t cols, Dtype dtype)¶
Construct a new Frame.
- Parameters:
bytes – pointer to the data to be copied into the frame
rows – number of rows
cols – number of columns
dtype – data type of the pixels
-
inline ~Frame()¶
-
Frame &operator=(const Frame &other) = delete¶
Warning
Copy is disabled to ensure performance when passing frames around. Can discuss enabling it.
-
uint32_t rows() const¶
-
uint32_t cols() const¶
-
size_t bitdepth() const¶
-
uint64_t size() const¶
-
size_t bytes() const¶
-
std::byte *data() const¶
-
std::byte *pixel_ptr(uint32_t row, uint32_t col) const¶
Get the pointer to the pixel at the given row and column.
Warning
The user should cast the pointer to the appropriate type. Think twice if this is the function you want to use.
- Parameters:
row – row index
col – column index
- Returns:
pointer to the pixel
-
template<typename T>
inline void set(uint32_t row, uint32_t col, T data)¶ Set the pixel at the given row and column to the given value.
- Template Parameters:
T – type of the value
- Parameters:
row – row index
col – column index
data – value to set
-
Frame(uint32_t rows, uint32_t cols, Dtype dtype)¶