Log in

View Full Version : Avisynth 2.6: Tweak(hue) is broken!?


Didée
20th February 2025, 23:06
Hey guys, for so many years I've used tweak() every now-and-then to, well, tweak just a little. I've never questioned its operations, just adjusted numbers until "it fits".

Lately during a mixed workflow with Avisynth and another serious image processor, I noticed that something is fishy. Long story short: the "rotation" of the color wheel with tweak(hue=xx.x) seems to be broken. Red is fading away, green gets darker, blue is fading away, red is coming back, ...

Quick impressions of correct-vs-tweak: (in 60° steps)

Base image for color wheel (to use for test script below)
https://t5.pixhost.to/thumbs/3054/569559803_colorwheel2.png (https://pixhost.to/show/3054/569559803_colorwheel2.png) https://t5.pixhost.to/thumbs/3054/569559805_tweak_seems_broken_000.png (https://pixhost.to/show/3054/569559805_tweak_seems_broken_000.png)
https://t5.pixhost.to/thumbs/3054/569559807_tweak_seems_broken_060.png (https://pixhost.to/show/3054/569559807_tweak_seems_broken_060.png) https://t5.pixhost.to/thumbs/3054/569559808_tweak_seems_broken_120.png (https://pixhost.to/show/3054/569559808_tweak_seems_broken_120.png)
https://t5.pixhost.to/thumbs/3054/569559810_tweak_seems_broken_180.png (https://pixhost.to/show/3054/569559810_tweak_seems_broken_180.png) https://t5.pixhost.to/thumbs/3054/569559811_tweak_seems_broken_240.png (https://pixhost.to/show/3054/569559811_tweak_seems_broken_240.png)
https://t5.pixhost.to/thumbs/3054/569559812_tweak_seems_broken_300.png (https://pixhost.to/show/3054/569559812_tweak_seems_broken_300.png) https://t5.pixhost.to/thumbs/3054/569559814_tweak_seems_broken_360.png (https://pixhost.to/show/3054/569559814_tweak_seems_broken_360.png)

Test script used: (needs Fizick's "rotate" plugin)
ImageReader("colorwheel2.png").converttorgb32().trim(0,360) #return(info())
oo=last
converttoyv12(matrix="PC.709")
o=last

check = oo.rotate(angle=0.0,start=0,end=360,endangle=360.0)
\ .subtitle("expected behaviour, simulated by rotate() plugin")

tweek = o.animate(0,360,"Tweak", 0.0,1.0,0.0,1.0,false, 360.0,1.0,0.0,1.0,false)
\ .converttoRGB32(matrix="PC.709")
\ .subtitle("real result of tweak(hue=xx.x) color rotation")


stackhorizontal(check.addborders(0,0,4,0,color=$404040),tweek).showframenumber(x=448,y=500)
#stackvertical(check.addborders(0,0,0,4,color=$404040),tweek) .showframenumber(x=5,y=500)

return(last)


Am I doing something wrong? Am I expecting something wrong? Or is it just that Tweak(hue) is broken? (As of ye old Avisynth 2.6, some guys still might be using it.)

wonkey_monkey
20th February 2025, 23:56
Is it because Tweak is only "rotating" the U and V channels, but leaving the Y channel untouched? E.g. yellow will have the highest Y value, and when you rotate it's U/V values to red, it washes out to pink, because real red would have a lower Y value.

Edit: The result is similar if you convert to lab colour in Photoshop and then use the Hue slider.

poisondeathray
21st February 2025, 01:00
And result is the same as "rotate" with hsvadjust (x86) in RGB
http://avisynth.nl/index.php/HSVAdjust


hsl = oo.animate(0,360,"hsladjust", 360,1,0,1, 0,1,0,1)
\ .converttoRGB32(matrix="PC.709")
\ .subtitle("real result of hsladjust(hue=) color rotation")

SaurusX
21st February 2025, 16:46
And is it just me or has the dither functionality just never worked? It's supposed to smoothly transition the colors after your "start" and "end", but it's always been a cliff.

Didée
21st February 2025, 18:11
Woke up this mornig with the thought "man, tweak is only processing the UV channels of YUV", and there, guys, meantime you have written it all. Thank you.

I feel a bit silly now. :)

wonkey_monkey
21st February 2025, 18:11
And is it just me or has the dither functionality just never worked? It's supposed to smoothly transition the colors after your "start" and "end", but it's always been a cliff.

That's interp, not dither, and according to the docs it only works on saturation adjustments.

SaurusX
21st February 2025, 21:16
That's interp, not dither, and according to the docs it only works on saturation adjustments.
You're right. It still doesn't work.