-
Notifications
You must be signed in to change notification settings - Fork 5.8k
/
Copy pathdsp_init.cpp
49 lines (38 loc) · 1.07 KB
/
dsp_init.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#include "precomp.hpp"
namespace cv {
namespace fastcv {
namespace dsp {
int fastcvq6init()
{
// Get the DSP context
FastCvDspContext& context = FastCvDspContext::getContext();
// Check if DSP is initialized
if (!context.isDspInitialized)
{
CV_Error(cv::Error::StsBadArg, cv::format("DSP initialization failed!"));
return 1;
}
// Get custom allocator
cv::MatAllocator* allocator = cv::fastcv::getDefaultFastCVAllocator();
// Ensure the allocator is not the standard one
CV_Assert(allocator != cv::Mat::getStdAllocator());
// Check if the current allocator is already set to the custom allocator
if (cv::Mat::getDefaultAllocator() != allocator)
{
// Set the custom allocator
cv::Mat::setDefaultAllocator(allocator);
}
return 0;
}
void fastcvq6deinit()
{
// Deinitialize the DSP environment
fcvQ6DeInit();
}
} // namespace dsp
} // namespace fastcv
} // namespace cv