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

Fix _ColorRange, it's the wrong way around! #41

Closed
wants to merge 1 commit into from
Closed

Fix _ColorRange, it's the wrong way around! #41

wants to merge 1 commit into from

Conversation

rlaphoenix
Copy link

@rlaphoenix rlaphoenix commented Apr 20, 2020

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:

YUVRGB_Scale mapped to _ColorRange prop
limited/TV full/PC
full/PC limited/TV

Behavior in this Pull Request:

YUVRGB_Scale mapped to _ColorRange prop
limited/TV limited/TV
full/PC full/PC

DGIndex sets the "YUVRGB_Scale" in the D2V file as follows:

0 == TV == Limited
1 == PC == Full

And VapourSynth reads _ColorRange as follows:

0 == PC == full
1 == TV == limited

but `core.d2v.Source` was setting it the wrong way around, this can be considered a fairly big issue.
This pull request was closed.
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.

PC scale color range doesn't seem to work as expected
1 participant