-
Notifications
You must be signed in to change notification settings - Fork 2
refactor: add compression package #19
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
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
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 PR introduces a new ROS 2 package accelerated_image_processor_compression that provides hardware-accelerated image compression capabilities, primarily targeting JPEG compression. The package supports multiple backends (Jetson, NVJPEG, TurboJPEG/CPU) with automatic detection and selection based on platform capabilities.
Key changes:
- Implements a flexible compression library with support for Jetson, NVJPEG, and CPU (TurboJPEG) backends
- Provides CMake infrastructure for conditional compilation based on available hardware acceleration libraries
- Includes comprehensive unit tests for each backend implementation
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
include/accelerated_image_processor_compression/builder.hpp |
Defines compressor creation API and type conversions |
include/accelerated_image_processor_compression/jpeg_compressor.hpp |
Declares JPEG compressor base class and backend enum |
src/builder.cpp |
Implements compressor factory functions with backend selection logic |
src/jpeg_compressor/cpu.cpp |
Implements CPU-based JPEG compression using TurboJPEG |
src/jpeg_compressor/nvjpeg.cpp |
Implements GPU-based JPEG compression using NVJPEG |
src/jpeg_compressor/jetson.cpp |
Implements Jetson-specific JPEG compression |
test/test_utility.hpp |
Provides test fixture for JPEG compressor tests |
test/builder.cpp |
Tests compressor factory functions |
test/cpu_jpeg_compressor.cpp |
Tests CPU JPEG compressor implementation |
test/nv_jpeg_compressor.cpp |
Tests NVJPEG compressor implementation |
test/jetson_jpeg_compressor.cpp |
Tests Jetson JPEG compressor implementation |
CMakeLists.txt |
Configures build system with conditional backend compilation |
cmake/FindNVJPEG.cmake |
CMake module for detecting NVJPEG library |
cmake/FindLibJpegTurbo.cmake |
CMake module for detecting TurboJPEG library |
cmake/LibFindMacros.cmake |
Helper macros for library detection |
package.xml |
ROS 2 package manifest |
README.md |
Documentation for package usage and supported backends |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| CHECK_CUDA(cudaStreamSynchronize(stream_)); | ||
|
|
||
| size_t out_buf_size = image.width * image.height * 3 / 2; | ||
| unsigned char * out_data = new unsigned char[out_buf_size]; |
Copilot
AI
Dec 26, 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.
Using raw new without corresponding exception safety. Consider using std::vector<unsigned char> or std::unique_ptr<unsigned char[]> to ensure automatic cleanup even if an exception occurs before the delete statement.
src/accelerated_image_processor_compression/cmake/FindNVJPEG.cmake
Outdated
Show resolved
Hide resolved
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
manato
left a comment
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.
Thank you very much for the PR! It looks more than good to me! (Especially, adding tests is highly appreciated)
I left small comments regarding ifdef scope. I guess they will rarely cause problems, but it's just for completeness.
src/accelerated_image_processor_compression/src/jpeg_compressor/nvjpeg.cpp
Show resolved
Hide resolved
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
d56fc2e to
2e0a944
Compare
manato
left a comment
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.
@ktro2828
Awesome! LGTM!
PR Type
Related Links
TIER IV INTERNAL LINK
Description
This pull request introduces a new package,
accelerated_image_processor_compression, which provides a flexible and hardware-accelerated image compression library, primarily targeting JPEG compression with support for various backends (Jetson, NVJPEG, TurboJPEG/CPU). The package is designed for ROS 2 integration and includes CMake configuration for dependency detection and platform-specific builds.The most important changes are:
Core Library Implementation:
builder.hppandjpeg_compressor.hppheaders, defining the compressor interface, compressor creation utilities, and backend selection logic, along with backend-specific compressor classes (JetsonJPEGCompressor,NvJPEGCompressor,CpuJPEGCompressor). [1] [2]CMake and Build System:
CMakeLists.txtto detect platform capabilities (Jetson, NVJPEG, TurboJPEG), configure build options, and handle conditional compilation and linking for different hardware backends.FindNVJPEG.cmake,FindLibJpegTurbo.cmake,LibFindMacros.cmake) to robustly detect and configure third-party dependencies required for hardware-accelerated JPEG compression. [1] [2] [3]Documentation and Packaging:
README.mddetailing the supported compression backends, usage examples in ROS 2, and integration instructions.package.xmlmanifest for ROS 2, declaring dependencies, maintainers, and licensing information.Remarks
The following demonstrates how to use the compressor on ROS 2 codebase:
Pre-Review Checklist for the PR Author
PR Author should check the checkboxes below when creating the PR.
Checklist for the PR Reviewer
Reviewers should check the checkboxes below before approval.
Post-Review Checklist for the PR Author
PR Author should check the checkboxes below before merging.
CI Checks
I confirmed unit testings passed with all of Jetson, NvJPEG, TurboJPEG backends:
Unit testings summary