#pragma once #include "engine/models/dramabox/types.h" #include #include #include namespace engine::models::dramabox { struct DramaBoxEncodedReferenceLatents; struct DramaBoxLatentShape { int64_t batch = 1; int64_t channels = 8; int64_t frames = 0; int64_t mel_bins = 16; int64_t token_count() const noexcept; int64_t latent_value_count() const noexcept; }; struct DramaBoxLatentState { DramaBoxLatentShape target_shape; int64_t tokens = 0; std::vector latent; std::vector clean_latent; std::vector denoise_mask; std::vector positions; }; struct DramaBoxPromptChunk { std::string text; double estimated_duration_seconds = 0.0; }; double estimate_dramabox_speech_duration_seconds(const std::string & prompt); double estimate_dramabox_duration_seconds(const std::string & prompt, float duration_scale); std::vector chunk_prompt_for_duration( const std::string & prompt, float max_duration_seconds, float target_duration_seconds, float duration_scale); int64_t dramabox_aligned_pixel_frames(double duration_seconds, float fps); DramaBoxLatentShape dramabox_target_latent_shape(double duration_seconds, const DramaBoxConfig & config); DramaBoxLatentState create_dramabox_initial_state(const DramaBoxLatentShape & shape, const DramaBoxConfig & config); std::vector make_dramabox_ltx2_sigmas(int64_t steps, int64_t latent_tokens); float auto_rescale_for_cfg(float cfg); void append_reference_latents( DramaBoxLatentState & state, const DramaBoxEncodedReferenceLatents & ref, const DramaBoxConfig & config); void guided_prediction_from_velocity( const std::vector & velocity, const DramaBoxLatentState & state, int64_t branch_count, float sigma, float cfg_scale, float spatio_temporal_guidance_scale, float guidance_rescale, bool cfg_enabled, bool stg_enabled, std::vector & cond, std::vector & pred); void post_process_and_euler_step( DramaBoxLatentState & state, std::vector & denoised, float sigma, float sigma_next); } // namespace engine::models::dramabox