7#include "../data_type.hpp"
8#include "../size_2d.hpp"
11#include "decl_access_base.hpp"
46 assert(basePtr_ !=
nullptr && inc_ > 0
58 ArrayAccess(const ArrayAccess &other) noexcept = default;
59 ArrayAccess &operator=(const ArrayAccess &other) noexcept = default;
60 ArrayAccess(ArrayAccess &&other) noexcept = default;
61 ArrayAccess &operator=(ArrayAccess &&other) noexcept = default;
62 ~ArrayAccess() = default;
73 template <class PLANE_T>
74 static ArrayAccess
FromPlane(const PLANE_T &plane) noexcept;
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
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();
173 explicit operator bool() const noexcept {
…}
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_);
188 CVB_FORCE_INLINE
const void *
operator()(
int x,
int y)
const noexcept {
…}
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_);
217 CVB_FORCE_INLINE
const void *
operator[](
int idx)
const noexcept {
…}
233 return reinterpret_cast<void *
>(this->basePtr_ + idx * this->inc_);
242 friend class ArrayAccess;
267 Row(
const Row &other)
noexcept =
default;
268 Row &operator=(
const Row &other)
noexcept =
default;
269 Row(
Row &&other)
noexcept =
default;
270 Row &operator=(
Row &&other)
noexcept =
default;
284 return reinterpret_cast<void *
>(line0_ + x * xInc_);
296 CVB_FORCE_INLINE
const void *
operator[](
int x)
const noexcept
298 return reinterpret_cast<const void *
>(line0_ + x * xInc_);
308 friend class ArrayAccess;
334 Column &operator=(
const Column &other)
noexcept =
default;
350 return reinterpret_cast<void *
>(column0_ + y * yInc_);
362 CVB_FORCE_INLINE
const void *
operator[](
int y)
const noexcept
364 return reinterpret_cast<const void *
>(column0_ + y * yInc_);
379 return {basePtr_ + y * inc_ * width_, inc_};
393 return {basePtr_ + x * inc_, inc_ * width_};
412 inline
bool operator!=(const ArrayAccess &lhs, const ArrayAccess &rhs) noexcept
414 return lhs.BasePtr() != rhs.BasePtr() || lhs.XInc() != rhs.XInc() || lhs.Width() != rhs.Width();
412 inline
bool operator!=(const ArrayAccess &lhs, const ArrayAccess &rhs) noexcept {
…}
425 inline bool operator==(
const ArrayAccess &lhs,
const ArrayAccess &rhs)
noexcept
427 return !(lhs != rhs);
425 inline bool operator==(
const ArrayAccess &lhs,
const ArrayAccess &rhs)
noexcept {
…}
434 inline bool IsInterleaved(
size_t bytesPerPixel,
const ArrayAccess &access0,
const ArrayAccess &access1)
noexcept
436 return access0.BasePtr() + bytesPerPixel == access1.BasePtr() && access0.XInc() == access1.XInc()
437 && access0.YInc() == access1.YInc();
434 inline bool IsInterleaved(
size_t bytesPerPixel,
const ArrayAccess &access0,
const ArrayAccess &access1)
noexcept {
…}
447 struct ArrayAccessFindNonInterleaved
449 size_t bytesPerPixel;
451 inline bool operator()(
const ArrayAccess *access0,
const ArrayAccess *access1)
const noexcept
453 return !IsInterleaved(bytesPerPixel, *access0, *access1);
456 inline bool operator()(
const ArrayAccess &access0,
const ArrayAccess &access1)
const noexcept
458 return !IsInterleaved(bytesPerPixel, access0, access1);
465 bool IsInterleaved(std::size_t bytesPerPixel,
const std::array<ArrayAccess, I> &accesses)
noexcept
467 return std::adjacent_find(accesses.cbegin(), accesses.cend(), Cvb::ArrayAccessFindNonInterleaved{bytesPerPixel})
486 template <
class... ACCESSES>
487 bool IsInterleaved(
size_t bytesPerPixel,
const ArrayAccess &access0,
const ArrayAccess &access1,
488 const ACCESSES &...accs)
noexcept
490 const std::array<
const ArrayAccess *,
sizeof...(accs) + 2> arr{&access0, &access1, &accs...};
487 bool IsInterleaved(
size_t bytesPerPixel,
const ArrayAccess &access0,
const ArrayAccess &access1, {
…}
A single column.
Definition decl_array_access.hpp:307
CVB_FORCE_INLINE const void * operator[](int y) const noexcept
Value access.
Definition decl_array_access.hpp:362
CVB_FORCE_INLINE void * operator[](int y) noexcept
Value access.
Definition decl_array_access.hpp:348
Column() noexcept
Default ctor of invalid column.
Definition decl_array_access.hpp:327
A single row.
Definition decl_array_access.hpp:241
CVB_FORCE_INLINE void * operator[](int x) noexcept
Value access.
Definition decl_array_access.hpp:282
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:296
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
Returns whether the ArrayAccesses are directly interleaved.
Definition decl_array_access.hpp:434
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:425
bool IsInterleaved(size_t bytesPerPixel, const ArrayAccess &access0, const ArrayAccess &access1, const ACCESSES &...accs) noexcept
Definition decl_array_access.hpp:487
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:377
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:391
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:23
Image plane information container.
Definition decl_image_plane.hpp:29
Linear access properties.
Definition decl_linear_access.hpp:25
Rectangle object.
Definition rect.hpp:24
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:23
Virtual Pixel Access Table.
Definition decl_vpat.hpp:24
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17