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

Loss of detail on reds on darker backgrounds #5

Closed
Jules-A opened this issue Oct 10, 2023 · 19 comments
Closed

Loss of detail on reds on darker backgrounds #5

Jules-A opened this issue Oct 10, 2023 · 19 comments

Comments

@Jules-A
Copy link

Jules-A commented Oct 10, 2023

Original:
z

12:
Capture

Reds become extremely bright and vary way too much from source and lose any borders or shadowing when on darker backgrounds.

Source: to-love-ru-darkness - S3E2 @ 6:57 but I've noticed it in many other areas to a lesser extent.

@Jules-A Jules-A changed the title Loss of detail on reds Loss of detail on reds on darker backgrounds Oct 10, 2023
@Artoriuz
Copy link
Owner

Not sure if I follow what the problem here is, is it that the red characters seem brighter and more saturated on top of the blue background?

Does it happen on all variants?

Does it happen with something like lanczos?

@Jules-A
Copy link
Author

Jules-A commented Oct 10, 2023

Not sure if I follow what the problem here is, is it that the red characters seem brighter and more saturated on top of the blue background?

You really can't see it? I thought it was obvious :/ The top half numbers/letters on the board from the part where the white turns to blue is completely off and disjointed from the bottom half's colours that it looks fake. The numbers on the right are also extremely bright.

Does it happen on all variants?

Yes, though I think it's ever so slightly better on the mix/4 variants.

Does it happen with something like lanczos?

Lanczos is terrible compared to kaiser/catrom ect. for cscale but no, none of the inbuilt chroma scalers exhibit that behavior. Some have way more black/darkness than there should be but none I've found are so bright.

Lanczos:
image

If you switch between chroma scalers you can't miss it...

There's also a large amount of ringing going on in 12 (don't think it's noticeable using AR from Ravu) though I can't really see it in mixed.

@Artoriuz
Copy link
Owner

I can see it, but I can also see in all of your screenshots. This doesn't seem to be CfL-specific (albeit it does make the difference more obvious), can you please check what Krig does in the same scene?

@Jules-A
Copy link
Author

Jules-A commented Oct 10, 2023

I can see it, but I can also see in all of your screenshots. This doesn't seem to be CfL-specific (albeit it does make the difference more obvious), can you please check what Krig does in the same scene?

Huh? what do you mean? It's not happening with Lanczos or any of the others I've tested and I don't recall it occurring when I tested Krig before, will retest without fsrcnnx though now.

EDIT: It also appears in Krigbillateral but the colours are slightly better... Krig has a separate bug here of being misaligned (too far to the south east).

Krigbillateral:
image

It does NOT occur with 9ad91ab :

image

@Artoriuz
Copy link
Owner

Just look at the red "8", the top half looks more saturated on all screenshots you've sent so far. If that's not the issue you're talking about then I'm seeing something else.

@Jules-A
Copy link
Author

Jules-A commented Oct 11, 2023

Just look at the red "8", the top half looks more saturated on all screenshots you've sent so far. If that's not the issue you're talking about then I'm seeing something else.

Yes, I guess it is saturation.
Some is to be expected when upscaling but Cfl and to a slightly lesser extent, Krig's is changing the color way too much compared to inbuilt scalers and even a previous version of Cfl... to the point it easily stands out and looks wrong.
For a quick rgb comparison from the top of the 8 (probably the most noticeable part) testing from a part that doesn't have blacks leaking from the outline:

Original
208
72
82

Cfl 12
245
51
56

Cfl old
230
68
77

@Jules-A
Copy link
Author

Jules-A commented Oct 14, 2023

Hmm.. It's not specific to reds, it seems to make blues a lot brighter too (though this is 480p source where errors are more acceptable):
Hamming (pretty much same as original):
hamming

Mix
mix

Actually, come to think about it, the whole image could be becoming brighter, didn't check it.

@Artoriuz
Copy link
Owner

I'm not super convinced this is a legitimate issue. The shader can't be compared to normal scalers in this case if you want to know what's the expected output, you'd have to find a 4:4:4 reference and test it after chroma subsampling.

@Jules-A
Copy link
Author

Jules-A commented Oct 16, 2023

I'm not super convinced this is a legitimate issue. The shader can't be compared to normal scalers in this case if you want to know what's the expected output, you'd have to find a 4:4:4 reference and test it after chroma subsampling.

Idk, really depends on what you want the shader to be, something that disregards the source colouring to look subjectively better or something more accurate I guess. The differences aren't really too subtle and are quite noticeable on normal playthrough for me.

I don't have any good 4:4:4 reference videos but some quick tests on 4:4:4 images I wasn't really able to replicate it, it did look a decent bit too bright and too dark in some areas but not really anything too noticeable.

@Artoriuz
Copy link
Owner

