Ocean
Ocean::CV::FrameShrinker Class Reference

This class implements function to downsize a frame. More...

Inheritance diagram for Ocean::CV::FrameShrinker:

Static Public Member Functions

static bool downsampleByTwo11 (const Frame &source, Frame &target, Worker *worker=nullptr)
 Reduces the resolution of a given frame by two, applying a 1-1 downsampling. More...
 
static bool downsampleBinayMaskByTwo11 (const Frame &source, Frame &target, const unsigned int threshold=766u, Worker *worker=nullptr)
 Reduces the resolution of a given binary mask by two, applying a 1-1 downsampling. More...
 
static bool downsampleByTwo14641 (const Frame &source, Frame &target, Worker *worker=nullptr)
 Reduces the resolution of a given frame by two, applying a 1-4-6-4-1 downsampling. More...
 
static bool downsampleByTwo11 (Frame &frame, Worker *worker=nullptr)
 Reduces the resolution of a given frame by two, taking four pixel values into account. More...
 
static bool downsampleBinayMaskByTwo11 (Frame &mask, const unsigned int threshold=766u, Worker *worker=nullptr)
 Reduces the resolution of a given binary mask by two, taking 2x2 (= four) mask pixel values into account. More...
 
static bool downsampleByTwo14641 (Frame &frame, Worker *worker=nullptr)
 Reduces the resolution of a given frame by two, applying a 1-4-6-4-1 downsampling. More...
 
static bool pyramidByTwo11 (const Frame &source, uint8_t *const pyramidTarget, const size_t pyramidTargetSize, const unsigned int layers, const bool copyFirstLayer, Worker *worker)
 Fills the buffer of a pyramid frame for frames with 1 plane and data type DT_UNSIGNED_INTEGER_8. More...
 
static bool pyramidByTwo8BitPerChannel11 (const uint8_t *source, uint8_t *pyramidTarget, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int channels, const size_t pyramidTargetSize, const unsigned int layers, const unsigned int sourcePaddingElements, const bool copyFirstLayer, Worker *worker)
 Fills the buffer of a pyramid frame for frames with 1 plane and data type DT_UNSIGNED_INTEGER_8 applying a 1-1 downsampling. More...
 
