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
18namespace Ocean
19{
20
21namespace Test
22{
23
24namespace TestCV
25{
26
27/**
28 * This class implements a test for the FrameInterpolator class.
29 * @ingroup testcv
30 */
31class OCEAN_TEST_CV_EXPORT TestFrameInterpolator
32{
33 public:
34
35 /**
36 * Invokes all test of the FrameInterpolator class.
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 resize function.
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 testResize(const double testDuration, Worker& worker);
50
51 /**
52 * Tests the resize function.
53 * @param sourceWidth The width of the source frame in pixel, with range [4, infinity)
54 * @param sourceHeight The height of the source frame in pixel, with range [4, infinity)
55 * @param targetWidth The width of the target frame in pixel, with range [4, infinity)
56 * @param targetHeight The height of the target frame in pixel, with range [4, infinity)
57 * @param testDuration Number of seconds for each test, with range (0, infinity)
58 * @param worker The worker object to distribute the computation
59 * @return True, if succeeded
60 */
61 template <unsigned int tChannels, CV::FrameInterpolator::ResizeMethod tResizeMethod>
62 static bool testResize(const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int targetWidth, const unsigned int targetHeight, const double testDuration, Worker& worker);
63
64 /**
65 * Tests the resize function with focus on production use case.
66 * @param testDuration Number of seconds for each test, with range (0, infinity)
67 * @return True, if succeeded
68 */
69 static bool testResizeUseCase(const double testDuration);
70
71 /**
72 * Tests the resize function with focus on production use case.
73 * @param testDuration Number of seconds for each test, with range (0, infinity)
74 * @param workerThreads The number of worker threads to be used, with range [1, 64]
75 * @return True, if succeeded
76 */
77 static bool testResizeUseCase(const double testDuration, const unsigned int workerThreads);
78
79 protected:
80
81 /**
82 * Validates a resize frame.
83 * @param source The source frame that has been resized, must be valid
84 * @param target The resized target frame, must be valid
85 * @param resizeMethod The method that has been used to resize the frame
86 * @return True, if the target frame is correct
87 */
88 static bool validateResizedFrame(const Frame& source, const Frame& target, const CV::FrameInterpolator::ResizeMethod resizeMethod);
89
90 /**
91 * Resizes a plane.
92 * @param sourcePlane The source plane to resize, must be valid
93 * @param targetPlane The resized target plane, must be valid
94 * @param resizeMethod The method that has been used to resize the frame
95 * @return True, if the target frame is correct
96 * @tparam tPlaneChannels The number of channels the plane has, with range [1, infinity)
97 */
98 template <unsigned int tPlaneChannels>
99 static bool resizePlane(const Frame& sourcePlane, Frame& targetPlane, const CV::FrameInterpolator::ResizeMethod resizeMethod);
100};
101
102}
103
104}
105
106}
107
108#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:1808
This class implements a test for the FrameInterpolator class.
Definition TestFrameInterpolator.h:32
static bool test(const double testDuration, Worker &worker)
Invokes all test of the FrameInterpolator class.
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 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 worker able to distribute function calls over different threads.
Definition Worker.h:33
The namespace covering the entire Ocean framework.
Definition Accessor.h:15