diff options
| author | Yousef Jan <yousefjan24000@gmail.com> | 2026-08-25 15:47:09 +0300 |
|---|---|---|
| committer | Yousef Jan <yousefjan24000@gmail.com> | 2026-08-25 15:51:41 +0300 |
| commit | 15bb2f12fd1b3a47ae0a790cfbd71f8837a3badc (patch) | |
| tree | 5aedd8fce4a9cb411ec9e8148fc76eaaa57c7589 /src/pipeline.h | |
| parent | ce90395aa32ad37d5ebcb628b2b22d7bf7d9850b (diff) | |
Diffstat (limited to 'src/pipeline.h')
| -rw-r--r-- | src/pipeline.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/pipeline.h b/src/pipeline.h new file mode 100644 index 0000000..93a7ea9 --- /dev/null +++ b/src/pipeline.h @@ -0,0 +1,52 @@ +#pragma once + +#include <hip/hip_runtime.h> +#include <stdexcept> +#include <string> +#include <vector> +#include <source_location> + + +inline void hip_check( + hipError_t err, + std::source_location loc = std::source_location::current()) +{ + if (err != hipSuccess) { + throw std::runtime_error( + std::string(hipGetErrorString(err)) + + " at " + loc.file_name() + ":" + std::to_string(loc.line())); + } +} + + +struct PyramidLevel { + int width = 0, height = 0; + float4* color_smax = nullptr; // rgb = color, a = s_max + float4* tensor = nullptr; // x=E, y=F, z=G, w=unused +}; + +struct Pyramid { + std::vector<PyramidLevel> levels; // 0 = finest, back() = coarsest +}; + +struct Params { + float radius = 5.0f; + float alpha = 1.0f; // eccentricity tuning + int num_sectors = 8; + float q = 8.0f; + float tau_w = 0.02f; + float p_s = 0.5f; + float p_d = 1.25f; + float tau_v = 0.1f; +}; + + +PyramidLevel make_level(int width, int height); +void free_level(PyramidLevel& lvl); +Pyramid make_pyramid(int base_width, int base_height, int num_levels); +void destroy_pyramid(Pyramid& pyr); + +void build_pyramid (Pyramid& pyr); +void compute_tensor(Pyramid& pyr, const Params& p); +void smooth_tensor (Pyramid& pyr, const Params& p); +void run_pipeline (Pyramid& pyr, const Params& p); |