MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ hash_vision_step()

size_t MayaFlux::Kinesis::Vision::hash_vision_step ( VisionOp  op,
const VisionParams params 
)
inline

Hash a VisionStep's op and parameters together.

Keys GPU dispatch memoization on VisionPass::completed, which spans one walk including any suspensions. Two steps hashing equal are treated as interchangeable, so every field that changes the output must be hashed.

Definition at line 367 of file VisionOp.hpp.

368{
369 size_t seed = std::hash<std::string_view> {}(Reflect::enum_to_string(op));
370
371 std::visit([&seed](const auto& p) {
372 using T = std::decay_t<decltype(p)>;
373 if constexpr (std::is_same_v<T, std::monostate>) {
374 } else if constexpr (std::is_same_v<T, ThresholdParams>) {
375 hash_combine(seed, std::hash<float> {}(p.value));
376 } else if constexpr (std::is_same_v<T, ThresholdAdaptiveParams>) {
377 hash_combine(seed, std::hash<uint32_t> {}(p.block_size));
378 hash_combine(seed, std::hash<float> {}(p.offset));
379 } else if constexpr (std::is_same_v<T, NormalizeRangeParams>) {
380 hash_combine(seed, std::hash<float> {}(p.lo));
381 hash_combine(seed, std::hash<float> {}(p.hi));
382 } else if constexpr (std::is_same_v<T, GaussianBlurParams>) {
383 hash_combine(seed, std::hash<float> {}(p.sigma));
384 } else if constexpr (std::is_same_v<T, FilterSeparableParams>) {
385 for (float v : p.kernel_x)
386 hash_combine(seed, std::hash<float> {}(v));
387 for (float v : p.kernel_y)
388 hash_combine(seed, std::hash<float> {}(v));
389 } else if constexpr (std::is_same_v<T, CannyParams>) {
390 hash_combine(seed, std::hash<float> {}(p.sigma));
391 hash_combine(seed, std::hash<float> {}(p.low_threshold));
392 hash_combine(seed, std::hash<float> {}(p.high_threshold));
393 } else if constexpr (std::is_same_v<T, MorphParams>) {
394 hash_combine(seed, std::hash<uint32_t> {}(p.radius));
395 } else if constexpr (std::is_same_v<T, HarrisParams>) {
396 hash_combine(seed, std::hash<float> {}(p.k));
397 hash_combine(seed, std::hash<float> {}(p.sigma));
398 } else if constexpr (std::is_same_v<T, ExtractPeaksParams>) {
399 hash_combine(seed, std::hash<float> {}(p.threshold));
400 hash_combine(seed, std::hash<uint32_t> {}(p.nms_radius));
401 } else if constexpr (std::is_same_v<T, TrackKeypointsParams>) {
402 hash_combine(seed, std::hash<uint32_t> {}(p.window_radius));
403 hash_combine(seed, std::hash<uint32_t> {}(p.max_iterations));
404 hash_combine(seed, std::hash<float> {}(p.eigen_threshold));
405 hash_combine(seed, std::hash<float> {}(p.error_threshold));
406 } else if constexpr (std::is_same_v<T, FindContoursParams>) {
407 hash_combine(seed, std::hash<float> {}(p.min_area));
408 hash_combine(seed, std::hash<uint32_t> {}(p.max_contours));
409 hash_combine(seed, std::hash<uint32_t> {}(p.max_points_per_contour));
410 hash_combine(seed, std::hash<bool> {}(p.as_image));
411 } else if constexpr (std::is_same_v<T, ConnectedComponentsParams>) {
412 hash_combine(seed, std::hash<bool> {}(p.export_labels));
413 hash_combine(seed, std::hash<bool> {}(p.with_colors));
414 }
415 },
416 params);
417
418 return seed;
419}
void hash_combine(size_t &seed, size_t value)
Combine a hash into an existing seed, FNV-style.
Definition VisionOp.hpp:355

References MayaFlux::Reflect::enum_to_string(), and hash_combine().

Referenced by MayaFlux::Yantra::VisionGpuExecutor::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: