Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 7th December 2017, 10:55   #1  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Different saturation adjusting filters vary in red

I did saturation adjustment in Color Finesse in Adobe Premiere and I wanted to reproduce the result in vapoursynth. So I did some tests comparing different hsl filters in the vapoursynth/avisynth/virtualdub pool to see how close they are. In my test I took a sample image and test it on all filters with 50% saturation.

In the results, the Tweak() in vs and avs, and the internal hsv filter and the 6-axis color correction filter in virtualdub are all identical. The only one that's visibly different is Color Mill.

When compares to the result of Color Finesse, the previous four looks very much the same in every color except red, as you can see in the samples:

color finesse
vapoursynth
color mill

Why are the difference only in red?
lansing is offline   Reply With Quote
Old 7th December 2017, 12:40   #2  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
All three look quite different to me. The vapoursynth image is YUV while the other two are RGB. How were the screenshots saved?

Compared to the first two, I think there's a rec.601 conversion that should've happened for the third image, but didn't.

The difference between one and two seems to be a difference in luminance levels and/or saturation. It's nowhere near a full TV vs PC levels difference, but the second image is a little darker than the first.
hello_hello is offline   Reply With Quote
Old 7th December 2017, 13:29   #3  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by lansing View Post
I did saturation adjustment in Color Finesse in Adobe Premiere and I wanted to reproduce the result in vapoursynth. So I did some tests comparing different hsl filters in the vapoursynth/avisynth/virtualdub pool to see how close they are. In my test I took a sample image and test it on all filters with 50% saturation.

In the results, the Tweak() in vs and avs, and the internal hsv filter and the 6-axis color correction filter in virtualdub are all identical. The only one that's visibly different is Color Mill.

When compares to the result of Color Finesse, the previous four looks very much the same in every color except red, as you can see in the samples:

color finesse
vapoursynth
color mill

Why are the difference only in red?
It's not only in read. It's in luma too and probably everything else. Can you post exact settings used and if you used tweak on YUV or RGB?
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 7th December 2017, 17:45   #4  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Here is the original screenshot that was saved by loading the ts file into vapoursythn, and then saving it as png in vs editor

original
Code:
clip = core.ffms2.Source(r'00020.m2ts')
For the tweak setting:
Code:
# vapoursynth, result image save directly from the same script as load the ts
clip = adjust.Tweak(clip, sat=0.5)

# avisynth, result image save from avspmod
ImageSource("17040.png")
converttoyv12(matrix="rec709")
SmoothTweak(saturation=0.5)
#tweak(sat=0.5)
For Color Finesse, I loaded the ts file into Adobe Premiere, applied the color finesse plugin to the track, and then "HSL->master->saturation" and set it to 50. Result image was saved from "export frame" of Premiere.

For Color mill, I loaded the original png into Virtualdub, loaded the color mill filter and set "saturation->stick->-50". The result image was saved to png from "file->export->single image".
lansing is offline   Reply With Quote
Old 7th December 2017, 19:07   #5  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
All I can tell you at this point is if I open the "original" image in Irfanview and reduce the saturation by 128 I'm not sure I can distinguish it from the color finesse screenshot. That makes the vapoursynth screenshot a little darker than the "original" and I'm sticking with my rec.601 theory for the color mill screenshot, although converting the colours doesn't make it the same as "original", maybe just less different, so either I'm wrong or there's something else happening there.

Last edited by hello_hello; 7th December 2017 at 19:12.
hello_hello is offline   Reply With Quote
Old 7th December 2017, 21:32   #6  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by hello_hello View Post
All I can tell you at this point is if I open the "original" image in Irfanview and reduce the saturation by 128 I'm not sure I can distinguish it from the color finesse screenshot. That makes the vapoursynth screenshot a little darker than the "original" and I'm sticking with my rec.601 theory for the color mill screenshot, although converting the colours doesn't make it the same as "original", maybe just less different, so either I'm wrong or there's something else happening there.
The color mill differences maybe a bug in the filter itself, or that it just uses a different algorithm, just like the hsl filter in Photoshop/Premiere.

I also thought that maybe color finesse also uses a slightly different algorithm from the mainstream, but then you said Irfanview can produces an identical result...

As I dig deeper, I saw that GIMP is also identical to photoshop/premiere, and an online photo editor at befunky.com produces identical result to vs/avs/vd...

