Fix _ColorRange, it's the wrong way around! #41
Closed
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.
Fixes: #40
Note: This should be re-opened.
Update: This pull request has been super-seeded by 700523c on the newffmpeg branch by removing the YUVRGB_Scale mappings to _ColorRange entirely, which is ultimately the better solution.
Since there's no data for color range in the MPEG ES structure, there's no way to inferr color range from the input stream, so _ColorRange should be assumed to be either limited/TV (1) as that's more likely than full/PC (0) or unspecified/NaN and let VS/user deal with it.
The current behavior is to map YUVRGB_Scale to the _ColorRange prop backward. As in, if YUVRGB_Scale is 1 (full/PC), then it sets _ColorRange to 1 (limited/TV) and so on.
Whereas it should set _ColorRange to the real color range by reading the value from the MPEG stream, or match the YUVRGB_Scale as that's our last hope of information on which range the input stream is. If we cannot read the color range from the MPEG stream, then all we can do is assume the YUVRGB_Scale is the input color range. We shouldn't assume the input color range is the opposite of YUVRGB_Scale.
This pull request only fixes it to map YUVRGB_Scale to _ColorRange correctly so that it isn't assuming the input color range is the opposite of YUVRGB_Scale. However, it would be even better to not use YUVRGB_Scale at all, or use it only as a fallback if the input color range cannot be read from the MPEG stream.
Current Behavior:
Behavior in this Pull Request: