Ocean
Loading...
Searching...
No Matches
TestFrameInterpolator.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_INTERPOLATOR_H
9#define META_OCEAN_TEST_TESTCV_TEST_FRAME_INTERPOLATOR_H
10
12
14#include "ocean/base/Worker.h"
15
17
19
20namespace Ocean
21{
22
23namespace Test
24{
25
26namespace TestCV
27{
28
29/**
30 * This class implements a test for the FrameInterpolator class.
31 * @ingroup testcv
32 */
33class OCEAN_TEST_CV_EXPORT TestFrameInterpolator
34{
35 public:
36
37 /**
38 * Invokes all test of the FrameInterpolator class.
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 control which tests to run
42 * @return True, if succeeded
43 */
44 static bool test(const double testDuration, Worker& worker, const TestSelector& selector = TestSelector());
45
46 /**
47 * Tests the resize function.
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 testResize(const double testDuration, Worker& worker);
53
54 /**
55 * Tests the resize function.
56 * @param sourceWidth The width of the source frame in pixel, with range [4, infinity)
57 * @param sourceHeight The height of the source frame in pixel, with range [4, infinity)
58 * @param targetWidth The width of the target frame in pixel, with range [4, infinity)
59 * @param targetHeight The height of the target frame in pixel, with range [4, infinity)
60 * @param testDuration Number of seconds for each test, with range (0, infinity)
61 * @param worker The worker object to distribute the computation
62 * @return True, if succeeded
63 */
64 template <unsigned int tChannels, CV::FrameInterpolator::ResizeMethod tResizeMethod>
65 static bool testResize(const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int targetWidth, const unsigned int targetHeight, const double testDuration, Worker& worker);
66
67 /**
68 * Tests the resize function with focus on production use case.
69 * @param testDuration Number of seconds for each test, with range (0, infinity)
70 * @return True, if succeeded
71 */
72 static bool testResizeUseCase(const double testDuration);
73
74 /**
75 * Tests the resize function with focus on production use case.
76 * @param testDuration Number of seconds for each test, with range (0, infinity)
77 * @param workerThreads The number of worker threads to be used, with range [1, 64]
78 * @return True, if succeeded
79 */
80 static bool testResizeUseCase(const double testDuration, const unsigned int workerThreads);
81
82 protected:
83
84 /**
85 * Validates a resize frame.
86 * @param source The source frame that has been resized, must be valid
87 * @param target The resized target frame, must be valid
88 * @param resizeMethod The method that has been used to resize the frame
89 * @return True, if the target frame is correct
90 */
91 static bool validateResizedFrame(const Frame& source, const Frame& target, const CV::FrameInterpolator::ResizeMethod resizeMethod);
92
93 /**
94 * Resizes a plane.
95 * @param sourcePlane The source plane to resize, must be valid
96 * @param targetPlane The resized target plane, must be valid
97 * @param resizeMethod The method that has been used to resize the frame
98 * @return True, if the target frame is correct
99 * @tparam tPlaneChannels The number of channels the plane has, with range [1, infinity)
100 */
101 template <unsigned int tPlaneChannels>
102 static bool resizePlane(const Frame& sourcePlane, Frame& targetPlane, const CV::FrameInterpolator::ResizeMethod resizeMethod);
103};
104
105}
106
107}
108
109}
110
111#endif // META_OCEAN_TEST_TESTCV_TEST_FRAME_INTERPOLATOR_H
ResizeMethod
Definition of individual resize methods.
Definition FrameInterpolator.h:57
This class implements Ocean's image class.
Definition Frame.h:1879
This class implements a test for the FrameInterpolator class.
Definition TestFrameInterpolator.h:34
static bool testResize(const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int targetWidth, const unsigned int targetHeight, const double testDuration, Worker &worker)
Tests the resize function.
static bool test(const double testDuration, Worker &worker, const TestSelector &selector=TestSelector())
Invokes all test of the FrameInterpolator class.
static bool testResize(const double testDuration, Worker &worker)
Tests the resize function.
static bool validateResizedFrame(const Frame &source, const Frame &target, const CV::FrameInterpolator::ResizeMethod resizeMethod)
Validates a resize frame.
static bool testResizeUseCase(const double testDuration)
Tests the resize function with focus on production use case.
static bool resizePlane(const Frame &sourcePlane, Frame &targetPlane, const CV::FrameInterpolator::ResizeMethod resizeMethod)
Resizes a plane.
static bool testResizeUseCase(const double testDuration, const unsigned int workerThreads)
Tests the resize function with focus on production use case.
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