Ocean
TestFrameShrinkerAlpha.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_TEST_FRAME_SHRINKER_ALPHA_H
9 #define META_OCEAN_TEST_TESTCV_TEST_FRAME_SHRINKER_ALPHA_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 /**
25  * This class implements tests for the frame downsizing functions with alpha channel.
26  * @ingroup testcv
27  */
28 class OCEAN_TEST_CV_EXPORT TestFrameShrinkerAlpha
29 {
30  public:
31 
32  /**
33  * Tests the frame downsize.
34  * @param testDuration Number of seconds for each test, with range (0, infinity)
35  * @param worker The worker object to distribute the computational load
36  * @return True, if succeeded
37  */
38  static bool test(const double testDuration, Worker& worker);
39 
40  /**
41  * Tests the frame downsize function bisecting the frame size.
42  * @param testDuration Number of seconds for each test, with range (0, infinity)
43  * @param worker The worker object to distribute the computational load
44  * @return True, if succeeded
45  */
46  static bool testFrameDivideByTwo(const double testDuration, Worker& worker);
47 
48  protected:
49 
50  /**
51  * Tests the frame downsize function bisecting the frame size.
52  * @param width The width of the source frame in pixel, with range [2, infinity)
53  * @param height The height of the source frame in pixel, with range [2, infinity)
54  * @param channels Number of frame channels (including the alpha channel), with range [1, infinity)
55  * @param alphaAtFront True, if the alpha channel is in front of the data channels
56  * @param transparentIs0xFF True, if 0xFF is interpreted as fully transparent pixel
57  * @param testDuration Number of seconds for each test, with range (0, infinity)
58  * @param worker The worker object to distribute the computational load
59  * @return True, if succeeded
60  */
61  static bool testFrameDivideByTwo(const unsigned int width, const unsigned int height, const unsigned int channels, const bool alphaAtFront, const bool transparentIs0xFF, const double testDuration, Worker& worker);
62 
63  /**
64  * Invokes the frame downsize function bisecting the frame size.
65  * @param source The source frame, must be valid
66  * @param target The target frame with half dimension, must be valid
67  * @param alphaAtFront True, if the alpha channel is in front of the data channels
68  * @param transparentIs0xFF True, if 0xFF is interpreted as fully transparent pixel
69  * @param worker Optional worker object to distribute the computational load
70  */
71  static void invokeFrameDivideByTwo(const Frame& source, Frame& target, const bool alphaAtFront, const bool transparentIs0xFF, Worker* worker);
72 
73  /**
74  * Tests the validation of the downsampling function.
75  * @param source The source frame, must be valid
76  * @param target The target frame with half dimension, must be valid
77  * @param alphaAtFront True, if the alpha channel is in front of the data channels
78  * @param transparentIs0xFF True, if 0xFF is interpreted as fully transparent pixel
79  * @return True, if succeeded
80  */
81  static bool validationDivideByTwo(const Frame& source, const Frame& target, const bool alphaAtFront, const bool transparentIs0xFF);
82 };
83 
84 }
85 
86 }
87 
88 }
89 
90 #endif // META_OCEAN_TEST_TESTCV_TEST_FRAME_SHRINKER_ALPHA_H
This class implements Ocean's image class.
Definition: Frame.h:1792
This class implements tests for the frame downsizing functions with alpha channel.
Definition: TestFrameShrinkerAlpha.h:29
static bool validationDivideByTwo(const Frame &source, const Frame &target, const bool alphaAtFront, const bool transparentIs0xFF)
Tests the validation of the downsampling function.
static bool testFrameDivideByTwo(const double testDuration, Worker &worker)
Tests the frame downsize function bisecting the frame size.
static bool testFrameDivideByTwo(const unsigned int width, const unsigned int height, const unsigned int channels, const bool alphaAtFront, const bool transparentIs0xFF, const double testDuration, Worker &worker)
Tests the frame downsize function bisecting the frame size.
static bool test(const double testDuration, Worker &worker)
Tests the frame downsize.
static void invokeFrameDivideByTwo(const Frame &source, Frame &target, const bool alphaAtFront, const bool transparentIs0xFF, Worker *worker)
Invokes the frame downsize function bisecting the frame size.
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