-
-
Notifications
You must be signed in to change notification settings - Fork 440
hw jpg encoder for orion o6 #189
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
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.
Pull Request Overview
This pull request introduces support for a hardware JPEG encoder (CIX) for the Orion O6 platform by adding a new header file and updating the image write and encode functions to use the new backend when available.
- Added jpeg_encoder_v4l_cix header with API declarations.
- Updated imwrite and imencode in highgui.cpp to conditionally use the CIX encoder.
- Implemented caching of encoder context in imwrite for potential performance improvement.
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| highgui/src/jpeg_encoder_v4l_cix.h | New header defining API for the CIX JPEG encoder |
| highgui/src/highgui.cpp | Updates in imwrite and imencode to integrate the CIX encoder |
Files not reviewed (1)
- highgui/CMakeLists.txt: Language not supported
| } | ||
|
|
||
| // cache jpeg_encoder_v4l_cix context | ||
| static int old_w = 0; |
Copilot
AI
Apr 20, 2025
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.
The static caching variables used in the CV_WITH_CIX block of imwrite may not be thread-safe. Consider using a mutex or other synchronization mechanism to protect access.
| if (ret == 0) | ||
| return true; |
Copilot
AI
Apr 20, 2025
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.
The caching branch in the CV_WITH_CIX block of imwrite does not call deinit() after a successful encode, which might leave resources allocated longer than intended. Ensure that proper resource cleanup is performed if required by the encoder's design.
| if (ret == 0) | |
| return true; | |
| if (ret == 0) | |
| { | |
| e.deinit(); // Ensure resources are cleaned up | |
| return true; | |
| } |
| int ret = e.init(img.cols, img.rows, c, quality); | ||
| if (ret == 0) | ||
| { | ||
| ret = e.encode(img.data, buf); |
Copilot
AI
Apr 20, 2025
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.
In the imencode function's CV_WITH_CIX block, if the encode call fails, deinit() is not invoked, potentially causing resource leaks. Consider calling deinit() on failure as well to ensure proper cleanup.
No description provided.