View Full Version : Hue/Sat/Bright/Cont filter now available
Guest
16th March 2002, 14:38
I have created a native YUY2 filter, called Tweak, for adjusting the hue, saturation, brightness, and contrast of a video clip. It operates directly in YUY2 space, without requiring any color space conversions, and therefore runs very fast.
I'll be releasing a series of new Avisynth filters. For user convenience, I plan to package them into a single DLL. Since this is the first one, there is only one in the package so far. :)
I was pleasantly surprised at how easy it was to make these adjustments directly in YUY2 space! The source code, as always, is available for the curious to inspect.
The filter is available at the web site given below my signature.
Guest
16th March 2002, 16:34
If you got version 1.0 during the hour or so that it was up, please get 1.1 as it is faster.
Dali Lama
16th March 2002, 17:28
Thanks Donald for the filter. Like I posted in your thread for suggestions, I think this filter is a good one to port to avisynth. A lot of people use it to correct brightness, color issues (like in anime).
So is it actually faster code than the virtualdub one or is it faster due to the unnecessary YUY2 conversion?
Thanks again,
Dali
Guest
16th March 2002, 17:32
I'll answer that after the next version, which will be much faster!
DDogg
16th March 2002, 17:52
DG, This conversion of filters to avisynth using native yuv is going to be a godsend to this community. Just wanted to say a heartfelt thanks for doing this.
Btw, I would vote for Jaan Kalda's optimized 2d cleaner to be in the list for conversion or anything you feel would best remove random noise from adjacent frames without the introduction of distortion (assuming that is even possible).
Blight
16th March 2002, 20:53
Just an observation...
The optimized asm/mmx vdub filters will probably be harder to convert since they are optimized for use in RGB. It's probably easier to write them from scratch aimed at YUY2.
Guest
17th March 2002, 02:35
@Blight
Another perceptive, insightful, and penetratingly focused observation from the Blightster!
You're absolutely right. It will not be easy to port that one.
Blight
17th March 2002, 05:41
I'm still wooting for WarpSharp btw ;) Although, I have no idea how it works and how hard it'll be to convert.
P.S.
I'm still waiting for someone to request an RGB filter for YUV, muhahaha
Roginator
17th March 2002, 09:15
I tried some tests on a TV capture using the new filter. I could see no discernable difference in speed between using the new filter in Avisynth vs. using the filters in Virtualdub. Possibly because filters like TemporalSmoother are so slow in comparison.
I convert MPEG-2 files to MPEG-1 thusly:
MPEG2>PVASTrumento>DVD2AVI>MPA2WAV>Avisynth>VirtualDub>TMPGEnc
I was hoping I could delete the VirtualDub step, but the GUI is handy for deleting commercials and adjusting colors, etc. I suspect it's still needed for synching audio to video as well.
Now if you could make TemporalSmoother much faster...<grin>. It's amazing the effect TS has on the background noise of a TV broadcast.
Guest
17th March 2002, 14:49
Tweak is a very small part of your processing chain.
You need to benchmark it against the VirtualDub version in isolation.
ARDA
18th March 2002, 00:19
@neuron2
I've been trying to make a test comparasion of speed between Tweak 1.1 and hue/saturation/intensity/1.1
Tha first problem I had was to find the equivalents parameters,hue works on the contrary;in Vd filter
positive values tends to green (or should I say cyan?);in Tweak positive values tends to red.
To go to the point I found all parameters with a different behaviour.Please correct me if I am wrong.
The second problem was to find a similar result in colors and contrast,Vd filter has not a contrast option.
But finally I have made two scripts with not too different colors and brightness(at least for my tired eyes).
Tweak script:
crop(12,12,704,548)
Tweak(hue=-1.2,sat=0.98,bright=-7,cont=1.25)
BicubicResize(640,336,0,0.75)
AddBorders(0,0,0,48)
Time for 1000 frames mins 2.16
__________________________________________________
Hue/saturation/intensity script:
crop(12,12,704,548)
ConvertToRGB()
VD_Hue(5,false,0.93,1.09,true,true,true,true,true,true)
ConvertToYUY2()
BicubicResize(640,336,0,0.75)
AddBorders(0,0,0,48)
Time for 1000 frames mins 2.40
The first conclusion was is that we had won 24 seconds
__________________________________________________
then I did the following test:
Tweak script with two useless coversions:
crop(12,12,704,548)
Tweak(hue=-1.2,sat=0.98,bright=-7,cont=1.25)
#I added to useless conversions
ConvertToRGB()
ConvertToYUY2()
BicubicResize(640,336,0,0.75)
AddBorders(0,0,0,48)
Time for 1000 frames mins 2.40
I am not too happy with the result I would like you to tell me where I did wrong but the conclusion
I get is that we won what avysinth takes to make the conversions to rgb and back.
I want to add that the quality result with Tweak is really better, and I imagine is the contrast function that
allows a better image.
Additional informations: I've made all my test with xvid latest Nic's release 170302 with same parameters.
I hope that can be usefull
Arda
Guest
20th March 2002, 00:43
Thanks, ARDA. That is useful. I have released a new version that is much faster. Please benchmark that one! It's available at the usual place.
No more floats. :)
Guest
20th March 2002, 01:24
@Dali
Version 1.2 is faster than the VirtualDub equivalent (used with YUY2 in an Avisynth script) because (a) it doesn't convert the color space, and (b) it uses integer calculations instead of floating point.
Roginator
20th March 2002, 02:12
I've been trying out the auto-levels filter at http://argx.20m.com/
It has some good points and some not-so-good points. USUALLY it does a great job at adjusting the settings -- much better than I have the patience for. I wish it would output the average settings it uses for an entire video so I could simply apply those settings. <hint> <hint>
The bad points are: in fades, it tries to lighten the dark picture TOO much, creating lousy-looking fades. If a bright white caption appears, the rest of the picture becomes darker. And it tends to shift brightness for no apparent reason occasionally.
Still, it's better than manually trying to adjust umpteen settings -- at least for me.
Guest
20th March 2002, 04:16
@Roginator
I think most people here would prefer to spend a little time getting good settings than to accept sudden spurious brightness changes and lousy looking fades. Anyway, I certainly wouldn't want my name on something like that. :)
Roginator
20th March 2002, 05:35
There are SOME people who will go through each of 70,000 frames to do a manual IVTC. I'm not QUITE that..um...anal. I'm a lazy guy.
But if you took the auto-level adjusting filter and modifed it so it kept a running average of the settings for each frame and applied those settings to subsequent frames, it would soon eliminate the weirdness at fades and the odd changes in brightness.
Alternately, using a separate video analysis program, you could run through the entire video to get average settings for the entire video -- thus eliminating any early weirdness.
Guest
20th March 2002, 13:17
Oh, sorry then for misunderstanding your point. That would surely be useful but is unlikely to rise very high on my priority list for some time. :(
ARDA
20th March 2002, 13:41
I've finished another test with Tweak 1.2
Tweak script (same as above)
for the same 1000 frames and same codec mins 1.44
________________________
Hue/saturation/intensity script(same as above)
idem the above test mins 2.40
_________________________
Tweak script with two useless coversions(same as above)
for the same 1000 frames and same codec mins 2.10
_________________________
Great job,now we've gon 26 seconds for 1000 frames.
I also want to add that with Tweak we are calling in fact 4 functions,using contrast.
Another two things I've watched:
1. The contrast function increases both high lights,and dark areas in a way that
in some cases it is not neccessary to apply the bright function.Is it possible
to have a particular parameters just for darkness? Just a wish to test.I can also
play with Levels of avisynth.
2. I have also watched that this function makes a small correction in reds.I've made
a test with just Tweak(cont=1.2)and it corrected me a little the problem we always
have with the that excess of red. Is that right;or my eyes are too tired?
Thanks again
Arda
Guest
20th March 2002, 23:57
Thank you, ARDA, for taking the time to produce these timing figures. It's pretty fast now, but there's always MMX if I get bored.
1. The contrast function increases both high lights,and dark areas in a way that in some cases it is not neccessary to apply the bright function.Is it possible to have a particular parameters just for darkness? Just a wish to test.
You just want to bring up the dark areas? That really is no longer a contrast operation as it is commonly known. I think the Levels filter is better suited for this.
I have also watched that this function makes a small correction in reds. I've made a test with just Tweak(cont=1.2) and it corrected a little the problem we always have with excess of red. Is that right; or my eyes are too tired?
I suppose your eyes are tired, because the contrast adjustment only affects the Y (luminance) bytes.
ARDA
21st March 2002, 00:35
I hope you get bored soon; but never of coding.
Thanks Arda
Dali Lama
22nd March 2002, 01:57
Great! Speed is definitely better with v1.2. Good job Donald.
Also, you have a "contrast" and "brightness" setting now. In the vdub version it was "intensity" correct?
Well, I have tested it pretty extensively and it works great. There is a "new setup" that I use now, it may be interesting for others to use too.
Before, for anime I would saturate a little (ie, 1.05-1.15) and that's it. But with the contrast and brightness settings, I am able to apply a small contrast (1.10) and then darken the movie with a brightness setting of (1.15). If the brightness is applied heavier than the contrast the resulting image (at least with anime) is sharp and saturated yet it retains the original brightness and intensity.
What do you guys think? Is it true? I think it doesn't help compression any, but it makes it look better.
Tell me what you think,
Dali
Guest
22nd March 2002, 02:30
@Dali
>Also, you have a "contrast" and "brightness" setting now. In the
>vdub version it was "intensity" correct?
Correct. Brightness and contrast came very cheap in YUY2, so I did it that way. Note that brightness is simply added to the Y (luminance) byte, while contrast scales it. So, it is like what you have on a TV set. If you crank up the contrast, you may have to reduce the brightness to avoid washout of light areas.
>I am able to apply a small contrast (1.10) and then darken the
>movie with a brightness setting of (1.15)
Although the brightness is a float in the user interface, it is simply converted to an integer and then added to Y. Thus, a brightness of 1.15 will actually only add 1 to the Y byte, which is essentially a no-op. :)
The settings always depend on the input clip. Some I like to saturate a bit more and increase contrast. Some I like to desaturate. And some I just leave alone.
Dali Lama
22nd March 2002, 06:05
Originally posted by neuron2
@Dali
brightness of 1.15 will actually only add 1 to the Y byte, which is essentially a no-op. :)
I messed up Donald, I meant to say I use a -15 setting for Brightness. Of course 1.15 would be practically no change...silly me.
BTW 1.15 would actually increase brightness by a little, right?
Ok, well with this in mind, it may be a viable method of increasing contrast without brightness, like your tv analogy.
Thanks,
Dali
Dali Lama
22nd March 2002, 06:09
Just a quick Q: Donald, do you encode anime too? Seing as you have made decomb and other anime beneficial products.
Guest
22nd March 2002, 14:21
@Dali
Of course I do. I'm working on "Tenchi The Movie 2" right now. It is exposing some weaknesses in Decomb and I hope to have an improved version available soon.
kramerdog
24th March 2002, 08:36
Thanks for the new avisynth filter!
I've been using your VirtualDub Hue filter in an avisynth chain with ConvertToRGB. Now I can stay in YUY2!
Thanks
avih
28th March 2002, 10:02
Originally posted by Blight
I'm still wooting for WarpSharp btw ;) Although, I have no idea how it works and how hard it'll be to convert.
P.S.
I'm still waiting for someone to request an RGB filter for YUV, muhahaha
hi, it's the 1st time i post on avisynth forum, so hi ;)
anyway, i'm working on xvid postprocessing, and implemented a (yet very slow) version of warp-sharp-filter, with assistance from avree lee. if u need some theoretical bg about this, just let me know.
it's implemented in c for yuv colorspace. and i'll try to optimize it for mmx soon (still yuv).
cheers
avi.
ps.
i'm newbie (at least for several years now :) ) to assembler and mmx. any help with optimizations is welcome (i've already managed to speed up my brightness/contrast/saturation/noise-generator quite a bit using mmx)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.