digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   SansGrip Filters: Improve picture quality using "AddNoise" Filter (http://www.digitalfaq.com/archives/avisynth/1510-sansgrip-filters-improve.html)

black prince 11-07-2002 03:51 PM

SansGrip Filters: Improve picture quality using "AddNoise" Filter
 
Hi All,

Here's an interesting post from Doom9. A new filter "AddNoise"
to improve picture encode quality by fooling the encoder program
(i.e. Tmpgenc) by sending noise to cause more bitrates to be applied
and correcting a problem (DCT, blockiness in dark areas) that
it would normally ignor. Here the link:

http://forum.doom9.org/showthread.ph...light=AddNoise

I have tried "AddNoise" and it certainly improved the background
blockiness for mpeg-1 352x240 or low resolution. The file did not
increase greatly with this improvement. Could it be possible to fool
Tmpgenc to pay more attention to motion search and vastly improve
the "mosquito effect", rather than pour more bitrates via CQ_VBR over
every frame to make it go away. The idea here is to test Tmpgenc
with the "Addnoise" and see what is effected. SansGrip of Doom9
has written "NoiseGenerator" which should create noise in many areas.
I am going to try his next with his recommended setting as a start.
This could be one solution to a better picture quality for low or very
low bitrate and resolutions. :) With "BitrateViewer" I hope to find
a noise that effects "mosquito effect". Even if it makes it worse, that
means some setting could improve it. :D


-black prince

TKS 11-07-2002 06:17 PM

cool!
 
This sounds amazing... geez reading some of stuff on Doom9's forums is quite scary.. After a while though.. i start to understand it :) (i hope)

tks

BTW how does one implement this into ones .avs file?

black prince 11-07-2002 08:34 PM

Hi TKS,

TKS wrote:
Quote:

TKS Posted: Thu Nov 07, 2002 7:17 pm Post subject: cool!

--------------------------------------------------------------------------------

This sounds amazing... geez reading some of stuff on Doom9's forums is quite scary.. After a while though.. i start to understand it (i hope)

tks

BTW how does one implement this into ones .avs file?
Go the link in my first post and download "AddNoise" filter. Follow
the sample script used by SansGrip and test a small clip of say
30 seconds with "AddNoise" and without it. Pay attention to
background of video and look for blocky areas to compare. I
think you'll be suprised at the results. :)

#----- AddNoise Filter Test ------
LoadPlugin("E:\bbbbbbbb\MPEG2DEC2.dll")
LoadPlugin("E:\bbbbbbbb\AddNoise.dll")
mpeg2source("D:\Temp\movie.d2v")
Trim(0,720) # <-- ~ 30 seconds of video play
AddNoise(yv=1,loop=4,mode="round")# <-- test yv = 1.5,2,3 etc.
BilinearResize(336,224)
TemporalSmoother(1,2)
AddBorders(8,8,8,8 )
# ------ End of Script ------



-black prince

kwag 11-07-2002 08:40 PM

How does this affect the file size? What's the difference on both samples. I would assume that the sample with the "AddNoise" filter would be larger, because it's actually increasing the noise floor ( My guess ) and this would force a higher CQ/bit rate factor. So the resulting file size would be larger. Is my guess correct :?: :roll:

-kwag

TKS 11-07-2002 09:51 PM

well...
 
From what i read really quickly :) on doom9s forum is that it didnt really change the file size all that much.. havent tried it myself yet...

tks

TKS 11-07-2002 10:17 PM

ok then...
 
I made some quick 1 min samples with Good Will Hunting DVD and here is my .avs script:

LoadPlugin("F:\util\video\mpgdecdll\MPEG2DEC.dll")
LoadPlugin("F:\Program Files\GordianKnot\AddNoise.dll")
mpeg2source("F:\rips\good1.d2v")
BilinearResize(336,192,45,0,630,480)
TemporalSmoother(1,2)
AddBorders(8,24,8,24)
#Trim(0,182097).FadeOut(150)
AddNoise(yv=1,loop=4,mode="round")
#ConvertToRGB24 # For TMPGEnc or VFAPI
#ResampleAudio(44100) # CCE 2.5 'crashfix' for Athlons
#== If you want this 'fix' permanently, edit the INI-file:
#== Under [AVSscript] set CCEcrashfix=1

