Template Class ImageBatchVarShapeWrapNHWC

Inheritance Relationships

Base Type

Class Documentation

template<typename T>
class ImageBatchVarShapeWrapNHWC : private nvcv::cuda::ImageBatchVarShapeWrap<T>

Image batch var-shape wrapper NHWC class to wrap ImageBatchVarShapeDataStridedCuda and number of channels.

This class handles number of channels as a separate run-time parameter instead of built-in T. It considers interleaved channels, where they appear in a packed sequence at the last dimension (thus NHWC). It also considers each image in the batch has a single plane.

Note

The class ImageBatchVarShapeWrap can be used with its template parameter T type as a compound type, where its number of elements yield the number of channels.

Template Parameters:

T – Type (it can be const) of each element inside this wrapper.

Public Types

using ValueType = T

Public Functions

ImageBatchVarShapeWrapNHWC() = default
inline __host__ ImageBatchVarShapeWrapNHWC(const ImageBatchVarShapeDataStridedCuda &images, int numChannels)

Constructs a ImageBatchVarShapeWrapNHWC by wrapping an images and numChannels arguments.

Parameters:
  • images[in] Reference to the list of images that will be wrapped.

  • numChannels[in] The number of (interleaved) channels inside the wrapper.

inline __host__ __device__ const int & numChannels () const
inline __host__ __device__ T & operator[] (int4 c) const

Subscript operator for either read-only or read-and-write access.

Parameters:

c[in] 4D coordinates (x sample, y row, z col, w channel) to be accessed.

Returns:

Accessed reference.

inline __host__ __device__ T & operator[] (int3 c) const

Subscript operator for either read-only or read-and-write access.

Parameters:

c[in] 3D coordinates (x sample, y row, z col) (first channel) to be accessed.

Returns:

Accessed reference.

inline __host__ __device__ T * ptr (int s, int y, int x, int c) const

Get either read-only or read-and-write proxy (as pointer) of the given coordinates.

Parameters:
  • s[in] Sample image index in the list.

  • y[in] Row index in the selected image.

  • x[in] Column index in the selected image.

  • c[in] Channel index in the image.

Returns:

The pointer to the beginning of the given coordinates.

inline __host__ __device__ T * ptr (int s, int y, int x) const

Get either read-only or read-and-write proxy (as pointer) of the given coordinates.

Parameters:
  • s[in] Sample image index in the list.

  • y[in] Row index in the selected image.

  • x[in] Column index in the selected image.

Returns:

The pointer to the beginning of the given coordinates.

inline __host__ __device__ T * ptr (int s, int y) const

Get either read-only or read-and-write proxy (as pointer) of the given coordinates.

Parameters:
  • s[in] Sample image index in the list.

  • y[in] Row index in the selected image.

  • x[in] Column index in the selected image.

Returns:

The pointer to the beginning of the given coordinates.

inline __host__ __device__ int height (int s, int p=0) const

Get height of plane p of image s sample.

Parameters:
  • s[in] Sample image index in the list.

  • p[in] Plane index in the image.

Returns:

The height of the given image plane in batch.

inline const __host__ __device__ NVCVImagePlaneStrided plane (int s, int p=0) const

Get plane p of image s sample.

Parameters:
  • s[in] Sample image index in the list.

  • p[in] Plane index in the image.

Returns:

The plane of the given image sample in batch.

inline __host__ __device__ int rowStride (int s, int p=0) const

Get row stride in bytes of plane p of image s sample.

Parameters:
  • s[in] Sample image index in the list.

  • p[in] Plane index in the image.

Returns:

The row stride in bytes of the given image plane in batch.

inline __host__ __device__ int width (int s, int p=0) const

Get width of plane p of image s sample.

Parameters:
  • s[in] Sample image index in the list.

  • p[in] Plane index in the image.

Returns:

The width of the given image plane in batch.

Public Static Attributes

static constexpr int kConstantStrides
static constexpr int kNumDimensions
static constexpr int kVariableStrides