1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
//! Constants for butteraugli and XYB color space.
//!
//! These values are from the libjxl C++ implementation.
// ============================================================================
// XYB Color Space Constants
// ============================================================================
/// Opsin absorbance matrix for converting linear RGB to opsin space.
/// This is an LMS-like transform (matches jpegli values).
pub const XYB_OPSIN_ABSORBANCE_MATRIX: = ;
/// Bias added to opsin values before cube root (matches jpegli values).
pub const XYB_OPSIN_ABSORBANCE_BIAS: = ;
/// Negative cube root of opsin absorbance bias.
/// This is subtracted after the cube root operation.
pub const XYB_NEG_OPSIN_ABSORBANCE_BIAS_CBRT: = ;
// ============================================================================
// Butteraugli Constants
// ============================================================================
/// Malta filter weights for MF band.
pub const W_MF_MALTA: f64 = 37.0819870399;
/// Normalization for MF band.
pub const NORM1_MF: f64 = 130_262_059.556;
/// Malta filter weights for MF-X band.
pub const W_MF_MALTA_X: f64 = 8246.75321353;
/// Normalization for MF-X band.
pub const NORM1_MF_X: f64 = 1_009_002.70582;
/// Malta filter weights for HF band.
pub const W_HF_MALTA: f64 = 18.7237414387;
/// Normalization for HF band.
pub const NORM1_HF: f64 = 4_498_534.45232;
/// Malta filter weights for HF-X band.
pub const W_HF_MALTA_X: f64 = 6923.99476109;
/// Normalization for HF-X band.
pub const NORM1_HF_X: f64 = 8051.15833247;
/// Malta filter weights for UHF band.
pub const W_UHF_MALTA: f64 = 1.10039032555;
/// Normalization for UHF band.
pub const NORM1_UHF: f64 = 71.7800275169;
/// Malta filter weights for UHF-X band.
pub const W_UHF_MALTA_X: f64 = 173.5;
/// Normalization for UHF-X band.
pub const NORM1_UHF_X: f64 = 5.0;
/// Weighted multipliers for different frequency bands.
pub const WMUL: = ;
// ============================================================================
// Blur Sigma Values
// ============================================================================
/// Sigma for LF (low frequency) blur.
pub const SIGMA_LF: f64 = 7.15593339443;
/// Sigma for HF (high frequency) blur.
pub const SIGMA_HF: f64 = 3.22489901262;
/// Sigma for UHF (ultra high frequency) blur.
pub const SIGMA_UHF: f64 = 1.56416327805;
// ============================================================================
// Masking Constants
// ============================================================================
/// Range removed around zero for MF band.
pub const REMOVE_MF_RANGE: f64 = 0.29;
/// Range added around zero for MF band.
pub const ADD_MF_RANGE: f64 = 0.1;
/// Range removed around zero for HF band.
pub const REMOVE_HF_RANGE: f64 = 1.5;
/// Range added around zero for HF band.
pub const ADD_HF_RANGE: f64 = 0.132;
/// Range removed around zero for UHF band.
pub const REMOVE_UHF_RANGE: f64 = 0.04;
/// Maximum clamp for HF band.
pub const MAXCLAMP_HF: f64 = 28.4691806922;
/// Maximum clamp for UHF band.
pub const MAXCLAMP_UHF: f64 = 5.19175294647;
/// Multiplier for Y channel in HF band.
pub const MUL_Y_HF: f64 = 2.155;
/// Multiplier for Y channel in UHF band.
pub const MUL_Y_UHF: f64 = 2.69313763794;
// ============================================================================
// LF to Vals Conversion Constants
// ============================================================================
/// X channel multiplier for LF-to-vals conversion.
pub const XMUL_LF_TO_VALS: f64 = 33.832837186260;
/// Y channel multiplier for LF-to-vals conversion.
pub const YMUL_LF_TO_VALS: f64 = 14.458268100570;
/// B channel multiplier for LF-to-vals conversion.
pub const BMUL_LF_TO_VALS: f64 = 49.87984651440;
/// Y-to-B mixing multiplier for LF-to-vals conversion.
pub const Y_TO_B_MUL_LF_TO_VALS: f64 = -0.362267051518;
// ============================================================================
// Suppression Constants
// ============================================================================
/// Suppression amount for X by Y.
pub const SUPPRESS_XY: f64 = 46.0;
/// Suppression scaling factor.
pub const SUPPRESS_S: f64 = 0.653020556257;
// ============================================================================
// Scoring Constants
// ============================================================================
/// Normalization factor for intensity target: ln(80) / ln(255).
pub const INTENSITY_TARGET_NORMALIZATION: f32 = 0.790_799_17;
/// Internal good quality threshold.
pub const INTERNAL_GOOD_QUALITY_THRESHOLD: f32 = 17.83 * INTENSITY_TARGET_NORMALIZATION;
/// Global scale factor.
pub const GLOBAL_SCALE: f32 = 1.0 / INTERNAL_GOOD_QUALITY_THRESHOLD;
// ============================================================================
// Mask Function Constants (from C++ butteraugli.cc lines 1220-1282)
// ============================================================================
/// Multiplier for DiffPrecompute.
pub const MASK_MUL: f32 = 6.19424080439;
/// Bias for DiffPrecompute.
pub const MASK_BIAS: f32 = 12.61050594197;
/// Blur radius for masking.
pub const MASK_RADIUS: f32 = 2.7;
/// Multiplier for mask-to-error in Mask function.
pub const MASK_TO_ERROR_MUL: f32 = 10.0;
/// MaskY offset constant.
pub const MASK_Y_OFFSET: f64 = 0.829591754942;
/// MaskY scaler constant.
pub const MASK_Y_SCALER: f64 = 0.451936922203;
/// MaskY mul constant.
pub const MASK_Y_MUL: f64 = 2.5485944793;
/// MaskDcY offset constant.
pub const MASK_DC_Y_OFFSET: f64 = 0.20025578522;
/// MaskDcY scaler constant.
pub const MASK_DC_Y_SCALER: f64 = 3.87449418804;
/// MaskDcY mul constant.
pub const MASK_DC_Y_MUL: f64 = 0.505054525019;
/// Multipliers for CombineChannelsForMasking.
pub const COMBINE_CHANNELS_MULS: = ;