So there is like three different algorithms for saturation on the market right now?
lansing is offline   Reply With Quote
Old 7th December 2017, 22:36   #7  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
There's definitely a difference between Tweak(sat=0.5) and reducing the saturation by 127 with Irfanview. I can easily see it when I use the following on your original image.

ConvertToYV12(matrix="rec709")
Tweak(Sat=0.50, coring=false)

I'm wondering if it's somehow gamma related. By reducing the gamma to 90% with Irfanview while reducing the saturation by a little more than 50% I can get it fairly close to what Tweak does, but I still haven't managed to find a combination that produces the same result.

Edit: No, after a bit more playing around I don't think it's gamma. Tweak(sat=0.52) is closer to Irfanview's 50% although reds still aren't the same.

Last edited by hello_hello; 7th December 2017 at 23:22.
hello_hello is offline   Reply With Quote
Old 8th December 2017, 17:42   #8  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Could it be the saturation definition in RGB vs YUV calculations ? Tweak only works in YUV . Some filters in PP work in YUV, but you're going to get different results if you use a YUV video vs a RGB converted PNG
poisondeathray is offline   Reply With Quote
Old 8th December 2017, 18:22   #9  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Some more observations:

Using a RGB source,

- Color Finesse 3 different as tweak (converted to RGB using 709) as you reported
- Colorista 3 gives same results as tweak
- Lumetri gives something completely different than those
- AE's internal Hue/Saturation filter or colorbalance HLS completely different but same as each other

It has something to do with brightness compensation calc because a 191 red bar becomes 41,41,41 with complete desaturation for colorista but 57,57,57 with color finesse, 95,95,95 with internal h/s filter or colorbalance hls
poisondeathray is offline   Reply With Quote
Old 8th December 2017, 19:43   #10  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by poisondeathray View Post
Could it be the saturation definition in RGB vs YUV calculations ? Tweak only works in YUV . Some filters in PP work in YUV, but you're going to get different results if you use a YUV video vs a RGB converted PNG
I think you found the right track, I found the common ground between them following it.

There should be a RGB and a YUV version of the HLS filter. Both producing different result because of different calculation. In Premiere, if I'm not mistaken, all the effect filters are RGB unless there is a "yuv" icon next to the name.

The yuv "fast color corrector" in Premiere produces identical result to color finesse and irfanview, which indicate that the latter two are also using the yuv version.

While the rgb "color balance (HLS)" gives identical result as photoshop and gimp.

So we can separate them into 3 groups now:
Code:
RGB HLS: Photoshop / GIMP / PP's HLS

YUV HLS: Color Finesse / IrfanView / PP's Fast Color Corrector

YUV HLS(2): Vapoursynth's Tweak / Avisynth's Tweak / VD's HSV Adjust / VD's 6-axis Color Correction, Befunky's Photo Editor, DaVinci Resolve
It makes more sense now, and since the two YUV groups produce so similar result beside red color, I'm suspecting that they should original be in one group, the difference is probably cause by missed calculation from one group. I don't think that the commercial one would mess up, so I think the flaw is probably Avisynth's tweak, since all the rest in the group are basically a port of it.

update: added davinci resolve

Last edited by lansing; 8th December 2017 at 22:48. Reason: added resolve to group
lansing is offline   Reply With Quote
Old 8th December 2017, 20:56   #11  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Quote:
Originally Posted by lansing View Post
I don't think that the commercial one would mess up, so I think the flaw is probably Avisynth's tweak, since all the rest in the group are basically a port of it.

I don't know if you can really call it a "flaw" ... it's just another method of defining and calculating "saturation". The commercial Colorista produces identical results as tweak, but using RGB input source. So if it's a "flaw", it has it too. I guess we could check a bunch of other commercial programs. Resolve would usually be considered the "gold standard" for video color work

In old thread, they discussed how to adjust RGB saturation in avisynth
https://forum.doom9.org/showthread.php?t=87439

I vaguely recall someone explaining all these differences a long time ago... somewhere... maybe it was Gavino

Last edited by poisondeathray; 8th December 2017 at 21:03.
poisondeathray is offline   Reply With Quote
Old 8th December 2017, 22:46   #12  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Okay I just checked Resolve, its saturation default at 50.00, so I set it to 25. The result was identical to tweak as well, um...I guess both calculation are fine then.
lansing is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:27.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.