Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avfilter/vf_overlay_videotoolbox: add fast code path for bgra overlay #410

Merged
merged 1 commit into from
Jul 7, 2024

Conversation

gnattu
Copy link
Member

@gnattu gnattu commented Jul 4, 2024

The previous implementation needed to convert both main and overlay frames to BGRA texture and then convert back to YUV. This operation is bandwidth heavy.

Add a faster shader when the overlay is in BGRA format which calculates YUV values in the shader. This eliminates the need to convert the main frame and does not require extra copy for the overlay frame, leading to more than 100% performance improvements overlaying 10-bit 1080p HEVC inputs on M1 Max (190fps -> 407fps).

The rgb to yuv formula is currently hard-coded to premultiplied BT.709 matrix.

Changes

  • add faster code path for bgra overlay

Issues

The previous implementation needed to convert both main and overlay
frames to BGRA texture and then convert back to YUV.
This operation is bandwidth heavy.

Add a faster shader when the overlay is in BGRA format which
calculates YUV values in the shader. This eliminates the need to
convert the main frame and does not require extra copy for the
overlay frame, leading to more than 100% performance improvements
overlaying 10-bit 1080p HEVC inputs on M1 Max (190fps -> 407fps).

The rgb to yuv formula is currently hard-coded to premultiplied
BT.709 matrix.
@gnattu gnattu requested a review from a team July 4, 2024 19:11
@gnattu gnattu merged commit 0d2ae62 into jellyfin Jul 7, 2024
25 checks passed
@gnattu gnattu deleted the improve-vt-overlay-perf branch July 7, 2024 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants