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