static void downsampleByTwo8BitPerChannel11 (const uint8_t *source, uint8_t *target, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int channels, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
 Reduces the resolution of a given frame by two, applying a 1-1 downsampling. More...
 
static void downsampleBinayMaskByTwo8BitPerChannel11 (const uint8_t *source, uint8_t *target, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const unsigned int threshold=766u, Worker *worker=nullptr)
 Reduces the resolution of a given binary frame with 8bit per pixel with values 0 and 255 by two, taking four pixel values into account. More...
 
static void downsampleByTwo8BitPerChannel14641 (const uint8_t *const source, uint8_t *const target, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int targetWidth, const unsigned int targetHeight, const unsigned int channels, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
 Reduces the resolution of a given frame by two, applying a 1-4-6-4-1 downsampling. More...
 

Protected Types

typedef void(* DownsampleBlockByTwo8BitPerChannelFunction) (const uint8_t *const sourceRow0, const uint8_t *const sourceRow1, uint8_t *const target)
 Definition of a function pointer allowing to down sample a block of elements by using a 11 pattern. More...
 
typedef void(* DownsampleBlockByTwoBinary8BitPerChannelFunction) (const uint8_t *const sourceRow0, const uint8_t *const sourceRow1, uint8_t *const target, const uint16_t threshold)
 Definition of a function pointer allowing to down sample a binary block of elements by using a 11 pattern. More...
 

Static Protected Member Functions

static bool pyramidByTwo8BitPerChannel11WithThreads (const uint8_t *source, uint8_t *pyramidTarget, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int channels, const size_t pyramidTargetSize, const unsigned int layers, const bool copyFirstLayer, const unsigned int sourcePaddingElements, const unsigned int threads, Worker *worker)
 Fills the buffer of a pyramid frame for frames with 1 plane and data type DT_UNSIGNED_INTEGER_8. More...
 
static void pyramidByTwo8BitPerChannel11WithThreadsSubset (const uint8_t *source, uint8_t *pyramidTarget, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int channels, const size_t pyramidTargetSize, const unsigned int layers, const bool copyFirstLayer, const unsigned int sourcePaddingElements, const unsigned int firstSubsetsSourceHeight, const unsigned int subsets, const unsigned int subsetIndex, const unsigned int valueOne)
 Fills a subset of the buffer of a pyramid frame for a given frame with 1 plane and data type DT_UNSIGNED_INTEGER_8. More...
 
static void downsampleByTwo8BitPerChannel11Subset (const uint8_t *source, uint8_t *target, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int channels, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const unsigned int firstTargetRow, const unsigned int numberTargetRows)
 Reduces the resolution of a given frame by two. More...
 
static void downsampleBinayMaskByTwo8BitPerChannel11Subset (const uint8_t *source, uint8_t *target, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const unsigned int threshold, const unsigned int firstTargetRow, const unsigned int numberTargetRows)
 Reduces the resolution of a given binary frame with 8bit per pixel with values 0 and 255 by two, taking four pixel values into account. More...
 
static void determineFunctionDownsampleBlockByTwo8Bit11 (const unsigned int sourceWidth, const unsigned int channels, DownsampleBlockByTwo8BitPerChannelFunction &downsampleBlockFunction, unsigned int &sourceElementsPerBlock)
 Determines the function to down sample a block of pixel elements by two with a 11 filter pattern. More...
 
static OCEAN_PREVENT_INLINE void downsampleByTwoOneRowThreeColumns8BitPerChannel121 (const uint8_t *source, uint8_t *target, const unsigned int channels, const unsigned int sourceStrideElements)
 Downsamples an area of 2x3 pixels (two rows and three columns) to one pixel in a frame, applying a 1-2-1 down sampling filter. More...
 
static OCEAN_PREVENT_INLINE void downsampleByTwoThreeRows8BitPerChannel121 (const uint8_t *source, uint8_t *target, const unsigned int sourceWidth, const unsigned int channels, const unsigned int sourceStrideElements)
 Downsamples three rows to one row in a frame, applying a 2x3 [1-2-1, 1-2-1] down sampling filter. More...
 
static void downsampleByTwoRowVertical8BitPerChannel14641 (const uint8_t *const source, uint16_t *targetRow, const unsigned int sourceElements, const unsigned int sourceHeight, const unsigned int sourceStrideElements, const unsigned int ySource)
 Applies a vertical 14641 filter to each pixel in a given row not applying any SIMD instructions. More...
 
static void downsampleByTwoRowHorizontal8BitPerChannel14641 (const uint16_t *sourceRow, uint8_t *targetRow, const unsigned int targetWidth, const unsigned int channels)
 Applies a horizontal 14641 filter to each second pixel in a given row not applying any SIMD instructions. More...
 
static void downsampleByTwoRowVertical8BitPerChannel14641SSE (const uint8_t *const source, uint16_t *targetRow, const unsigned int sourceElements, const unsigned int sourceHeight, const unsigned int sourceStrideElements, const unsigned int ySource)
 Applies a vertical 14641 filter to each pixel in a given row using SSE instructions. More...
 
static void downsampleByTwoRowVertical8BitPerChannel14641NEON (const uint8_t *const source, uint16_t *targetRow, const unsigned int sourceElements, const unsigned int sourceHeight, const unsigned int sourceStrideElements, const unsigned int ySource)
 Applies a vertical 14641 filter to each pixel in a given row using NEON instructions. More...
 
template<unsigned int tChannels>
static void downsampleByTwoRowHorizontal8BitPerChannel14641NEON (const uint16_t *sourceRow, uint8_t *targetRow, const unsigned int targetWidth, const unsigned int channels)
 Applies a horizontal 14641 filter to each second pixel in a given row applying NEON instructions. More...
 
static void downsampleByTwo8BitPerChannel14641Subset (const uint8_t *source, uint8_t *target, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int targetWidth, const unsigned int channels, const unsigned int sourceStrideElements, const unsigned int targetStrideElements, const unsigned int firstTargetRow, const unsigned int numberTargetRows)
 Reduces the resolution in a subregion of a given frame by two, taking 5x5 (= 25) pixel values into account. More...
 
static unsigned int mirroredBorderLocationLeft (const int value)
 Mirrors a given value at the left border if necessary. More...
 
static unsigned int mirroredBorderLocationRight (const unsigned int value, const unsigned int size)
 Mirrors a given value at the right border if necessary. More...
 

Detailed Description

This class implements function to downsize a frame.

Member Typedef Documentation

◆ DownsampleBlockByTwo8BitPerChannelFunction

typedef void(* Ocean::CV::FrameShrinker::DownsampleBlockByTwo8BitPerChannelFunction) (const uint8_t *const sourceRow0, const uint8_t *const sourceRow1, uint8_t *const target)
protected

Definition of a function pointer allowing to down sample a block of elements by using a 11 pattern.

Parameters
sourceRow0The upper source row, must be valid
sourceRow1The lower source row, must be valid
targetThe target receiving the down sampled data

◆ DownsampleBlockByTwoBinary8BitPerChannelFunction

typedef void(* Ocean::CV::FrameShrinker::DownsampleBlockByTwoBinary8BitPerChannelFunction) (const uint8_t *const sourceRow0, const uint8_t *const sourceRow1, uint8_t *const target, const uint16_t threshold)
protected

Definition of a function pointer allowing to down sample a binary block of elements by using a 11 pattern.

Parameters
sourceRow0The upper source row, must be valid
sourceRow1The lower source row, must be valid
targetThe target receiving the down sampled data
thresholdMinimal sum threshold of four pixels to result in a pixel with value 255

Member Function Documentation

◆ determineFunctionDownsampleBlockByTwo8Bit11()

static void Ocean::CV::FrameShrinker::determineFunctionDownsampleBlockByTwo8Bit11 ( const unsigned int  sourceWidth,
const unsigned int  channels,
DownsampleBlockByTwo8BitPerChannelFunction downsampleBlockFunction,
unsigned int &  sourceElementsPerBlock 
)
staticprotected

Determines the function to down sample a block of pixel elements by two with a 11 filter pattern.

This function will return the function able to handle the largest block of elements, if any function exists.

Parameters
sourceWidthThe width of the source frame in pixel, with range [2, infinity)
channelsThe number of frame channels, with range [1, infinity)
downsampleBlockFunctionThe resulting function down sampling the block of elements, nullptr if no matching function could be determined
sourceElementsPerBlockThe resulting number of source elements which will be handled by the resulting down sampling function, 0 if no matching function could be determined

◆ downsampleBinayMaskByTwo11() [1/2]

static bool Ocean::CV::FrameShrinker::downsampleBinayMaskByTwo11 ( const Frame source,
Frame target,
const unsigned int  threshold = 766u,
Worker worker = nullptr 
)
static

Reduces the resolution of a given binary mask by two, applying a 1-1 downsampling.

Each downsampled pixel is based on 2x2 (= four) corresponding pixels from the source image:

| 1 1 |
| 1 1 | * 1/4

If the given source image has an odd frame dimension the last pixel row or the last pixel column is filtered together with the two valid rows or columns respectively.
If the type of the target frame does not match to the input frame the target frame (and image buffer) will be replaced by the correct one.

Parameters
sourceThe source mask to resize, must be valid
targetThe target mask receiving the down sampled frame data, can be invalid
thresholdThe threshold of the minimal sum of the four mask pixels values to result in a downsampled pixel with value 255, with range [0, 255 * 4]
workerOptional worker object to distribute the computational load to several CPU cores
Returns
True, if succeeded

◆ downsampleBinayMaskByTwo11() [2/2]

bool Ocean::CV::FrameShrinker::downsampleBinayMaskByTwo11 ( Frame mask,
const unsigned int  threshold = 766u,
Worker worker = nullptr 
)
inlinestatic

Reduces the resolution of a given binary mask by two, taking 2x2 (= four) mask pixel values into account.

Parameters
maskThe mask to down sample, must be valid
thresholdThe threshold of the minimal sum of the four mask pixels values to result in a downsampled pixel with value 255, with range [0, 255 * 4]
workerOptional worker object to distribute the computational load to several CPU cores
Returns
True, if succeeded

◆ downsampleBinayMaskByTwo8BitPerChannel11()

void Ocean::CV::FrameShrinker::downsampleBinayMaskByTwo8BitPerChannel11 ( const uint8_t *  source,
uint8_t *  target,
const unsigned int  sourceWidth,
const unsigned int  sourceHeight,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
const unsigned int  threshold = 766u,
Worker worker = nullptr 
)
inlinestatic

Reduces the resolution of a given binary frame with 8bit per pixel with values 0 and 255 by two, taking four pixel values into account.

Parameters
sourceBinary source frame buffer to resize
targetBinary target frame buffer
sourceWidthWidth of the source frame in pixel, with range [2, infinity)
sourceHeightHeight of the source frame in pixel, with range [2, infinity)
sourcePaddingElementsThe number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsThe number of padding elements at the end of each target row, in elements, with range [0, infinity)
thresholdMinimal sum threshold of four pixels to result in a pixel with value 255
workerOptional worker object to distribute the computational load to several CPU cores

◆ downsampleBinayMaskByTwo8BitPerChannel11Subset()

static void Ocean::CV::FrameShrinker::downsampleBinayMaskByTwo8BitPerChannel11Subset ( const uint8_t *  source,
uint8_t *  target,
const unsigned int  sourceWidth,
const unsigned int  sourceHeight,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
const unsigned int  threshold,
const unsigned int  firstTargetRow,
const unsigned int  numberTargetRows 
)
staticprotected

Reduces the resolution of a given binary frame with 8bit per pixel with values 0 and 255 by two, taking four pixel values into account.

Parameters
sourceThe binary source frame, must be valid
targetThe binary target frame, must be valid
sourceWidthWidth of the source frame in pixel, with range [2, infinity)
sourceHeightHeight of the source frame in pixel, with range [2, infinity)
sourcePaddingElementsThe number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsThe number of padding elements at the end of each source row, in elements, with range [0, infinity)
thresholdThe threshold of the minimal sum of the four mask pixels values to result in a downsampled pixel with value 255, with range [0, 255 * 4]
firstTargetRowThe first target row to be handled, with range [0, sourceHeight / 2 - 1]
numberTargetRowsThe number of target rows to be handled, with range [1, sourceHeight / 2 - firstTargetRow]

◆ downsampleByTwo11() [1/2]

static bool Ocean::CV::FrameShrinker::downsampleByTwo11 ( const Frame source,
Frame target,
Worker worker = nullptr 
)
static

Reduces the resolution of a given frame by two, applying a 1-1 downsampling.

Each downsampled pixel is based on 2x2 (= four) corresponding pixels from the source image:

| 1 1 |
| 1 1 | * 1/4

If the given source image has an odd frame dimension the last pixel row or the last pixel column is filtered together with the two valid rows or columns respectively.
If the type of the target frame does not match to the input frame the target frame (and image buffer) will be replaced by the correct one.

Parameters
sourceThe source frame to resize, must be valid
targetThe target frame receiving the down sampled frame data, can be invalid
workerOptional worker object to distribute the computational load to several CPU cores
Returns
True, if succeeded

◆ downsampleByTwo11() [2/2]

bool Ocean::CV::FrameShrinker::downsampleByTwo11 ( Frame frame,
Worker worker = nullptr 
)
inlinestatic

Reduces the resolution of a given frame by two, taking four pixel values into account.

If the given source image has an odd frame dimension the last pixel row or the last pixel column is filtered together with the two valid rows or columns respectively.

Parameters
frameThe frame to down sample, must be valid
workerOptional worker object to distribute the computational load to several CPU cores
Returns
True, if succeeded

◆ downsampleByTwo14641() [1/2]

static bool Ocean::CV::FrameShrinker::downsampleByTwo14641 ( const Frame source,
Frame target,
Worker worker = nullptr 
)
static

Reduces the resolution of a given frame by two, applying a 1-4-6-4-1 downsampling.

Each downsampled pixel is based on 5x5 (= 25) corresponding pixels from the source image:

| 1  4  6  4 1 |
| 4 16 24 16 4 |
| 6 24 36 24 6 | * 1/256
| 4 16 24 16 4 |
| 1  4  6  4 1 |

The filter values are determined at even pixel coordinates (0, 2, 4, ...). If the type of the target frame does not match to the input frame the target frame (and image buffer) will be replaced by the correct one.
By default, the resolution of the target frame will be set to (source.width() / 2, source.height() / 2).

Parameters
sourceThe source frame to resize, must be valid
targetThe target frame receiving the down sampled frame data, with resolution [source.width() / 2, (source.width() + 1) / 2]x[source.height() / 2, (source.height() + 1) / 2], can be invalid
workerOptional worker object to distribute the computational load to several CPU cores
Returns
True, if succeeded

◆ downsampleByTwo14641() [2/2]

bool Ocean::CV::FrameShrinker::downsampleByTwo14641 ( Frame frame,
Worker worker = nullptr 
)
inlinestatic

Reduces the resolution of a given frame by two, applying a 1-4-6-4-1 downsampling.

Each downsampled pixel is based on 5x5 (= 25) corresponding pixels from the source image:

| 1  4  6  4 1 |
| 4 16 24 16 4 |
| 6 24 36 24 6 | * 1/256
| 4 16 24 16 4 |
| 1  4  6  4 1 |

The filter values are determined at even pixel coordinates (0, 2, 4, ...).
The resulting frame will have the resolution (frame.width() / 2, frame.height() / 2).

Parameters
frameThe frame to down sample, must be valid
workerOptional worker object to distribute the computational load to several CPU cores
Returns
True, if succeeded

◆ downsampleByTwo8BitPerChannel11()

void Ocean::CV::FrameShrinker::downsampleByTwo8BitPerChannel11 ( const uint8_t *  source,
uint8_t *  target,
const unsigned int  sourceWidth,
const unsigned int  sourceHeight,
const unsigned int  channels,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
Worker worker = nullptr 
)
inlinestatic

Reduces the resolution of a given frame by two, applying a 1-1 downsampling.

Each downsampled pixel is based on 2x2 (= four) corresponding pixels from the source image:

| 1 1 |
| 1 1 | * 1/4

The target width and target height will be sourceWidth / 2, targetHeight / 2.
In case, the given source image has an odd frame resolution the last pixel row or the last pixel column is filtered together with the two valid rows or columns respectively.
However, in general, this function is meant to be used for images with even width and height.

Parameters
sourceThe source frame buffer to resize, must be valid
targetThe target frame buffer receiving the down sampled image information, must be valid
sourceWidthWidth of the source frame in pixel, with range [2, infinity)
sourceHeightHeight of the source frame in pixel, with range [2, infinity)
channelsThe number of data channel the frames have, with range [1, infinity)
sourcePaddingElementsOptional padding at the end of each source row in elements, with range [0, infinity)
targetPaddingElementsOptional padding at the end of each target row in elements, with range [0, infinity)
workerOptional worker object to distribute the computational load to several CPU cores

◆ downsampleByTwo8BitPerChannel11Subset()

static void Ocean::CV::FrameShrinker::downsampleByTwo8BitPerChannel11Subset ( const uint8_t *  source,
uint8_t *  target,
const unsigned int  sourceWidth,
const unsigned int  sourceHeight,
const unsigned int  channels,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
const unsigned int  firstTargetRow,
const unsigned int  numberTargetRows 
)
staticprotected

Reduces the resolution of a given frame by two.

Parameters
sourceThe source frame buffer to resize, must be valid
targetThe target frame buffer receiving the down sampled image information, must be valid
sourceWidthWidth of the source frame in pixel, with range [2, infinity)
sourceHeightHeight of the source frame in pixel, with range [2, infinity)
channelsThe number of data channel the frames have, with range [1, infinity)
sourcePaddingElementsOptional padding at the end of each source row in elements, with range [0, infinity)
targetPaddingElementsOptional padding at the end of each target row in elements, with range [0, infinity)
firstTargetRowThe first target row to be handled, with range [0, sourceHeight / 2 - 1]
numberTargetRowsThe number of target rows to be handled, with range [1, sourceHeight / 2 - firstTargetRow]

◆ downsampleByTwo8BitPerChannel14641()

void Ocean::CV::FrameShrinker::downsampleByTwo8BitPerChannel14641 ( const uint8_t *const  source,
uint8_t *const  target,
const unsigned int  sourceWidth,
const unsigned int  sourceHeight,
const unsigned int  targetWidth,
const unsigned int  targetHeight,
const unsigned int  channels,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
Worker worker = nullptr 
)
inlinestatic

Reduces the resolution of a given frame by two, applying a 1-4-6-4-1 downsampling.

Each downsampled pixel is based on 5x5 (= 25) corresponding pixels from the source image:

| 1  4  6  4 1 |
| 4 16 24 16 4 |
| 6 24 36 24 6 | * 1/256
| 4 16 24 16 4 |
| 1  4  6  4 1 |

The filter values are determined at even pixel coordinates.

Parameters
sourceThe source frame to resize, must be valid
targetThe target frame receiving the down sampled frame data, with memory for (targetWidth * targetHeight) pixels, must be valid
sourceWidthThe width of the source frame in pixel, with range [2, infinity)
sourceHeightThe height of the source frame in pixel, with range [2, infinity)
targetWidthThe width of the target frame in pixel, with range [sourceWidth / 2, (sourceWidth + 1) / 2]
targetHeightThe height of the target frame in pixel, with range [sourceHeight / 2, (sourceHeight + 1) / 2]
channelsThe number of frame channels, with range [1, infinity)
sourcePaddingElementsOptional padding at the end of each source row in elements, with range [0, infinity)
targetPaddingElementsOptional padding at the end of each target row in elements, with range [0, infinity)
workerOptional worker object to distribute the computational load to several CPU cores

◆ downsampleByTwo8BitPerChannel14641Subset()

static void Ocean::CV::FrameShrinker::downsampleByTwo8BitPerChannel14641Subset ( const uint8_t *  source,
uint8_t *  target,
const unsigned int  sourceWidth,
const unsigned int  sourceHeight,
const unsigned int  targetWidth,
const unsigned int  channels,
const unsigned int  sourceStrideElements,
const unsigned int  targetStrideElements,
const unsigned int  firstTargetRow,
const unsigned int  numberTargetRows 
)
staticprotected

Reduces the resolution in a subregion of a given frame by two, taking 5x5 (= 25) pixel values into account.

The filter values are determined at even pixel coordinates.

Parameters
sourceThe source frame to resize, must be valid
targetThe target frame receiving the down sample frame data, with memory for (targetWidth * targetHeight) pixels, must be valid
sourceWidthThe width of the source frame in pixel, with range [2, infinity)
sourceHeightThe height of the source frame in pixel, with range [2, infinity)
targetWidthThe width of the target frame in pixel, with range [sourceWidth / 2, (sourceWidth + 1) / 2]
channelsThe number of frame channels, with range [1, infinity)
sourceStrideElementsThe stride of the source frame in elements (sourceWidth * channels + optional padding), with range [sourceWidth * channels, infinity)
targetStrideElementsThe stride of the target frame in elements (targetWidth * channels + optional padding), with range [targetWidth * channels, infinity)
firstTargetRowThe first target row to be handled, with range [0, targetHeight)
numberTargetRowsThe number of target rows to be handled, with range [1, targetHeight - firstTargetRow]

◆ downsampleByTwoOneRowThreeColumns8BitPerChannel121()

static OCEAN_PREVENT_INLINE void Ocean::CV::FrameShrinker::downsampleByTwoOneRowThreeColumns8BitPerChannel121 ( const uint8_t *  source,
uint8_t *  target,
const unsigned int  channels,
const unsigned int  sourceStrideElements 
)
staticprotected

Downsamples an area of 2x3 pixels (two rows and three columns) to one pixel in a frame, applying a 1-2-1 down sampling filter.

This function is typically handling the last pixel in a frame (if the frame has an odd width).

Parameters
sourceThe location of the top left pixel in the source frame, must be valid
targetThe location in the target frame, must be valid
channelsThe number of channels the source (and target) frame have, with range [1, infinity)
sourceStrideElementsThe number of elements between two successive rows in the source frame, in elements, with range [sourceWidth * channels, infinity)

◆ downsampleByTwoRowHorizontal8BitPerChannel14641()

static void Ocean::CV::FrameShrinker::downsampleByTwoRowHorizontal8BitPerChannel14641 ( const uint16_t *  sourceRow,
uint8_t *  targetRow,
const unsigned int  targetWidth,
const unsigned int  channels 
)
staticprotected

Applies a horizontal 14641 filter to each second pixel in a given row not applying any SIMD instructions.

Each second pixel is skipped so that the target row has a length half of the source row.
This function can be used to down sample an image e.g., by a factor of two.

Parameters
sourceRowThe source row already holding the vertical filter responses to which now the horizontal filter will be applied, must be valid
targetRowThe target row receiving the filter results which will be normalized before assignment, must be valid
targetWidthThe width of the target row in pixel, with range [1, infinity)
channelsThe number of channels the target row (and source row) has, with range [1, infinity)
See also
downsampleByTwoRowVertical8BitPerChannel14641().

◆ downsampleByTwoRowHorizontal8BitPerChannel14641NEON()

template<unsigned int tChannels>
static void Ocean::CV::FrameShrinker::downsampleByTwoRowHorizontal8BitPerChannel14641NEON ( const uint16_t *  sourceRow,
uint8_t *  targetRow,
const unsigned int  targetWidth,
const unsigned int  channels 
)
staticprotected

Applies a horizontal 14641 filter to each second pixel in a given row applying NEON instructions.

Each second pixel is skipped so that the target row has a length half of the source row.
This function can be used to down sample an image e.g., by a factor of two.

Parameters
sourceRowThe source row already holding the vertical filter responses to which now the horizontal filter will be applied, must be valid
targetRowThe target row receiving the filter results which will be normalized before assignment, must be valid
targetWidthThe width of the target row in pixel, with individual ranges depending on tChannels
channelsThe number of frame channels the target row (and source row) has, with range [1, infinity)
See also
downsampleByTwoRowVertical8BitPerChannel14641NEON().
Template Parameters
tChannelsThe number of channels the target row (and source row) has, with range [1, 4]

◆ downsampleByTwoRowVertical8BitPerChannel14641()

static void Ocean::CV::FrameShrinker::downsampleByTwoRowVertical8BitPerChannel14641 ( const uint8_t *const  source,
uint16_t *  targetRow,
const unsigned int  sourceElements,
const unsigned int  sourceHeight,
const unsigned int  sourceStrideElements,
const unsigned int  ySource 
)
staticprotected

Applies a vertical 14641 filter to each pixel in a given row not applying any SIMD instructions.

This function can be used to down sample an image e.g., by a factor of two.

Parameters
sourceThe entire source frame holding the row to which the filter is applied, must be valid
targetRowThe target row receiving the filter results which are not normalized, must be valid
sourceElementsThe number of elements in each row (pixels * channels), with range [1, infinity)
sourceHeightThe height of the source frame in pixel, with range [2, infinity)
sourceStrideElementsThe stride of the source frame (the number of elements in each row - may including padding at the end of each row), with range [sourceElements, infinity)
ySourceThe row within the source frame to which the filter will be applied, with range [0, sourceHeight)
See also
downsampleByTwoRowHorizontal8BitPerChannel14641().

◆ downsampleByTwoRowVertical8BitPerChannel14641NEON()

static void Ocean::CV::FrameShrinker::downsampleByTwoRowVertical8BitPerChannel14641NEON ( const uint8_t *const  source,
uint16_t *  targetRow,
const unsigned int  sourceElements,
const unsigned int  sourceHeight,
const unsigned int  sourceStrideElements,
const unsigned int  ySource 
)
staticprotected

Applies a vertical 14641 filter to each pixel in a given row using NEON instructions.

This function can be used to down sample an image e.g., by a factor of two.

Parameters
sourceThe entire source frame holding the row to which the filter is applied, must be valid
targetRowThe target row receiving the filter results which are not normalized, must be valid
sourceElementsThe number of elements in each row (pixels * channels), with range [16, infinity)
sourceHeightThe height of the source frame in pixel, with range [2, infinity)
sourceStrideElementsThe stride of the source frame (the number of elements in each row - may including padding at the end of each row), with range [sourceElements, infinity)
ySourceThe row within the source frame to which the filter will be applied, with range [0, sourceHeight)
See also
downsampleByTwoRowHorizontal8BitPerChannel14641NEON().

◆ downsampleByTwoRowVertical8BitPerChannel14641SSE()

static void Ocean::CV::FrameShrinker::downsampleByTwoRowVertical8BitPerChannel14641SSE ( const uint8_t *const  source,
uint16_t *  targetRow,
const unsigned int  sourceElements,
const unsigned int  sourceHeight,
const unsigned int  sourceStrideElements,
const unsigned int  ySource 
)
staticprotected

Applies a vertical 14641 filter to each pixel in a given row using SSE instructions.

This function can be used to down sample an image e.g., by a factor of two.

Parameters
sourceThe entire source frame holding the row to which the filter is applied, must be valid
targetRowThe target row receiving the filter results which are not normalized, must be valid
sourceElementsThe number of elements in each row (pixels * channels), with range [1, infinity)
sourceHeightThe height of the source frame in pixel, with range [2, infinity)
sourceStrideElementsThe stride of the source frame (the number of elements in each row - may including padding at the end of each row), with range [sourceElements, infinity)
ySourceThe row within the source frame to which the filter will be applied, with range [0, sourceHeight)
See also
downsampleByTwoRowHorizontal8BitPerChannel14641NEON().

◆ downsampleByTwoThreeRows8BitPerChannel121()

static OCEAN_PREVENT_INLINE void Ocean::CV::FrameShrinker::downsampleByTwoThreeRows8BitPerChannel121 ( const uint8_t *  source,
uint8_t *  target,
const unsigned int  sourceWidth,
const unsigned int  channels,
const unsigned int  sourceStrideElements 
)
staticprotected

Downsamples three rows to one row in a frame, applying a 2x3 [1-2-1, 1-2-1] down sampling filter.

In case the width of the source rows is 1 pixel, a 1x3 [1-2-1] is applied.
In case the width of the source rows is not a multiple of two, a 3x3 [1-2-1, 2-4-2, 1-2-1] filter is applied to the last 3 pixels.

Parameters
sourceThe location of the left pixel in the top source row, must be valid
targetThe location in the left pixel target row, must be valid
sourceWidthThe number of pixels in the source frame, with range [1, infinity)
channelsThe number of channels the source (and target) frame have, with range [1, infinity)
sourceStrideElementsThe number of elements between two successive rows in the source frame, in elements, with range [sourceWidth * channels, infinity)

◆ pyramidByTwo11()

static bool Ocean::CV::FrameShrinker::pyramidByTwo11 ( const Frame source,
uint8_t *const  pyramidTarget,
const size_t  pyramidTargetSize,
const unsigned int  layers,
const bool  copyFirstLayer,
Worker worker 
)
static

Fills the buffer of a pyramid frame for frames with 1 plane and data type DT_UNSIGNED_INTEGER_8.

Parameters
sourceThe source frame buffer to be used, must be valid
pyramidTargetThe frame buffer of the frame pyramid, large enough for the requested layers, must be valid
pyramidTargetSizeThe size of the pyramid target memory, in bytes, with range [1, infinity)
layersThe number of pyramid layers to be created, with range [1, infinity)
copyFirstLayerTrue, to copy the first layer before processing the next finer layers; False, to start directly with the next coarser layer (the memory for pyramidTarget can then be correspondingly smaller)
workerOptional worker object to distribute the computational load, nullptr otherwise
Returns
True, if succeeded

◆ pyramidByTwo8BitPerChannel11()

static bool Ocean::CV::FrameShrinker::pyramidByTwo8BitPerChannel11 ( const uint8_t *  source,
uint8_t *  pyramidTarget,
const unsigned int  sourceWidth,
const unsigned int  sourceHeight,
const unsigned int  channels,
const size_t  pyramidTargetSize,
const unsigned int  layers,
const unsigned int  sourcePaddingElements,
const bool  copyFirstLayer,
Worker worker 
)
static

Fills the buffer of a pyramid frame for frames with 1 plane and data type DT_UNSIGNED_INTEGER_8 applying a 1-1 downsampling.

Each pixel of a coarser pyramid level is based on 2x2 pixels from the corresponding finer pyramid level.

Parameters
sourceThe source frame buffer to be used, must be valid
pyramidTargetThe frame buffer of the frame pyramid, large enough for the requested layers, must be valid
sourceWidthWidth of the source frame in pixel, with range [1, infinity)
sourceHeightHeight of the source frame in pixel, with range [1, infinity)
channelsThe number of data channel the frames have, with range [1, infinity)
pyramidTargetSizeThe size of the pyramid target memory, in bytes, with range [1, infinity)
layersThe number of pyramid layers to be created, with range [1, infinity)
sourcePaddingElementsThe number of padding elements at the end of each source row, in elements, with range [0, infinity)
copyFirstLayerTrue, to copy the first layer before processing the next finer layers; False, to start directly with the next coarser layer (the memory for pyramidTarget can then be correspondingly smaller)
workerOptional worker object to distribute the computational load, nullptr otherwise
Returns
True, if succeeded

◆ pyramidByTwo8BitPerChannel11WithThreads()

static bool Ocean::CV::FrameShrinker::pyramidByTwo8BitPerChannel11WithThreads ( const uint8_t *  source,
uint8_t *  pyramidTarget,
const unsigned int  sourceWidth,
const unsigned int  sourceHeight,
const unsigned int  channels,
const size_t  pyramidTargetSize,
const unsigned int  layers,
const bool  copyFirstLayer,
const unsigned int  sourcePaddingElements,
const unsigned int  threads,
Worker worker 
)
staticprotected

Fills the buffer of a pyramid frame for frames with 1 plane and data type DT_UNSIGNED_INTEGER_8.

Parameters
sourceThe source frame buffer from which the pyramid will be created, must be valid
pyramidTargetThe frame buffer of the frame pyramid, large enough for the requested layers, must be valid
sourceWidthWidth of the source frame in pixel, with range [1, infinity)
sourceHeightHeight of the source frame in pixel, with range [1, infinity)
channelsThe number of frame channels the source frame has, with range [1, infinity)
pyramidTargetSizeThe size of the pyramid target memory, in bytes, with range [1, infinity)
layersThe number of pyramid layers to be created, with range [1, infinity)
copyFirstLayerTrue, to copy the first layer before processing the next finer layers; False, to start directly with the next coarser layer
sourcePaddingElementsThe number of padding elements at the end of each source row, in elements, with range [0, infinity)
workerOptional worker object to distribute the computational load
threadsThe number of threads to be used if a valid worker is defined, with range [1u, worker->threads()] and the following must hold: threads * 2^layers <= sourceHeight
Returns
True, if succeeded

◆ pyramidByTwo8BitPerChannel11WithThreadsSubset()

static void Ocean::CV::FrameShrinker::pyramidByTwo8BitPerChannel11WithThreadsSubset ( const uint8_t *  source,
uint8_t *  pyramidTarget,
const unsigned int  sourceWidth,
const unsigned int  sourceHeight,
const unsigned int  channels,
const size_t  pyramidTargetSize,
const unsigned int  layers,
const bool  copyFirstLayer,
const unsigned int  sourcePaddingElements,
const unsigned int  firstSubsetsSourceHeight,
const unsigned int  subsets,
const unsigned int  subsetIndex,
const unsigned int  valueOne 
)
staticprotected

Fills a subset of the buffer of a pyramid frame for a given frame with 1 plane and data type DT_UNSIGNED_INTEGER_8.

Parameters
sourceThe source frame buffer from which the pyramid will be created, must be valid
pyramidTargetThe frame buffer of the frame pyramid, large enough for the requested layers, must be valid
sourceWidthWidth of the source frame in pixel, with range [1, infinity)
sourceHeightHeight of the source frame in pixel, with range [1, infinity)
channelsThe number of frame channels the source image has, with range [1, infinity)
pyramidTargetSizeThe size of the pyramid target memory, in bytes, with range [1, infinity)
layersThe number of pyramid layers to be created, with range [1, infinity)
copyFirstLayerTrue, to copy the first layer before processing the next finer layers; False, to start directly with the next coarser layer
sourcePaddingElementsThe number of padding elements at the end of each source row, in elements, with range [0, infinity)
firstSubsetsSourceHeightThe height of the first subsets on the finest pyramid layer, with range [1, sourceHeight]
subsetsThe number of subsets which will be used in parallel (the number of threads executing the function in parallel)
subsetIndexThe index of the subset which is handled, with range [0, subsetIndex)
valueOneThe parameter must be 1

The documentation for this class was generated from the following file: