1616using System . Collections . Generic ;
1717using System . Linq ;
1818using System . Runtime . CompilerServices ;
19+ using System . Runtime . Intrinsics . X86 ;
1920using System . Threading ;
2021using System . Threading . Tasks ;
2122
@@ -243,7 +244,13 @@ public override async IAsyncEnumerable<BatchImageResult> GenerateImageBatchAsync
243244 public override async Task < OnnxVideo > GenerateVideoAsync ( PromptOptions promptOptions , SchedulerOptions schedulerOptions = default , ControlNetModel controlNet = default , Action < DiffusionProgress > progressCallback = null , CancellationToken cancellationToken = default )
244245 {
245246 var tensors = await RunInternalAsync ( promptOptions , schedulerOptions , controlNet , progressCallback , cancellationToken ) ;
246- return new OnnxVideo ( promptOptions . InputVideo . Info , tensors ) ;
247+ var videoInfo = promptOptions . InputVideo . Info with
248+ {
249+ Width = schedulerOptions . Width ,
250+ Height = schedulerOptions . Height
251+ } ;
252+ progressCallback ? . Invoke ( new DiffusionProgress ( "Generating Video Result..." ) ) ;
253+ return new OnnxVideo ( videoInfo , tensors ) ;
247254 }
248255
249256
@@ -261,7 +268,13 @@ public override async IAsyncEnumerable<BatchVideoResult> GenerateVideoBatchAsync
261268 {
262269 await foreach ( var batchResult in RunBatchInternalAsync ( batchOptions , promptOptions , schedulerOptions , controlNet , progressCallback , cancellationToken ) )
263270 {
264- yield return new BatchVideoResult ( batchResult . SchedulerOptions , new OnnxVideo ( promptOptions . InputVideo . Info , batchResult . Result ) ) ;
271+ var videoInfo = promptOptions . InputVideo . Info with
272+ {
273+ Width = batchResult . SchedulerOptions . Width ,
274+ Height = batchResult . SchedulerOptions . Height
275+ } ;
276+ progressCallback ? . Invoke ( new DiffusionProgress ( "Generating Video Result..." ) ) ;
277+ yield return new BatchVideoResult ( batchResult . SchedulerOptions , new OnnxVideo ( videoInfo , batchResult . Result ) ) ;
265278 }
266279 }
267280
0 commit comments