Mirror Batch#

Mirrors the batch of images about the specified axis.

Description

This function mirrors the source batch of images about the axis defined in mirror_spec class. This function supports only vertical axis and uses it by default. This function can operate with ROI (see Image Regions of Interest). All images in the batches shall have the same ROI size.

Headers

oneapi/ipl/transform/mirror_batch.hpp

Syntax

template<typename SrcBatchT, typename DstBatchT>
sycl::event oneapi::ipl::mirror_batch(sycl::queue &queue, SrcBatchT &src, DstBatchT &dst, const mirror_spec &spec = {}, const std::vector<sycl::event> &dependencies = {})#

Mirror Batch.

Template Parameters:
  • SrcBatchT – Source batch type

  • DstBatchT – Destination batch type

Parameters:
  • queue – SYCL queue

  • src – source batch

  • dst – destination batch

  • spec – algorithmic specification

  • dependencies – dependencies

Returns:

SYCL event

Supported combinations for DataT/Layouts:

DataT/Layouts

plane

channel3

channel4

plane3

std::uint8_t

std::int8_t

std::uint16_t

std::int16_t

std::uint32_t

std::int32_t

float

double

Supported values for subsampled layout (only for std::uint8_t data type):

sub420

sub420i

Parameters

For mirror_spec description please refer to Mirror.

Errors

compile-time memory layout check

Indicates an error when image memory layout 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 source and destination batch sizes are not equal.

unimplemented exception

Indicates an error when axis defined in mirror specification class has an illegal value.

The code example below demonstrates how oneapi::ipl::mirror_batch shall be called:

using namespace oneapi;
using descriptor_t = ipl::image_descriptor<ipl::layouts::plane, std::uint8_t>;

sycl::queue queue;

// Allocate and fill grayscale image descriptors memory
auto src_descriptors = sycl::malloc_shared<descriptor_t>(batch_size, queue);
auto dst_descriptors = sycl::malloc_shared<descriptor_t>(batch_size, queue);

auto src_data = sycl::malloc_shared<std::uint8_t>(batch_size * image_size.size(), queue);
auto dst_data = sycl::malloc_shared<std::uint8_t>(batch_size * image_size.size(), queue);

// Here goes filling souce images data

// Fill image descriptors data
for (std::size_t i{ 0U }; i < batch_size; ++i) {
    src_descriptors[i] = descriptor_t{ src_data + i * image_size.size(), width, image_size, { image_size } };
    dst_descriptors[i] = descriptor_t{ dst_data + i * image_size.size(), width, image_size, { image_size } };
}

// Source grayscale batch data
ipl::batch<ipl::layouts::plane, std::uint8_t> src_batch{ src_descriptors, batch_size, image_size };
// Desination grayscale batch data
ipl::batch<ipl::layouts::plane, std::uint8_t> dst_batch{ dst_descriptors, batch_size, image_size };

// Mirrors the batch of images.
auto event = ipl::mirror_batch(queue, src_batch, dst_batch);