-
Notifications
You must be signed in to change notification settings - Fork 559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify the memory allocation method of matd_t
to comply with ISO standards
#362
Modify the memory allocation method of matd_t
to comply with ISO standards
#362
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add the compiler flags (add_compile_options(-Wall -Wextra -Wpedantic -Werror)
) to make sure that the warning does not appear again?
39ec42e
to
a91a5a3
Compare
The original line 46 in |
Right. It was actually me who left this commented out (9959575). Probably a reminder that about unsolved issues. But now the checking seems to be too strict as the CI fails for clang with |
The original approach in I doubt this performance difference matters for the usage of matd within this project. Since most of the compute of apiltag detection is not within matrix calculations I imagine it won't make much difference. But it might be nice to just double check for a single image that this doesn't make a noticeable difference to compute speed |
a91a5a3
to
b25fc1e
Compare
b25fc1e
to
6d0f9e0
Compare
Alright, to pass the CI-CD, I temporarily commented out the The performance improvement brought by using
As you can see, the performance improvement brought by using flexible array memory is indeed noticeable, but it is at the static void matd(benchmark::State &state)
{
cv::Mat gray = cv::imread("1.png", cv::IMREAD_GRAYSCALE);
auto tf = tag25h9_create();
auto td = apriltag_detector_create();
// init
apriltag_detector_add_family(td, tf);
for (auto _ : state)
{
// format conversion
image_u8_t apriltag_img = {gray.cols, gray.rows, gray.cols, gray.data};
// detect
zarray_t *detections = apriltag_detector_detect(td, &apriltag_img);
// release
apriltag_detections_destroy(detections);
}
apriltag_detector_destroy(td);
tag25h9_destroy(tf);
}
BENCHMARK(matd)->Name("detect by (double *data)")->Iterations(100); And the result of this perf test are as follows:
In fact, I use this project as a There are two solutions to this problem.
|
Oh, by the way, the environment of this perf test are as follows.
|
Thank you for running the performance test. I agree that this seems to make very little difference to performance and that this is a good change |
Did you try running with |
I just tried using the |
Thanks. But this is yet again raising another error |
93a4ce7
to
c057be8
Compare
Add -Wno-strict-prototypes and -Wno-static-in-inline
c057be8
to
0106e3e
Compare
Why does the CICD for MacOS Jazzy fail when running the |
I don't know why the brew installation now conflicts with the already installed packages. Maybe the GitHub runners or the brew behaviour changed. brew installs these packages:
I guess we just have to wait until this is fixed in the GitHub action that we are using. |
Alright. Finally, the CI passes. Thank you for going the extra mile and your patience. |
The original way of writing
matd_t
waswhich does not conform to the ISO standard. For example, it will generate a warning in C++ compilers such as g++, with the following message:
Therefore, it was changed to use
double *
, and separate memory was allocated form
andm->data
. Additionally, resource release form->data
was added in thematd_destroy
function.