wonkey_monkey
4th March 2024, 21:20
SelectiveColour v2.0.1 (https://horman.net/avisynth/)
Direct download (https://horman.net/avisynth/download/SelectiveColour2.zip)
2.0.1: Incorporating threadpool fixes identified by pinterf in FastBlur
I've rewritten my old SelectiveColour filter (link to previous discussion (https://forum.doom9.org/showthread.php?t=151259)) using AVX instructions and now working exclusively in floating point RGB, so it's both faster and more accurate.
Also because I'm quite lazy, input clip width must be mod 8.
It's a clone of Photoshop's Selective color (https://helpx.adobe.com/photoshop/using/mix-colors.html) adjustment.
Apart from an input clip (which must be floating point planar RGB) it takes 19 required arguments, plus one optional argument.
The first 18 are floats in the range -1 to 1 (other values are accepted, but that behaviour is not well defined). These are in groups of three, representing the Cyan, Magenta, and Yellow percentages (normalised) present in Photoshop's Selective Color dialogue for each of the six colour sections (reds, yellows, greens, cyans, blues, magentas).
The 19th argument is a boolean to choose either relative (false) or absolute (true) mode, as per the Photoshop dialogue box.
The final optional named argument is "threads". This defaults to 1, but can be set to a higher number to enable multithreading. Two threads gave me a 25% speed increase, but not much more beyond that.
Usage:
...
ConvertBits(32)
ConvertToPlanarRGB
SelectiveColour(last,\
0.5,0,0,\
0.25,0.1,0,\
1,-0.5,-0.25,\
-0.5,0.5,-0.5,\
0.1,0.2,0.3,\
-0.1,-0.2,-0.3,\
true, threads = 2)
The six triples act on the following sets of pixels (any pixel may be a member of up to 2 adjacent sets):
Reds: those pixels where R>(G and B)
Yellows: (R and G)>B
Greens: G>(R and B)
Cyans: (G and B)>R
Blues: B>(R and G)
Magentas: (R and B)>G
The first number in a triple alters the Red channel, the second the Green channel, the third the Blue channel. Because Photoshop calls these values Cyan, Magenta and Yellow, the numbers work backwards - if you want to increase the intensity of a channel, use a negative number, and vice versa.
The filter still doesn't currently implement the "Black" value in Photoshop.
Direct download (https://horman.net/avisynth/download/SelectiveColour2.zip)
2.0.1: Incorporating threadpool fixes identified by pinterf in FastBlur
I've rewritten my old SelectiveColour filter (link to previous discussion (https://forum.doom9.org/showthread.php?t=151259)) using AVX instructions and now working exclusively in floating point RGB, so it's both faster and more accurate.
Also because I'm quite lazy, input clip width must be mod 8.
It's a clone of Photoshop's Selective color (https://helpx.adobe.com/photoshop/using/mix-colors.html) adjustment.
Apart from an input clip (which must be floating point planar RGB) it takes 19 required arguments, plus one optional argument.
The first 18 are floats in the range -1 to 1 (other values are accepted, but that behaviour is not well defined). These are in groups of three, representing the Cyan, Magenta, and Yellow percentages (normalised) present in Photoshop's Selective Color dialogue for each of the six colour sections (reds, yellows, greens, cyans, blues, magentas).
The 19th argument is a boolean to choose either relative (false) or absolute (true) mode, as per the Photoshop dialogue box.
The final optional named argument is "threads". This defaults to 1, but can be set to a higher number to enable multithreading. Two threads gave me a 25% speed increase, but not much more beyond that.
Usage:
...
ConvertBits(32)
ConvertToPlanarRGB
SelectiveColour(last,\
0.5,0,0,\
0.25,0.1,0,\
1,-0.5,-0.25,\
-0.5,0.5,-0.5,\
0.1,0.2,0.3,\
-0.1,-0.2,-0.3,\
true, threads = 2)
The six triples act on the following sets of pixels (any pixel may be a member of up to 2 adjacent sets):
Reds: those pixels where R>(G and B)
Yellows: (R and G)>B
Greens: G>(R and B)
Cyans: (G and B)>R
Blues: B>(R and G)
Magentas: (R and B)>G
The first number in a triple alters the Red channel, the second the Green channel, the third the Blue channel. Because Photoshop calls these values Cyan, Magenta and Yellow, the numbers work backwards - if you want to increase the intensity of a channel, use a negative number, and vice versa.
The filter still doesn't currently implement the "Black" value in Photoshop.