7#include "../data_type.hpp"
9#include "../size_2d.hpp"
11#include "decl_access_base.hpp"
51 template <class PLANE_T>
90 return LinearAccessData{basePtr_ + newAoi.Top() * yInc_ + newAoi.Left() * xInc_, xInc_, yInc_, newAoi.Width()};
132 CVB_FORCE_INLINE
int Width() const noexcept
132 CVB_FORCE_INLINE
int Width() const noexcept {
…}
145 return this->basePtr_ !=
nullptr && this->xInc_ != 0 && this->yInc_ != 0 && this->width_ > 0;
149 explicit operator bool() const noexcept
151 return this->
Valid();
149 explicit operator bool() const noexcept {
…}
164 CVB_FORCE_INLINE
const void *
operator()(
int x,
int y)
const noexcept
166 return reinterpret_cast<const void *
>(this->basePtr_ + y * this->yInc_ + x * this->xInc_);
164 CVB_FORCE_INLINE
const void *
operator()(
int x,
int y)
const noexcept {
…}
181 return reinterpret_cast<void *
>(this->basePtr_ + y * this->yInc_ + x * this->xInc_);
193 CVB_FORCE_INLINE
const void *
operator[](
int idx)
const noexcept
195 const int y = idx / this->width_;
196 const int x = idx % this->width_;
198 return reinterpret_cast<const void *
>(this->basePtr_ + y * this->yInc_ + x * this->xInc_);
193 CVB_FORCE_INLINE
const void *
operator[](
int idx)
const noexcept {
…}
212 const int y = idx / this->width_;
213 const int x = idx % this->width_;
215 return reinterpret_cast<void *
>(this->basePtr_ + y * this->yInc_ + x * this->xInc_);
224 friend class LinearAccessData;
249 Row(
const Row &other)
noexcept =
default;
250 Row &operator=(
const Row &other)
noexcept =
default;
251 Row(
Row &&other)
noexcept =
default;
252 Row &operator=(
Row &&other)
noexcept =
default;
266 return reinterpret_cast<void *
>(line0_ + x * xInc_);
278 CVB_FORCE_INLINE
const void *
operator[](
int x)
const noexcept
280 return reinterpret_cast<const void *
>(line0_ + x * xInc_);
290 friend class LinearAccessData;
316 Column &operator=(
const Column &other)
noexcept =
default;
332 return reinterpret_cast<void *
>(column0_ + y * yInc_);
344 CVB_FORCE_INLINE
const void *
operator[](
int y)
const noexcept
346 return reinterpret_cast<const void *
>(column0_ + y * yInc_);
361 return {basePtr_ + y * yInc_, xInc_};
375 return {basePtr_ + x * xInc_, yInc_};
387 template <class PLANE_T, std::enable_if_t<PlaneTraits<PLANE_T>::HasVpat,
int> = 0>
389 template <class PLANE_T, std::enable_if_t<!PlaneTraits<PLANE_T>::HasVpat,
int> = 0>
412 return lhs.
BasePtr() != rhs.BasePtr() || lhs.YInc() != rhs.YInc() || lhs.XInc() != rhs.XInc()
413 || lhs.Width() != rhs.Width();
426 return !(lhs != rhs);
436 return access0.BasePtr() + bytesPerPixel == access1.BasePtr() && access0.XInc() == access1.XInc()
437 && access0.YInc() == access1.YInc();
447 struct LinearAccessFindNonInterleaved
449 size_t bytesPerPixel;
451 inline bool operator()(
const LinearAccessData *access0,
const LinearAccessData *access1)
const noexcept
453 return !IsInterleaved(bytesPerPixel, *access0, *access1);
456 inline bool operator()(
const LinearAccessData &access0,
const LinearAccessData &access1)
const noexcept
458 return !IsInterleaved(bytesPerPixel, access0, access1);
464 bool IsInterleaved(std::size_t bytesPerPixel,
const std::array<LinearAccessData, I> &accesses)
noexcept
466 return std::adjacent_find(accesses.cbegin(), accesses.cend(), Cvb::LinearAccessFindNonInterleaved{bytesPerPixel})
485 template <
class... ACCESSES>
487 const ACCESSES &...accs)
noexcept
490 return std::adjacent_find(arr.cbegin(), arr.cend(), LinearAccessFindNonInterleaved{bytesPerPixel}) == arr.cend();
T adjacent_find(T... args)
Access trait for contiguous linear CVB image planes.
Definition decl_array_access.hpp:27
Data type description for an image plane.
Definition data_type.hpp:23
Image plane information container.
Definition decl_image_plane.hpp:29
A single column.
Definition decl_linear_access.hpp:289
CVB_FORCE_INLINE const void * operator[](int y) const noexcept
Value access.
Definition decl_linear_access.hpp:344
CVB_FORCE_INLINE void * operator[](int y) noexcept
Value access.
Definition decl_linear_access.hpp:330
Column() noexcept
Default ctor of invalid column.
Definition decl_linear_access.hpp:309
A single row.
Definition decl_linear_access.hpp:223
CVB_FORCE_INLINE void * operator[](int x) noexcept
Value access.
Definition decl_linear_access.hpp:264
Row() noexcept
Default ctor of invalid row.
Definition decl_linear_access.hpp:243
CVB_FORCE_INLINE const void * operator[](int x) const noexcept
Value access.
Definition decl_linear_access.hpp:278
Linear access properties.
Definition decl_linear_access.hpp:25
CVB_FORCE_INLINE void * operator[](int idx) noexcept
Index pixel access operator.
Definition decl_linear_access.hpp:210
std::intptr_t XInc() const noexcept
X-increment for linear access.
Definition decl_linear_access.hpp:112
bool Valid() const noexcept
Gets whether this linear access object is valid.
Definition decl_linear_access.hpp:143
bool IsInterleaved(size_t bytesPerPixel, const LinearAccessData &access0, const LinearAccessData &access1, const ACCESSES &...accs) noexcept
Returns whether the LinearAccesses are directly interleaved.
Definition decl_linear_access.hpp:486
bool IsInterleaved(size_t bytesPerPixel, const LinearAccessData &access0, const LinearAccessData &access1) noexcept
Returns whether the LinearAccesses are directly interleaved.
Definition decl_linear_access.hpp:433
LinearAccessData() noexcept
Creates a default linear access data set.
bool operator==(const LinearAccessData &lhs, const LinearAccessData &rhs) noexcept
Equality operator.
Definition decl_linear_access.hpp:424
static LinearAccessData FromPlane(const PLANE_T &plane) noexcept
Tries to get a valid LinearAccessData from the given plane.
Definition detail_plane_access.hpp:40
CVB_FORCE_INLINE int Width() const noexcept
Gets the pixel width of the underlying plane.
Definition decl_linear_access.hpp:132
LinearAccessData NewMoved(const Cvb::Rect< int > newAoi) const noexcept
Creates a new, moved linear access object.
Definition decl_linear_access.hpp:88
static LinearAccessData FromPtr(std::uint8_t *basePtr, std::intptr_t xInc, std::intptr_t yInc, int width) noexcept
Creates LinearAccessData from the given pointer and increments.
Definition decl_linear_access.hpp:74
std::intptr_t YInc() const noexcept
Y-increment for linear access.
Definition decl_linear_access.hpp:122
std::uint8_t * BasePtr() const noexcept
Linear access base pointer.
Definition decl_linear_access.hpp:102
CVB_FORCE_INLINE const void * operator()(int x, int y) const noexcept
Coordinate pixel access operator.
Definition decl_linear_access.hpp:164
Row RowAt(int y) const noexcept
Gets the LinearAccessData::Row at y.
Definition decl_linear_access.hpp:359
static LinearAccessData FromVpat(const Vpat &access, Cvb::Size2D< int > size, Cvb::DataType dataType) noexcept
Tries to get a valid LinearAccessData trait from the given vpat.
Definition detail_plane_access.hpp:47
CVB_FORCE_INLINE void * operator()(int x, int y) noexcept
Coordinate pixel access operator.
Definition decl_linear_access.hpp:179
Column ColumnAt(int x) const noexcept
Gets the LinearAccessData::Column at x.
Definition decl_linear_access.hpp:373
CVB_FORCE_INLINE const void * operator[](int idx) const noexcept
Index pixel access operator.
Definition decl_linear_access.hpp:193
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