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/*videotoolbox: fix color range handling #439

Merged
merged 2 commits into from
Aug 21, 2024

Conversation

gnattu
Copy link
Member

@gnattu gnattu commented Aug 15, 2024

Changes

FFmpeg's implementation of the VideoToolbox hardware context requires specifying the color range during the context's initialization, rather than deriving it from the AVFrame. Unfortunately, both the upstream-provided VideoToolbox filters and our custom filters did not correctly handle the color range when creating the VT context, leaving it unspecified. As a result, the generated pixels default to the TV range, since that is the default value.

This PR makes most of the filters to inherit the input's color range, and makes the tonemap_videotoolbox filter to correctly set hardware color range based on user input. It was previously defaults to tv range, not it defaults to be same as input.

This PR also fixed the double-free issue in the upstream yadif_videotoolbox filter. That filer frees the auto-released objc objects which may cause segfaults.

I plan to submit the fix for upstream filters to upstream mailing list shortly as well. If we are going to make more 6.x releases, I will create another PR to back-port these changes to our 6.x branch.

Issues

@gnattu gnattu requested a review from a team August 15, 2024 23:47
@gnattu
Copy link
Member Author

gnattu commented Aug 15, 2024

This leaves unnoticed for so long is probably most videos are in the tv range and the full range ones are super rare.

@gnattu
Copy link
Member Author

gnattu commented Aug 16, 2024

@nyanmisaka
Copy link
Member

https://ffmpeg.org/pipermail/ffmpeg-devel/2024-August/332375.html
Does this review need to be resolved?

@gnattu
Copy link
Member Author

gnattu commented Aug 20, 2024

https://ffmpeg.org/pipermail/ffmpeg-devel/2024-August/332375.html Does this review need to be resolved?

This file is not related to this PR though. The upstream want another method to resolved the leak because they want "future use" but it is okay for us now. I will submit another version when I have time.

@gnattu gnattu merged commit a893486 into jellyfin-7.0 Aug 21, 2024
27 checks passed
@gnattu gnattu deleted the jellyfin-7.0-fix-vt-color-range branch August 21, 2024 18:30
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.

3 participants