BorderWrap classes

group NVCV_CPP_CUDATOOLS_BORDERWRAP
template<class TW, NVCVBorderType B, bool... ActiveDimensions>
class BorderWrap : public nvcv::cuda::detail::BorderWrapImpl<TW, B, ActiveDimensions...>
#include <BorderWrap.hpp>

Border wrapper class used to wrap a TensorWrap adding border handling to it.

This class wraps a TensorWrap to add border handling functionality. It provides the methods ptr and operator[] to do the same semantic access, pointer or reference respectively, in the wrapped TensorWrap but border aware. It also provides a compile-time set of boolean flags to inform active border-aware dimensions. Active dimensions participate in border handling, storing the corresponding dimension shape. Inactive dimensions are not checked, the dimension shape is not stored, and thus core dump (or segmentation fault) might happen if accessing outside boundaries of inactive dimensions.

using DataType = ...;
using TensorWrap2D = TensorWrap<-1, -1, DataType>;
using BorderWrap2D = BorderWrap<TensorWrap2D, NVCV_BORDER_REFLECT, true, true>;
TensorWrap2D tensorWrap(...);
int2 tensorShape = ...;
BorderWrap2D borderAwareTensor(tensorWrap, tensorShape.x, tensorShape.y);
// Now use borderAwareTensor instead of tensorWrap to access elements inside or outside the tensor,
// outside elements use reflect border, that is the outside index is reflected back inside the tensor

See also

NVCV_CPP_CUDATOOLS_BORDERWRAPS

Template Parameters:
  • TW – It is a TensorWrap class with any dimension and type.

  • B – It is a NVCVBorderType indicating the border to be used.

  • ActiveDimensions – Flags to inform active (true) or inactive (false) dimensions.

template<class TW, bool... ActiveDimensions>
class BorderWrap<TW, NVCV_BORDER_CONSTANT, ActiveDimensions...> : public nvcv::cuda::detail::BorderWrapImpl<TW, NVCV_BORDER_CONSTANT, ActiveDimensions...>
#include <BorderWrap.hpp>

Border wrapper class specialized for NVCV_BORDER_CONSTANT.

Template Parameters:
  • TW – It is a TensorWrap class with any dimension and type.

  • ActiveDimensions – Flags to inform active (true) or inactive (false) dimensions.