Skip to content

Commit bdeb837

Browse files
committed
remove c++ includes from tone_mapping.hpp
the tone_mapping.hpp header was including <opencv2/opencv.hpp>, which pulls in tons of c++ template types (cv::Scalar_, std::vector, std::shared_ptr, etc). bindgen was generating layout tests for these templates but couldn't determine their correct sizes, causing test failures.
1 parent d0bcbbf commit bdeb837

File tree

2 files changed

+14
-24
lines changed

2 files changed

+14
-24
lines changed

tone_mapping.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#include "tone_mapping.hpp"
2+
#include <opencv2/opencv.hpp>
3+
#include <lcms2.h>
24
#include <cstring>
35
#include <memory>
46
#include <algorithm>
@@ -12,6 +14,18 @@ static inline float calculate_luminance(float r, float g, float b) {
1214
return 0.2126f * r + 0.7152f * g + 0.0722f * b;
1315
}
1416

17+
/**
18+
* Applies HDR to SDR tone mapping using Reinhard algorithm.
19+
*
20+
* This function detects PQ (Perceptual Quantizer) HDR profiles and applies
21+
* luminance-based tone mapping to reduce brightness while preserving color
22+
* relationships. Non-PQ images are returned unchanged (as a copy).
23+
*
24+
* @param src Source image (BGR or BGRA format, 8-bit)
25+
* @param icc_data ICC profile data from the source image
26+
* @param icc_len Length of ICC profile data in bytes
27+
* @return Tone-mapped image (caller owns the pointer), or nullptr on error
28+
*/
1529
cv::Mat* apply_hdr_to_sdr_tone_mapping(
1630
const cv::Mat* src,
1731
const uint8_t* icc_data,

tone_mapping.hpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,3 @@ opencv_mat apply_tone_mapping_ffi(
2424
#ifdef __cplusplus
2525
}
2626
#endif
27-
28-
// C++ implementation details (not visible to C/FFI)
29-
#ifdef __cplusplus
30-
#include <opencv2/opencv.hpp>
31-
#include <lcms2.h>
32-
33-
/**
34-
* Applies HDR to SDR tone mapping using Reinhard algorithm.
35-
*
36-
* This function detects PQ (Perceptual Quantizer) HDR profiles and applies
37-
* luminance-based tone mapping to reduce brightness while preserving color
38-
* relationships. Non-PQ images are returned unchanged (as a copy).
39-
*
40-
* @param src Source image (BGR or BGRA format, 8-bit)
41-
* @param icc_data ICC profile data from the source image
42-
* @param icc_len Length of ICC profile data in bytes
43-
* @return Tone-mapped image (caller owns the pointer), or nullptr on error
44-
*/
45-
cv::Mat* apply_hdr_to_sdr_tone_mapping(
46-
const cv::Mat* src,
47-
const uint8_t* icc_data,
48-
size_t icc_len
49-
);
50-
#endif

0 commit comments

Comments
 (0)