8 #ifndef META_OCEAN_TEST_TESTCV_TEST_FRAME_CHANNELS_H
9 #define META_OCEAN_TEST_TESTCV_TEST_FRAME_CHANNELS_H
47 static bool test(
const unsigned int width,
const unsigned int height,
const double testDuration,
Worker& worker);
65 static bool testZipChannels(
const unsigned int width,
const unsigned int height,
const double testDuration);
95 static bool testAddLastChannel(
const unsigned int width,
const unsigned int height,
const double testDuration,
Worker& worker);
135 static bool testCopyChannel(
const unsigned int width,
const unsigned int height,
const double testDuration,
Worker& worker);
145 static bool testSetChannel(
const unsigned int width,
const unsigned int height,
const double testDuration,
Worker& worker);
168 template <
typename TElement,
unsigned int tChannels,
void (*tPixelFunction)(const TElement*, TElement*)>
179 template <
typename TPrecision,
unsigned int tChannels>
200 template <
typename TElementType,
unsigned int tChannels>
237 template <
typename T,
unsigned int tChannels>
331 template <
typename TSource,
typename TTarget,
unsigned int tChannels>
346 template <
typename TSource,
typename TTarget>
347 static bool testSeparateTo1Channel(
const unsigned int width,
const unsigned int height,
const unsigned int channels,
const double testDuration);
359 template <
typename TSource,
typename TTarget>
360 static bool testZipChannels(
const unsigned int width,
const unsigned int height,
const unsigned int channels,
const double testDuration);
372 template <
typename T,
unsigned int tSourceChannels>
385 template <
typename T,
unsigned int tSourceChannels>
398 template <
typename T,
unsigned int tSourceChannels>
411 template <
typename T,
unsigned int tSourceChannels>
424 template <
typename T,
unsigned int tSourceChannels>
437 template <
typename T,
unsigned int tSourceChannels>
453 template <
typename T,
unsigned int tSourceChannels,
unsigned int tTargetChannels,
unsigned int tSourceChannelIndex,
unsigned int tTargetChannelIndex>
454 static bool testCopyChannel(
const unsigned int width,
const unsigned int height,
const double testDuration,
Worker& worker);
467 template <
typename T,
unsigned int tChannel,
unsigned int tChannels>
468 static bool testSetChannel(
const unsigned int width,
const unsigned int height,
const double testDuration,
Worker& worker);
484 template <
typename T>
485 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);
500 template <
typename T>
517 template <
typename T>
518 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);
533 template <
typename T>
534 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);
545 template <
typename TElement,
unsigned int tChannels,
void (*tPixelFunction)(const TElement*, TElement*)>
559 template <
typename TSource0,
typename TSource1,
typename TTarget>
575 template <
typename TElementType,
unsigned int tChannels>
591 template <
typename T>
606 template <
typename T>
620 template <
typename T>
637 template <
typename T>
638 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);
651 template <
typename T>
652 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);
661 template <
typename T,
unsigned int tChannels>
671 template <
typename T,
unsigned int tChannels>
683 template <
typename T,
unsigned int tSourceChannels,
unsigned int tTargetChannels,
unsigned int tShufflePattern>
695 template <
typename T,
unsigned int tSourceChannels,
unsigned int tTargetChannels,
unsigned int tShufflePattern>
704 template <
unsigned int tChannels>
711 template <
unsigned int tChannels>
721 template <
typename TSource0,
typename TSource1,
typename TTarget>
722 static void subtract(
const TSource0* source0,
const TSource1* source1, TTarget* target);
726 template <
unsigned int tChannels>
727 template <
typename TSource0,
typename TSource1,
typename TTarget>
730 static_assert(tChannels >= 1u,
"Invalid channel number!");
732 ocean_assert(source0 !=
nullptr && source1 !=
nullptr && target !=
nullptr);
734 for (
unsigned int c = 0u; c < tChannels; ++c)
736 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:1792
This class implements a generator for random numbers.
Definition: RandomGenerator.h:42
This class implements a frame channels test.
Definition: TestFrameChannels.h:36
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 test(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests all frame channels functions.
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 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 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:713
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:728