Full (dec+filters) ffmpeg-vaapi pipeline for Intel GPU (xpu pytorch backend) #832
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
I submit this PR to illustrate filter graphs usage for multi-gpu support on the example of ffmpeg vaapi backend. The difference of this PR from #558 is usage of ffmpeg filters for color space conversion. Pay attention that
XpuDeviceInterface
implemented in the last commit of this PR can further be generalized to support any hw (and cpu) ffmpeg backend by having these 3 backend specific stuff:AVBufferRef
)scale
vs.scale_vaapi
vs.scale_cuda
)AVFrame
(from filters) to the tensorThe reason of this PR being a draft is that currently full (dec+filters) ffmpeg-vaapi pipeline generates worse quality output vs. pipeline in #558. Reason for that is handling of color standards in
scale_vaapi
filter and Intel media driver. I believe there are some issues here in these components which needs to be reported and fixed. I will follow up.Details
This commit enables support for Intel GPUs in torchcodec. It adds:
output to RGBA
To build torchcodec with Intel GPU support:
https://github.com/pytorch/pytorch?tab=readme-ov-file#intel-gpu-support
--enable-vaapi
pip3 install torcheval
ENABLE_XPU=1 python3 setup.py develop
CC: @scotts @NicolasHug @eromomon