Ocean
Loading...
Searching...
No Matches
TestAdvancedFrameShrinker.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_TEST_TESTCV_TESTADVANCED_TEST_ADVANCED_FRAME_SHRINKER_H
9#define META_OCEAN_TEST_TESTCV_TESTADVANCED_TEST_ADVANCED_FRAME_SHRINKER_H
10
12
13#include "ocean/base/Worker.h"
14
16
17namespace Ocean
18{
19
20namespace Test
21{
22
23namespace TestCV
24{
25
26namespace TestAdvanced
27{
28
29/**
30 * This class implements an advanced frame shrinker test.
31 * @ingroup testcvadvanced
32 */
33class OCEAN_TEST_CV_ADVANCED_EXPORT TestAdvancedFrameShrinker
34{
35 public:
36
37 /**
38 * Tests all advanced frame shrinker functions.
39 * @param testDuration Number of seconds for each test, with range (0, infinity)
40 * @param worker The worker object to distribute the computation
41 * @param selector The test selector to filter tests
42 * @return True, if succeeded
43 */
44 static bool test(const double testDuration, Worker& worker, const TestSelector& selector);
45
46 /**
47 * Tests the advanced frame shrinker.
48 * @param testDuration Number of seconds for each test, with range (0, infinity)
49 * @param worker The worker object to distribute the computation
50 * @return True, if succeeded
51 */
52 static bool testDivideByTwo(const double testDuration, Worker& worker);
53
54 /**
55 * Tests the advanced frame shrinker for a specific frame type.
56 * @param width The width of the test frame in pixel
57 * @param height The height of the test frame in pixel
58 * @param handleMask True, to handle also frame pixels corresponding to four mask pixels
59 * @param testDuration Number of seconds for each test, with range (0, infinity)
60 * @param worker The worker object to distribute the computation
61 * @return True, if succeeded
62 * @tparam tChannels The number of frame channels, with range [1, infinity)
63 */
64 template <unsigned int tChannels>
65 static bool testDivideByTwo(const unsigned int width, const unsigned int height, const bool handleMask, const double testDuration, Worker& worker);
66
67 protected:
68
69 /**
70 * Validates the advanced frame shrinker for a given frame.
71 * @param sourceFrame The source frame, must be valid
72 * @param sourceMask The mask associated with the source frame, must be valid
73 * @param targetFrame The resulting target frame, must be valid
74 * @param targetMask The resulting target mask, must be valid
75 * @param handleMaskPixels True, to handle also pixels entirely associated with mask pixels; False, to skip these pixels
76 * @param maskValue The pixel value associated with a mask pixel belonging to the mask, with range [0, 255]
77 * @param nonMaskValue The pixel value associated with a mask pixel not belonging to the mask, with range [0, 255]
78 * @return True, if succeeded
79 */
80 static bool validateDivideByTwo(const Frame& sourceFrame, const Frame& sourceMask, const Frame& targetFrame, const Frame& targetMask, const bool handleMaskPixels, const uint8_t maskValue = 0x00u, const uint8_t nonMaskValue = 0xFFu);
81};
82
83}
84
85}
86
87}
88
89}
90
91#endif // META_OCEAN_TEST_TESTCV_TESTADVANCED_TEST_ADVANCED_FRAME_SHRINKER_H
This class implements Ocean's image class.
Definition Frame.h:1879
This class implements an advanced frame shrinker test.
Definition TestAdvancedFrameShrinker.h:34
static bool validateDivideByTwo(const Frame &sourceFrame, const Frame &sourceMask, const Frame &targetFrame, const Frame &targetMask, const bool handleMaskPixels, const uint8_t maskValue=0x00u, const uint8_t nonMaskValue=0xFFu)
Validates the advanced frame shrinker for a given frame.
static bool testDivideByTwo(const unsigned int width, const unsigned int height, const bool handleMask, const double testDuration, Worker &worker)
Tests the advanced frame shrinker for a specific frame type.
static bool test(const double testDuration, Worker &worker, const TestSelector &selector)
Tests all advanced frame shrinker functions.
static bool testDivideByTwo(const double testDuration, Worker &worker)
Tests the advanced frame shrinker.
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