Ocean
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 
15 namespace Ocean
16 {
17 
18 namespace Test
19 {
20 
21 namespace TestCV
22 {
23 
24 namespace TestAdvanced
25 {
26 
27 /**
28  * This class implements an advanced frame shrinker test.
29  * @ingroup testcvadvanced
30  */
31 class OCEAN_TEST_CV_ADVANCED_EXPORT TestAdvancedFrameShrinker
32 {
33  public:
34 
35  /**
36  * Tests all advanced frame shrinker functions.
37  * @param testDuration Number of seconds for each test, with range (0, infinity)
38  * @param worker The worker object to distribute the computation
39  * @return True, if succeeded
40  */
41  static bool test(const double testDuration, Worker& worker);
42 
43  /**
44  * Tests the advanced frame shrinker.
45  * @param testDuration Number of seconds for each test, with range (0, infinity)
46  * @param worker The worker object to distribute the computation
47  * @return True, if succeeded
48  */
49  static bool testDivideByTwo(const double testDuration, Worker& worker);
50 
51  /**
52  * Tests the advanced frame shrinker for a specific frame type.
53  * @param width The width of the test frame in pixel
54  * @param height The height of the test frame in pixel
55  * @param handleMask True, to handle also frame pixels corresponding to four mask pixels
56  * @param testDuration Number of seconds for each test, with range (0, infinity)
57  * @param worker The worker object to distribute the computation
58  * @return True, if succeeded
59  * @tparam tChannels The number of frame channels, with range [1, infinity)
60  */
61  template <unsigned int tChannels>
62  static bool testDivideByTwo(const unsigned int width, const unsigned int height, const bool handleMask, const double testDuration, Worker& worker);
63 
64  protected:
65 
66  /**
67  * Validates the advanced frame shrinker for a given frame.
68  * @param sourceFrame The source frame, must be valid
69  * @param sourceMask The mask associated with the source frame, must be valid
70  * @param targetFrame The resulting target frame, must be valid
71  * @param targetMask The resulting target mask, must be valid
72  * @param handleMaskPixels True, to handle also pixels entirely associated with mask pixels; False, to skip these pixels
73  * @param maskValue The pixel value associated with a mask pixel belonging to the mask, with range [0, 255]
74  * @param nonMaskValue The pixel value associated with a mask pixel not belonging to the mask, with range [0, 255]
75  * @return True, if succeeded
76  */
77  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);
78 };
79 
80 }
81 
82 }
83 
84 }
85 
86 }
87 
88 #endif // META_OCEAN_TEST_TESTCV_TESTADVANCED_TEST_ADVANCED_FRAME_SHRINKER_H
This class implements Ocean's image class.
Definition: Frame.h:1792
This class implements an advanced frame shrinker test.
Definition: TestAdvancedFrameShrinker.h:32
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)
Tests all advanced frame shrinker functions.
static bool testDivideByTwo(const double testDuration, Worker &worker)
Tests the advanced frame shrinker.
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