Now the file size of the first sample done with kvcd LBR NTSC in Tmpgenc without Addnoise was 5.2 megs. The one with Addnoise was 5.6, not much of a difference at all.
Now this is hoping that I did everything right and placed the Addnoise statement in the right place within the .avs script :)

Quality diference:

Well i noticed that there were a lot of blackboard scenes and this really showed the difference between the two files. The Addnoise filter really helped there, it was much better, alot less mosquito effect going on with the black and white or the blackboard/chalk.

tks

kwag 11-07-2002 10:25 PM

Hi TKS,

That's a ~50MB difference right there on a two hour movie. Can you try just increasing the CQ_VBR just a little, so that you get the same file size you got with the noise filter. But encode without the filter. See if you get the same "less" mosquito effect. :wink:

-kwag

TKS 11-08-2002 07:59 AM

well...
 
I did the entire movie and to fill the entire disc the audio was 128 with HeadAChe. Without the audio the movie was 678 megs.. So far it looks really good.. See Good Will Hunting isnt a really quick action scene type of movie..

But ill give that a try Kwag..


tks

black prince 11-08-2002 08:30 AM

Hi Kwag,

Kwag wrote:
Quote:

kwag Posted: Thu Nov 07, 2002 9:40 pm Post subject:

--------------------------------------------------------------------------------

How does this affect the file size? What's the difference on both samples. I would assume that the sample with the "AddNoise" filter would be larger, because it's actually increasing the noise floor ( My guess ) and this would force a higher CQ/bit rate factor. So the resulting file size would be larger. Is my guess correct

-kwag
Yes it does increase file size, but blockiness in dark areas does disappear.
I tried a higher CQ without "AddNoise" and blockiness in dark areas was
still there. My understanding after reading the link was this noise only
caused more lumina noise and had no effect on "mosquitos effect". The
increase of CQ seemed to improve "mosquitos effect". The question is
picture quality vs small increase in file size. Tmpgenc sees macro block
and block changes during motion search, but pixel block changes are not
detected and the "mosquitos effect" occurs unless CQ is highest enough
to overcome this in every frame. Sort of an over-kill in CQ to remove
"mosquitos effect". Another question is what would make Tmpgenc look
at pixel block. Could a noise do this or an enhancement to the motion
search formula? Would there be a price for this refinement (i.e. very slow
encode times, larger file size, etc.). "AddNoise" is just a start to stimulate
more discussion on how to improve picture quality for low resolution (352x
240) and low bitrate videos. :)

-black prince

black prince 11-08-2002 08:45 AM

Hi TKS,

TKS wrote:
Quote:

Quality diference:

Well i noticed that there were a lot of blackboard scenes and this really showed the difference between the two files. The Addnoise filter really helped there, it was much better, alot less mosquito effect going on with the black and white or the blackboard/chalk.

tks
Try yv=1.5 or 2. This really showed a bigger differance between using
"AddNoise" and without it. Be careful not to be too agressive with yv. It
will start to blurr if you use higher values. :)

-black prince

kwag 11-08-2002 09:52 AM

This is VERY interesting :wink: . Starting to read about it in depth :wink:

-kwag

GFR 11-08-2002 12:51 PM

Adding noise before quantizing a signal is a technique called "dither". It gives the "impression" that you have a finer quantization than you have indeed.

Imagine you have a smooth gradient (degradée). When you quantize it, it is not smooth anymore, it looks like a "staircase", with each "step" corresponding to a quantizing step.

If you add a little noise to this gradient, the points where you change from one step to the next are not in line anymore, it's like if the step is "fuzzy". If you look at a sufficient distance the effect is that the gradient is smooth again.

In MPEG, suppose you have a block that's almost at a constant colour and gets coded as a solid colour square. The block next to it is also almost at a constant colour and gets coded as a solid colour square, but at a slightly different colour than its neighbour. The effect is that the transistion from one block to the other is not smooth, but you have a step.

If you add some noise to these blocks then each block will hopefully not be a solid colour square but will have some variance and the transition from one block to the other will be smoother.

The ideal is to select the noise level such that quantization will kill it for real solid colours but slow changing colours that cause ugly blocks are "enhanced". This way you don't get blocks and the file size does not increases too much.

I think increasing CQ doesn't help very much, but you can try tweaking the quantizing matrix for slow frequencies and if you're using mpeg-2 maybe trying more bits for the DC.

