View Full Version : Request: ColorYUV(autogain=true) temporal parameter addition
anton_foy
22nd March 2022, 16:56
I don't know if this is just the right place to post this but I would like to know if it is possible/feasible to add temporal parameter to ColorYUV's autogain function? Sadly I do not know how to code this, it was implemented though into the AutoLevels plugin (averages luma statistics from frames in the vincinity of the current frame...filterRadius parameter, default: 5 frames) and I believe it would be very useful.
Ceppo
22nd March 2022, 21:13
I have only seen something like that in Adobe programs and it didn't work very well. Now I don't want to say that Adobe is bad but I don't consider them the best either, however, this might show that it is either very hard to make or, like IVTC, there is no perfect way to do it. Da Vinci Resolve which is more advanced for color correction might be able to do it, but I never used it so I don't know. However, that's not what you want so is kinda pointless to say. Just sharing my input.
anton_foy
22nd March 2022, 23:00
I have only seen something like that in Adobe programs and it didn't work very well. Now I don't want to say that Adobe is bad but I don't consider them the best either, however, this might show that it is either very hard to make or, like IVTC, there is no perfect way to do it. Da Vinci Resolve which is more advanced for color correction might be able to do it, but I never used it so I don't know. However, that's not what you want so is kinda pointless to say. Just sharing my input.
Thanks for your input! Just as I mentioned in my post that if AutoLevels for AviSynth can do it (which is based on AviSynth's internal levels?) then it can be done for ColorYUV I think. Why AutoLevels(autolevel=true) or AutoLevels(autogamma=true) is not working for me is that it does not give at all the same results visually as ColorYUV(autogain=true) and is useless for prefiltering while ColorYuv is almost perfect. Almost only because it measures the luma frame by frame and this can produce sudden and unpleasant shifts in the brightness. The proposed temporal averaging could minimize or maybe even eliminate this problem.
AutoLevels - AviSynth plugin (http://avisynth.nl/index.php/Autolevels)
EDIT: I tried using deflicker with ColorYUV(autogain=true) but it is slow and produces some artifacts when used as prefilter. Seems it would be a better solution to modify ColorYUV directly.
wonkey_monkey
22nd March 2022, 23:32
Maybe you could cheese it by stacking before/after frames horizontally with the current frame, then call ColorYUV(autogain = true), then crop back to just the original frame.
You could scale down the immediately before/after frames to half size (in one direction) before stacking, the -2/+2 frames to quarter size, and so on - this will help improve speed and also give more weight to the center (current) frame.
anton_foy
23rd March 2022, 00:17
Maybe you could cheese it by stacking before/after frames horizontally with the current frame, then call ColorYUV(autogain = true), then crop back to just the original frame.
You could scale down the immediately before/after frames to half size (in one direction) before stacking, the -2/+2 frames to quarter size, and so on - this will help improve speed and also give more weight to the center (current) frame.
Thanks Wonkey_monkey great idea! I will try to put together something.
anton_foy
23rd March 2022, 08:37
Not yet tried your idea Wonkey because I still did not figure out how to write it yet.
Here below totally untested and probably totally wrong but my idea here was to get an average luma from one and two before + one and two after frames by resizing down to 1 pixel then do average then upscale to original size and overlay onto the current frame before applying ColorYUV(autogain=true).
function averF(clip C)
{
F=c.greyscale.bilinearresize(1,1)
FF1=f.trim(1,0)
FF2=f.trim(2,0)
FB1=f.trim(-1,0)
FB2=f.trim(-2,0)
FM=average(fb2,fb1,ff1,ff2).pointresize(width(c),height(c))
O=Overlay_mtools(c,fm,mode="overlay")
mergechroma(o,c)
return Last
}
Prefilter=averF.ColorYUV(autogain=true).somedenoiser()
EDIT: now I think I know how to write it Wonkey_Monkey but I work with UHD size footage if that matters much speedwise.
function avCYUV(clip C)
{
FF1=c.trim(1,0).bilinearresize(1920,2160)
FF2=c.trim(2,0).bilinearresize(960,2160)
FB1=c.trim(-1,0).bilinearresize(1920,2160)
FB2=c.trim(-2,0).bilinearresize(960,2160)
StackHorizontal(FB2,FB1,c,FF1,FF2).ColorYUV(autogain=true).Crop(2880,0,-2880,0)
return Last
}
Prefilter=avCYUV.somedenoiser() Like that?
wonkey_monkey
23rd March 2022, 11:07
The second one looks right from what I had in mind.
takla
23rd March 2022, 21:54
You want AutoAdjust (http://avisynth.nl/index.php/AutoAdjust)
anton_foy
24th March 2022, 09:47
You want AutoAdjust (http://avisynth.nl/index.php/AutoAdjust)
Thanks first I read wrong so now I edited my response :) I will try it again but last time I tried it the result differed too much from ColorYUV's autogain. I guess I can try to combine them though.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.