omni-ffi 0.1.0

Zero-cost C++/CUDA FFI bridge for the OmniPulse Wavelet Scattering Transform engine — GPU-accelerated perceptual fingerprinting from Rust
Documentation
// wst_bridge.h — C++ FFI surface for the omni-ffi Rust crate.
//
// The WSTResult struct itself is generated by cxx-build from the
// `#[cxx::bridge]` declaration in src/lib.rs and emitted into
// `target/cxxbridge/omni-ffi/src/lib.rs.h`. We include that generated header
// here so wst_bridge_cpu.cpp (and wst_bridge_cuda.cpp) can return the struct
// by value without redefining it — which would be an ODR violation.
//
// Contract: every function declared here must have an implementation in the
// active bridge translation unit (wst_bridge_cpu.cpp on the default build,
// wst_bridge_cuda.cpp when the `cuda` feature is enabled).

#pragma once

#include <cstdint>

#include "omni-ffi/src/lib.rs.h"

// Run the Wavelet Scattering Transform / Joint Time-Frequency Scattering
// pipeline against a Plasma-resident input buffer.
//
// Parameters:
//   input_plasma_ptr — host-side pointer to a contiguous
//                      float32[batch_size * signal_len] tensor. Must be
//                      readable for the duration of this call.
//   signal_len       — samples per signal (>0).
//   batch_size       — number of signals in the batch (>0).
//   J                — maximum wavelet scale (>0).
//   Q                — wavelets per octave (>0).
//   depth            — scattering cascade depth (>0).
//   use_jtfs         — reserved for the JTFS phase-recovery pass. Ignored on
//                      the CPU build (always plain WST).
//
// Returns a WSTResult whose `fingerprint_ptr` owns a heap (CPU) or device
// (CUDA) allocation. The caller MUST release it via `free_wst_result`
// exactly once.
//
// Throws std::runtime_error on invalid inputs. cxx surfaces this to Rust as
// a `cxx::Exception` (i.e. an `Err` variant in the `Result<WSTResult>`).
WSTResult run_wst_pipeline(
    uint64_t input_plasma_ptr,
    int32_t  signal_len,
    int32_t  batch_size,
    int32_t  J,
    int32_t  Q,
    int32_t  depth,
    bool     use_jtfs);

// Release the tensor backing a WSTResult. Idempotent for the zero-pointer
// case; otherwise must be called exactly once per pointer returned by
// run_wst_pipeline.
void free_wst_result(WSTResult result);