#pragma once /** * @file oscillation.hpp * @brief FFT-based oscillation detection (Phase 25). */ #include namespace fces { class OscillationDetector { public: static constexpr int WINDOW_SIZE = 64; static constexpr float POWER_THRESHOLD = 0.5f; static constexpr int MIN_PERIOD = 4; static constexpr int MAX_PERIOD = 16; void update(float loss); bool detect() const; float get_score() const; float get_variance_50() const; void reset(); private: std::vector loss_history_; static std::vector detrend(const std::vector& signal); static std::vector compute_power_spectrum(const std::vector& signal); }; } // namespace fces