Files
ffmpeg/libavfilter/dnn
Raja-89 c60ac8f256 avfilter/dnn: implement batching for Torch backend
Add batch processing support to the LibTorch DNN backend, following
the same pattern used by the OpenVINO backend.

Key changes:
- Add batch_size AVOption (range 1-1000, default 1) to DnnContext
- Accumulate lltasks in the queue, trigger inference when batch_size
  lltasks are ready (matching the OpenVINO batch execution pattern)
- Pre-allocate a single contiguous memory buffer for the entire batch
  in fill_model_input_th() to avoid unnecessary tensor copies
- Split batched output in infer_completion_callback() and dispatch
  each slice to its corresponding task

Tested with:
ffmpeg -f lavfi -i testsrc=duration=5:size=640x480:rate=25 -vf format=rgb24,dnn_processing=dnn_backend=torch:model=dummy_model.pt:batch_size=4 -f null -

Signed-off-by: Raja Rathour <imraja729@gmail.com>
2026-07-18 02:56:18 +00:00
..