Update deformes4D_engine.py
Browse files- deformes4D_engine.py +23 -13
deformes4D_engine.py
CHANGED
|
@@ -2,7 +2,8 @@
|
|
| 2 |
# Copyright (C) 4 de Agosto de 2025 Carlos Rodrigues dos Santos
|
| 3 |
#
|
| 4 |
# MODIFICATIONS FOR ADUC-SDR:
|
| 5 |
-
# Copyright (C) 2025 Carlos Rodrigues dos Santos. All rights reserved
|
|
|
|
| 6 |
# This file is part of the ADUC-SDR project. It contains the core logic for
|
| 7 |
# video fragment generation, latent manipulation, and dynamic editing,
|
| 8 |
# governed by the ADUC orchestrator.
|
|
@@ -118,27 +119,36 @@ class Deformes4DEngine:
|
|
| 118 |
return output_path
|
| 119 |
|
| 120 |
def generate_full_movie(self, keyframes: list, global_prompt: str, storyboard: list,
|
| 121 |
-
#
|
| 122 |
-
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
handler_strength: float, destination_convergence_strength: float,
|
| 125 |
video_resolution: int, use_continuity_director: bool,
|
| 126 |
progress: gr.Progress = gr.Progress()):
|
| 127 |
|
| 128 |
-
# ---
|
| 129 |
-
|
| 130 |
-
FRAMES_TO_GENERATE = (N_CHUNKS_TO_GENERATE - 1) * 8 + 1 # 97 frames
|
| 131 |
|
| 132 |
-
VIDEO_CHUNK_INDICES = slice(0,
|
| 133 |
-
ECO_CHUNK_INDICES = slice(
|
| 134 |
-
HANDLER_CHUNK_INDICES = slice(
|
| 135 |
|
| 136 |
-
HANDLER_FRAME_TARGET =
|
| 137 |
DESTINATION_FRAME_TARGET = FRAMES_TO_GENERATE - 1
|
| 138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
logger.info("="*60)
|
| 140 |
-
logger.info("MODO DE GERAÇÃO: Estratégia de Cauda Longa
|
| 141 |
-
logger.info(f" - Geração Bruta por Fragmento: {
|
| 142 |
logger.info(f" - Clipe Final por Fragmento: Chunks {VIDEO_CHUNK_INDICES.start} a {VIDEO_CHUNK_INDICES.stop-1}")
|
| 143 |
logger.info(f" - Guia de Eco (Memória): Chunks {ECO_CHUNK_INDICES.start} a {ECO_CHUNK_INDICES.stop-1}")
|
| 144 |
logger.info(f" - Guia de Handler (Evolução): Chunks {HANDLER_CHUNK_INDICES.start} a {HANDLER_CHUNK_INDICES.stop-1}")
|
|
|
|
| 2 |
# Copyright (C) 4 de Agosto de 2025 Carlos Rodrigues dos Santos
|
| 3 |
#
|
| 4 |
# MODIFICATIONS FOR ADUC-SDR:
|
| 5 |
+
# Copyright (C) 2025 Carlos Rodrigues dos Santos. All rights reserved.
|
| 6 |
+
#
|
| 7 |
# This file is part of the ADUC-SDR project. It contains the core logic for
|
| 8 |
# video fragment generation, latent manipulation, and dynamic editing,
|
| 9 |
# governed by the ADUC orchestrator.
|
|
|
|
| 119 |
return output_path
|
| 120 |
|
| 121 |
def generate_full_movie(self, keyframes: list, global_prompt: str, storyboard: list,
|
| 122 |
+
# Novos parâmetros de controle vindos da UI
|
| 123 |
+
n_chunks_to_generate: int,
|
| 124 |
+
video_end_chunk: int,
|
| 125 |
+
eco_start_chunk: int,
|
| 126 |
+
handler_start_chunk: int,
|
| 127 |
+
handler_frame_target: int,
|
| 128 |
+
# Parâmetros restantes
|
| 129 |
handler_strength: float, destination_convergence_strength: float,
|
| 130 |
video_resolution: int, use_continuity_director: bool,
|
| 131 |
progress: gr.Progress = gr.Progress()):
|
| 132 |
|
| 133 |
+
# --- Lógica de Geração Dinâmica Baseada nos Parâmetros da UI ---
|
| 134 |
+
FRAMES_TO_GENERATE = (n_chunks_to_generate - 1) * 8 + 1
|
|
|
|
| 135 |
|
| 136 |
+
VIDEO_CHUNK_INDICES = slice(0, video_end_chunk)
|
| 137 |
+
ECO_CHUNK_INDICES = slice(eco_start_chunk, eco_start_chunk + 2)
|
| 138 |
+
HANDLER_CHUNK_INDICES = slice(handler_start_chunk, handler_start_chunk + 2)
|
| 139 |
|
| 140 |
+
HANDLER_FRAME_TARGET = handler_frame_target
|
| 141 |
DESTINATION_FRAME_TARGET = FRAMES_TO_GENERATE - 1
|
| 142 |
|
| 143 |
+
# Validação de sanidade para garantir que as fatias não se sobreponham de forma incorreta
|
| 144 |
+
if not (video_end_chunk <= eco_start_chunk and
|
| 145 |
+
(eco_start_chunk + 2) <= handler_start_chunk and
|
| 146 |
+
(handler_start_chunk + 2) <= n_chunks_to_generate):
|
| 147 |
+
raise gr.Error(f"Configuração de Chunks inválida! Verifique as sobreposições e o total de chunks.")
|
| 148 |
+
|
| 149 |
logger.info("="*60)
|
| 150 |
+
logger.info("MODO DE GERAÇÃO: Estratégia de Cauda Longa Dinâmica")
|
| 151 |
+
logger.info(f" - Geração Bruta por Fragmento: {n_chunks_to_generate} chunks ({FRAMES_TO_GENERATE} frames)")
|
| 152 |
logger.info(f" - Clipe Final por Fragmento: Chunks {VIDEO_CHUNK_INDICES.start} a {VIDEO_CHUNK_INDICES.stop-1}")
|
| 153 |
logger.info(f" - Guia de Eco (Memória): Chunks {ECO_CHUNK_INDICES.start} a {ECO_CHUNK_INDICES.stop-1}")
|
| 154 |
logger.info(f" - Guia de Handler (Evolução): Chunks {HANDLER_CHUNK_INDICES.start} a {HANDLER_CHUNK_INDICES.stop-1}")
|