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