7#include "../data_type.hpp"
8#include "../size_2d.hpp"
11#include "decl_access_base.hpp"
20 class LinearAccessData;
46 assert(basePtr_ !=
nullptr && inc_ > 0 && width_ > 0);
73 template <class PLANE_T>
118 return ArrayAccess{basePtr_ + idx * inc_, inc_, width_};
128 return this->basePtr_;
148 return this->inc_ * this->width_;
156 CVB_FORCE_INLINE
int Width() const noexcept
169 return this->basePtr_ != 0 && this->inc_ > 0 && this->width_ > 0;
173 explicit operator bool() const noexcept
175 return this->
Valid();
188 CVB_FORCE_INLINE
const void *
operator()(
int x,
int y)
const noexcept
190 return reinterpret_cast<const void *
>(this->basePtr_ + y * this->inc_ * this->width_ + x * this->inc_);
205 return reinterpret_cast<void *
>(this->basePtr_ + y * this->inc_ * this->width_ + x * this->inc_);
217 CVB_FORCE_INLINE
const void *
operator[](
int idx)
const noexcept
219 return reinterpret_cast<const void *
>(this->basePtr_ + idx * this->inc_);
233 return reinterpret_cast<void *
>(this->basePtr_ + idx * this->inc_);
268 Row(
const Row &other)
noexcept =
default;
269 Row &operator=(
const Row &other)
noexcept =
default;
270 Row(
Row&& other)
noexcept =
default;
271 Row& operator=(
Row&& other)
noexcept =
default;
285 return reinterpret_cast<void *
>(line0_ + x * xInc_);
297 CVB_FORCE_INLINE
const void *
operator[](
int x)
const noexcept
299 return reinterpret_cast<const void *
>(line0_ + x * xInc_);
336 Column& operator=(
const Column& other)
noexcept =
default;
352 return reinterpret_cast<void *
>(column0_ + y * yInc_);
364 CVB_FORCE_INLINE
const void *
operator[](
int y)
const noexcept
366 return reinterpret_cast<const void *
>(column0_ + y * yInc_);
381 return {basePtr_ + y * inc_ * width_, inc_};
395 return {basePtr_ + x * inc_, inc_ * width_};
416 return lhs.BasePtr() != rhs.BasePtr() || lhs.XInc() != rhs.XInc() || lhs.Width() != rhs.Width();
429 return !(lhs != rhs);
438 return access0.BasePtr() + bytesPerPixel == access1.BasePtr() && access0.XInc() == access1.XInc()
439 && access0.YInc() == access1.YInc();
449 struct ArrayAccessFindNonInterleaved
451 size_t bytesPerPixel;
469 return std::adjacent_find(accesses.cbegin(), accesses.cend(), Cvb::ArrayAccessFindNonInterleaved{bytesPerPixel})
488 template <
class... ACCESSES>
490 const ACCESSES &... accs)
noexcept
493 return IsInterleaved(bytesPerPixel, arr);
A single column.
Definition: decl_array_access.hpp:308
CVB_FORCE_INLINE const void * operator[](int y) const noexcept
Value access.
Definition: decl_array_access.hpp:364
CVB_FORCE_INLINE void * operator[](int y) noexcept
Value access.
Definition: decl_array_access.hpp:350
Column() noexcept
Default ctor of invalid column.
Definition: decl_array_access.hpp:328
A single row.
Definition: decl_array_access.hpp:241
CVB_FORCE_INLINE void * operator[](int x) noexcept
Value access.
Definition: decl_array_access.hpp:283
Row() noexcept
Default ctor of invalid row.
Definition: decl_array_access.hpp:261
CVB_FORCE_INLINE const void * operator[](int x) const noexcept
Value access.
Definition: decl_array_access.hpp:297
Access trait for contiguous linear CVB image planes.
Definition: decl_array_access.hpp:27
CVB_FORCE_INLINE std::intptr_t XInc() const noexcept
Gets the offset to the next pixel on this line in this plane.
Definition: decl_array_access.hpp:136
CVB_FORCE_INLINE void * operator[](int idx) noexcept
Index pixel access operator.
Definition: decl_array_access.hpp:231
static ArrayAccess FromVpat(const Vpat &access, Size2D< int > size, DataType dataType) noexcept
Tries to get a valid ArrayAccess trait from the given VPAT access.
Definition: detail_plane_access.hpp:103
CVB_FORCE_INLINE std::uint8_t * BasePtr() const noexcept
Gets the address of the first pixel of the plane.
Definition: decl_array_access.hpp:126
bool IsInterleaved(size_t bytesPerPixel, const ArrayAccess &access0, const ArrayAccess &access1) noexcept
Definition: decl_array_access.hpp:436
bool Valid() const noexcept
Gets whether this linear access object is valid.
Definition: decl_array_access.hpp:167
bool operator==(const ArrayAccess &lhs, const ArrayAccess &rhs) noexcept
Equality operator.
Definition: decl_array_access.hpp:427
bool IsInterleaved(size_t bytesPerPixel, const ArrayAccess &access0, const ArrayAccess &access1, const ACCESSES &... accs) noexcept
Definition: decl_array_access.hpp:489
CVB_FORCE_INLINE std::intptr_t YInc() const noexcept
Gets the offset to the next pixel on the next line in this plane.
Definition: decl_array_access.hpp:146
CVB_FORCE_INLINE int Width() const noexcept
Gets the width of the buffer, this access operates on.
Definition: decl_array_access.hpp:156
static ArrayAccess FromLinearAccess(const LinearAccessData &access, Size2D< int > size) noexcept
Tries to get a valid ArrayAccess trait from the given access.
Definition: detail_plane_access.hpp:93
CVB_FORCE_INLINE const void * operator()(int x, int y) const noexcept
Coordinate pixel access operator.
Definition: decl_array_access.hpp:188
LinearAccessData NewMoved(const Rect< int > newAoi) const noexcept
Creates a new, moved linear access object.
Definition: detail_plane_access.hpp:108
Row RowAt(int y) const noexcept
Gets the ArrayAccess::Row at y.
Definition: decl_array_access.hpp:379
CVB_FORCE_INLINE void * operator()(int x, int y) noexcept
Coordinate pixel access operator.
Definition: decl_array_access.hpp:203
static ArrayAccess FromPlane(const PLANE_T &plane) noexcept
Tries to get a valid ArrayAccess trait from the given plane.
Definition: detail_plane_access.hpp:86
Column ColumnAt(int x) const noexcept
Gets the ArrayAccess::Column at x.
Definition: decl_array_access.hpp:393
CVB_FORCE_INLINE const void * operator[](int idx) const noexcept
Index pixel access operator.
Definition: decl_array_access.hpp:217
Data type description for an image plane.
Definition: data_type.hpp:28
Linear access properties.
Definition: decl_linear_access.hpp:25
Rectangle object.
Definition: rect.hpp:26
Stores a pair of numbers that represents the width and the height of a subject, typically a rectangle...
Definition: size_2d.hpp:20
Common base class for access traits, providing typed Value access to planes.
Definition: decl_access_base.hpp:22
Virtual Pixel Access Table.
Definition: decl_vpat.hpp:24
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24