As for mosquitoes, the Doom9 thread suggests that you use this filter with method=blur and invert=true - this will do a selective blur just on the edges.

I really hope this helps, cause the sources I'm most interested in converting are VHS camcorder shootings and anime, both suffer a lot from mosquitoes!!!

black prince 11-08-2002 02:46 PM

Hi GFR,

Thanks for the technical info. Could you be more specific about Doom9's
solution to improve the "mosquito effect". I encoded "Enough" using
"AddNoise". Here the LBR script below:

LoadPlugin("E:\DVD Backup\2 - DVD2SVCD\MPEG2DEC\MPEG2DEC2.dll")
LoadPlugin("E:\DVD Backup\2 - DVD2SVCD\AddNoise\Addnoise.dll")
mpeg2source("D:\Temp\movie.d2v")
#
LanczosResize(336,224)
#
opening=Trim(0,550)
opening=opening.TemporalSoften(3,8,30)
#
movie=Trim(551,158936)
movie=movie.AddNoise(yv=1.5,loop=4,mode="round")
#
credits=Trim(158937,0)
credits=credits.Greyscale().TemporalSoften(3,8,30)
#
last=opening+movie+credits
#
AddBorders(8,8,8,8 )
#
#LegalClip()
ConvertToRGB()
#
# ---------- End of Script ----------

Tmpgenc MPEG-1 352x240 500-2564kbps CQ-100


Not sure what LegalClip() is so it's commented.
The results played back on standard 27" TV was WOW 8O
The picture quality was excellent even up close. Again WOW 8O
Of course file size was large (2 CD's), but I had to see how
good this could get. The real test was viewing this movie in
a dark room. This would show blockiness in dark areas very
easily. WOW 8O No blockiness in dark areas. With a CQ = 100
their was no "mosquito effect", but I will test lower CQ's to try
and get the file size to fit one CD. I hope GFR's solution for this
works without impacting file size. This is a certainly a manual
process, but it's well worth it. 8)

-black prince

kwag 11-08-2002 04:10 PM

The noise filter is now called "Blockbuster" :D
Check here: http://www.jungleweb.net/~sansgrip/avisynth/

-kwag

black prince 11-08-2002 04:14 PM

Hi GFR and Kwag,

I found a filter that effects "mosquitoe noise" called UnDot, BUT it
can only work with avisynth 2.5 alpha release. Bummer!! :x This release
is unstable and for developers. Here's the doc file:

File: Readme_UnDot.txt

// UnDot - Simple Deringing Dot Remover
// Copyright (C) 2002 Tom Barry - trbarry@trbarry.com
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

Also, this program is "Philanthropy-Ware". That is, if you like it and feel
the need to reward or inspire the author then please feel free (but not obligated)
to consider joining or donating to the Electronic Frontier Foundation. This will
help keep cyber space free of barbed wire and bullsh*t.

See their web page at www.eff.org

***************

Okay, on to business.

WARNING - This version only runs on the Avisynth 2.5 alpha release.

UnDot is a simple median filter for removing dots, that is stray orphan pixels and
mosquito noise. It basicly just clips each pixel value to stay within min and max
of its eight surrounding neigbors.


USAGE - To use it just:

1) Place the UnDot.dll in a directory somewhere. You can get it from
www.trbarry.com/UnDot.zip

2) In your Avisynth file use commands similar to

LoadPlugin("F:\UnDot\UnDot.dll")
Avisource("D:\wherever\myfile.avi")
UnDot()

Of course replace the file and directory names with your own. There are no parameters.


KNOWN ISSUES AND LIMITATIONS

1) Requires either YUY2 or YV12 input.

2) Sorry, currently requires a P-III, Athlon, or higher. Needs SSEMMX support.

3) So far it has only been tested on SSEMMX (P3 & P4) machines.

4) In YV12 format it will filter both luma and chroma. In YUY2 format it will
only filter luma.

FILE LOCATIONS

For now, both source, this readme, and DLL should be at:

www.trbarry.com/UnDot.zip

A copy of this Readme_UnDot.txt file should be at:

www.trbarry.com/Readme_UnDot.txt

***************

Change Log:


2002/11/03 V 0.0.1.0 Initial test release for Avisynth 2.5 alpha only


