15#include <magic_enum/magic_enum.hpp>
181 bool m_half_size{
false};
202 switch (m_demosaic) {
217 default:
return "AHD";
225 [[nodiscard]]
constexpr bool get_half_size() const noexcept {
return m_half_size; }
231 constexpr void set_half_size(
bool half_size)
noexcept { m_half_size = half_size; }
259 switch (m_color_space) {
271 default:
return "ProPhoto-linear";
287 bool m_balance_clamped{
true};
307 return static_cast<int>(m_highlight_mode);
336 bool m_use_camera_wb{
true};
340 bool m_use_auto_wb{
false};
341 std::array<int, 4> m_grey_box{0, 0, 0, 0};
342 std::array<float, 4> m_user_mul{1.0f, 1.0f, 1.0f, 1.0f};
362 [[nodiscard]]
constexpr bool get_use_auto_wb() const noexcept {
return m_use_auto_wb; }
376 if (m_use_camera_wb) {
383 if (m_grey_box[2] > 0 && m_grey_box[3] > 0) {
396 m_use_camera_wb =
false;
397 m_use_auto_wb =
false;
400 m_use_camera_wb =
true;
401 m_use_auto_wb =
false;
404 m_use_camera_wb =
false;
405 m_use_auto_wb =
true;
408 m_use_camera_wb =
false;
409 m_use_auto_wb =
false;
412 m_use_camera_wb =
false;
413 m_use_auto_wb =
false;
414 m_grey_box = {0, 0, 0, 0};
422 [[nodiscard]]
constexpr const std::array<int, 4>&
get_grey_box() const noexcept {
return m_grey_box; }
432 constexpr void set_grey_box(
int x,
int y,
int width,
int height)
noexcept {
433 m_grey_box = {x, y, width, height};
435 m_use_camera_wb =
false;
436 m_use_auto_wb =
false;
443 [[nodiscard]]
constexpr const std::array<float, 4>&
get_user_mul() const noexcept {
return m_user_mul; }
453 constexpr void set_user_mul(
float r,
float g,
float b,
float g2)
noexcept {
454 m_user_mul = {r, g, b, g2};
456 m_use_camera_wb =
false;
457 m_use_auto_wb =
false;
458 m_grey_box = {0, 0, 0, 0};
486 return static_cast<int>(m_camera_matrix);
492 float m_exposure{1.0f};
493 bool m_auto_bright{
false};
494 bool m_apply_scene_linear_scale{
false};
495 float m_camera_to_scene_linear_scale{2.2222222222222223f};
503 [[nodiscard]]
constexpr float get_exposure() const noexcept {
return m_exposure; }
509 constexpr void set_exposure(
float exposure)
noexcept { m_exposure = exposure; }
515 [[nodiscard]]
constexpr bool get_auto_bright() const noexcept {
return m_auto_bright; }
521 constexpr void set_auto_bright(
bool auto_bright)
noexcept { m_auto_bright = auto_bright; }
541 return m_camera_to_scene_linear_scale;
549 m_camera_to_scene_linear_scale = scale;
556 int m_user_black{-1};
558 float m_adjust_maximum_thr{0.0f};
565 [[nodiscard]]
constexpr int get_user_black() const noexcept {
return m_user_black; }
577 [[nodiscard]]
constexpr int get_user_sat() const noexcept {
return m_user_sat; }
604 float m_threshold{0.0f};
624 return static_cast<int>(m_fbdd_noiserd);
632 [[nodiscard]]
constexpr float get_threshold() const noexcept {
return m_threshold; }
638 constexpr void set_threshold(
float threshold)
noexcept { m_threshold = threshold; }
643 std::array<float, 2> m_aber{1.0f, 1.0f};
653 [[nodiscard]]
constexpr const std::array<float, 2>&
get_aber() const noexcept {
return m_aber; }
660 constexpr void set_aber(
float red,
float blue)
noexcept { m_aber = {red, blue}; }
687 return static_cast<int>(m_user_flip);
694 std::array<int, 4> m_crop_box{0, 0, 0, 0};
701 [[nodiscard]]
constexpr const std::array<int, 4>&
get_crop_box() const noexcept {
return m_crop_box; }
710 constexpr void set_crop_box(
int x,
int y,
int width,
int height)
noexcept {
711 m_crop_box = {x, y, width, height};
718 int m_max_raw_memory_mb{4096};
719 bool m_force_load{
true};
739 [[nodiscard]]
constexpr bool get_force_load() const noexcept {
return m_force_load; }
771 settings.m_balance_clamped =
false;
772 settings.m_half_size =
true;
774 settings.m_force_load =
false;
776 settings.m_use_camera_wb =
true;
777 settings.m_use_auto_wb =
false;
803 settings.m_balance_clamped =
true;
804 settings.m_half_size =
false;
806 settings.m_force_load =
true;
808 settings.m_use_camera_wb =
true;
809 settings.m_use_auto_wb =
false;
835 settings.m_balance_clamped =
true;
836 settings.m_half_size =
false;
838 settings.m_force_load =
true;
840 settings.m_use_camera_wb =
true;
841 settings.m_use_auto_wb =
false;
873 return m_half_size &&
CameraMatrixMode
Controls when to use the embedded camera color profile matrix. Camera color matrices provide accurate...
@ dng_only
Use only for DNG files (LibRaw default).
@ never
Never use embedded color matrix.
@ always
Always use embedded color matrix when available (recommended).
RawColorSpace
Color primaries and transfer function for RAW development output. The working color space determines ...
@ prophoto_linear
ProPhoto primaries with linear transfer. Best for editing (recommended).
@ srgb_linear
sRGB primaries with linear transfer. Good for editing.
@ srgb
sRGB with gamma curve. Not recommended for editing.
@ adobe
Adobe RGB (1998). Wider gamut than sRGB.
@ rec2020
ITU-R BT.2020 color space (LibRaw >= 0.20).
@ wide
Wide gamut color space.
@ raw
Raw sensor data, no color space conversion.
@ xyz
CIE XYZ connection space.
@ dci_p3
DCI-P3 color space (LibRaw >= 0.21).
@ aces
Academy Color Encoding System. Film industry standard.
@ prophoto
ProPhoto RGB with gamma. Very wide gamut.
Orientation
Image orientation values matching EXIF orientation codes. Used to rotate/flip the image during RAW de...
@ flip_vertical
Mirror vertical.
@ flip_horizontal
Mirror horizontal.
@ flip_v_rotate_90
Mirror vertical and rotate 90° CW.
@ rotate_270_cw
Rotate 270° clockwise (or 90° CCW).
@ flip_h_rotate_90
Mirror horizontal and rotate 90° CW.
@ rotate_90_cw
Rotate 90° clockwise.
@ ignored
Ignore orientation metadata.
@ flip_h_rotate_270
Mirror horizontal and rotate 270° CW.
@ normal
Normal orientation (0°).
HighlightMode
Controls how overexposed/clipped highlights are handled during RAW development. When sensor channels ...
@ rebuild
Reconstruct highlights using advanced algorithms. Best quality for heavily clipped areas.
@ blend
Blend clipped areas with surrounding unclipped data. Natural-looking highlights.
@ unclip
Unclip: attempt to reconstruct clipped values. Better for slight overexposure.
@ clip
Clip all channels to maximum (default LibRaw behavior). Fast but may cause color shifts.
DemosaicAlgorithm
Demosaicing algorithms for converting Bayer pattern RAW data to RGB. Demosaicing is the process of in...
@ mixed
Mixed demosaicing approach.
@ lmmse
Linear Minimum Mean Square Error.
@ vng
Variable Number of Gradients. Good balance of speed/quality.
@ amaze
Adaptive Malvar-He-Cutler algorithm. Best quality, slower.
@ none
No demosaicing (return raw Bayer pattern).
@ ahd
Adaptive Homogeneity-Directed. Good quality, standard default.
@ ahd_mod
Modified AHD algorithm.
@ vcd
Variance of Color Difference.
@ linear
Simple bilinear interpolation. Fast, lower quality.
@ afd
Adaptive Frequency Domain demosaicing.
@ dht
DHT-based demosaicing.
@ aahd
Advanced Adaptive Homogeneity-Directed.
@ ppg
Patterned Pixel Grouping. Moderate quality.
@ dcb
Directional Color Filter Array interpolation with Bilateral filter.
FbddNoiseRd
FBDD (Fuzzy Block Denoising and Demosaicing) noise reduction level. Controls noise reduction applied ...
@ light
Light FBDD reduction (recommended for most images).
@ off
No FBDD noise reduction.
@ full
Full FBDD reduction (for very noisy images).
WhiteBalanceMode
White balance calculation mode for RAW development. Determines how the initial white balance multipli...
@ none
No white balance applied.
@ auto_wb
Calculate white balance automatically from image data.
@ user_mul
Use user-specified custom white balance multipliers.
@ grey_box
Calculate from a user-specified grey card region.
@ camera
Use camera-recorded white balance (recommended default).
Complete configuration for RAW image development via OIIO/LibRaw. This struct encapsulates all RAW pr...
constexpr bool get_balance_clamped() const noexcept
Checks if highlight clamping balance is enabled.
constexpr void set_white_balance_mode(WhiteBalanceMode mode) noexcept
Sets the white balance mode from high-level enum.
constexpr int get_highlight_mode_value() const noexcept
Gets the highlight mode value as integer (for OIIO attribute).
constexpr WhiteBalanceMode get_white_balance_mode() const noexcept
Gets the white balance mode as high-level enum.
constexpr void set_use_camera_wb(bool use_camera) noexcept
Enables or disables camera white balance.
constexpr bool is_performance_configuration() const noexcept
Checks if the current configuration matches performance preset.
constexpr DemosaicAlgorithm get_demosaic() const noexcept
Gets the demosaicing algorithm.
constexpr void set_apply_scene_linear_scale(bool apply) noexcept
Enables or disables scene-linear scaling.
static constexpr RawSettings fast_settings() noexcept
Creates a RawSettings configured for maximum processing speed.
constexpr RawColorSpace get_color_space() const noexcept
Gets the output color space.
constexpr void set_fbdd_noiserd(FbddNoiseRd noiserd) noexcept
Sets the FBDD noise reduction level.
constexpr float get_camera_to_scene_linear_scale() const noexcept
Gets the camera-to-scene linear scale factor.
constexpr void set_color_space(RawColorSpace color_space) noexcept
Sets the output color space.
constexpr bool get_use_camera_wb() const noexcept
Checks if camera white balance is enabled.
constexpr void set_max_raw_memory_mb(int max_mb) noexcept
Sets the maximum memory allocation for RAW processing.
static constexpr RawSettings quality_settings() noexcept
Creates a RawSettings configured for maximum image quality.
constexpr void set_aber(float red, float blue) noexcept
Sets the chromatic aberration correction factors.
constexpr void set_user_flip(Orientation flip) noexcept
Sets the user-specified orientation.
constexpr void set_user_sat(int sat) noexcept
Sets the user-specified saturation point.
constexpr int get_user_sat() const noexcept
Gets the user-specified saturation point.
constexpr const std::array< float, 2 > & get_aber() const noexcept
Gets the chromatic aberration correction factors.
constexpr int get_camera_matrix_value() const noexcept
Gets the camera matrix mode value as integer (for OIIO attribute).
constexpr void set_half_size(bool half_size) noexcept
Enables or disables half-size output mode.
constexpr void set_highlight_mode(HighlightMode mode) noexcept
Sets the highlight recovery mode.
constexpr const std::array< int, 4 > & get_crop_box() const noexcept
Gets the crop box region.
constexpr void set_camera_to_scene_linear_scale(float scale) noexcept
Sets the camera-to-scene linear scale factor.
constexpr float get_exposure() const noexcept
Gets the exposure multiplier.
constexpr void set_grey_box(int x, int y, int width, int height) noexcept
Sets the grey box region for white balance calculation.
constexpr void set_adjust_maximum_thr(float thr) noexcept
Sets the auto-adjust maximum threshold.
constexpr int get_max_raw_memory_mb() const noexcept
Gets the maximum memory allocation for RAW processing.
constexpr void set_demosaic(DemosaicAlgorithm algorithm) noexcept
Sets the demosaicing algorithm.
constexpr void set_threshold(float threshold) noexcept
Sets the wavelet denoising threshold.
std::string get_demosaic_string() const noexcept
Gets the demosaic algorithm name as string (for OIIO attribute).
constexpr void set_use_auto_wb(bool use_auto) noexcept
Enables or disables auto white balance.
constexpr void set_balance_clamped(bool balance) noexcept
Enables or disables highlight clamping balance.
static constexpr RawSettings performance_settings() noexcept
Creates a RawSettings configured for balanced performance and quality.
constexpr void set_exposure(float exposure) noexcept
Sets the exposure multiplier.
constexpr Orientation get_user_flip() const noexcept
Gets the user-specified orientation.
constexpr void set_user_mul(float r, float g, float b, float g2) noexcept
Sets the user-defined white balance multipliers.
constexpr void set_force_load(bool force) noexcept
Enables or disables force load.
constexpr CameraMatrixMode get_camera_matrix() const noexcept
Gets the camera color matrix usage mode.
void reset_to_defaults() noexcept
Resets all settings to their default values. Default values are optimized for quality (same as qualit...
constexpr FbddNoiseRd get_fbdd_noiserd() const noexcept
Gets the FBDD noise reduction level.
constexpr void set_camera_matrix(CameraMatrixMode mode) noexcept
Sets the camera color matrix usage mode.
constexpr void set_user_black(int black) noexcept
Sets the user-specified black point.
constexpr bool is_quality_configuration() const noexcept
Checks if the current configuration matches quality preset.
constexpr int get_user_black() const noexcept
Gets the user-specified black point.
constexpr HighlightMode get_highlight_mode() const noexcept
Gets the highlight recovery mode.
std::string get_color_space_string() const noexcept
Gets the color space name as string (for OIIO attribute).
constexpr int get_user_flip_value() const noexcept
Gets the orientation value as integer (for OIIO attribute).
constexpr const std::array< float, 4 > & get_user_mul() const noexcept
Gets the user-defined white balance multipliers.
constexpr const std::array< int, 4 > & get_grey_box() const noexcept
Gets the grey box region for white balance calculation.
constexpr bool get_half_size() const noexcept
Checks if half-size output is enabled.
constexpr float get_threshold() const noexcept
Gets the wavelet denoising threshold.
constexpr bool get_force_load() const noexcept
Checks if force load is enabled.
constexpr void set_crop_box(int x, int y, int width, int height) noexcept
Sets the crop box region.
constexpr bool get_use_auto_wb() const noexcept
Checks if auto white balance is enabled.
constexpr int get_fbdd_noiserd_value() const noexcept
Gets the FBDD noise reduction value as integer (for OIIO attribute).
constexpr bool get_apply_scene_linear_scale() const noexcept
Checks if scene-linear scaling is applied.
constexpr float get_adjust_maximum_thr() const noexcept
Gets the auto-adjust maximum threshold.
constexpr bool get_auto_bright() const noexcept
Checks if auto brightness is enabled.
constexpr void set_auto_bright(bool auto_bright) noexcept
Enables or disables auto brightness.
constexpr bool is_fast_configuration() const noexcept
Checks if the current configuration matches fast preset.