36constexpr bool ValidRamp(InputIter begin, InputIter end, T offset, U slope) {
37 typename std::iterator_traits<InputIter>::value_type counter = offset;
38 typename std::iterator_traits<InputIter>::value_type delta = slope;
39 for (
auto value = begin; value != end; ++value) {
40 if (*value != counter) {
65 using C =
typename std::iterator_traits<InputIter>::value_type;
67 typename C::value_type cast_offset = offset;
68 if (sample_id % 2 == 0) {
69 return ValidRamp(begin, end, C(cast_offset, cast_offset + 1), C(+2, +2));
71 return ValidRamp(begin, end, C(-cast_offset, -cast_offset - 1), C(-2, -2));
73 }
else if constexpr (std::is_signed_v<C>) {
74 C cast_offset = offset;
75 if (sample_id % 2 == 0) {
76 return ValidRamp(begin, end, cast_offset, +1);
78 return ValidRamp(begin, end, -cast_offset, -1);
81 C cast_offset = offset;
82 if (sample_id % 2 == 0) {
83 return ValidRamp(begin, end, cast_offset, +1);
85 return ValidRamp(begin, end, std::numeric_limits<C>::max() - cast_offset, -1);
constexpr bool ValidRamp(InputIter begin, InputIter end, T offset, U slope)
Checks to see if the buffer contains a ramp of values.
Definition patternValidation.hpp:36
constexpr bool ValidAlternatingRamp(InputIter begin, InputIter end, std::uint32_t sample_id, T offset)
Checks to see if the buffer contains an alternating ramp of values.
Definition patternValidation.hpp:64