If only the author could have written this for avisynth 2.05 or 2.06.
Bummer!! :twisted:
However, Tom Barry may allow his source code to be used for avisynth
2.05 or 2.06. Maybe :idea:

-black prince

TKS 11-08-2002 06:06 PM

dark scenes
 
In Good Wil Hunting there are also some darker bar scenes and these are much better then the average daylight scenes. Pratically no mosquito effect that is really noticable..

tks

kwag 11-09-2002 08:43 AM

I'm trying something with the new Blockbuster filters ( the old AddNoise filters ), but can't get it to work. http://www.jungleweb.net/~sansgrip/avisynth/
I can use Blockbuster(method="show") or Blockbuster(method="noise") or Blockbuster(method="blur")
But I can't make Blockbuster(method="noise, 8, 10, False, 0, 1, 0, 1, 256 ) as in the documentation, or any different value. I also tried Blockbuster(method="noise", 8, 10, False, lm=0, lv=1, cm=0, cv=1, cache=256)
I've tried Blockbuster(method="noise") but with the default values, I don't see any difference in test encodes with or without the filter.
So if anyone has been able to make the filters work, passing arguments, please let me know.

-kwag

SansGrip 11-09-2002 10:45 AM

Hi Karl, I tried to reply to your email but it was rejected by the server so I registered here instead ;). Here is my reply:

It's definitely working with non-default parameters, or at least it is here.

If you try it with a very high variance (say, lv=20) and a zero threshold (meaning do the whole frame) you'll see it working for sure. Personally I always use named arguments, and that may be why it's not working for you. Try something like:

Blockbuster(method="noise", detail_threshold=0, lv=20)

and you should see very strong noise all over the frame.

Thanks for being open-minded and trying a little noise ;).

SansGrip 11-09-2002 11:47 AM

I just read the whole thread and am very glad you guys are finding it useful.

As far as the mosquito noise problem goes, it's obviously a high-frequency (high detail level) phenomena, which means theoretically the "invert" mode should be able to target it.

I implemented blur because this gigantic Doom9 thread mentioned that a combination of offsetting the luma by -2 and then using UnFilter either sharpening or blurring had an effect on DCT blocks in dark areas (incidentally, it was this thread that gave me the idea for the filter in the first place).

While I am still dubious about the effectiveness of blurring in already low-frequency areas, it's possible that in combination with invert mode it might work to reduce mosquito noise. If it does this'll be a totally unintended use for the filter :).

If I get good reports about blur/invert for mosquito noise I'll have a look at the blur method again to see if I can improve it. Right now it just does a simple 3x3 average, and one possible improvement would be to make the radius configurable. Another option might be to incorporate temporal smoothing.

Anyway, I'm glad kwag emailed me with this thread. It's always nice to hear that what started out as an experiment is actually turning out to be useful ;).

SansGrip 11-09-2002 12:04 PM

black prince: Not sure what LegalClip() is so it's commented.

I apologise for being off-topic, but I thought I'd just address this quickly.

LegalClip is unrelated to DCT blocks. Without going into too much detail, there's a standard called CCIR-601 which defines various elements of video signals destined for TV (all formats: NTSC, PAL, SECAM etc.). It specifies that luma pixel values must be in the range of 16-235 and chroma pixel values must be in the range of 16-240. Colours outside this range are known as "superblack" and "superwhite" and can cause problems on some TVs.

Since Avisynth can produce pixels outside these ranges, I wrote this filter to clamp to the legal ranges. In other words, luma pixels in the range 0-15 become 16 and 236-255 become 235. The same is done in chroma except the upper limit is 240.

If you look at the output of mpeg2dec you'll notice a lot of out-of-range pixels, since they seem to be a side-effect of MPEG compression. In this case these pixels convey no actual information -- they are just artifacts -- so removing them is both The Right Thing To Do For TVs (tm) and doesn't force the encoder to use up bits describing useless information that will get removed by the DVD player anyway.

Edit: When encoding from an MPEG-2 source I put one instance of LegalClip directly after Mpeg2Source so that the out-of-range artifacts don't interfer with the results of other filters in the script, and then one at the very end to remove any that might have been generated during processing.

black prince 11-09-2002 03:57 PM

Hi SansGrip,

