Skip to content

fix(build): replace im2d.hpp with im2d.h to fix RGA compilation on RK3588#334

Open
flyw wants to merge 1 commit intoHyperInspire:masterfrom
flyw:master
Open

fix(build): replace im2d.hpp with im2d.h to fix RGA compilation on RK3588#334
flyw wants to merge 1 commit intoHyperInspire:masterfrom
flyw:master

Conversation

@flyw
Copy link

@flyw flyw commented Jan 13, 2026

Description

This PR fixes a compilation error encountered when building the Android NDK version for RK3588 with RGA enabled.

Context

When IS_RGA is enabled, the build fails because im2d.hpp is included in image_processor_rga.h. It seems that the RGA library (librga) available in the NDK environment for RK3588 provides im2d.h instead of the C++ header im2d.hpp.

Changes

  • Modified cpp/inspireface/image_process/nexus_processor/image_processor_rga.h: Changed #include "im2d.hpp" to #include "im2d.h".

Verification

  • Verified that the compilation passes successfully on Android NDK (RK3588 target) after this change.

Compile failed when enabling RGA on Android (RK3588). The issue was caused by including `im2d.hpp` which could not be resolved.
Changing the include to `im2d.h` fixes the build issue.

Tested on: Android NDK for Rockchip 3588.
Copy link

@devloai devloai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary:

This PR attempts to fix a compilation error when building the Android NDK version for RK3588 with RGA enabled by changing the include from im2d.hpp (C++ header) to im2d.h (C header). The author reports that the RGA library in the Android NDK environment for RK3588 only provides the C header rather than the C++ header.

Review Summary:

I've identified a critical API compatibility issue with this change. The existing code on line 129 calls wrapbuffer_handle(handle, w, h, RK_FORMAT_RGB_888) with only 4 arguments, which relies on C++ default parameters available in im2d.hpp. The C header im2d.h requires all 6 parameters explicitly: wrapbuffer_handle(handle, width, height, format, wstride, hstride).

My research of the Rockchip librga library confirms that while both headers are standard in the upstream repositories, the C++ version provides default arguments for stride parameters that the C version does not. This change should cause a compilation error unless the function call on line 129 is also updated to include the stride parameters, or the precompiled librga in the build environment has non-standard function signatures.

Knowledge utilized: Rockchip RGA library API documentation, librga repository structure, CMake build system configuration for RK3588 platform, and hardware acceleration backend integration patterns from the InspireFace codebase.

Follow-up suggestions:

  • @devloai verify the compilation status and update line 129 if needed
  • @devloai check if im2d.hpp can be added to the precompiled librga package to avoid this workaround

#include <memory>
#include <unordered_map>
#include "im2d.hpp"
#include "im2d.h"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critical Issue: This change from im2d.hpp (C++) to im2d.h (C) introduces an API compatibility problem that should cause compilation failure.

Root Problem: Line 129 in this file uses:

buffer = wrapbuffer_handle(handle, w, h, RK_FORMAT_RGB_888);

This 4-argument call requires C++ default parameters from im2d.hpp. The C header im2d.h requires all 6 parameters: wrapbuffer_handle(handle, width, height, format, wstride, hstride).

Research findings:

  1. Standard Rockchip librga repositories (rockchip-linux/librga, airockchip/librga) provide both headers
  2. For C++ projects, im2d.hpp is the recommended choice
  3. The C++ header offers default arguments and better type safety

Recommended Solution:

Option A (Preferred): Fix the build environment to include im2d.hpp

  • Revert this change back to #include "im2d.hpp"
  • Ensure the librga package in your Android NDK includes C++ headers
  • This maintains the intended API usage

Option B: If im2d.hpp is truly unavailable, fix the function call:

  • Keep #include "im2d.h"
  • Update line 129 to: buffer = wrapbuffer_handle(handle, w, h, RK_FORMAT_RGB_888, w, h);
  • Add a comment explaining the environment constraint

Verification Request:
Please confirm that the build actually passes with this change alone. The code should fail to compile without fixing line 129. If it compiles, your librga version may have non-standard function signatures.

actions

Feedback: Rate this comment to help me improve future code reviews:

  • 👍 Good - Helpful and accurate
  • 👎 Poor - Wrong, unclear, or unhelpful
  • Skip if you don't have any strong opinions either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant