8#ifndef META_OCEAN_TEST_TESTCV_TEST_FRAME_CHANNELS_H
9#define META_OCEAN_TEST_TESTCV_TEST_FRAME_CHANNELS_H
68 static bool testZipChannels(
const unsigned int width,
const unsigned int height,
const double testDuration);
98 static bool testAddLastChannel(
const unsigned int width,
const unsigned int height,
const double testDuration,
Worker& worker);
138 static bool testCopyChannel(
const unsigned int width,
const unsigned int height,
const double testDuration,
Worker& worker);
148 static bool testSetChannel(
const unsigned int width,
const unsigned int height,
const double testDuration,
Worker& worker);
171 template <
typename TElement,
unsigned int tChannels,
void (*tPixelFunction)(const TElement*, TElement*)>
182 template <
typename TPrecision,
unsigned int tChannels>
203 template <
typename TElementType,
unsigned int tChannels>
240 template <
typename T,
unsigned int tChannels>
334 template <
typename TSource,
typename TTarget,
unsigned int tChannels>
349 template <
typename TSource,
typename TTarget>
350 static bool testSeparateTo1Channel(
const unsigned int width,
const unsigned int height,
const unsigned int channels,
const double testDuration);
362 template <
typename TSource,
typename TTarget>
363 static bool testZipChannels(
const unsigned int width,
const unsigned int height,
const unsigned int channels,
const double testDuration);
375 template <
typename T,
unsigned int tSourceChannels>
388 template <
typename T,
unsigned int tSourceChannels>
401 template <
typename T,
unsigned int tSourceChannels>
414 template <
typename T,
unsigned int tSourceChannels>
427 template <
typename T,
unsigned int tSourceChannels>
440 template <
typename T,
unsigned int tSourceChannels>
456 template <
typename T,
unsigned int tSourceChannels,
unsigned int tTargetChannels,
unsigned int tSourceChannelIndex,
unsigned int tTargetChannelIndex>
457 static bool testCopyChannel(
const unsigned int width,
const unsigned int height,
const double testDuration,
Worker& worker);
470 template <
typename T,
unsigned int tChannel,
unsigned int tChannels>
471 static bool testSetChannel(
const unsigned int width,
const unsigned int height,
const double testDuration,
Worker& worker);
487 template <
typename T>
488 static bool validateAddFirstChannel(
const T* source,
const T* sourceNewChannel,
const T* target,
const unsigned int sourceChannels,
const unsigned int width,
const unsigned int height,
const CV::FrameConverter::ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int sourceNewChannelPaddingElements,
const unsigned int targetPaddingElements);
503 template <
typename T>
520 template <
typename T>
521 static bool validateAddLastChannel(
const T* source,
const T* sourceNewChannel,
const T* target,
const unsigned int sourceChannels,
const unsigned int width,
const unsigned int height,
const CV::FrameConverter::ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int sourceNewChannelPaddingElements,
const unsigned int targetPaddingElements);
536 template <
typename T>
537 static bool validateAddLastChannelValue(
const T* source,
const T& newChannelValue,
const T* target,
const unsigned int sourceChannels,
const unsigned int width,
const unsigned int height,
const CV::FrameConverter::ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements);
548 template <
typename TElement,
unsigned int tChannels,
void (*tPixelFunction)(const TElement*, TElement*)>
562 template <
typename TSource0,
typename TSource1,
typename TTarget>
578 template <
typename TElementType,
unsigned int tChannels>
594 template <
typename T>
609 template <
typename T>
623 template <
typename T>
640 template <
typename T>
641 static bool validateCopyChannel(
const T* source,
const T* originalTarget,
const T* target,
const unsigned int sourceChannels,
const unsigned int targetChannels,
const unsigned int sourceChannelIndex,
const unsigned int targetChannelIndex,
const unsigned int width,
const unsigned int height,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements);
654 template <
typename T>
655 static bool validateSetChannel(
const T* originalFrame,
const T* frame,
const unsigned int width,
const unsigned int height,
const T value,
const unsigned int channelIndex,
const unsigned int channels,
const unsigned int framePaddingElements);
664 template <
typename T,
unsigned int tChannels>
674 template <
typename T,
unsigned int tChannels>
686 template <
typename T,
unsigned int tSourceChannels,
unsigned int tTargetChannels,
unsigned int tShufflePattern>
698 template <
typename T,
unsigned int tSourceChannels,
unsigned int tTargetChannels,
unsigned int tShufflePattern>
707 template <
unsigned int tChannels>
714 template <
unsigned int tChannels>
724 template <
typename TSource0,
typename TSource1,
typename TTarget>
725 static void subtract(
const TSource0* source0,
const TSource1* source1, TTarget* target);
729template <
unsigned int tChannels>
730template <
typename TSource0,
typename TSource1,
typename TTarget>
733 static_assert(tChannels >= 1u,
"Invalid channel number!");
735 ocean_assert(source0 !=
nullptr && source1 !=
nullptr && target !=
nullptr);
737 for (
unsigned int c = 0u; c < tChannels; ++c)
739 target[c] = (TTarget)(source0[c] - source1[c]);
ConversionFlag
Definition of individual conversion flags.
Definition FrameConverter.h:39
This class implements Ocean's image class.
Definition Frame.h:1879
This class implements a generator for random numbers.
Definition RandomGenerator.h:42
This class implements a frame channels test.
Definition TestFrameChannels.h:38
static bool validateRemoveLastChannel(const T *source, const T *target, const unsigned int sourceChannels, const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements)
Validates the remove channel function that removes the last channel.
static bool testAddFirstChannel(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the add channel function that adds a channel as new first channel.
static bool testAddFirstChannelValue(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the add channel value function that adds a channel as new first channel.
static bool testAddLastChannel(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the add channel function that adds a channel as new last channel.
static bool testNarrowRow16BitPerChannels(const double testDuration)
Test the row-based narrowing of pixel with 16 bit channels.
static bool testRemoveFirstChannel(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the remove channel function that removes the first channel.
static bool testStraightAlphaToPremultipliedAlpha(const double testDuration, Worker &worker)
Tests the conversion function from straight alpha to premultiplied alpha images.
static bool validateNarrowRow16BitPerChannels(RandomGenerator &randomGenerator)
Validates the row-based narrow function for 16 bit channels.
static bool testShuffleRowChannels(const double testDuration)
Test the row-based shuffling of pixel channels.
static bool validateReverseChannelOrder(const T *source, const T *target, const unsigned int width, const unsigned int height, const unsigned int channels, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const CV::FrameConverter::ConversionFlag flag)
Validates the reversion of channels of frame pixels.
static bool validateTransformGeneric(const TElementType *source, const TElementType *target, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const CV::FrameConverter::ConversionFlag flag)
Validation function for image transformations like flipping and mirroring for a specific generic pixe...
static bool testApplyBivariateOperator(const double testDuration, Worker &worker)
Test the pixel operator for two inputs and one output.
static bool testRowPixelConversion4ChannelsTo2Channels(const double testDuration)
Test the row-based pixel conversion from 4 channels to 2 channel.
static void testFunctionApplyAdvancedModifier(const TSource *source, TTarget *target)
Test function to be used with the test for the advanced pixel modifier.
static bool testReverseRowChannelOrder(const double testDuration)
Test the row-based pixel reverse order function.
static bool testReverseChannelOrder(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the image conversion function reversing the order of pixel channels for a specific data type an...
static bool testSeparateTo1Channel(const unsigned int width, const unsigned int height, const double testDuration)
Tests frame separation to one channel function.
static bool testTransformGeneric(const double testDuration, Worker &worker)
Test the image transformation function for generic pixel formats.
static bool validateAddLastChannel(const T *source, const T *sourceNewChannel, const T *target, const unsigned int sourceChannels, const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int sourceNewChannelPaddingElements, const unsigned int targetPaddingElements)
Validates the add channel function that add a new channel as last channel.
static bool testRemoveFirstChannel(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the remove channel function that removes the first channel.
static bool testRowPixelConversion4ChannelsTo1Channel(const double testDuration)
Test the row-based pixel conversion from 4 channels to 1 channel.
static bool testRemoveLastChannel(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the remove channel function that removes the last channel.
static bool testApplyAdvancedPixelModifier(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the advanced pixel modifier function for specifc element type and number of channels.
static bool testAddLastChannel(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the add channel function that adds a channel as new last channel.
static bool testSetChannel(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the set channel function.
static bool testTransformGeneric(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the image transformation function for a specific generic pixel format.
static bool testReverseRowPixelOrder(const double testDuration)
Test the row-based pixel reverse order function.
static bool testRowPixelConversion3ChannelsTo1Channel(const double testDuration)
Test the row-based pixel conversion from 3 channels to 1 channel.
static bool validateShuffleRowAndSetLastChannelValueChannels(RandomGenerator &randomGenerator)
Validates the row-based shuffle and setting last channel with constant value function for channels.
static bool testCopyChannel(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the copy channel function.
static bool validateShuffleRowChannels(RandomGenerator &randomGenerator)
Validates the row-based shuffle function for channels.
static bool testSeparateTo1Channel(const unsigned int width, const unsigned int height, const unsigned int channels, const double testDuration)
Tests frame separation to one channel function.
static bool testRowPixelConversion3ChannelsTo3Channels10BitPrecision(const double testDuration)
Test the row-based pixel conversion from 3 channels to 3 channels with 10 bit precision.
static bool test(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker, const TestSelector &selector=TestSelector())
Tests all frame channels functions.
static bool testZipChannels(const unsigned int width, const unsigned int height, const double testDuration)
Tests frame zip channels function.
static bool testShuffleRowChannelsAndSetLastChannelValue(const double testDuration)
Test the row-based shuffling of pixel channels and setting the last channel with constant value.
static bool validateApplyBivariateOperatorSubtract(const Frame &source0, const Frame &source1, const Frame &target, const CV::FrameChannels::ConversionFlag flag)
Validates the bivariate operator using subtraction.
static bool testCopyChannel(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the copy channel function.
static bool testAddLastChannelValue(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the add channel value function that adds a channel as new last channel.
static bool testRemoveLastChannel(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the remove channel function that removes the last channel.
static bool testAddFirstChannelValue(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the add channel value function that adds a channel as new first channel.
static bool testApplyAdvancedPixelModifier(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the advanced pixel modifier function.
static bool testRowPixelConversion3ChannelsTo3Channels7BitPrecision(const double testDuration)
Test the row-based pixel conversion from 3 channels to 3 channels with 7 bit precision.
static bool testPremultipliedAlphaToStraightAlpha(const double testDuration, Worker &worker)
Tests the conversion function from premultiplied alpha to straight alpha images.
static bool validateRemoveFirstChannel(const T *source, const T *target, const unsigned int sourceChannels, const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements)
Validates the remove channel function that removes the first channel.
static bool validateAddLastChannelValue(const T *source, const T &newChannelValue, const T *target, const unsigned int sourceChannels, const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements)
Validates the add channel value function that adds a new channel as last channel.
static bool testRowPixelConversion4ChannelsTo3Channels(const double testDuration)
Test the row-based pixel conversion from 4 channels to 3 channel.
static bool testSetChannel(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the set channel function.
static bool testReverseChannelOrder(const double testDuration, Worker &worker)
Tests the image conversion function reversing the order of pixel channels.
static bool testAddLastChannelValue(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the add channel value function that adds a channel as new last channel.
static bool validateCopyChannel(const T *source, const T *originalTarget, const T *target, const unsigned int sourceChannels, const unsigned int targetChannels, const unsigned int sourceChannelIndex, const unsigned int targetChannelIndex, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements)
Validates the copy channel function.
static bool validateSetChannel(const T *originalFrame, const T *frame, const unsigned int width, const unsigned int height, const T value, const unsigned int channelIndex, const unsigned int channels, const unsigned int framePaddingElements)
Validates the set channel function.
static bool testRowPixelConversion3ChannelsTo3Channels6BitPrecision(const double testDuration)
Test the row-based pixel conversion from 3 channels to 3 channels with 6 bit precision.
static bool validateReverseRowPixelOrder(RandomGenerator &randomGenerator)
Validates the row-based pixel reverse order function for a specific data type and channel number.
static bool validateAddFirstChannelValue(const T *source, const T &newChannelValue, const T *target, const unsigned int sourceChannels, const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements)
Validates the add channel value function that adds a new channel as first channel.
static bool validateAddFirstChannel(const T *source, const T *sourceNewChannel, const T *target, const unsigned int sourceChannels, const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int sourceNewChannelPaddingElements, const unsigned int targetPaddingElements)
Validates the add channel function that add a new channel as first channel.
static bool validateApplyAdvancedPixelModifier(const Frame &source, const Frame &validationTarget, const CV::FrameConverter::ConversionFlag conversionFlag)
Validates the advanced pixel modification function.
static bool validateReverseRowChannelOrder(RandomGenerator &randomGenerator)
Validates the row-based channel reverse order function for a specific data type and channel number.
static bool testZipChannels(const unsigned int width, const unsigned int height, const unsigned int channels, const double testDuration)
Tests zip channels function.
static bool testAddFirstChannel(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the add channel function that adds a channel as new first channel.
This class implements a test selector that parses test function strings and determines which tests sh...
Definition TestSelector.h:51
This class implements a worker able to distribute function calls over different threads.
Definition Worker.h:33
The namespace covering the entire Ocean framework.
Definition Accessor.h:15
Collection of test operations for pixel operators.
Definition TestFrameChannels.h:716
static void subtract(const TSource0 *source0, const TSource1 *source1, TTarget *target)
Facilitates subtraction between two sources and stores the result to another destination Essentially,...
Definition TestFrameChannels.h:731