SansGrip wrote:LegalClip is unrelated to DCT blocks. Without going into too much detail, there's a standard called CCIR-601 which defines various elements of video signals destined for TV (all formats: NTSC, PAL, SECAM etc.). It specifies that luma pixel values must be in the range of 16-235 and chroma pixel values must be in the range of 16-240. Colours outside this range are known as "superblack" and "superwhite" and can cause problems on some TVs.

Since Avisynth can produce pixels outside these ranges, I wrote this filter to clamp to the legal ranges. In other words, luma pixels in the range 0-15 become 16 and 236-255 become 235. The same is done in chroma except the upper limit is 240.

If you look at the output of mpeg2dec you'll notice a lot of out-of-range pixels, since they seem to be a side-effect of MPEG compression. In this case these pixels convey no actual information -- they are just artifacts -- so removing them is both The Right Thing To Do For TVs (tm) and doesn't force the encoder to use up bits describing useless information that will get removed by the DVD player anyway.

Edit: When encoding from an MPEG-2 source I put one instance of LegalClip directly after Mpeg2Source so that the out-of-range artifacts don't interfer with the results of other filters in the script, and then one at the very end to remove any that might have been generated during processing.


Thanks for explaination. :D I and others at KVCD are constantly look-
ing for ways to improve picture quality even more. The old "AddNoise"
was a start for me and "BlockBuster" gave me problems also until you
and Kwag stepped in. My major interest is "mosquito noise" at low
CQ settings. I did look at trbarry's "UnDot", but it must be use with
avisynth 2.5 alpha. The source seemed to be available and wondered
if something could be written for avisynth 2.05 or 2.06? This type of
pratical solution solving is what I like. :D Keep up your great work.

-black prince

jorel 11-09-2002 04:20 PM

can you put a script here to test it;please?

thanks. :wink:

kwag 11-09-2002 04:56 PM

@SansGrip,
Thanks for joining :D and thanks for the explanation. I'll be experimenting more with Blockbuster filter :wink:

-kwag

SansGrip 11-09-2002 06:18 PM

black prince: My major interest is "mosquito noise" at low CQ settings.

As soon as I have some time I'm going to sit down and read this forum, since my main interest is MPEG-1 with TMPGEnc. I've never tried CQ mode at anything less than 100, so I still have a lot to learn :).

I did look at trbarry's "UnDot", but it must be use with avisynth 2.5 alpha. The source seemed to be available and wondered if something could be written for avisynth 2.05 or 2.06?

I'll find the source and take a look at it. I can't think of any reason it need be 2.5-specific, since it does YUY2 already, so "porting" it to 2.0 should be fairly simple.

:D Keep up your great work.

I decided it would be best to balance my cosmic karma by writing a smoother too. You can check that out at my web site ;).

SansGrip 11-09-2002 06:19 PM

kwag: Thanks for joining :D and thanks for the explanation

No problem. I'll be happy to try to answer any questions you might have about Blockbuster (or any of my other filters for that matter). Suggestions and feature requests are always welcome, too :).

kwag 11-09-2002 06:39 PM

Quote:

Originally Posted by SansGrip
kwag: Thanks for joining :D and thanks for the explanation

No problem. I'll be happy to try to answer any questions you might have about Blockbuster (or any of my other filters for that matter). Suggestions and feature requests are always welcome, too :).

Hi SansGrip,

I am about to start looking at the source of UnDot. I assume that he uses some API calls, specific to AviSynth 2.5. So it might be a matter of rewriting the API calls. I've been programming in C for some time ( for too long :wink: ), but I have no experience with the AviSynth API and hooks, and very little C++ experience. So it will take me some time to study the mechanism, before I can actually do something with AviSynth plugins. Also, I don't use MS VC++ ( :twisted: ) I use GCC on Unix and recently started to use DEV-C++ on Windows for plain "LEAN_AND_MEAN" ( you should know what that is :lol: ) console applications. So I have A LOT of studying to do :wink:
I mention that, because I see that UnDOt was written with ( :twisted: ) Microsoft Developer Studio.

-kwag

kwag 11-09-2002 08:01 PM

First try using "Sharpen" in Blockbuster filter.
 
@SansGrip,

What can I say 8O I'm drooling 8O
Here's my first try, using the KVCD LBR template, with a CQ_VBR of 27 ( the value I used originally to put this particular movie on one CD-R )

