Log in

View Full Version : Which picture do you prefer?


Chainmax
14th September 2005, 16:08
I'm trying to filter a quite blocky and noisy source and have come up with the following simple filterchain:

Denoise
Deblock(quant=30)
LimitedSharpen()
AddGrain(3,0,0)

where Denoise is either FFT3DFilter(sigma=1) or LRemoveDust_YV12(17,2). I'm having a hard time choosing one of these denoisers bover the other, so I'm asking for your opinion. Here are three versions of a frame:


Source:
http://img53.imageshack.us/img53/1935/source2wp.png

FFT3DFilter:
http://img53.imageshack.us/img53/6332/fft3dfilter7hk.png

LRemoveDust_YV12:
http://img53.imageshack.us/img53/4190/lremovedust1st.png


I can post more comparison frames upon request.

DigitalDeviant
14th September 2005, 16:23
Well, without knowing how you intend to use the output I would take the one done with FFT3DFilter. It looks a little more detailed to me. The LRemoveDust frame does looks less noisy though.

unskinnyboy
14th September 2005, 16:45
LRemoveDust'd one looks more denoised, but tbh, both don't look good to my eyes. They both have that "oil paint" look which comes due to too much sharpening (LRemoveDust'd one especially). I recommend you reduce the 'strength' of LimitedSharpen() and/or add Soothe() after it.

Maybe more frames would give a different perspective.

Chainmax
14th September 2005, 16:46
DigitalDeviant: I agree with you, but the thing is that the source itself doesn't seem to have much detail, so maybe what appears as more detailed just removes less noise from it.
I'm not sure wether to choose the LRemoveDust version and increase the AddGrain setting, choosing the FFT3DFilter version, or using FFT3DFilter with higher sigma and increase the AddGrain setting.

unskinnyboy: I'll try using including Soothe() in the LRemoveDust_YV12 version and post a screenshot soon.

foxyshadis
15th September 2005, 01:58
That's the great thing about old 70's shows and films, the cheap film stock (Super 8?) gave everything a pastel look, and the bad storage of most masters over the years sure didn't help. =D At least I'm assuming that's what it is, it has that distinct washed out and posturized look. Might as well throw in as much smoothing as you can get, depending on how much you like the grain.

Mug Funky
15th September 2005, 05:25
definitely the fft3d one. the blocks are just gone, but not much else was touched (which is good IMHO - if you can spare the bitrate, you'll find the brain is a much better noise-reduction tool than anything we have in avisynth currently). you might want to play with saturation a little to make it "look" better without actually being any better...

morsa
15th September 2005, 07:37
Yes, you should try to balance colors.
That image has too much magenta(or maybe red, I'm not sure).
You can see the red cast all over the image.
The opposite color of magenta is green, the opposite of red is cyan.

mg262
15th September 2005, 11:10
you'll find the brain is a much better noise-reduction tool than anything we have in avisynth currentlyWe need to take one apart and reverse engineer it. :devil: Volunteers?

Seriously, I'm not sure what you mean... if the noise is there, the brain will generally perceive it?

Mug Funky
15th September 2005, 11:42
you'll percieve it alright, but you'll also pick up the detail under it. in time you'll ignore the noise and enjoy the picture :)

i tend to distrust denoisers because they aren't as able to discern between signal and noise, and tend to leave too much of one and remove too much of the other...

of course i still use them all the time, but high bitrates are a luxury that allows more noise to be left in.

Didée
15th September 2005, 12:07
Just as Mug Funky said. (Also, compare the last paragraph of this post (http://forum.doom9.org/showthread.php?p=547327#post547327) - one year old by now.) ;)

Apart from the method's inherent problems, I'd still say that motion compensated temporal denoising is, theoretically, the method bringing you as close to "human brain denoising" as possible.

mg262
15th September 2005, 12:12
Interesting post...
Even the best imaginable block-based ME can only work on orthogonal squares or rectangles. But, the presented textures mostly are not fully identical from frame to frame. Imagine an object that, as it is travelling its way through the frame, also is i.e. slowly rotating over any axis in space. This leads to small texture changes between the frames, and these small changes are likely to appear just as noise after compensation, and are in danger of being filtered away together with the noise as well. ... one can imagine combining motion estimation with morphing to create something that dealt with this. But there are still problems like occlusion and irregular objects with many holes [trees]. It would be interesting to know more about the flow-based methods Fizick mentioned too.

Chainmax
15th September 2005, 13:01
Mug Funky, morsa: I'll try to toy with Tweak's saturation control and post a screenshot.

Chainmax
15th September 2005, 20:48
Wow, Tweak(sat=1.2) makes a whole lot of indifference indeed :). Problem is, while stepping through the stream in order to check its effect, I found a some frames where sigma=1 just doesn't cut it. I'll post three more pairs of comparison frames between FFT3DFilter+Tweak and the source soon.

Chainmax
16th September 2005, 02:32
As promised, here are three more comparison frames:

http://img367.imageshack.us/img367/8025/comparisonframe12bx.th.png (http://img367.imageshack.us/my.php?image=comparisonframe12bx.png)

http://img391.imageshack.us/img391/9469/comparisonframe26es.th.png (http://img391.imageshack.us/my.php?image=comparisonframe26es.png)

http://img367.imageshack.us/img367/3412/comparisonframe33wq.th.png (http://img367.imageshack.us/my.php?image=comparisonframe33wq.png)

Is the Tweak setting ok or should I tone it down? As for noise, in the first image (and, to a less extent, the third one) the denoising is not sufficient in my opinion. Would increasing sigma to 2 or 3 kill too much detail?

sh0dan
16th September 2005, 15:33
The first two images are far too red for my taste. You might try toining it down a bit. Instead of your Tweak, try:
coloryuv(off_u=4, off_v=-14, cont_u=32, cont_v=32)
"off_u"/"off_v" are color tone adjustments. "cont_u"/"cont_v" are saturation adjustment.

Chainmax
16th September 2005, 16:23
Wow, your suggestion looks awesome. I now understand what Mug Funky and morsa meant, I should have been decreasing saturation, not increasing it. I'm such a tool :) :o. Now I'll remove the AddGrain line, toy with different sigma settings and post some more comparison frames.

Boulder
16th September 2005, 16:28
Didée created a nice noise-adding function some time ago. I wonder why he never posted it here (or did he :confused: ) ?

Anyway, here it is:

function DideeGrain(clip last)
{
grain1_strength = 10 # [ 0 - ???] strength of grain / for mid-tone areas
grain1_size = 1.15 # [0.5 - 4.0] size of grain / for mid-tone areas

grain2_strength = 5 # [ 0 - ???] strength of grain / for dark & bright areas
grain2_size = 0.8 # [0.5 - 4.0] size of grain / for dark & bright areas

grain1_sharpness = 100 # [ 0 - 100] very soft (0) to very sharp(100)
grain2_sharpness = 100 # [ 0 - 100] grain definition

grain1_texture = 0 # [ 0 - 100] strength of "material texture" appearance def 100
grain2_texture = 0 # [ 0 - 100] (in fact: 'bump' effect) def 50

ontop_grain = 0 # [ 0 - ???] additional grain to put on top of prev. generated grain

temp_avg = 20 # [ 0 - 100] percentage of noise's temporal averaging

brightness_bias = 0.96 # [0.5 - 2.0] bias for dark|bright --> midtone fading

#-----------------------------------------------------------------------------------

o = last
ox = o.width
oy = o.height
sx1 = m4(ox/grain1_size)
sy1 = m4(oy/grain1_size)
sx1a = m4((ox+sx1)/2.0)
sy1a = m4((oy+sy1)/2.0)
sx2 = m4(ox/grain2_size)
sy2 = m4(oy/grain2_size)
sx2a = m4((ox+sx2)/2.0)
sy2a = m4((oy+sy2)/2.0)
b1 = grain1_sharpness/(-50.0) + 1.0
b2 = grain2_sharpness/(-50.0) + 1.0
b1a = b1/2.0
b2a = b2/2.0
c1 = (1.0-b1)/2.0
c2 = (1.0-b2)/2.0
c1a = c1/2.0
c2a = c2/2.0
t1a = string(grain1_texture)
t1b = string(100-grain1_texture)
t2a = string(grain2_texture)
t2b = string(100-grain2_texture)
tmpavg = temp_avg/100.0

#-----------------------------------------------------------------------------------

ADD_DIFF = "x y - 128 +"
BUMPKERNEL1 = T1a + " 0 0 0 " + T1b + " 0 0 0 0"
BUMPKERNEL2 = T2a + " 0 0 0 " + T2b + " 0 0 0 0"
CENTER2MAX_BIAS = "x 120 - abs "+string(brightness_bias)+" ^ 2.5 *"

#-----------------------------------------------------------------------------------

grainlayer1 = blankclip(o, width=sx1, height=sy1, color=$808080) .AddGrain(grain1_strength, 0, 0)

grainlayer1 = (grain1_texture==0)
\ ? grainlayer1
\ : yv12lutxy(grainlayer1,grainlayer1.DEdgeMask(0,255,0,255, BUMPKERNEL1), ADD_DIFF)

grainlayer1 = (grain1_size == 1.0) ? grainlayer1
\ : (grain1_size < 0.75) ? grainlayer1.bicubicresize(sx1a,sy1a, b1a, c1a).bicubicresize(ox,oy, b1a,c1a)
\ : grainlayer1.bicubicresize(ox,oy, b1,c1)

#-----------------------------------------------------------------------------------

grainlayer2 = blankclip(o, width=sx2, height=sy2, color=$808080) .AddGrain(grain2_strength, 0, 0)

grainlayer2 = (grain2_texture==0)
\ ? grainlayer2
\ : yv12lutxy(grainlayer2,grainlayer2.DEdgeMask(0,255,0,255, BUMPKERNEL1), ADD_DIFF)

grainlayer2 = (grain2_size == 1.0) ? grainlayer2
\ : (grain2_size < 0.75) ? grainlayer2.bicubicresize(sx2a,sy2a, b2a, c2a).bicubicresize(ox,oy, b2a,c2a)
\ : grainlayer2.bicubicresize(ox,oy, b2,c2)

#-----------------------------------------------------------------------------------

grainlayer = MaskedMerge(grainlayer1, grainlayer2, o.yv12lut(CENTER2MAX_BIAS), U=1,V=1)

grainlayer = (temp_avg==0) ? grainlayer
\ : grainlayer.mergeluma(grainlayer.temporalsoften(1,255,255,255,2), tmpavg)
grainlayer = (ontop_grain==0) ? grainlayer
\ : grainlayer.AddGrain(ontop_grain,0,0)

#-----------------------------------------------------------------------------------

result = yv12lutxy(o, grainlayer, ADD_DIFF, U=2,V=2)

return result

}
#-----------------------------------------------------------------------------------
function m4(float x) {return( x<16?16:int(round(x/4.0)*4)) }
#===================================================================================

Tweaking the strength of grain can fool the human brain quite nicely ;)

Chainmax
16th September 2005, 16:32
I'll try it later, but I love AddGrain for stuff like this. We'll see how they stack up against each other.

Boulder
16th September 2005, 16:34
I'll try it later, but I love AddGrain for stuff like this. We'll see how they stack up against each other.
As you can see, the function utilises AddGrain. It just varies the amount of grain according to the luma level of the image.

Didée
16th September 2005, 16:41
Definetly I never have created any avisynth function carrying my name in it's. :)

Plus, I felt it was too hack'ish and would need quite some cleaning & tweaking ... if I actually had a to-do list, it would be a long one, oh my.
But of course, the output is fully usable. I like especially the bumpmapping effect, tweaked to an amount where it's just appearing as such ... too much of that is not good, either.


@ Chainmax

Eventually I have something ... perhaps the source should ride on a see-saw! :D

Chainmax
16th September 2005, 16:45
sh0dan: shouldn't opt=coring be used in the ColorYUV line in order to keep the luminance in the 16-235 range?

Boulder
16th September 2005, 17:01
Definetly I never have created any avisynth function carrying my name in it's. :)

Stop being so modest :D I had to come up with some name..

Plus, I felt it was too hack'ish and would need quite some cleaning & tweaking ... if I actually had a to-do list, it would be a long one, oh my.
But of course, the output is fully usable. I like especially the bumpmapping effect, tweaked to an amount where it's just appearing as such ... too much of that is not good, either.

It works very well with any oversmoothed source, that's why I offered it. The only downside is that compressibility takes a big hit but it's "one or the other". I take the one that looks more detailed ;)

sh0dan
16th September 2005, 17:08
sh0dan: shouldn't opt=coring be used in the ColorYUV line in order to keep the luminance in the 16-235 range?
You are not touching the luma values, but chroma could get out of range, since the chroma contrast (= saturation) is increased, so I guess you could add it just for safety.

ColorYUV is a great tool for coloradjustments, switch on Histogram(mode="levels") after coloryuv - this can give you pointers for how to adjust it. Based on the material you have, I would also personally turn down luma gamma, and apply some luma contrast, but I'd need the entire movie to judge if it is a good idea for the entire movie. Something like:
coloryuv(off_u=4, off_v=-14, cont_u=32, cont_v=32, gamma_y=-64, cont_y=32, opt="coring")

Chainmax
16th September 2005, 23:14
Maybe I'll toy around with Histogram a little bit. If not, what you suggested looks impressive already. Now I'll try to see what can I do about the denoising.

Chainmax
17th September 2005, 00:19
Ok, here are three comparison frames between sigma=1 and sigma=3. In my opinion, the latter denoises significantly more than the former without removing too much detail, but I'd like to hear what you think.

http://img168.imageshack.us/img168/5659/sigmacomp12ft.th.png (http://img168.imageshack.us/my.php?image=sigmacomp12ft.png)

http://img168.imageshack.us/img168/3357/sigmacomp23hu.th.png (http://img168.imageshack.us/my.php?image=sigmacomp23hu.png)

http://img168.imageshack.us/img168/7853/sigmacomp37mx.th.png (http://img168.imageshack.us/my.php?image=sigmacomp37mx.png)


sh0dan: do you want to me cook up a small sample with scenes?

morsa
17th September 2005, 00:39
BTW Chanquete has too much Cyan , so try decreasing blue and green or increasing red saturation.

Chainmax
17th September 2005, 18:33
This is the first time I've done color adjustments and the Avisynth documentation on ColorYUV hasn't clarified much, how would I go about doing that?

Wilbert
17th September 2005, 22:07
@Chainmax,

Did you look at the color adjustment in the analog cap guide?

Chainmax
18th September 2005, 02:04
Actually, I did, but the parameters altered in there (off_y,gain_y,cont_u,cont_v) are not the same as the ones sh0dan suggested me (off_u,off_v,cont_u,cont_v), which makes it difficult for me to understand how things work. Besides, even though the guide makes an excellent step-by-step guide on how to tweak off_y and gain_y with the histogram, it really doesn't explain how to tweak cont_u and cont_v using VScope. I gave it a try but didn't really manage to get as good results as the ones in sh0dan's first suggestion.

Chainmax
20th September 2005, 02:55
morsa, can you give me a hand with decreasing blue and green?

Chainmax
21st September 2005, 18:58
Ok, I toyed around with ColorYUV and this is what I obtained:

http://img231.imageshack.us/img231/5189/coloryuv10ba.th.png (http://img231.imageshack.us/my.php?image=coloryuv10ba.png)

http://img231.imageshack.us/img231/1773/coloryuv21sb.th.png (http://img231.imageshack.us/my.php?image=coloryuv21sb.png)

http://img231.imageshack.us/img231/7686/coloryuv30xi.th.png (http://img231.imageshack.us/my.php?image=coloryuv30xi.png)

Before corresponds to sh0dan's suggestion and Now to what I came up with. I can also provide the source shots for a better estimation of the effects of the filterchain.

morsa
23rd September 2005, 21:16
Great, they look quite good right now, especially Chanquete.
I hope you keep them as DVD (or at least mpeg4 with a high bitrate :cool: )

Chainmax
23rd September 2005, 22:12
On material this crappy, I'm not sure if going from SVCD (what I intend to do) to DVD would yield much better results. Do you think it would be worth it?

These are some more comparison frames but this time they show the source material and the final filtered output. If you think it's good enough, then I'll start encoding.


http://img217.imageshack.us/img217/4218/sf28ec.th.png (http://img217.imageshack.us/my.php?image=sf28ec.png)

http://img217.imageshack.us/img217/7265/sf35fl.th.png (http://img217.imageshack.us/my.php?image=sf35fl.png)

http://img217.imageshack.us/img217/4395/sf48zi.th.png (http://img217.imageshack.us/my.php?image=sf48zi.png)

http://img217.imageshack.us/img217/2176/sf52jy.th.png (http://img217.imageshack.us/my.php?image=sf52jy.png)


All were made with this line: ColorYUV(off_y=-9,gain_y=11,cont_u=0,cont_v =-51.2) which corresponds to a saturation_v of 0.8. I wonder if I should set cont_v to 25.6 (saturation_v=0.9) instead...

Boulder
24th September 2005, 07:41
On material this crappy, I'm not sure if going from SVCD (what I intend to do) to DVD would yield much better results. Do you think it would be worth it?
If it's a VHS source, there's not any extra details to be seen if you use 720x576(480) as the resolution of the source is low. However, you'll avoid one large scaling step if you use a full DVD resolution (the one that comes from your standalone stretching the SVCD video when displaying it).

mg262
24th September 2005, 09:33
If it's a VHS source, there's not any extra details to be seen if you use 720x576(480)You know, that's probably true, but I have never actually seen anyone demonstrate it. It's not trivially true because the frequency limiting in the VHS is quite different from the spatial limiting that is resolution... depending on how it's implemented, it can cause halos rather than loss of sharpness. When I have less things on hand I will pull out a VHS to DVD conversion andpost the results of comparison.

Boulder
24th September 2005, 12:06
I should also mention that I've always used 704x576 for my VHS->DVD transfers. I capture at 696x576 (BT8x8 chip) so going down to 352x576 and then back up when playing the clip doesn't appeal to me at all ;) That's one point of view to consider as well. SVCD would be nice but the maximum bitrate is too limited.

Chainmax
24th September 2005, 14:46
As it turns out, I don't have enough HDD space for the intermediary HuffYV12 step (the direct conversion to MPEG2 takes too long) anyway, so I'll wait until completing some other SVCDs before taking these on. In the meantime, I'll be asking around the MPEG-1/2 Encoding forums for suggestions on low bitrate encodes. Just to be clear though: you still consider that resizing from 480x368 to 672x544 (then adding suitable borders for overscan) is a good idea, right?