Update Filter Configuration Impact in lower_cpu_usage README

This commit is contained in:
jj
2025-04-11 17:28:43 +08:00
parent 09ac8e63d2
commit 6da4777754
@@ -6,10 +6,10 @@ This document outlines strategies for minimizing CPU usage in the **OrbbecSDK_RO
To achieve the lowest possible CPU usage in OrbbecSDK_ROS2, it is recommended to configure the following parameters.
| Parameter | Recommendation | Note |
| :------------: | :----------------------------------: | :--------------------------------------------: |
| `uvc_backend` | `v4l2` | Lower CPU usage compared to `libuvc` |
| `color_format` | `RGB` | Lower CPU usage than `MJPG` |
| Parameter | Recommendation | Note |
| :--------------: | :------------------------------------: | :--------------------------------------------: |
| `uvc_backend` | `v4l2` | Lower CPU usage compared to `libuvc` |
| `color_format` | `RGB` | Lower CPU usage than `MJPG` |
| `filter` | Only `hardware_noise_removal_filter` | Other filters significantly increase CPU usage |
### Launch Files Used for Testing
@@ -51,7 +51,7 @@ Note: The following CPU usage data focuses on `uvc_backend`, `color_format` and
| libuvc CPU Usage | v4l2 CPU Usage | Absolute Change |
| :--------------: | :------------: | :-------------: |
| 182.8% | 118.8% | -64.0% |
| 182.8% | 118.8% | -64.0% |
The CPU usage can be significantly reduced with v4l2 backend. In our implementation, v4l2 works without requiring any patches to the Linux kernel, allowing users to easily switch between v4l2 and libuvc and maintaining full compatibility with standard Linux distributions.
@@ -59,27 +59,27 @@ The CPU usage can be significantly reduced with v4l2 backend. In our implementat
| Backend | MJPG CPU Usage | RGB CPU Usage | Absolute Change |
| :-----: | :------------: | :-----------: | :-------------: |
| libuvc | 347.7% | 182.8% | -164.9% |
| v4l2 | 170.0% | 118.8% | -51.2% |
| libuvc | 347.7% | 182.8% | -164.9% |
| v4l2 | 170.0% | 118.8% | -51.2% |
The CPU usage can be reduced if the RGB format is selected instead of MJPG, since the decoding of MJPG image will consume the host CPU resource.
### 3. Filter Configuration Impact
| Filters Applied | libuvc CPU Usage | Change w.r.t benchmark | v4l2 CPU Usage | Change w.r.t benchmark |
| ------------------------------------------------- | ---------------- | ---------------------- | -------------- | ---------------------- |
| No Filter (benchmark) | 182.8% | 0.0%(benchmark) | 118.8% | 0.0%(benchmark) |
| `(software)noise_removal_filter` | 218.0% | +35.2% | 128.5% | +9.7% |
| `(software)noise_removal_filter + spatial_filter` | 469.6% | +286.8% | 336.7% | +217.9% |
| `hardware_noise_removal_filter` | 186.3% | +3.5% | 115.4% | -3.4% |
| `hardware_noise_removal_filter + spatial_filter` | 251.3% | +68.5% | 152.5% | +33.7% |
| Filters Applied | libuvc CPU Usage | CPU Usage Increase | v4l2 CPU Usage | CPU Usage Increase |
| ----------------------------------------------------- | ---------------- | ------------------ | -------------- | ------------------ |
| No Filter (benchmark) | 182.8% | 0.0%(benchmark) | 118.8% | 0.0%(benchmark) |
| `(software)noise_removal_filter` | 218.0% | +35.2% | 128.5% | +9.7% |
| `(software)noise_removal_filter + spatial_filter` | 469.6% | +286.8% | 336.7% | +217.9% |
| `hardware_noise_removal_filter` | 186.3% | +3.5% | 115.4% | -3.4% |
| `hardware_noise_removal_filter + spatial_filter` | 251.3% | +68.5% | 152.5% | +33.7% |
Based on the test results, using only the `hardware_noise_removal_filter` results in a negligible change in CPU usage for both `libuvc` (+3.5%) and `v4l2` (-3.4%) compared to the no-filter benchmark, as this filter runs internally on the camera hardware. In contrast, other filters execute on the host system. Adding the `spatial_filter` to the hardware filter leads to a moderate increase in CPU usage, while applying the software-based `noise_removal_filter` —either alone or combined with `spatial_filter` —significantly increases CPU load. To maintain low CPU usage, it is recommended to avoid software-based filters and rely solely on the `hardware_noise_removal_filter`.
## Further Optimization
| Parameter | Recommendation | Note |
| :--------------------------: | :------------------------------------: | :---------------------------------------------: |
| `depth_registration` | `false` or `true` with `align_mode=HW` | Software alignment consumes more CPU |
| `enable_point_cloud` | `false` | Disabling point cloud reduces CPU usage |
| `enable_colored_point_cloud` | `false` | Disabling colored point cloud reduces CPU usage |
| Parameter | Recommendation | Note |
| :----------------------------: | :----------------------------------------------: | :---------------------------------------------: |
| `depth_registration` | `false` or `true` with `align_mode=HW` | Software alignment consumes more CPU |
| `enable_point_cloud` | `false` | Disabling point cloud reduces CPU usage |
| `enable_colored_point_cloud` | `false` | Disabling colored point cloud reduces CPU usage |