Here is the .m1v without any filters:
http://www.kvcd.net/test-nofilter.m1v
And here's the same sample, but with the line: Blockbuster(method="sharpen", detail_threshold=0, lv=20) added to my test .avs script:
http://www.kvcd.net/test-sharpen.m1v

AwWwWewsome :lol:

I'll be doing many more test strips tomorrow

Thanks,
-kwag

jorel 11-09-2002 08:40 PM

Quote:

Originally Posted by jorel
can you put a script here to test it;please?

thanks. :wink:

any help please,i can't see a thing.
:?: :?: :(

black prince 11-09-2002 09:05 PM

Hi jorel,

Here's a script you could try.

# ------- Beginning of Script --------
LoadPlugin("E:\DVD Backup\2 - DVD2SVCD\MPEG2DEC\MPEG2DEC2.dll")
LoadPlugin("E:\DVD Backup\2 - DVD2SVCD\BlockBuster\BlockBuster.dll")
LoadPlugin("E:\DVD Backup\2 - DVD2SVCD\LegalClip\LegalClip.dll")
mpeg2source("D:\Temp\movie.d2v")
#
LanczosResize(336,224)
#
opening=Trim(0,550)
opening=opening.TemporalSoften(3,8,30)
#
movie=Trim(551,158936)
movie=movie.Blockbuster(method="noise", detail_threshold=0, lv=1)
#
credits=Trim(158937,0)
credits=credits.Greyscale().TemporalSoften(3,8,30)
#
last=opening+movie+credits
#
AddBorders(8,8,8,8 )
#
LegalClip()
ConvertToRGB()

# ------End of Script ------

@Kwag

Downloaded your test scripts and ditto. It's awesome!!! 8O

-black prince

kwag 11-09-2002 10:42 PM

Quote:

Originally Posted by jorel
Quote:

Originally Posted by jorel
can you put a script here to test it;please?

thanks. :wink:

any help please,i can't see a thing.
:?: :?: :(

Sorry for not posting my script jorel,
Here it is:

LoadPlugin("C:\encoding\MPEG2DEC.dll")
LoadPlugin("C:\encoding\blockbuster.dll")
mpeg2source("K:\UNDEFINED\VIDEO_TS\movie.d2v")
BilinearResize(336,224,0,0,720,480)
Blockbuster(method="sharpen", detail_threshold=0, lv=20)
#TemporalSmoother(2,2)
AddBorders( 8,8,8,8 )


That's the script I used for the samples I posted.

-kwag

kwag 11-09-2002 10:49 PM

Quote:

Originally Posted by black prince
@Kwag

Downloaded your test scripts and ditto. It's awesome!!! 8O

-black prince

Just finished encoding the complete movie with the blockbuster filter. Originally, I had used a CQ_VBR of 27. With the blockbuster filter, I had to change to 24.5 to maintain the same target file size. But the difference in quality is excelent! Still, the file prediction works as expected. +-1% even with the filter :wink:

-kwag

jorel 11-10-2002 12:49 AM

thanks! :wink:
sometimes i read the faqs or help of a prog or "how to use it"
and it's not clear for my poor english,than i use a sample,
test it and learn something!

:!: :wink:

LadyMiles 11-10-2002 02:07 AM

Why sharpen ?
 
@kwag
Your test downloads aren't working for me. But why did you choose sharpen over noise ? Are there certain settings for anime than for live movies ?

kwag 11-10-2002 05:34 AM

Re: Why sharpen ?
 
Quote:

Originally Posted by LadyMiles
@kwag
Your test downloads aren't working for me. But why did you choose sharpen over noise ? Are there certain settings for anime than for live movies ?

That was just a test. I still have to experiment with noise and blur.
Play the samples with WMP. If you want to see them with WinDVD, rename them to .mpg. They don't have any sound.

-kwag

kwag 11-10-2002 07:11 AM

Blockbuster sharpen + noise ( Low pass, high pass filter )
 
Hello SansGrip,

Here is my first in depth test with your filters. Please let me know if what I describe below is correct, or is bologna :lol:
Here is the latest combination I have tried, with a detailed explanation followed:

Blockbuster(method="sharpen", detail_threshold=20, Invert=True, lv=20) # Only sharpen material above 20%.
Blockbuster(method="noise", detail_threshold=20, lv=2) # Only apply noise below 20% complexity.

Both lines were added to my test .avs script.
This is what I have done, after reading your documentation, and understanding how the filter works.
The "sharpen" line on the script, works as a high pass filter by selecting "Invert=True", so only the content above the treshold of 20 is processed by the filter. That means that low lit and low to medium details won't be sharpened at all. Which makes sense, because we don't want to sharpen what we can't see, including DCT blocks.

Then the "noise" line, works the opossite way. It works as a low pass filter, because everything below the treshold of 20 is injected with noise. So only low lit scenes see noise. Thus reducing DCT blocks.

The result is this sample: http://mpeg.0catch.com/test-sharp-noise.m1v ( Very small, 948KB )

Now I believe that what we need next, would be a variable frequency notch filter, targeted at the "Mosquito Effect" frequency domain. That would complete your filter set as the "Killer Filters Set" :wink:

-kwag

SansGrip 11-10-2002 08:00 AM

Re: First try using "Sharpen" in Blockbuster filte
 
kwag: What can I say 8O I'm drooling 8O

hehehe :D

Here's my first try, using the KVCD LBR template, with a CQ_VBR of 27 ( the value I used originally to put this particular movie on one CD-R )

Looks good, though possibly a little over-sharp in places. Or that might just be my imagination, since I knew you used the sharpen method on it :).

Blockbuster(method="sharpen", detail_threshold=0, lv=20)

Obviously the docs aren't very clear on which parameters go with which method. The lv (luma variance) parameter is specific to the "noise" method, and will have no effect with the others.

I'm going to fix the docs today, but in the meantime here's the valid parameters for each method:

method="noise": detail_threshold, block_size, invert, lm, lv, cm, cv, cache

method="sharpen": detail_threshold, block_size, invert, strength

method="blur": detail_threshold, block_size, invert, strength

method="show": detail_threshold, block_size, invert

I'll be doing many more test strips tomorrow

Glad to hear that, it'll be nice to put some "recommended ranges" on the various parameters :).

SansGrip 11-10-2002 08:16 AM

Re: Blockbuster sharpen + noise ( Low pass, high pass filter
 
kwag: The "sharpen" line on the script, works as a high pass filter by selecting "Invert=True", so only the content above the treshold of 20 is processed by the filter.

Well, technically with invert it's a low-pass filter, because only the high-frequency information is being targeted. "Low-pass" means the low end gets passed through unaltered while the high end gets processed. At least, that's my understanding of the term and I could easily be proven wrong ;).

Bear in mind that increasing the frequency of already high-frequency information will probably result in more mosquito noise. It's not evident in that clip because of the overall low luma levels, but you might want to look for it in day-time sections of the movie.

The clip looks excellent -- definitely the best of the three you posted.

Now I believe that what we need next, would be a variable frequency notch filter, targeted at the "Mosquito Effect" frequency domain.

I've yet to do any analysis on exactly what frequencies are involved in the various types of artifacts. That would be interesting, and would mean I'd know roughly what ranges of detail_threshold to recommend for each. Perhaps what might help is to remove invert and split detail_threshold into two parameters, detail_threshold_min and detail_threshold_max, so that users could target a specific frequency range?

(Now this is the kind of productive discussion I've been wanting since I released the filter... :))

kwag 11-10-2002 08:55 AM

Re: Blockbuster sharpen + noise ( Low pass, high pass filter
 
Hi SansGrip,

Quote:

Originally Posted by SansGrip
kwag: The "sharpen" line on the script, works as a high pass filter by selecting "Invert=True", so only the content above the treshold of 20 is processed by the filter.

Well, technically with invert it's a low-pass filter, because only the high-frequency information is being targeted. "Low-pass" means the low end gets passed through unaltered while the high end gets processed. At least, that's my understanding of the term and I could easily be proven wrong ;).

Ok, it was my mistake!. I should have specified more clearly what was passed to the filter. My explanation refering to what was "passed" to the filter, is what was processed by the filter. That's why I used the "Invert" on the sharpen line. This way it's a high pass filter, meaning that above 20, sharpenning is applied. But on the noise filter, below 20 is applied. So the correct meaning I wanted to express is that the "Active" part of the filters is what I described as low pass and high pass. Sorry for the confussion :D

Quote:

Bear in mind that increasing the frequency of already high-frequency information will probably result in more mosquito noise. It's not evident in that clip because of the overall low luma levels, but you might want to look for it in day-time sections of the movie.
Exactly. On high luma, the noise filter will not be injecting noise, because the scenes will be above the treshold of 20, so the noise filter will be inactive. But the sharpen filter will be active. I know I set the "cut off/turn on" point the same, thus when the luma increases from below 20 to 20 and above, theoretically that should trigger the sharpen filter and stop the noise filter. Maybe I could widen the sharpen to turn on at a higher point than 20. Maybe around 50. So that would create a "Bandpass Filter" area, where neither sharpen nor noise would have effect. So >=20 OR <=50 is the bandpass window area.

Quote:

The clip looks excellent -- definitely the best of the three you posted.
Thanks to you :lol:
I made some small changes.
I changed:
Blockbuster(method="sharpen", detail_threshold=20, Invert=True, lv=10) # Only sharpen material above 20%.
Blockbuster(method="noise", detail_threshold=20, lv=1.5) # Only apply noise below 20% complexity.

The lv=10 on the sharpen line, and lv=1.5 on the noise line. It was a little strong before. Here are two samples of dark screen with fog on the scene. Look at the DCT macroblock dance :lol: on the sample without filter, and look at the sample with the combination of both filters above:
http://mpeg.0catch.com/test2-sharp-noise.m1v
http://mpeg.0catch.com/test2-nofilter.m1v

Quote:

Now I believe that what we need next, would be a variable frequency notch filter, targeted at the "Mosquito Effect" frequency domain.

I've yet to do any analysis on exactly what frequencies are involved in the various types of artifacts. That would be interesting, and would mean I'd know roughly what ranges of detail_threshold to recommend for each. Perhaps what might help is to remove invert and split detail_threshold into two parameters, detail_threshold_min and detail_threshold_max, so that users could target a specific frequency range?

(Now this is the kind of productive discussion I've been wanting since I released the filter... :))
This is a great discussion :D , and what you just described above, basically a bandstop filter, is exactly what's needed for the "Mosquito effect". Your idea of a MIN and MAX treshold specifier is great, because that would allow a "Dynamic Window" to be adjusted to the frequency domain of the "Mosquito Effect" I just hope the frequency domain falls in a very small segment, because if it has separate frequency blocks, then the only way to filter that would be to have a king of "Parametric Equalizer" ( similar to what's used on audio equipment ) kind of filter, in order to notch out each block of noise area. What do you think of that :idea:

Regards,
-kwag

Edit:
I changed the script as follows:
Blockbuster(method="sharpen", detail_threshold=20, Invert=True, lv=2) # Only sharpen material above 20%
Blockbuster(method="noise", detail_threshold=20, lv=1.5) # Only apply noise below 20% complexity


You're right on target SansGrip ;) . On bright scenes, the value for lv on sharpen was too high. At lv=2, it's enough to sharpen the image, while not increasing the "Mosquito Effect" that much. I'll post samples in a while. The previous samples are not affected, because it only affected bright scenes.

kwag 11-10-2002 09:40 AM

Blockbuster sharpen + noise ( Low pass, high pass filter
 
As promised. Here are the two new samples, with the filter settings I posted before:

Blockbuster(method="sharpen", detail_threshold=20, Invert=True, lv=2) # Only sharpen material above 20%.
Blockbuster(method="noise", detail_threshold=20, lv=1.5) # Only apply noise below 20% complexity.


http://mpeg.0catch.com/test3-sharp-noise.m1v
http://mpeg.0catch.com/test3-nofilter.m1v

And please, don't judge the quality of these samples. They are meant only to test the filters. With those settings, the movie does fit on a single CD-R. And because it's a Full Screen film, it won't look nearly as good as if it was the Wide Screen Version. :wink:

-kwag

kwag 11-10-2002 10:30 AM

A high contrast scene, made with KVCDx3, using a CQ_VBR value of 15.5 to save space, using the same filter parameters of the previous post:

http://mpeg.0catch.com/test4-sharp-noise.m1v
http://mpeg.0catch.com/test4-nofilter.m1v

-kwag


All times are GMT -5. The time now is 09:33 AM  —  vBulletin © Jelsoft Enterprises Ltd

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.