Idk, really depends on what you want the shader to be, something that disregards the source colouring to look subjectively better or something more accurate I guess.

No. My point is that you don't know what the "source colour" is unless you have a 4:4:4 reference.

@Jules-A
Copy link
Author

Jules-A commented Oct 16, 2023

No. My point is that you don't know what the "source colour" is unless you have a 4:4:4 reference.

Well yeah that's true but it's doubtful that the authors would put such odd colours and that none of the built-in more tried scalers exhibit the same issue.

@Artoriuz
Copy link
Owner

The built-in scalers are merely interpolating the existing data points, which have nothing to do with what the authors intended to show. Chroma-subsampling is done for compression, not artistic intent.

I'm not saying CfL 100% isn't overshooting a bit, it probably is, but you don't know by how much unless you have a 4:4:4 reference.

@Artoriuz
Copy link
Owner

Artoriuz commented Oct 16, 2023

Case in point:

lanczos (mpv default):
lanczos

cfl (12-tap, master):
cfl12

cfl (12-tap, smaller downsampling window for a sharper LUMA_LOWRES):
cfl12_smaller_window

Look at the blue spiral on top of the girl with white hair, you can see that the outline gets closer to what lanczos is doing with the sharper downsampling passes, but if you look at any of the coloured balls on top of coloured backgrounds (like the yellow one right next to her) you can see that master is doing a much better job at keeping the unintended colours away (you don't see yellow blending into purple nearly as much).

This could be a case of being better at one thing while being worse at another, but without the reference we literally can't tell.

@Jules-A
Copy link
Author

Jules-A commented Oct 16, 2023

That's a tough example since being lineart you can't tell if it's intended to be shown like that as anime often has drawing showing transparency.
Also I don't think lanczos is the best for comparison, while it is the default I don't feel lanczos does a very good job of chroma scaling from my subjective testing. Lanczos was one of the furthest away from the source colours out of the inbuilt scalers (so it's harder to spot the difference). Hamming feels it captures the colours much better and just feels way more natural though it's not too sharp like Cfl so without luma scaling kaiser might look better for the sharpness.

@Artoriuz
Copy link
Owner

Last commit should help with this.

@Jules-A
Copy link
Author

Jules-A commented Oct 16, 2023

It's a lot better but still feels little off imo.

@Jules-A
Copy link
Author

Jules-A commented Oct 25, 2023

Hmm... actually it's still pretty awful, I noticed some other reds got completely murdered and washed out yellows, the issue probably should be kept open... Forgot to screenshot it and forgot the anime/scene already.
It doesn't occur at all when running from CHROMA_SCALED (but that suffers from massive offset issues).

@Jules-A
Copy link
Author

Jules-A commented Nov 25, 2023

I've been playing around with swapping out FSR's approximated Lanczos with others like Hamming (reduces impact but not very sharp) and Garamond's modified versions of scalers from here: https://github.com/garamond13/alt-scale (which pretty much solves the issue and is far higher quality in general but 2x as slow...).

I'm going to try reducing the distance to see if that helps. EDIT: It does but causes other artifacts.

EDIT2: With those alt-scale shaders and replacing the FSR with the current one Cfl uses doesn't cause it so it's not it on it's own.

EDIT3: Actually, while it does look good, after testing Garamond scaling on it's own (in altScale) it appears to de-saturate the image so what's happening here is it's just undoing Cfl's over-saturation.

Jules-A added a commit to Jules-A/glsl-chroma-from-luma-prediction that referenced this issue Jan 2, 2024
Fixes Artoriuz#5 and other artifacts like borders disappearing ect. , Artoriuz#10 (I think the only reason was because it wasn't respecting it).

Downside is scaling of text ect. doesn't look as great, you'd need to consider switching to an algorithm that can handle a radius >2.0 (I've had pretty good results with Garamond), even Hamming seems better if you need speed and sharpness loss is acceptable.
Jules-A referenced this issue Jan 22, 2024
This offers a small performance increase for all scaling factors while
providing the exact same quality at 2x (normal 4:2:0 use-case).

At 4x (when using a luma doubler) it is a bit worse but nothing
noticeable on real content. A nice side-effect is that the problem with
vanishing line-art seems to be a bit less severe now (I think it's due
to lower correlation, the older downscaling code was blurrier which
made the correlation between planes higher).

Again I may or may not revert this at some point, but I'm reasonably
happy with the change and it also reduces bloat a bit.
@I2ujbNGakP8KfLKbho0Z
Copy link

Another example (using the fullsize CfL shader):

Krig:
agf_1_krig

CfL:
agf_1_cfl

The joystick in the middle of the frame loses its outline completely.
It'd be great if this can be fixed, because while this issue is present, rainbowing in MPEG2-streams is reduced immensely by this shader, which is why i want to use it.
Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants