Change #275148
| Category | ffmpeg |
| Changed by | Raja-89 <imraja729@gmail.com> |
| Changed at | Sat 18 Jul 2026 04:56:18 |
| Repository | https://git.ffmpeg.org/ffmpeg.git |
| Project | ffmpeg |
| Branch | master |
| Revision | c60ac8f256cd76341df4fb5abdfd38d9c47c0a6e |
Comments
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>
Changed files
- libavfilter/dnn/dnn_backend_torch.cpp
- libavfilter/dnn/dnn_interface.c
- libavfilter/dnn_interface.h