MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / validate

Method validate

src/OpenColorIO/ops/range/RangeOpData.cpp:187–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187void RangeOpData::validate() const
188{
189 // NB: Need to allow vals to exceed normal integer range
190 // to allow lossless setting of bit-depth from float-->int-->float.
191
192 // If in_min or out_min is not empty, so must the other half be.
193 if (IsNan((float)m_minInValue))
194 {
195 if (!IsNan((float)m_minOutValue))
196 {
197 throw Exception("In and out minimum limits must be both set "
198 "or both missing in Range.");
199 }
200 }
201 else
202 {
203 if (IsNan((float)m_minOutValue))
204 {
205 throw Exception("In and out minimum limits must be both set "
206 "or both missing in Range.");
207 }
208 }
209
210 if (IsNan((float)m_maxInValue))
211 {
212 if (!IsNan((float)m_maxOutValue))
213 {
214 throw Exception("In and out maximum limits must be both set "
215 "or both missing in Range.");
216 }
217 if (IsNan((float)m_minInValue))
218 {
219 throw Exception("At least minimum or maximum limits must be set in Range.");
220 }
221 }
222 else
223 {
224 if (IsNan((float)m_maxOutValue))
225 {
226 throw Exception("In and out maximum limits must be both set "
227 "or both missing in Range.");
228 }
229 }
230
231 // Currently not allowing polarity inversion so enforce max > min.
232 if (!IsNan((float)m_minInValue) && !IsNan((float)m_maxInValue))
233 {
234 if (m_minInValue > m_maxInValue)
235 {
236 throw Exception("Range maximum input value is less than minimum input value");
237 }
238 if (m_minOutValue > m_maxOutValue)
239 {
240 throw Exception("Range maximum output value is less than minimum output value");
241 }
242 }
243
244 // A one-sided clamp must have matching in & out values.

Callers 5

RangeOpMethod · 0.45
canCombineWithMethod · 0.45
BuildRangeOpFunction · 0.45
convertToMatrixMethod · 0.45
getAsForwardMethod · 0.45

Calls 2

IsNanFunction · 0.85
FloatsDifferFunction · 0.85

Tested by

no test coverage detected