View Full Version : Hdr Agc 1.8.7 - 10.09.2006
videoFred
27th September 2006, 06:35
Like Richard says, you capture too bright.
The sky around the car and the upper part of the (wonderful!)car is blown out.
No way to recover this, there is nothing to recover. Just white.
You see the peak in the histogram.
Please capture this scene again, but expose on the bright parts this time.
Like I did on my examples in this thread.
Maybe you can set your camcorder in manual modus?
Then you will have a very dark picture.
But with a lot of info hidden in the dark parts.
This is the point where HDRAGC does his magic :cool:
Fred.
krisq
27th September 2006, 10:25
OMG paviko! This plugin is working miracles on my material :D
Dzieki :thanks: ;)
Piper
27th September 2006, 16:45
@Richard & Fred: Thanks for your your replies.
Then you will have a very dark picture.
But with a lot of info hidden in the dark parts.
This is the point where HDRAGC does his magic
This point solidified it for me, thanks.
The options on my camcorder include perhaps using the backlight option which should lower the gain somewhat. Other options are "spotlight" and "surf & snow" modes.
When I captured this I used the cameras halogen setting for the white balance which I presume is the correct setting. I've attempted to keep any auto settings turned off, including focus.
@Richard: I've read that using a piece of 8 1/2" x 11" bright white printer paper is a good option, perhaps even using some aluminum foil behind it. This is what I've used for this example. Would a good camera shop have the type of projection screen you've mentioned?
I've looked up Tiffen filters, and I may be able to pick one up off of ebay. Given their price, I doubt I'll be buying several of them. I'm not sure what you meant by (F15), or which type of ultra contrast filter I'd need as there are apparently a few types. Can you please elaborate?
FredThompson
15th October 2006, 08:03
This might have some helpful information: http://www.popphoto.com/howto/3038/how-to-create-high-dynamic-range-images.html
guada 2
15th October 2006, 08:35
Many thanks FredThompson for this link.
I didn't know the plug-in Photomatix tone mapping for adobe photoshop.
Bye. ;)
Piper
15th October 2006, 16:51
Thanks again for the tips above. I've since tracked down a filter for my camcorder. It took some time but I was able to come up with a Hoya cir-polarizing filter (pitch: 0.75). Using this filter has indeed corrected the washed out scenes significantly. The issue I'm having now is tweaking hdragc effectively. I've experimented using other examples posted in this thread as guides. So far about the best I've been able to come up with is this:
Without hdragc:
http://img427.imageshack.us/img427/4888/withouthdrbb0.th.jpg (http://img427.imageshack.us/my.php?image=withouthdrbb0.jpg)
With hdragc: hdragc(max_sat=1.2,min_gain=4.0,max_gain=5.0,coef_gain=0.5,corrector=0.7,coef_sat=0.8)
http://img143.imageshack.us/img143/9097/withhdrmc1.th.jpg (http://img143.imageshack.us/my.php?image=withhdrmc1.jpg)
This image is one of the brighter frames and while it is now longer washed out, I'd like to brighten it further and reduce haze. I've tried using black_clip but even with lowest settings the blacks end up being too dark. I've also tried using tweak but I wasn't happy with the results.
Can anyone help further improve this capture? Once I think I've got all I can out of hdragc, I'll deal with denoising. In comparison to the original images I posted earlier, those were denoised using
dull = last
sharp = dull.LimitedSharpenFaster(smode=4)
sharp = LRemoveDust_YV12(17,1)
sharp = sharp.DeGrainMedian()
Soothe(sharp, dull,80)
The current images contain no denoising. The complete filter chain I'm currently using is:
# Source
AVISource("c:\tape1.avi").AssumeBFF()
ReInterpolate411()
ColorYUV(autowhite=true)
ColorYUV(levels="PC->TV")
ConvertToYV12(interlaced=true)
separatefields().DeFlicker(percent=50,scene=30).weave()
# Convert to top field first
DoubleWeave.SelectOdd()
AssumeTFF()
Telecide()
Decimate(5).Decimate(4)
Assumefps(18)
changefps(23.976)
hdragc(max_sat=1.2,min_gain=4.0,max_gain=5.0,coef_gain=0.5,corrector=0.7,coef_sat=0.8)
Thanks!
videoFred
16th October 2006, 08:18
The picture without HDR already looks fine!
I think this is not a good example for HDR AGC.
Adjusting the black point a little with virtual dub's levels filter schould be enough.
What do you want to improve?
Also, the pic without HDR....
Is this the original source or have you applied this already?:
ColorYUV(autowhite=true)
ColorYUV(levels="PC->TV")
I never use these... I use HDR after denoising but before anything else.
Fred.
Piper
16th October 2006, 14:54
@videoFred: My goal was to bring out more detail in the dark areas. There are some scenes on this reel which are shot in lower light which the camcorder is having difficulty picking up, with or without the lens filter.
Yes, both images have this applied:
ColorYUV(autowhite=true)
ColorYUV(levels="PC->TV")
I started playing with ColorYUV when I first started this project. At first I had the cameras colour balance set to halogen which gave the footage a redish tone, hence the use of autowhite. Since picking up the Hoya filter, I've found the camera produces a brighter picture if I set the colour balance to auto so autowhite can probably go if I stay with this colour balance setting. I'll take the two out and compare it with what I have.
As far as denoising is concerned, I typically denoise last, or before resizing on progressive video. Perhaps I'll try it immediately after deflicker, though I'd be surprised if it makes that much of a difference.
I've also noticed that my original (over exposed) frame looks sharper than my latest capture. It's tricky business focusing both the projector and camera just right! I may try to capture it again and frame it slightly better as well. Still, if hdragc isn't required with this footage then perhaps I'll start a new thread if I need further assistance rather than hijacking this one by going off topic.
Thanks
videoFred
16th October 2006, 15:20
Hi Piper!
I do not think there is more to see in the dark parts from the frame you showed us.
Yes! Please start a new thread.
We could discuss film transfering in this new thread and how to improve it by using Avisynth.
For those who are interested :)
Fred.
johnmeyer
24th October 2006, 19:52
Since I am transferring from film, sometimes I have a black border around the film. Is there a way to have HdrAGC ignore the black pixels around the border when it calculates min/max values?
Adub
10th December 2006, 04:19
so, how's development coming? :)
The reason I ask is because I drool over those sse2 optimizations.
paviko
16th December 2006, 15:08
Hello
Could you be so kind to tell me which documentation your filter is based on?
I'm interested in the »simulating the work of our eyes« algorithm and the range spreading (only luma or chroma too?).
Are there free docs on the internet?
First version used this algorithm:
http://www.cs.ucf.edu/~sumant/publications/SCCG2002.pdf
but it caused lots of artifact. Then I've searched some other staff. Here you can find great reference with source code and links to publications:
http://www.mpi-sb.mpg.de/~krawczyk/
I've tried some of algorithm from above link, but still could get satisfactory result for moving parts (they are good for still images).
The best one algorithm was:
http://www.cs.utah.edu/~reinhard/cdrom/tonemap.pdf
Current version of HDRAGC is using it's own algorithm. Not much was left from above mentioned links.
Is there a way to have HdrAGC ignore the black pixels around the border when it calculates min/max values?HDRAGC is already ignoring pure black parts when calculating min/max.
so, how's development coming?
The development is not progessing :( When I'm back home from work the computer is mostly turned off. I've got enough stearing at monitor at work. But I hope soon my mood will be better.
Regards
Adub
17th December 2006, 00:11
Oh, ok. Well getter better soon! ;)
Thanks for your work, man! It is really awesome!
R3Z
27th December 2006, 10:01
Does anyone have any suggestions on using this filter for the reverse ? IE i have a video thats pretty grey instead of being black and the singer is fairly well lit without needing anymore birghtness added.
Can this filter darken a clip like the MSU Smart Brightness and Contrast filter ?
Cheers !
rfmmars
27th December 2006, 14:06
Does anyone have any suggestions on using this filter for the reverse ? IE i have a video thats pretty grey instead of being black and the singer is fairly well lit without needing anymore birghtness added.
Can this filter darken a clip like the MSU Smart Brightness and Contrast filter ?
Cheers !
You can use invert before and after the HDRagc script. This is where you can't do without AVSp. Also "Fdumps" ColorMill 2.1 VD plugin may work for you.
Richard
R3Z
28th December 2006, 02:36
You can use invert before and after the HDRagc script. This is where you can't do without AVSp. Also "Fdumps" ColorMill 2.1 VD plugin may work for you.
Richard
Thanks for your suggestions :) Its appreciated !
actionman133
29th December 2006, 14:40
Not necessarily on topic, but I casually developed my own internal HDR filter, using levels and overlay... not expecting much, although it is easier to use than HDRAGC () in that it only has one input variable and if it weren't for 8 bit rounding, it'd look pretty good, I think...
Function HDR (clip Last, float gain) {
#low boosts shadows, high reduces highlights
low = ConvertToRGB ().Levels (0, gain, 255, 16, 235).ConvertBackToYUY2 ("pc.601")
lowmask = low.Levels (16, 1, 255, 255, 0, false)
high = ConvertToRGB ().Levels (0, 1/gain, 255, 16, 235).ConvertBackToYUY2 ("pc.601")
highmask = high.Levels (16, 1, 235, 0, 255, false)
# mix high and low into original clip
hdr1 = Overlay (last, high, mask = highmask, output = "YUY2")
hdr2 = Overlay (hdr1, low, mask = lowmask, output = (isRGB () ? "RGB32" : isYUY2 () ? "YUY2" : "YV12"))
return hdr2
}
At the moment, it's not optimal (it scales the masks twice), but it works well. Here's a couple samples:
Screenshots from Eternal Sunshine, Mi-3 and Miami Vice: http://actionman133.isa-geek.net:8080/preview/HDRtest.jpg
Footage from a DVCAM camera: http://actionman133.isa-geek.net:8080/preview/HDR_DV_Test.jpg
What do you reckon?
rfmmars
29th December 2006, 15:00
Thanks for giving us another tool, look good. HDRagc is hard to use unless you use AVSp with sliders for its functions, then very easy.
Richard
photorecall.net
trolltuning
30th December 2006, 19:52
I tried to use Hdrag in reverse with this and got nowhere despite trying a lot of settings. (I'm trying to get rid of the glare from the white talc on the stage). Is this just not a suitable task or did I just never find the right setting?http://members.atlantic.net/~andypo/go/britespot.JPG
or http://members.atlantic.net/~andypo/go/britespot4.avi
Only 4 frames so you need to download to view.
rfmmars
30th December 2006, 20:16
Ok using HDRagc, EQrgb 2.11, and colormill2.11.
http://aycu07.webshots.com/image/6326/2001470403868177783_th.jpg (http://allyoucanupload.webshots.com/v/2001470403868177783)
Richard
trolltuning
30th December 2006, 23:04
Wow, nice! I've tried to download the other two filters-followed about 5 threads and Googled but never ended up with a working link. Did you use the default settings for all three? (I don't even know if there are things to set with the other two until I can download them).
Also I'm curious why I got no noticble change inverting and using HDrag by itself.
Edit:Ah just found them both. I finally realized I should search for all posts by FDump.:p :thanks:
rfmmars
31st December 2006, 01:18
Wow, nice! I've tried to download the other two filters-followed about 5 threads and Googled but never ended up with a working link. Did you use the default settings for all three? (I don't even know if there are things to set with the other two until I can download them).
Also I'm curious why I got no noticble change inverting and using HDrag by itself.
Edit:Ah just found them both. I finally realized I should search for all posts by FDump.:p :thanks:
With HDRagc I have developed a rather detailed interface using AVSp
Script:
AVISource("e:\1.vdr.avi")
LoadPlugin("e:\AVS\Plugins\AGC.dll")
LoadPlugin("e:\AVS\plugins\removegrain.dll")
LoadPlugin("e:\AVS\Plugins\mt_masktools.dll")
LoadPlugin("e:\AVS\Plugins\warpsharp.dll")
Loadplugin("e:\avs\plugins\gradfun2db.dll")
loadplugin("e:\avs\plugins\DeGrainMedian.dll")
loadplugin("e:\avs\plugins\Smoothdeinterlacer.dll")
LoadPlugin("e:\avs\plugins\Convolution3d.dll")
LoadPlugin("e:\avs\plugins\FFT3DFilter.dll")
LoadPlugin("e:\avs\plugins\VagueDenoiser.dll")
LoadPlugin("e:\avs\plugins\depan.dll")
ConvertToYV12()
[Pre-Auto Gain=0]
colorYUV(autogain=true)
[/Pre-Auto Gain]
[Analyze Input Signal=0]
colorYUV(analyze=true)
[/Analyze Input Signal]
[Open White balance=0]
colorYUV(autowhite=true)
[/Open White balance]
Smoothdeinterlace()
HDRAGC(avg_lum=[<"Screen Radial (128)", 128, 2000, 746>],mode=[<"Mode (2)", 0, 2, 2>],passes=[<"Resample (4)", 1, 9, 4>],shift_u=[<"U Color Yel. Blue (0)", -100, +100, 0>], shift_v=[<"V Color Cyan Magenta (0)", -100, +100, 0>],protect=[<"Protect (2)", 0, 2, 1>],coef_gain=[<"Shadow Brightness (1)", 0.00, 0.5, 0.28>],max_gain=[<"Max Level (3)", 0, 8, 3.9>],corrector=[<"Corrector ((0)", 0.5, 1.5, 1.25>],reducer=[<"Reducer (0.5)", 0, 2, 2.0>],avg_window=[<"Frames Adverage (30)", 0, 120, 30>],black_clip=[<"Black Clip (0.0)", 0.0, 2, 1.2>],max_sat=[<"Max Satuation (9)", 0, 20, 15>],min_sat=[<"Min Satuation (1)", 0, 2, 0.7>],coef_sat=[<"Dark Color Level (1)", 0, 2, 1.0>])
Tweak([<"Hue (0)", -60, 60, 0.0>])
Converttorgb24
RGBadjust([<"Red (0)", 0.00, 2, 1.0>],[<"Green (0)", 0.00, 2, 1.0>],[<"Blue (0)", 0.00, 2, 1.0>])
#ConverttoYV12
#motion=DepanEstimate(trust=2.5, fftw=true)
#DepanInterleave(data=motion)
#YToUV(fft3dfilter(sigma=3, plane=1).UToY,\
#fft3dfilter(sigma=3, plane=2).VToY,\
#fft3dfilter(sigma=2, plane=0))
#SelectEvery(3,1)
ConvertToYV12()
gradfun2db( )
[Grain Reduction Heavy=0]
DeGrainMedian(limitY=7,limitUV=9,mode=0)
DeGrainMedian(limitY=7,limitUV=9,mode=1)
[/Grain Reduction Heavy]
[Grain Reduction Lite=0]
DeGrainMedian(limitY=2,limitUV=3,mode=1)
DeGrainMedian(limitY=2,limitUV=3,mode=1)
[/Grain Reduction Lite]
[Large Grain Reduction=0]
DeGrainMedian(limitY=40,limitUV=56,mode=0)
[/Large Grain Reduction]
Function LimitedSharpenFaster( clip clp,
\ float "ss_x", float "ss_y",
\ int "dest_x", int "dest_y",
\ int "Smode" , int "strength", int "radius",
\ int "Lmode", bool "wide", int "overshoot", int "undershoot",
\ int "soft", int "edgemode", bool "special",
\ int "exborder" )
{
ox = clp.width
oy = clp.height
Smode = default( Smode, 3 )
ss_x = (Smode==4)
\ ? default( ss_x, 1.25)
\ : default( ss_x, 1.5 )
ss_y = (Smode==4)
\ ? default( ss_y, 1.25)
\ : default( ss_y, 1.5 )
dest_x = default( dest_x, ox )
dest_y = default( dest_y, oy )
strength = (Smode==1)
\ ? default( strength, 160 )
\ : default( strength, 100 )
strength = (Smode==2&&strength>100) ? 100 : strength
radius = default( radius, 2 )
Lmode = default( Lmode, 1 )
wide = default( wide, false )
overshoot = default( overshoot, 1)
undershoot= default( undershoot, overshoot)
softdec = default( soft, 0 )
soft = softdec!=-1 ? softdec : sqrt( (((ss_x+ss_y)/2.0-1.0)*100.0) ) * 10
soft = soft>100 ? 100 : soft
edgemode = default( edgemode, 0 )
special = default( special, false )
exborder = default( exborder, 0)
#radius = round( radius*(ss_x+ss_y)/2) # If it's you, Mug Funky - feel free to activate it again
xxs=round(ox*ss_x/8)*8
yys=round(oy*ss_y/8)*8
smx=exborder==0?dest_x:round(dest_x/Exborder/4)*4
smy=exborder==0?dest_y:round(dest_y/Exborder/4)*4
clp.isYV12() ? clp : clp.converttoyv12()
ss_x != 1.0 || ss_y != 1.0 ? last.lanczosresize(xxs,yys) : last
tmp = last
edge = mt_logic( tmp.mt_edge(thY1=0,thY2=255,"8 16 8 0 0 0 -8 -16 -8 4")
\ ,tmp.mt_edge(thY1=0,thY2=255,"8 0 -8 16 0 -16 8 0 -8 4")
\ ,"max") .mt_lut("x 128 / 0.86 ^ 255 *") #.levels(0,0.86,128,0,255,false)
tmpsoft = tmp.removegrain(11,-1)
dark_limit1 = tmp.mt_inpand()
bright_limit1 = tmp.mt_expand()
dark_limit = (wide==false) ? dark_limit1 : dark_limit1 .removegrain(20,-1).mt_inpand()
bright_limit = (wide==false) ? bright_limit1 : bright_limit1.removegrain(20,-1).mt_expand()
minmaxavg = special==false
\ ? mt_average(dark_limit1, bright_limit1)
\ : mt_merge(dark_limit,bright_limit,tmp.removegrain(11,-1),Y=3,U=-128,V=-128)
Str=string(float(strength)/100.0)
normsharp = Smode==1 ? unsharpmask(strength,radius,0)
\ : Smode==2 ? sharpen(float(strength)/100.0)
\ : Smode==3 ? mt_lutxy(tmp,minmaxavg,yexpr="x x y - "+Str+" * +")
\ : mt_lutxy(tmp,tmpsoft,"x y == x x x y - abs 16 / 1 2 / ^ 16 * "+Str+
\ " * x y - 2 ^ x y - 2 ^ "+Str+" 100 * 25 / + / * x y - x y - abs / * + ?")
OS = string(overshoot)
US = string(undershoot)
mt_lutxy( bright_limit, normsharp, yexpr="y x "+OS+" + < y x y x - "+OS+" - 1 2 / ^ + "+OS+" + ?")
mt_lutxy( dark_limit, last, yexpr="y x "+US+" - > y x x y - "+US+" - 1 2 / ^ - "+US+" - ?")
Lmode==1 ? mt_clamp(normsharp, bright_limit, dark_limit, overshoot, undershoot) : last
normal = last
zero = mt_clamp(normsharp, bright_limit, dark_limit, 0,0)
Lmode==3 ? mt_merge(normal,zero,edge.mt_inflate()) : normal
edgemode==0 ? last
\ : edgemode==1 ? mt_merge(tmp,last,edge.mt_inflate().mt_inflate().removegrain(11,-1),Y=3,U=1,V=1)
\ : mt_merge(last,tmp,edge.mt_inflate().mt_inflate().removegrain(11,-1),Y=3,U=1,V=1)
AMNT = string(soft)
AMNT2 = string(100-soft)
sharpdiff=mt_makediff(tmp,last)
sharpdiff2=mt_lutxy(sharpdiff,sharpdiff.removegrain(19,-1),
\ "x 128 - abs y 128 - abs > y "+AMNT+" * x "+AMNT2+" * + 100 / x ?")
soft==0 ? last : mt_makediff(tmp,sharpdiff2)
(ss_x != 1.0 || ss_y != 1.0)
\ || (dest_x != ox || dest_y != oy) ? lanczosresize(dest_x,dest_y) : last
ex=blankclip(last,width=smx,height=smy,color=$FFFFFF).addborders(2,2,2,2).coloryuv(levels="TV->PC")
\.blur(1.3).mt_inpand().blur(1.3).bicubicresize(dest_x,dest_y,1.0,.0)
tmp = clp.lanczosresize(dest_x,dest_y)
clp.isYV12() ? ( exborder==0 ? tmp.mergeluma(last)
\ : mt_merge(tmp,last,ex,Y=3,U=1,V=1) )
\ : ( exborder==0 ? tmp.mergeluma(last.converttoyuy2())
\ : tmp.mergeluma( mt_merge(tmp.converttoyv12(),last,ex,Y=3,U=1,V=1)
\ .converttoyuy2()) )
(edgemode!= -1) ? last : edge.lanczosresize(dest_x,dest_y).greyscale
}
LimitedSharpenFaster(Smode=1, ss_x=2.0, ss_y=2.0,strength=400, overshoot=2)
[Post-Auto Gain=0]
colorYUV(autogain=true)
[/Post-Auto Gain]
[White Balance=0]
colorYUV(autowhite=true)
[/White Balance]
[Analyze Signal Output=0]
colorYUV(analyze=true)
[/Analyze Signal Output]
ConverttoYUY2()
[3D Convolution=0]
Convolution3D (0, 32, 128, 16, 64, 10, 0)
[/3D Convolution]
return last
EQrgb 2.11 has 17 sliders plus 2 posistion adjustments using RGB grouped.
I just used Colormoll this time just for gamma since that funtion in EQrgb is broken. Need to add that to the AVSp script.
Richard
paviko
21st January 2007, 13:01
Hello,
@actionman133
Nice script, thanks.
I needed hdragc funcionality for lots of image, so I was forced to write GIMP plugin :) Again, I was not satisfied with some results ;) and I've simplified whole algorithm. Almost nothing has left from real HDR technics, but I think that for normal pictures (not HDR) it gives now even better results.
HDRAGC 2.0.0 Beta for GIMP 2.x Win32
Download Hdragc 2.0.0 Beta for GIMP 2.x Win32 (http://strony.aster.pl/paviko/Hdragc-2.0.0betaGimp.zip)
- new algorithm
- highlights enhancements
Known bugs:
- preview is not working as it should
- controls are not organized (hmm... how to add checkbox in GTK+ :D)
It's recommended to use HDRAGC GIMP with good denoiser like Dcam Noise.
Plans:
Move the new algorithm to AviSynth plugin and then release source code.
Regards
Adub
21st January 2007, 21:39
Cool! I await the avisynth version.
Pookie
22nd January 2007, 08:51
Hey Paviko - Thanks for the links to those other HDR sites. I had to laugh, some were mentioning HDR video as though it was brand new technology. You've been doing it for almost 2 years! :D
taeuber
22nd April 2007, 17:20
Hi Paviko,
I really appreciate your efforts. Thanks!
I downloaded your GIMP plugin in the hope it would be written in the scheme scripting dialect for GIMP. So I just wanted to give it a try under Linux. But I had bad luck. :(
Anyway when you release the source maybe I'm able to port it to Linux if I'm allowed to.
Thanks
Lars
Isochroma
15th May 2007, 02:54
I've taken a great liking to this plugin, for video and now for still images!
Sample script:
imagesource("everything and nothing.jpg", fps=1, end=0) + converttorgb24(killaudio(blankclip(length=1, width=1083, height=720, fps=1)))
lanczos4resize(3610,2400)
converttoyuy2()
hdragc(max_gain=1.5,avg_lum=200,coef_gain=1.0,freezer=1)
converttorgb32()
lanczos4resize(1805,1200)
imagewriter("F:\Desktop\Output.bmp", 0, 0, "bmp")
1. get source image create
2. append a blank frame, so to use freezer=1 which allows hdragc to work properly.
3. upscale image to twice the size of the final size desired, to avoid chroma subsampling loss, and also make it even for yuy2 conversion
4. convert to YUY2
5. gain, specifying analysis frame as 1
6. upsample back to RGB32
7. resize to output size
8. write image
The results have been truly fantastic on still images, nothing else can compare!
Note that we put the source image into frame 0, and the black frame into 1. This is so that when the script is opened in Vdub, it immediately spits out the output image, rather than having the need to manually step to frame 1.
superuser
14th July 2007, 03:29
I had couple of question on HDRAGC params. Generally it clears the image pretty well and increases the gain, but the following observed points sort of upsets me
- color depth is lost. Looks like colors are diluted after processing with the filter.
- if I try to improve the depth of colors using saturation+black_clip with vairable values of corrector, there are artifacts in dark colors esp black and dark blue. More of halos sort of effect with those colors.
- There is blurriness in screen titles which appear in white.
For one of the source I had tweaked hdragc with following params:
HDRAGC(Edit: blnked)
I am using black_clip = 0.0 as I bump up black_clip > 0, I start seeing artefacts in violet color. Also have to keep corrector close to 0.5 and 0.4 to avoid halos with Black Color.
and later I am processing resultant of hdragc with tweak darken a bit with brightness params in negative, followed by denoiser and sharpner.
I may be doing something stupid also above, please any suggestion on how to avoid such colors artefacts with hdragc? Also what would be other suggested color corrector to be used in combination with hdragc?
Regards
rfmmars
14th July 2007, 07:17
I use HDRagc everyday without the problems you are stating.
1st Are you using the lastest version 1.87, there were artifacts in earlier version. One big thing is not to have the clip start with a black screen. I suggest apending a netual gray front end.
2nd If you haven't converted your HDRagc script to Avs-P, then your spinning your wheels.
3rd Be carefull of the U V settings, overdone can interduce artifacts.
4th There is no one setting that does it all, split the clip up into sections and test settings with A-B source.
I use Virtualdub to frameserve to Avs-P's HDRagc script and output it back to another copy of VDub.
Richard
photorecall.net
superuser
14th July 2007, 07:49
yes I am using ver 1.8.7 and sorry if it appears in any way I m criticizing or complaining about the above filter. .
And for determining appropriate settings for the source am using Avs-P else it would be very difficult. And in fact for the same purpose long back had copied lines of hdragc() from ur post (http://forum.doom9.org/showpost.php?p=923679&postcount=172)
Of the UV settings, I am using it to balance greenish and reddish component in the clip and also to darken the black component.
The intent of my post is to ask if in my settings there are visible params which sort of stands out and can produce artefacts.
rfmmars
14th July 2007, 19:47
This is my latest Avs-p HDRace script........to be used with Avs-p 1.39 or later.
AVISource("e:\1.vdr.avi")
LoadPlugin("e:\AVS\Plugins\AGC.dll")
LoadPlugin("e:\AVS\plugins\removegrain.dll")
LoadPlugin("e:\AVS\Plugins\mt_masktools.dll")
LoadPlugin("e:\AVS\Plugins\warpsharp.dll")
Loadplugin("e:\avs\plugins\gradfun2db.dll")
loadplugin("e:\avs\plugins\DeGrainMedian.dll")
loadplugin("e:\avs\plugins\Smoothdeinterlacer.dll")
LoadPlugin("e:\avs\plugins\Convolution3d.dll")
LoadPlugin("e:\avs\plugins\FFT3DFilter.dll")
LoadPlugin("e:\avs\plugins\VagueDenoiser.dll")
LoadPlugin("e:\avs\plugins\depan.dll")
LoadPlugin("e:\avs\plugins\depanEstimate.dll")
LoadPlugin("E:\AVS\Plugins\repair.dll")
LoadPlugin("E:\AVS\Plugins\masktools.dll")
LoadPlugin("e:\avs\plugins\mvtools.dll")
import("E:\avs\seesaw6.avs")
SetMemoryMax(512)
ConverttoYv12()
[<separator="DeHalo">]
function abcxyz(clip clp, int "rad", int "ss")
{
rad=([<"Radius (3)", -1.0, 20.0, 1.2>]) # radius for halo removal
ss=([<"Super Sampling (1)", -0.2, 3, 0.6>]) # radius for supersampling / ss=1.0 -> no supersampling
ox = clp.width()
oy = clp.height()
x = clp.bicubicresize(m4(ox/rad),m4(oy/rad)).bicubicresize(ox,oy,1,0)
y = yv12lutxy(clp,x,"x 8 + y < x 8 + x 24 - y > x 24 - y ? ? x y - abs * x 32 x y - abs - * + 32 /",U=2,V=2)
z1 = repair(clp,y,1)
maxbig = y.expand().bicubicresize(m4(ox*ss),m4(oy*ss))
minbig = y.inpand().bicubicresize(m4(ox*ss),m4(oy*ss))
z2 = clp.lanczosresize(m4(ox*ss),m4(oy*ss))
z2 = z2.logic(maxbig,"min",U=2,V=2).logic(minbig,"max",U=2,V=2).lanczosresize(ox,oy)
return( (ss==1.0) ? z1 : z2 )
}
abcxyz()
function m4(float x) {return( x<16?16:int(round(x/4.0)*4)) }
ConverttoYUY2()
[HQ Movie=0]
Convolution3D (preset="movieHQ")
[/HQ Movie]
[LQ Movie=0]
Convolution3D (preset="movieLQ")
[/LQ Movie]
[Bad Tape=0]
Convolution3D (0,32,128,16,64,10,0)
[/Bad Tape]
ConvertToYV12()
[Pre-Auto Gain=0]
colorYUV(autogain=true)
[/Pre-Auto Gain]
[Analyze Input Signal=0]
colorYUV(analyze=true)
[/Analyze Input Signal]
[Open White balance=0]
colorYUV(autowhite=true)
[/Open White balance]
Smoothdeinterlace()
[<separator="HDRagc">]
HDRAGC(avg_lum=[<"Screen Radial (128)", 128, 2000, 596>],mode=[<"Mode (2)", 0, 2, 2>],passes=[<"Resample (4)", 1, 9, 1>],shift_u=[<"U Color Yel. Blue (0)", -100, +100, -20>], shift_v=[<"V Color Cyan Magenta (0)", -100, +100, -1>],protect=[<"Protect (2)", 0, 2, 1>],coef_gain=[<"Shadow Brightness (1)", 0.00, 0.5, 0.33>],max_gain=[<"Max Level (3)", 0.00, 8, 5.58>],corrector=[<"Corrector ((0)", 0.5, 1.5, 0.8>],reducer=[<"Reducer (0.5)", 0, 2, 2.0>],avg_window=[<"Frames Adverage (30)", 0, 120, 30>],black_clip=[<"Black Clip (0.00)", 0.0, 2, 0.8>],max_sat=[<"Max Satuation (9)", 0.00, 4, 3.68>],min_sat=[<"Min Satuation (1)", 0.00, 2, 1.06>],coef_sat=[<"Dark Color Level (1)", 0, 2, 1.9>])
[<separator="Color Balance">]
Tweak([<"Hue (0)", -60, 60, 0.8>])
[RGB Adjust=0]
[<separator="RGB Setup">]
Converttorgb24
RGBadjust([<"Red (0)", 0.00, 2, 1.0>],[<"Green (0)", 0.00, 2, 1.0>],[<"Blue (0)", 0.00, 2, 0.95>])
ConverttoYV12
[/RGB Adjust]
motion=DepanEstimate(trust=2.5, fftw=true)
DepanInterleave(data=motion)
YToUV(fft3dfilter(sigma=3, plane=1).UToY,\
fft3dfilter(sigma=3, plane=2).VToY,\
fft3dfilter(sigma=2, plane=0))
SelectEvery(3,1)
[Lite Grain=0]
DeGrainMedian(limitY=2,limitUV=3,mode=0,interlaced=false)
DeGrainMedian(limitY=2,limitUV=3,mode=1,interlaced=false)
[/Lite Grain]
[Medium Grain=0]
DeGrainMedian(limitY=7,limitUV=9,mode=0,interlaced=false)
DeGrainMedian(limitY=7,limitUV=9,mode=1,interlaced=false)
[/Medium Grain]
[Med-Heavy Grain=0]
DeGrainMedian(limitY=40,limitUV=56,mode=0,interlaced=false)
[/Med-Heavy Grain]
[Bad Grain=0]
DeGrainMedian(limitY=20,limitUV=28,mode=0,interlaced=false)
DeGrainMedian(limitY=20,limitUV=28,mode=1,interlaced=false)
[/Bad Grain]
[<separator="Noise Reduction 1">]
[Noise Redution 1=0]
DeGrainMedian([<"Y-NOISE-1", 0, 255, 20>],[<"UV-NOISE-1", 0, 255, 28>],[<"MODE-1", 0, 5, 0>],interlaced=false)
[/Noise Redution 1]
[<separator="Noise Reduction 2">]
[Noise Reduction 2=0]
DeGrainMedian([<"Y-NOISE-2", 0, 255, 0>],[<"UV-NOISE-2", 0, 255, 40>],[<"MODE-2", 0, 5, 1>],interlaced=false)
[/Noise Reduction 2]
Function LimitedSharpenFaster( clip clp,
\ float "ss_x", float "ss_y",
\ int "dest_x", int "dest_y",
\ int "Smode" , int "strength", int "radius",
\ int "Lmode", bool "wide", int "overshoot", int "undershoot",
\ int "soft", int "edgemode", bool "special",
\ int "exborder" )
{
ox = clp.width
oy = clp.height
Smode = default( Smode, 3 )
ss_x = (Smode==4)
\ ? default( ss_x, 1.25)
\ : default( ss_x, 1.5 )
ss_y = (Smode==4)
\ ? default( ss_y, 1.25)
\ : default( ss_y, 1.5 )
dest_x = default( dest_x, ox )
dest_y = default( dest_y, oy )
strength = (Smode==1)
\ ? default( strength, 160 )
\ : default( strength, 100 )
strength = (Smode==2&&strength>100) ? 100 : strength
radius = default( radius, 2 )
Lmode = default( Lmode, 1 )
wide = default( wide, false )
overshoot = default( overshoot, 1)
undershoot= default( undershoot, overshoot)
softdec = default( soft, 0 )
soft = softdec!=-1 ? softdec : sqrt( (((ss_x+ss_y)/2.0-1.0)*100.0) ) * 10
soft = soft>100 ? 100 : soft
edgemode = default( edgemode, 0 )
special = default( special, false )
exborder = default( exborder, 0)
#radius = round( radius*(ss_x+ss_y)/2) # If it's you, Mug Funky - feel free to activate it again
xxs=round(ox*ss_x/8)*8
yys=round(oy*ss_y/8)*8
smx=exborder==0?dest_x:round(dest_x/Exborder/4)*4
smy=exborder==0?dest_y:round(dest_y/Exborder/4)*4
clp.isYV12() ? clp : clp.converttoyv12()
ss_x != 1.0 || ss_y != 1.0 ? last.lanczosresize(xxs,yys) : last
tmp = last
edge = mt_logic( tmp.mt_edge(thY1=0,thY2=255,"8 16 8 0 0 0 -8 -16 -8 4")
\ ,tmp.mt_edge(thY1=0,thY2=255,"8 0 -8 16 0 -16 8 0 -8 4")
\ ,"max") .mt_lut("x 128 / 0.86 ^ 255 *") #.levels(0,0.86,128,0,255,false)
tmpsoft = tmp.removegrain(11,-1)
dark_limit1 = tmp.mt_inpand()
bright_limit1 = tmp.mt_expand()
dark_limit = (wide==false) ? dark_limit1 : dark_limit1 .removegrain(20,-1).mt_inpand()
bright_limit = (wide==false) ? bright_limit1 : bright_limit1.removegrain(20,-1).mt_expand()
minmaxavg = special==false
\ ? mt_average(dark_limit1, bright_limit1)
\ : mt_merge(dark_limit,bright_limit,tmp.removegrain(11,-1),Y=3,U=-128,V=-128)
Str=string(float(strength)/100.0)
normsharp = Smode==1 ? unsharpmask(strength,radius,0)
\ : Smode==2 ? sharpen(float(strength)/100.0)
\ : Smode==3 ? mt_lutxy(tmp,minmaxavg,yexpr="x x y - "+Str+" * +")
\ : mt_lutxy(tmp,tmpsoft,"x y == x x x y - abs 16 / 1 2 / ^ 16 * "+Str+
\ " * x y - 2 ^ x y - 2 ^ "+Str+" 100 * 25 / + / * x y - x y - abs / * + ?")
OS = string(overshoot)
US = string(undershoot)
mt_lutxy( bright_limit, normsharp, yexpr="y x "+OS+" + < y x y x - "+OS+" - 1 2 / ^ + "+OS+" + ?")
mt_lutxy( dark_limit, last, yexpr="y x "+US+" - > y x x y - "+US+" - 1 2 / ^ - "+US+" - ?")
Lmode==1 ? mt_clamp(normsharp, bright_limit, dark_limit, overshoot, undershoot) : last
normal = last
zero = mt_clamp(normsharp, bright_limit, dark_limit, 0,0)
Lmode==3 ? mt_merge(normal,zero,edge.mt_inflate()) : normal
edgemode==0 ? last
\ : edgemode==1 ? mt_merge(tmp,last,edge.mt_inflate().mt_inflate().removegrain(11,-1),Y=3,U=1,V=1)
\ : mt_merge(last,tmp,edge.mt_inflate().mt_inflate().removegrain(11,-1),Y=3,U=1,V=1)
AMNT = string(soft)
AMNT2 = string(100-soft)
sharpdiff=mt_makediff(tmp,last)
sharpdiff2=mt_lutxy(sharpdiff,sharpdiff.removegrain(19,-1),
\ "x 128 - abs y 128 - abs > y "+AMNT+" * x "+AMNT2+" * + 100 / x ?")
soft==0 ? last : mt_makediff(tmp,sharpdiff2)
(ss_x != 1.0 || ss_y != 1.0)
\ || (dest_x != ox || dest_y != oy) ? lanczosresize(dest_x,dest_y) : last
ex=blankclip(last,width=smx,height=smy,color=$FFFFFF).addborders(2,2,2,2).coloryuv(levels="TV->PC")
\.blur(1.3).mt_inpand().blur(1.3).bicubicresize(dest_x,dest_y,1.0,.0)
tmp = clp.lanczosresize(dest_x,dest_y)
clp.isYV12() ? ( exborder==0 ? tmp.mergeluma(last)
\ : mt_merge(tmp,last,ex,Y=3,U=1,V=1) )
\ : ( exborder==0 ? tmp.mergeluma(last.converttoyuy2())
\ : tmp.mergeluma( mt_merge(tmp.converttoyv12(),last,ex,Y=3,U=1,V=1)
\ .converttoyuy2()) )
(edgemode!= -1) ? last : edge.lanczosresize(dest_x,dest_y).greyscale
}
[<separator="Sharping">]
LimitedSharpenFaster(Smode=1, ss_x=2.0, ss_y=2.0,strength=[<"Sharpness (400)", 0, 2400, 129>],overshoot=[<"OverShoot (0)", 0, 6, 0>])
[Post-Auto Gain=0]
colorYUV(autogain=true)
[/Post-Auto Gain]
[White Balance=0]
colorYUV(autowhite=true)
[/White Balance]
[Analyze Signal Output=0]
colorYUV(analyze=true)
[/Analyze Signal Output]
### Some values can not have sliders, if you move one of these values, it will crash and will not reset...AVS-p
### re-edits the lines incorrectly
#
#SetMTmode(2,2)
#[<separator="SeeSaw">]
#SeeSaw(NRlimit=[<"NR-Limit(4)",.1,10,4>],NRlimit2=[<"NR-Limit2(5)", .1, 10, 4>], Sstr=[<"Sstr(1.5)",.1,10,1.5>], #Slimit=[<"Slimit(9)",.1,20,9>], Spower=[<"Spower(9)",.1,20,9>], Szp=[<"Spz(16)",.1,30,16>], #sootheT=[<"smootheT(8)",.1,20,8>], bias=[<"Bias(40)",.1,80,40>] )
#
#New code
[<separator="SeeSaw">]
SetMTmode(2,2)
SeeSaw( NRlimit=10,NRlimit2=5, Sstr=[<"Sstr(1.5)", .1, 10, 4.2>],Slimit=9,Spower=9, Szp=[<"Spz(16)", .1, 30, 16.6>],sootheT=80, bias=[<"Bias(40)", .1, 80, 40.4>] )
[SeeSaw 2=0]
[<separator="SeeSaw 2">]
SeeSaw( NRlimit=4, NRlimit2=5, Sstr=1.5, Slimit=9, Spower=9, Szp=16, sootheT=80, bias=40)
[/SeeSaw 2]
[Invert Video=0]
INVERT()
[/Invert Video]
return last
Could you post some frames of the problem?
Richard
EuropeanMan
6th August 2007, 18:27
Can someone please tell me why some arguments are not valid with this line?
HDRAGC(B,avg_lum=1078,mode=2,passes=4,shift_u=-15, shift_v=6,protect=2,coef_gain=0.22,max_gain=4.0,corrector=0.8,reducer=1.1,avg_window=30,black_clip=0.3,min_sat=0.4, max_sat=16, coef_sat=1.0)
passes
shift_u
shift_v
protect
corrector
reducer
black_clip
these arguments are erroring out in AVSp...when I take them out, then MPC crashes while playing... :(
superuser
7th August 2007, 02:48
^ above lines work for me. use the rfmmars template for avsp.
johnmeyer
29th August 2007, 17:54
Previous posts have questioned whether the black_clip parameter works correctly. I don't think it does. Here are my settings:final=source.HDRAGC(coef_gain=3,shift_u =-20,coef_sat=1,min_gain=1.3,avg_window=1,shift=0,corrector=.75,black_clip=0.00029,protect=1,debug=0)This produces this result:
http://i177.photobucket.com/albums/w208/johnmeyer/Result_01.jpg
However, if I change black_clip from 0.00029 to 0.00028, I get this:
http://i177.photobucket.com/albums/w208/johnmeyer/Result_02.jpg
If I change to 0.00030 or to 0.00027, I don't get any noticeable change. Thus, there appears to be a step function
behavior with this paramater.
AlanHK
24th December 2007, 10:20
I've got an old space opera movie, which is rather too dark.
Just using
HDRAGC()
gives decent results for most scenes (especially interiors). However, some "outer space" scenes, with large areas of black sky, are brightened too much.
Is there a setting that would not overbrighten this kind of scene? (I guessed from the name that "black_clip" might do that but I can't understand how this parameter works.)
I was hoping for something like "if more than x% of the frame is more than y% black don't mess with it".
I also tried
ColorYUV(autogain=true)
which also worked okay on most scenes, but really messed up the black sky scenes, making them full of grey blocks.
rfmmars
24th December 2007, 15:24
Is there a setting that would not overbrighten this kind of scene? (I guessed from the name that "black_clip" might do that but I can't understand how this parameter works.)
Look at the script that I posted above, it has everything you need, tons of sliders for "HDRagc, must use "AVS-p" or you are spinning your wheels.
TIP: Never start with a clip that is all black or very bright.
Richard
photorecall.net
AlanHK
24th December 2007, 20:12
Look at the script that I posted above, it has everything you need, tons of sliders for "HDRagc, must use "AVS-p" or you are spinning your wheels.
TIP: Never start with a clip that is all black or very bright.
Thanks, I do use AVsP.
In the current version (2) it's defined as "AGC_HDRAGC", but doesn't have any sliders defined; I used yours with some changes.
(You might like to correct a few typos:
Adverage -> Average
Satuation -> Saturation.)
But I'm afraid the explanations of what they do is not clear to me, and randomly twiddling them has not got me far.
Can you advise just what "Black_clip" does?
And what do you mean by "Never start with a clip that is all black? Start what?
rfmmars
25th December 2007, 01:30
Hi, yes am Mr. "Typo" for sure.
Her's the lastest script
------------------------------------------------------------
AVISource("e:\1.vdr.avi")
#ImageSource("E:\train.bmp")
LoadPlugin("e:\AVS\Plugins\AGC.dll")
LoadPlugin("e:\AVS\plugins\removegrain.dll")
LoadPlugin("e:\AVS\Plugins\mt_masktools.dll")
LoadPlugin("e:\AVS\Plugins\warpsharp.dll")
Loadplugin("e:\avs\plugins\gradfun2db.dll")
loadplugin("e:\avs\plugins\DeGrainMedian.dll")
loadplugin("e:\avs\plugins\Smoothdeinterlacer.dll")
LoadPlugin("e:\avs\plugins\Convolution3d.dll")
LoadPlugin("e:\avs\plugins\FFT3DFilter.dll")
LoadPlugin("e:\avs\plugins\VagueDenoiser.dll")
LoadPlugin("e:\avs\plugins\depan.dll")
LoadPlugin("e:\avs\plugins\depanEstimate.dll")
LoadPlugin("E:\AVS\Plugins\repair.dll")
LoadPlugin("E:\AVS\Plugins\masktools.dll")
LoadPlugin("e:\avs\plugins\mvtools.dll")
LoadPlugin("e:\avs\plugins\autolevels.dll")
LoadPlugin("e:\avs\plugins\GrainOpt.dll")
LoadPlugin("e:\avs\plugins\MSU_FRC.dll")
import("E:\avs\seesaw6.avs")
LoadPlugin("e:\avs\plugins\DGbob.dll")
SetMemoryMax(512)
ConverttoYv12()
Autolevels(filterRadius=5,sceneChgThresh=254)
#Autolevels(filterRadius=8, sceneChgThresh=10,
ConvertToYV12()
HDRAGC(avg_lum=2000,mode=2,passes=1,shift_u=-31, shift_v=0,protect=2,coef_gain=0.5,max_gain=6.3,corrector=1.31,reducer=2.0,avg_window=16,black_clip=0.0,max_sat=1.56,min_sat=1.19,coef_sat=0.9)
Tweak(-1.692,1.1,-18.36,1.0)
Converttorgb24
RGBadjust(1.0,1.04,1.0)
ConverttoYV12
#SeeSaw( NRlimit=4, NRlimit2=5, Sstr=1.5, Slimit=9, Spower=9, Szp=16, sootheT=80, bias=40)
return last
### AvsP marked script ###
# AVISource("e:\1.vdr.avi")
# #ImageSource("E:\train.bmp")
# LoadPlugin("e:\AVS\Plugins\AGC.dll")
# LoadPlugin("e:\AVS\plugins\removegrain.dll")
# LoadPlugin("e:\AVS\Plugins\mt_masktools.dll")
# LoadPlugin("e:\AVS\Plugins\warpsharp.dll")
# Loadplugin("e:\avs\plugins\gradfun2db.dll")
# loadplugin("e:\avs\plugins\DeGrainMedian.dll")
# loadplugin("e:\avs\plugins\Smoothdeinterlacer.dll")
# LoadPlugin("e:\avs\plugins\Convolution3d.dll")
# LoadPlugin("e:\avs\plugins\FFT3DFilter.dll")
# LoadPlugin("e:\avs\plugins\VagueDenoiser.dll")
# LoadPlugin("e:\avs\plugins\depan.dll")
# LoadPlugin("e:\avs\plugins\depanEstimate.dll")
# LoadPlugin("E:\AVS\Plugins\repair.dll")
# LoadPlugin("E:\AVS\Plugins\masktools.dll")
# LoadPlugin("e:\avs\plugins\mvtools.dll")
# LoadPlugin("e:\avs\plugins\autolevels.dll")
# LoadPlugin("e:\avs\plugins\GrainOpt.dll")
# LoadPlugin("e:\avs\plugins\MSU_FRC.dll")
# import("E:\avs\seesaw6.avs")
# LoadPlugin("e:\avs\plugins\DGbob.dll")
# SetMemoryMax(512)
#
#
#
#
#
# ConvertToYV12()
#
# [MSU Slow Motion=0]
# MSU_FRC(4, "slow")
# [/MSU Slow Motion]
#
#
# [Super Motion=0]
# function MotionProtectedFPS(
# \ clip input, float FPS,
# \ int "mode", int "protection",
# \ int "iterate", int "reset", int "initialise")
# {
# mode = default(mode, warpfast)
# protection = default(protection, 80)
# iterate = default(iterate, 2)
# reset = default(reset, 50)
# initialise = default(initialise, 6)
#
# originalFPS = input.framerate()
# input
#
# mp = temporalsoften(2,4,5,2).FindMotion(iterate = iterate, reset = reset,
# \ initialise = initialise)
# p = MotionFPS(FPS,mode,Motion = mp)
# maskp = mp.SumStretchFPSMask(FPS, protection)
#
# mn = temporalsoften(2,4,5,2).FindMotion(iterate = iterate, reset = reset,
# \ initialise = initialise, from = next)
# n = MotionFPS(FPS,mode,Motion = mn, source = next)
# maskn = mn.SumStretchFPSMask(FPS, protection, source = next)
#
# maskp
# assumeFPS(originalFPS)
# CombineFPS(FPS, maskp, maskn.Invert())
# bilinearresize(width*8, height*8)
# crop(0, 0, input.width(), input.height())
# fity2uv()
#
# maskedmerge(p, n, last, u=3, v=3)
# }
# [/Super Motion]
#
#
#
# GrainOptimizer()
#
#
# [First Invert=0]
# INVERT()
# [/First Invert]
#
#
# ConverttoYv12()
#
# Smoothdeinterlace()
#
#
#
#
#
# [<separator="AutoLevels">]
#
# Autolevels(filterRadius=[<"Radius(8)", 0, 20, 5>],sceneChgThresh=[<"Threshold(10)", 0, 255, 254>])
#
#
# #Autolevels(filterRadius=8, sceneChgThresh=10,
#
#
#
#
#
# [<separator="Refocus>]
#
# function abcxyz(clip clp, int "rad", int "ss")
# {
# ss=([<"Core (1)", 0.00, 2.00, 0.64>]) # radius for supersampling / ss=1.0 -> no supersampling
# rad=([<"Refocus (3)", 0.0, 20.0, 0.9>]) # radius for halo removal
#
#
# ox = clp.width()
# oy = clp.height()
#
# x = clp.bicubicresize(m4(ox/rad),m4(oy/rad)).bicubicresize(ox,oy,1,0)
# y = yv12lutxy(clp,x,"x 8 + y < x 8 + x 24 - y > x 24 - y ? ? x y - abs * x 32 x y - abs - * + 32 /",U=2,V=2)
# z1 = repair(clp,y,1)
# maxbig = y.expand().bicubicresize(m4(ox*ss),m4(oy*ss))
# minbig = y.inpand().bicubicresize(m4(ox*ss),m4(oy*ss))
# z2 = clp.lanczosresize(m4(ox*ss),m4(oy*ss))
# z2 = z2.logic(maxbig,"min",U=2,V=2).logic(minbig,"max",U=2,V=2).lanczosresize(ox,oy)
#
# return( (ss==1.0) ? z1 : z2 )
# }
# abcxyz()
#
# function m4(float x) {return( x<16?16:int(round(x/4.0)*4)) }
#
#
#
#
# [<separator="DeHalo">]
#
# function abcxyz(clip clp, int "rad", int "ss")
# {
# rad=([<"Radius (3)", -1.0, 20.0, 0.3>]) # radius for halo removal
# ss=([<"Super Sampling (1)", -0.2, 3, 1.2>]) # radius for supersampling / ss=1.0 -> no supersampling
#
# ox = clp.width()
# oy = clp.height()
#
# x = clp.bicubicresize(m4(ox/rad),m4(oy/rad)).bicubicresize(ox,oy,1,0)
# y = yv12lutxy(clp,x,"x 8 + y < x 8 + x 24 - y > x 24 - y ? ? x y - abs * x 32 x y - abs - * + 32 /",U=2,V=2)
# z1 = repair(clp,y,1)
# maxbig = y.expand().bicubicresize(m4(ox*ss),m4(oy*ss))
# minbig = y.inpand().bicubicresize(m4(ox*ss),m4(oy*ss))
# z2 = clp.lanczosresize(m4(ox*ss),m4(oy*ss))
# z2 = z2.logic(maxbig,"min",U=2,V=2).logic(minbig,"max",U=2,V=2).lanczosresize(ox,oy)
#
# return( (ss==1.0) ? z1 : z2 )
# }
# abcxyz()
#
# function m4(float x) {return( x<16?16:int(round(x/4.0)*4)) }
#
#
#
#
#
# ConverttoYUY2()
#
# [HQ Movie=0]
# Convolution3D (preset="movieHQ")
# [/HQ Movie]
#
#
# [LQ Movie=0]
# Convolution3D (preset="movieLQ")
# [/LQ Movie]
#
#
# [Bad Tape=0]
# Convolution3D (0,32,128,16,64,10,0)
# [/Bad Tape]
#
#
#
#
# ConvertToYV12()
#
#
#
# [Pre-Auto Gain=0]
# colorYUV(autogain=true)
# [/Pre-Auto Gain]
#
#
# [Analyze Input Signal=0]
# colorYUV(analyze=true)
# [/Analyze Input Signal]
#
#
# [Open White balance=0]
# colorYUV(autowhite=true)
# [/Open White balance]
#
#
#
# [<separator="HDRagc">]
#
# HDRAGC(avg_lum=[<"Screen Radial (128)", 128, 2000, 2000>],mode=[<"Mode (2)", 0, 2, 2>],passes=[<"Resample (4)", 1, 9, 1>],shift_u=[<"U Color Yel. Blue (0)", -100, +100, -31>], shift_v=[<"V Color Cyan Magenta (0)", -100, +100, 0>],protect=[<"Protect (2)", 0, 2, 2>],coef_gain=[<"Shadow Brightness (1)", 0.00, 0.5, 0.5>],max_gain=[<"Max Level (3)", 0.00, 8, 6.3>],corrector=[<"Corrector ((0)", 0.50, 1.50, 1.31>],reducer=[<"Reducer (0.5)", 0, 2, 2.0>],avg_window=[<"Frames Adverage (30)", 0, 120, 16>],black_clip=[<"Black Clip (0.00)", 0.00, 2.00, 0.0>],max_sat=[<"Max Satuation (9)", 0.00, 4, 1.56>],min_sat=[<"Min Satuation (1)", 0.00, 2, 1.19>],coef_sat=[<"Dark Color Level (1)", 0, 2, 0.9>])
#
#
# [<separator="Color Balance">]
# Tweak([<"Hue (0)", -60.00, 60.00, -1.692>],[<"sat(2)", 0.00, 20.00, 1.1>],[<"Bright", -50.00, 50.00, -18.36>],[<"Cont", 0.00, 2.00, 1.0>])
#
# [<separator="RGB Setup">]
# [RGB Adjust=1]
# Converttorgb24
# RGBadjust([<"Red (0)", 0.00, 2, 1.0>],[<"Green (0)", 0.00, 2, 1.04>],[<"Blue (0)", 0.00, 2, 1.0>])
#
# ConverttoYV12
# [/RGB Adjust]
#
#
#
# motion=DepanEstimate(trust=2.5, fftw=true)
# DepanInterleave(data=motion)
# YToUV(fft3dfilter(sigma=3, plane=1).UToY,\
# fft3dfilter(sigma=3, plane=2).VToY,\
# fft3dfilter(sigma=2, plane=0))
# SelectEvery(3,1)
#
#
# [Lite Grain=0]
# DeGrainMedian(limitY=2,limitUV=3,mode=0,interlaced=false)
# DeGrainMedian(limitY=2,limitUV=3,mode=1,interlaced=false)
# [/Lite Grain]
#
# [Medium Grain=0]
# DeGrainMedian(limitY=7,limitUV=9,mode=0,interlaced=false)
# DeGrainMedian(limitY=7,limitUV=9,mode=1,interlaced=false)
# [/Medium Grain]
#
#
#
#
# [Med-Heavy Grain=0]
# DeGrainMedian(limitY=40,limitUV=56,mode=0,interlaced=false)
# [/Med-Heavy Grain]
#
# [Bad Grain=0]
# DeGrainMedian(limitY=20,limitUV=28,mode=0,interlaced=false)
# DeGrainMedian(limitY=20,limitUV=28,mode=1,interlaced=false)
# [/Bad Grain]
#
# [<separator="Noise Reduction 1">]
# [Noise Redution 1=0]
# DeGrainMedian([<"Y-NOISE-1", 0, 255, 20>],[<"UV-NOISE-1", 0, 255, 28>],[<"MODE-1", 0, 5, 0>],interlaced=false)
# [/Noise Redution 1]
# [<separator="Noise Reduction 2">]
# [Noise Reduction 2=0]
# DeGrainMedian([<"Y-NOISE-2", 0, 255, 0>],[<"UV-NOISE-2", 0, 255, 40>],[<"MODE-2", 0, 5, 1>],interlaced=false)
# [/Noise Reduction 2]
#
#
# Function LimitedSharpenFaster( clip clp,
# \ float "ss_x", float "ss_y",
# \ int "dest_x", int "dest_y",
# \ int "Smode" , int "strength", int "radius",
# \ int "Lmode", bool "wide", int "overshoot", int "undershoot",
# \ int "soft", int "edgemode", bool "special",
# \ int "exborder" )
# {
# ox = clp.width
# oy = clp.height
#
# Smode = default( Smode, 3 )
# ss_x = (Smode==4)
# \ ? default( ss_x, 1.25)
# \ : default( ss_x, 1.5 )
# ss_y = (Smode==4)
# \ ? default( ss_y, 1.25)
# \ : default( ss_y, 1.5 )
# dest_x = default( dest_x, ox )
# dest_y = default( dest_y, oy )
# strength = (Smode==1)
# \ ? default( strength, 160 )
# \ : default( strength, 100 )
# strength = (Smode==2&&strength>100) ? 100 : strength
# radius = default( radius, 2 )
# Lmode = default( Lmode, 1 )
# wide = default( wide, false )
# overshoot = default( overshoot, 1)
# undershoot= default( undershoot, overshoot)
# softdec = default( soft, 0 )
# soft = softdec!=-1 ? softdec : sqrt( (((ss_x+ss_y)/2.0-1.0)*100.0) ) * 10
# soft = soft>100 ? 100 : soft
# edgemode = default( edgemode, 0 )
# special = default( special, false )
# exborder = default( exborder, 0)
# #radius = round( radius*(ss_x+ss_y)/2) # If it's you, Mug Funky - feel free to activate it again
# xxs=round(ox*ss_x/8)*8
# yys=round(oy*ss_y/8)*8
# smx=exborder==0?dest_x:round(dest_x/Exborder/4)*4
# smy=exborder==0?dest_y:round(dest_y/Exborder/4)*4
#
# clp.isYV12() ? clp : clp.converttoyv12()
#
# ss_x != 1.0 || ss_y != 1.0 ? last.lanczosresize(xxs,yys) : last
# tmp = last
#
# edge = mt_logic( tmp.mt_edge(thY1=0,thY2=255,"8 16 8 0 0 0 -8 -16 -8 4")
# \ ,tmp.mt_edge(thY1=0,thY2=255,"8 0 -8 16 0 -16 8 0 -8 4")
# \ ,"max") .mt_lut("x 128 / 0.86 ^ 255 *") #.levels(0,0.86,128,0,255,false)
#
# tmpsoft = tmp.removegrain(11,-1)
# dark_limit1 = tmp.mt_inpand()
# bright_limit1 = tmp.mt_expand()
# dark_limit = (wide==false) ? dark_limit1 : dark_limit1 .removegrain(20,-1).mt_inpand()
# bright_limit = (wide==false) ? bright_limit1 : bright_limit1.removegrain(20,-1).mt_expand()
# minmaxavg = special==false
# \ ? mt_average(dark_limit1, bright_limit1)
# \ : mt_merge(dark_limit,bright_limit,tmp.removegrain(11,-1),Y=3,U=-128,V=-128)
#
# Str=string(float(strength)/100.0)
# normsharp = Smode==1 ? unsharpmask(strength,radius,0)
# \ : Smode==2 ? sharpen(float(strength)/100.0)
# \ : Smode==3 ? mt_lutxy(tmp,minmaxavg,yexpr="x x y - "+Str+" * +")
# \ : mt_lutxy(tmp,tmpsoft,"x y == x x x y - abs 16 / 1 2 / ^ 16 * "+Str+
# \ " * x y - 2 ^ x y - 2 ^ "+Str+" 100 * 25 / + / * x y - x y - abs / * + ?")
#
# OS = string(overshoot)
# US = string(undershoot)
# mt_lutxy( bright_limit, normsharp, yexpr="y x "+OS+" + < y x y x - "+OS+" - 1 2 / ^ + "+OS+" + ?")
# mt_lutxy( dark_limit, last, yexpr="y x "+US+" - > y x x y - "+US+" - 1 2 / ^ - "+US+" - ?")
#
# Lmode==1 ? mt_clamp(normsharp, bright_limit, dark_limit, overshoot, undershoot) : last
#
# normal = last
# zero = mt_clamp(normsharp, bright_limit, dark_limit, 0,0)
#
# Lmode==3 ? mt_merge(normal,zero,edge.mt_inflate()) : normal
#
# edgemode==0 ? last
# \ : edgemode==1 ? mt_merge(tmp,last,edge.mt_inflate().mt_inflate().removegrain(11,-1),Y=3,U=1,V=1)
# \ : mt_merge(last,tmp,edge.mt_inflate().mt_inflate().removegrain(11,-1),Y=3,U=1,V=1)
#
# AMNT = string(soft)
# AMNT2 = string(100-soft)
# sharpdiff=mt_makediff(tmp,last)
# sharpdiff2=mt_lutxy(sharpdiff,sharpdiff.removegrain(19,-1),
# \ "x 128 - abs y 128 - abs > y "+AMNT+" * x "+AMNT2+" * + 100 / x ?")
#
# soft==0 ? last : mt_makediff(tmp,sharpdiff2)
#
# (ss_x != 1.0 || ss_y != 1.0)
# \ || (dest_x != ox || dest_y != oy) ? lanczosresize(dest_x,dest_y) : last
#
# ex=blankclip(last,width=smx,height=smy,color=$FFFFFF).addborders(2,2,2,2).coloryuv(levels="TV->PC")
# \.blur(1.3).mt_inpand().blur(1.3).bicubicresize(dest_x,dest_y,1.0,.0)
# tmp = clp.lanczosresize(dest_x,dest_y)
#
# clp.isYV12() ? ( exborder==0 ? tmp.mergeluma(last)
# \ : mt_merge(tmp,last,ex,Y=3,U=1,V=1) )
# \ : ( exborder==0 ? tmp.mergeluma(last.converttoyuy2())
# \ : tmp.mergeluma( mt_merge(tmp.converttoyv12(),last,ex,Y=3,U=1,V=1)
# \ .converttoyuy2()) )
#
# (edgemode!= -1) ? last : edge.lanczosresize(dest_x,dest_y).greyscale
#
#
# }
#
# [<separator="Sharping">]
# LimitedSharpenFaster(Smode=1, ss_x=2.0, ss_y=2.0,strength=[<"Sharpness (400)", 0, 2400, 407>],overshoot=[<"OverShoot (0)", 0, 6, 0>])
#
#
#
# [Post-Auto Gain=0]
# colorYUV(autogain=true)
# [/Post-Auto Gain]
#
# [White Balance=0]
# colorYUV(autowhite=true)
# [/White Balance]
# [<separator="SeeSaw Boost 2">]
# [SeeSaw 2=0]
# SetMTmode(2,2)
# SeeSaw( NRlimit=10,NRlimit2=5, Sstr=[<"SstrT(1.5)", .1, 10, 8.3>],Slimit=9,Spower=9, Szp=[<"SpzT(16)", .1, 30, 23.0>],sootheT=80, bias=[<"BiasT(40)", .1, 80, 7.6>] )
# [/SeeSaw 2]
#
# #SeeSaw( NRlimit=4, NRlimit2=5, Sstr=1.5, Slimit=9, Spower=9, Szp=16, sootheT=80, bias=40)
#
#
### AvsP marked script ###
--------------------------------------------------------
Notice that the lastest HDRagc plugin is"AGC.dll
With HGRagc box checked, there are tons of sliders.
Black Clip sets the lowest black level (16) for my work.
There seems to be some interaction between AVS-p and HDRagc for proper operation and I found if you start with a video frame as the first one to be processed, then there's no problem, if its black or full white frame at the begining, it won't work..
http://img291.imageshack.us/img291/3034/hdr1hb5.th.jpg (http://img291.imageshack.us/my.php?image=hdr1hb5.jpg)
http://img153.imageshack.us/img153/4417/hdr2us2.th.jpg (http://img153.imageshack.us/my.php?image=hdr2us2.jpg)
you need to edit out almost all of the #, I don't know why AVSp saves that way
Richard
foxyshadis
26th December 2007, 20:40
As long as you open that in avsp, instead of copying it in, avsp will remove the hashes for you. It saves that way so that what it saves will be a real avisynth script, but at the same time still keep the sliders (which would cause errors in a real script).
JK1974
9th July 2008, 00:35
Hi,
I have a basic question on an idea that was postet at http://forum.doom9.org/showthread.php?t=118580.
I am also working on Super-8 telecine - currently having the luck being able to have a projector synchronised to 16,666... for recording the film at 50i (PAL).
Because my S8 movie had some scenes that were to dark and some that looked quite right at the same level of light, I also thought about working with it like with HDR photos:
1. Recording the film three times: With less light, with normal light and with bright light.
2. Combining all three videos to one HDR film.
3. Using tonemapping technique to move the color range back to the displayable area.
In the thread I mentioned above, it has finally been talked about the export of the HDR movie - which is not possible before AVISynth 2.6/3.0. But I don´t want to export the movie as HDR movie, I "just" want to "downscale" it before to the "normal" color range and export it "normally".
Is there any way to accomplish this? The only plug-in concerting HDR seems to be HDR AGC, but if I have seen right, this is "just" a "HDR/tonemapping simulation", or did I understand anything wrong? Don´t get me wrong: HDR AGC does a brilliant job, but as "real" HDR is possible in the case I described above, I would really be interested if I there is any "new" development besides HDR AGC or if there is any way to accomplish my needs with HDR AGC.
Undead Sega
11th November 2008, 05:09
Hi everyone, sorry for bringing such an old thread to the present time, but i cant help to say that i think indeed this is a brilliant filter and works wonders with footage that is incredibly dark (of course not that dark), but the last release we saw was just over 2 years ago, and impretty sure that improvements can still be made?
one i would like to ask, is that, the use of gain, which produces a noisy picture, which is can be irratable and many would consider non-professional. but i was wondering if it is possible to give a clean image (or footage with little gain in itself) a HDR treatment but not resulting of having such a noisy picture, or having gain resulting into the video?
Sagekilla
11th November 2008, 05:59
@Undead Sega: Unfortunately, most of the time you apply gain to any weak signal noise will be prevalent. Didee worked out a script before that works around this by providing gain (from HDRAGC) and temporal filtering (MVDegrain) to provide some very good results.
It is possible, and I think the script Didee posted was a bit rudimentary (he gave a framework and said you can fill in the blanks) but it should be able to do something like what you want.
Undead Sega
11th November 2008, 06:37
hmmm, i was pretty aware of that, it even goes for audio. however, i have seen some other HDR(I) work, and gain does not become prevelent in those cases. I do not want to bring out detail to be washed out afterwards.
isnt there another filter or plugin (commercial even) that can do the job?
mikeytown2
11th November 2008, 07:33
@Undead Sega
Open a new thread with some sample clips, we should be able to give you better advice. As Sagekilla stated, HDRAGC with MVDegrain is quite powerful.
Here's a script that I fine tuned for this clip
http://forum.doom9.org/showthread.php?t=139402
Undead Sega
12th November 2008, 02:57
ive checked out the link and the results somewhat doesnt look pleasing or doesnt quite satisfy me, HDR is there to make tonned-maps from information when having an image with low and high expsure put together, and quality shouldnt be an issue.
mikeytown2
12th November 2008, 03:13
Unless you shot the scene with 2 cameras very close together and in sync, how are you going to get the low and high exposures? A better option is to record raw data, like the Red One does. Like I said before, post some samples in a new thread. Otherwise this is it... there is nothing more we can do.
Aghora
23rd October 2010, 17:34
I'm getting this error
http://i53.tinypic.com/s664a1.jpg
leeperry
23rd October 2010, 19:50
very impressive! :eek:
but w/ MT() I get mismatched bands:
MT("""
HDRAGC(coef_gain=1.2)
colorYUV(levels="tv->pc")
""",4)
http://thumbnails19.imagebam.com/10352/f7cd4b103511528.jpg (http://www.imagebam.com/image/f7cd4b103511528)
any chance for built-in MT please? but the OP hasn't showed up since 2007, so I guess that'll never happen :(
and I'd rather not use SetMode() because it's async and it's bad for jitter in realtime IME.
PS: anyone knows of a MT plugin that'd more or less do the same?
fenomeno83
27th November 2010, 14:50
so; I have these 3 images.. look "T" product
I want make an analize based on color, but 3 images have different exposure..
http://img689.imageshack.us/img689/539/050820100030.jpg
http://img442.imageshack.us/img442/1715/05082010031.jpg
http://img574.imageshack.us/img574/4237/sam00002.jpg
so, there is any avisynth script to balance in automatic to have for example "T" with similar color/exposure..
HDR filter is image is already brighter, increase brightness
dansrfe
27th November 2010, 18:03
very impressive! :eek:
but w/ MT() I get mismatched bands:
MT("""
HDRAGC(coef_gain=1.2)
colorYUV(levels="tv->pc")
""",4)
http://thumbnails19.imagebam.com/10352/f7cd4b103511528.jpg (http://www.imagebam.com/image/f7cd4b103511528)
any chance for built-in MT please? but the OP hasn't showed up since 2007, so I guess that'll never happen :(
and I'd rather not use SetMode() because it's async and it's bad for jitter in realtime IME.
PS: anyone knows of a MT plugin that'd more or less do the same?
You cannot MT HDRAGC. It won't work. The best you ccan do for hdragc is setmtmode().
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.