Resize Supersampling

Changes an image size using the super sampling interpolation method.

Description

This function changes an image size using the super sampling interpolation method. This method only reduces the image size. The interpolation algorithm applied uses only pixels of the source image origin that are inside of the image boundaries. This function can operate with ROI (see Image Regions of Interest).

Before using the resize_supersampling function, implementation must initialize the resize_supersampling_spec.

Headers

oneapi/ipl/transform/resize_supersampling.hpp

Syntax

template<typename ComputeT = float, formats Format, typename DataT, typename SrcAllocatorT, typename DstAllocatorT>
sycl::event oneapi::ipl::resize_supersampling(sycl::queue &queue, image<Format, DataT, SrcAllocatorT> &src, image<Format, DataT, DstAllocatorT> &dst, const resize_supersampling_spec<ComputeT> &spec, const std::vector<sycl::event> &dependencies = {})

Resize supersampling.

Template Parameters
  • ComputeT – type to perform calculations

  • Format – the given format of an image

  • DataT – the given type of a pixel component

  • SrcAllocatorT – the given type of source image memory allocator

  • DstAllocatorT – the given type of destination image memory allocator

Parameters
  • queue – SYCL queue

  • src – source image

  • dst – destination image

  • spec – algorithmic specification

  • dependencies – dependencies

Returns

SYCL event

Supported values for ComputeT:

float

double

half

v

v

x

Supported combinations for DataT/Formats:

DataT/Formats

plane

rgb/bgr

rgba/bgra

rgbp

std::uint8_t

v

v

v

x

std::int8_t

v

v

v

x

std::uint16_t

v

v

v

x

std::int16_t

v

v

v

x

std::uint32_t

v

v

v

x

std::int32_t

v

v

v

x

float

v

v

v

x

double

v

v

v

x

Supported values for subsampled Format (only for DataT = std::uint8_t):

nv12

i420

x

x

Parameters

template<typename ComputeT = float>
class oneapi::ipl::resize_supersampling_spec

Resize supersampling parameters.

Template Parameters

ComputeT – the type for computations

Public Functions

constexpr resize_supersampling_spec() noexcept = default

Construct resize supersampling specification.

explicit constexpr resize_supersampling_spec(ComputeT x_shift, ComputeT y_shift, bool smooth_edge = false) noexcept

Construct resize supersampling specification.

Parameters
  • x_shift – subpixel shift in x direction

  • y_shift – subpixel shift in y direction

  • smooth_edge – edge smoothing parameter

constexpr ComputeT get_shift_x() const noexcept

Returns the x component of the subpixel shift.

Returns

the x component of the subpixel shift

constexpr ComputeT get_shift_y() const noexcept

Returns the y component of the shift.

Returns

the y component of the shift

constexpr bool is_smooth_edge() const noexcept

Returns the flag of edge smoothing.

Returns

the flag of edge smoothing

Errors

compile-time format check

Indicates an error when image format is not supported.

compile-time data type check

Indicates an error when image data type is not supported.

compile-time compute data type check

Indicates an error when compute data type is not supported.

invalid_argument exception

Indicates an error when the destination image ROI size is greater than the source image ROI size.

invalid_argument exception

Indicates an error when one of the pitch values is not divisible by size of component data type in bytes.

The code example below demonstrates how to use the oneapi::ipl::resize_supersampling:

// Create queue
sycl::queue queue{};

// Source rgba image data
image<formats::rgba, std::uint8_t> src_image{ src_data_pointer, src_size };
// Destination rgba image data (Format should be the same)
image<formats::rgba, std::uint8_t> dst_image{ dst_size };
const float                        x_shift     = 0.1f;
const float                        y_shift     = 0.1f;
const bool                         smooth_edge = true;
const resize_supersampling_spec    spec{ x_shift, y_shift, smooth_edge };
(void)resize_supersampling(queue, src_image, dst_image, spec);