Quantcast Sansgrip Filters: Improve Picture Quality Using "Addnoise" Filter - Page 4 - digitalFAQ.com Forums [Archives]
Go Back    digitalFAQ.com Forums [Archives] > Video Production Forums > Avisynth Scripting

Reply
 
LinkBack Thread Tools
  #61  
11-10-2002, 10:50 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by SansGrip
Quote:
Originally Posted by kwag
What about 180 degree phase shifting on macro block boundaries? Thus, cancelling the block edges.
I'm not quite sure how a phase shift would be accomplished. Do you know any good links to information?
Never mind SansGrip,

After analyzing this scheme again, I believe that there's no way to play with macro block alignment or anything macro block related, because that's a function that we can't controll externally. It really depends on the motion estimation algo that the encoder uses. At a low CQ value, the encoder doesn't have enough bandwidth to analyze and predict frames to keep up with the movement, and blocks will show everywhere. Your original idea of rounding the edges sounds to me very logical. And that will go into the encoder. So maybe a rounding (anti-aliasing?) algo on edges followed by a slight sharpen is the key. Go for that

-kwag
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #62  
11-11-2002, 07:32 AM
GFR GFR is offline
Free Member
 
Join Date: May 2002
Posts: 438
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by black prince
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!! This release
is unstable and for developers. Here's the doc file:

- 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.

-black prince
Hi, I guess it's intended for existing mosquitoes, not potential mosquitoes

If you can't run this, maybe try the virtualdub Cartoon tool (Flaxen?) I guess it works on a similar principle (median filter) only his objective is to thicken the contours in anime.

The mosquito noise, as I understand it, is a combination of the Gibbs effect AND movement. That is, if you have a sharp edge and limit the bandwith, oscillations appear round the edges that then turn into little blocks. These little blocks are not that bad because they're small. If you look at a still from a mosquito infected sequence you'll think it's problably OK. The biggest problem is when the edge is moving and then the little blocks "move" around them, drawing your attention to them!

Animes are problably the worst sources because 1) all edges are sharp; 2) most areas are "flat" - you don't have complex textures near the edges that can "mask" the little blocks.

If you try selective bluring, remember that the low pass filter you use should not introduce its own spurious oscillations or it will CREATE Gibbs effect.

I was thinking, if you take an algorythm like wavelet denoising and instead of "gating" low level noise you CLIP high level detail, you have sort of a non-linear selective edge bluring, cause you are only limiting the "biggest" edges, and keeping "mild" edges and textures intact. If the clipping function is continuous and smooth, it won't introduce any spurious oscillations (so says theory ) And the clipping level could be independent for each subband.
Reply With Quote
  #63  
11-11-2002, 01:15 PM
black prince black prince is offline
Free Member
 
Join Date: Jul 2002
Posts: 1,224
Thanks: 0
Thanked 0 Times in 0 Posts
Hi All,

Would re-encoding LBR (Blockbuster) --> LBR(UnDot only) to remove
Gibbs effect (mosquito noise) cause too much picture loss? I know this
is not a pratical solution for mosquito noise, but I would like to see how
effective any method would have as a test. If this sounds crazy, post me
about your opinions either way.

-black prince
Reply With Quote
  #64  
11-11-2002, 02:16 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by black prince
Hi All,

Would re-encoding LBR (Blockbuster) --> LBR(UnDot only) to remove
Gibbs effect (mosquito noise) cause too much picture loss?
Yes, we would loose, because we would be re-encoding an already compressed file.

-kwag
Reply With Quote
  #65  
11-11-2002, 04:04 PM
black prince black prince is offline
Free Member
 
Join Date: Jul 2002
Posts: 1,224
Thanks: 0
Thanked 0 Times in 0 Posts
Hey Kwag,

Quote:
Kwag wrote:
Quote:
black prince wrote:
Hi All,

Would re-encoding LBR (Blockbuster) --> LBR(UnDot only) to remove
Gibbs effect (mosquito noise) cause too much picture loss?

Yes, we would loose, because we would be re-encoding an already compressed file.

-kwag
I know better Kwag. Re-encoding will always loose picture quality.
Just anxious about results for Gibbs effect, since everything looks
great so far. My last encode using Blockbuster's filters made the
LBR video come closer to KVCDx3. I compared the x3 version with
LBR and it's very close. LBR suffers from mosquito noise big time.
If and when a solution comes for mosquito noise, my next issue
will be file size to fit one CD.

-black prince
Reply With Quote
  #66  
11-11-2002, 04:46 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by black prince
LBR suffers from mosquito noise big time.
If and when a solution comes for mosquito noise, my next issue
will be file size to fit one CD.

-black prince
It depends on the movie. You might want to tighten the GOP more, for your particular film. Try a GOP of ( 1, 10, 2, 1, 10 ) for high contrast movies or Animes. That will make a huge difference. But remember, some things that look like "Mosquito Effect" on the LBR, actually any 352x240 encode, are not really "Mosquito Effect" it's the actual movie, but specially on far away scenes you'll see more, because what you are really seeing is pixel artifacts. The higher resolution you go, the less artifacts, because there are more pixels on the screen. So a lot of things we see on the LBR, are actually pixel artifacts. You can confirm this by making a sample with CQ_VBR=100 and increase the MAX bit rate to 6,000Kbs. You'll still see some pixel artifacts on far away moving objects. There's no way around that. Unless you increase the resolution.

-kwag
Reply With Quote
  #67  
11-11-2002, 09:10 PM
black prince black prince is offline
Free Member
 
Join Date: Jul 2002
Posts: 1,224
Thanks: 0
Thanked 0 Times in 0 Posts
Hi Kwag,

Kwag wrote:
Quote:
Quote:
black prince wrote:
LBR suffers from mosquito noise big time.
If and when a solution comes for mosquito noise, my next issue
will be file size to fit one CD.

-black prince

It depends on the movie. You might want to tighten the GOP more, for your particular film. Try a GOP of ( 1, 10, 2, 1, 10 ) for high contrast movies or Animes. That will make a huge difference. But remember, some things that look like "Mosquito Effect" on the LBR, actually any 352x240 encode, are not really "Mosquito Effect" it's the actual movie, but specially on far away scenes you'll see more, because what you are really seeing is pixel artifacts. The higher resolution you go, the less artifacts, because there are more pixels on the screen. So a lot of things we see on the LBR, are actually pixel artifacts. You can confirm this by making a sample with CQ_VBR=100 and increase the MAX bit rate to 6,000Kbs. You'll still see some pixel artifacts on far away moving objects. There's no way around that. Unless you increase the resolution.

-kwag
Your right Kwag. I pushed the CQ to 100 and most of what I thought
was mosquito noise turned out to be artifacts. There was a small amount
of mosquito noise, but from a distance of 3 feet you couldn't tell.
I burned the test mpeg and tested it on 27" TV. Excellent, but the predicted
file size without credits would not fit on one CD (700MB). I am going to try
my 99 min CD's and this should work. It may not play on other DVD
players, but it sure will play on my JVC.

-black prince
Reply With Quote
  #68  
11-12-2002, 01:42 AM
LadyMiles LadyMiles is offline
Free Member
 
Join Date: Sep 2002
Posts: 124
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Your right Kwag. I pushed the CQ to 100 and most of what I thought
was mosquito noise turned out to be artifacts. There was a small amount
of mosquito noise, but from a distance of 3 feet you couldn't tell.
I burned the test mpeg and tested it on 27" TV. Excellent, but the predicted file size without credits would not fit on one CD (700MB).
Okay I am getting all confused again what's the difference between artifacts and mosquito noise ?

Oh btw black prince, I thought you might be interested this thread Sangrip wrote me at doom9 about what exactly is noise.

http://forum.doom9.org/showthread.php?s=&threadid=37395
Reply With Quote
  #69  
11-12-2002, 04:28 PM
black prince black prince is offline
Free Member
 
Join Date: Jul 2002
Posts: 1,224
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks LadyMiles,

I actually spotted your post last week on Doom9 and that's why I
sent a PM to you about improving LBR picture quality. Your post
at Doom9 led me to start investigating "AddNoise" by SansGrip
and then when Kwag got involved with SansGrip they begain the
Blockbuster filter which were now using. GFR has a program which
may help the "Gibbs effect" or mosquito noise, so work and testing
are still being done. All this from your post to SansGrip about picture
noise. All templates will benifit from BlockBuster and with more
enhancements to come. And you started it.


-black prince
Reply With Quote
  #70  
11-12-2002, 04:56 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Here's a new toy to add to your script. It will proportionally adjust the Strength value on the "sharpen" method, depending on your target resolution. So you only have to uncomment one line, and encode

######## Auto Strength, proportional strength depending on resolution #####
## Remove only one "#" on front of the resolution that matches your encoding.

BB_Resolution = 352*240
#BB_Resolution = 352*480
#BB_Resolution = 528*480
#BB_Resolution = 544*480
#BB_Resolution = 704*480

BB_StrengthConstant = 352 * 240 * 20 # Base strength
StrengthValue = BB_StrengthConstant / BB_Resolution
Blockbuster( method="noise", detail_min=1, detail_max=3, lv=1.5 ) # Apply noise if complexity is <= 3%.
Blockbuster( method="sharpen", detail_min=4, detail_max=99, strength=StrengthValue ) # Sharpen only if complexity is >= 4%.

##
################## End Auto Strength ####################

A little explanation. I had selected a value of 20 for strength on 352x240. So that means that every time I switch a template, I would have to figure out different strength values, because the higher resolutions don't need as much sharpness as lower resolutions. Well, use this script and let it calculate it automatically. The constant 1689600 is based on calculating 352 X 240 X 20. 20 meaning the fixed value I was using on the 352x240 LBR template. So now, every time the resolution increases, the strength value will be lowered proportionally.

Note: For PAL people. Adjust your constant to read "BB_StrengthConstant = 352 X 288 X 20" , and change the lines to read:
BB_Resolution = 352x288
BB_Resolution = 352x576
Etc, etc

Have fun
-kwag
Reply With Quote
  #71  
11-12-2002, 07:09 PM
edmund edmund is offline
Free Member
 
Join Date: Oct 2002
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
hey kwag.. that script is great.. but where do i insert it exactly.. do i put it after the resizing?? and also.. tmpgenc won't allow my avs file in with the blockbuster line of code it it.. it says there is an error?? i have check to make sure the path to my dll file is correct and it is.. so i don't know what else to do?? please help thanks
Reply With Quote
  #72  
11-12-2002, 07:32 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by edmund
hey kwag.. that script is great.. but where do i insert it exactly.. do i put it after the resizing?? and also.. tmpgenc won't allow my avs file in with the blockbuster line of code it it.. it says there is an error?? i have check to make sure the path to my dll file is correct and it is.. so i don't know what else to do?? please help thanks
Works fine here! Check your blockbuster.dll path. I am using mine after the resizing line.
Here's my working script:

LoadPlugin("C:\encoding\MPEG2DEC.dll")
LoadPlugin("C:\encoding\blockbuster.dll")
mpeg2source("K:\TEST\VIDEO_TS\movie.d2v")
BilinearResize(336,192,45,0,630,480)


######## Auto Strength, proportional strength depending on resolution #####
## Remove only one "#" on front of the resolution that matches your encoding.

BB_Resolution = 352*240
#BB_Resolution = 352*480
#BB_Resolution = 528*480
#BB_Resolution = 544*480
#BB_Resolution = 704*480

BB_StrengthConstant = 352 * 240 * 20 # Base strength
StrengthValue = round (BB_StrengthConstant / BB_Resolution)
Blockbuster( method="noise", detail_min=1, detail_max=3, lv=1.5 ) # Apply noise if complexity is <= 3%.
Blockbuster( method="sharpen", detail_min=4, detail_max=99, strength=StrengthValue ) # Sharpen only if complexity is >= 4%.

##
################## End Auto Strength ####################

AddBorders(8,24,8,24)


-kwag
Reply With Quote
  #73  
11-12-2002, 07:57 PM
christopher christopher is offline
Free Member
 
Join Date: Jun 2002
Location: North Carolina
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
strength=StrengthValue - strength can only accept integers, so Kwag you need to round your StrengthValue.

Christopher
Reply With Quote
  #74  
11-12-2002, 08:46 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by christopher
strength=StrengthValue - strength can only accept integers, so Kwag you need to round your StrengthValue.

Christopher

Ahh!, that bit me again
Thanks Christopher.
Post edited
Should read: StrengthValue = round (BB_StrengthConstant / BB_Resolution)

-kwag
Reply With Quote
  #75  
11-12-2002, 09:42 PM
Daagar Daagar is offline
Free Member
 
Join Date: May 2002
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
If you want to use DVD2SVCD with this, here is a sample (cut & paste this to the bottom of dvd2svcd.ini and then you can access it in the Frameserver tab):

[AVISYNTH_BlockbusterBilinearResize]
0=BilinearResize(^TargetWidth,^TargetHeight)
1=AddBorders(0,^BorderTop,0,^BorderBottom)
2=LoadPlugin(!Blockbuster.dll)
3=Blockbuster( method="noise", detail_min=1, detail_max=3, lv=1.5 )
4=Blockbuster( method="sharpen", detail_min=4, detail_max=99, strength=^StrengthValue )
!Blockbuster.dll=C:\VideoTools\DVD2SVCD\Blockbuste r\Blockbuster.dll
^StrengthValue=20

Change the path to blockbuster.dll, and adjust your strength value according to Kwag's formulas based on your resolution. I'm not sure if dvd2svcd can handle mathematical expressions in the avs scripts, so I hardcoded the strength value. You can manipulate it via dvd2svcd, however.
Reply With Quote
  #76  
11-13-2002, 12:43 AM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
@Daagar,
Thanks for that script

@All,

Here's my latest test with Blockbuster AND NoMoSmooth filters, also from SansGrip. @SansGrip, I can't thank you enough
This is an excelent sample showing the removal of DCT blocks on the background. Look carefully at the background wall.

KVCD LBR sample WITH filters: http://www.kvcd.net/test5-sharpen-noise-nomosmooth.m1v
KVCD LBR sample WITHOUT filters: http://www.kvcd.net/test5-nofilter.m1v
Standard VCD. Constant bit rate using TMPEG VCD template: http://www.kvcd.net/test5-standard-cbr-vcd.m1v

Both KVCD samples are less than 1MB. The standard VCD sample is 1.3MB.

Also, look at the file size difference after applying the NoMoSmooth filter. It's a combination of Temporal and Spatial filter. So you may now discard TemporalSmoother and (probably) Convolution3D

Here's the script I used for the sample:

LoadPlugin("C:\encoding\MPEG2DEC.dll")
LoadPlugin("C:\encoding\nomosmooth.dll")
LoadPlugin("C:\encoding\blockbuster.dll")
mpeg2source("K:\TEST\VIDEO_TS\movie.d2v")
BilinearResize(336,192,45,0,630,480)

NoMoSmooth()

######## Auto Strength, proportional strength depending on resolution #####
## Remove only one "#" on front of the resolution that matches your encoding.


BB_Resolution = 352*240
#BB_Resolution = 352*480
#BB_Resolution = 528*480
#BB_Resolution = 544*480
#BB_Resolution = 704*480

BB_StrengthConstant = 352 * 240 * 20 # Base strength
StrengthValue = round (BB_StrengthConstant / BB_Resolution)
Blockbuster( method="noise", detail_min=1, detail_max=10, lv=1 ) # Apply noise if complexity is <= 10%.
Blockbuster( method="sharpen", detail_min=20, detail_max=90, strength=StrengthValue) # Sharpen only if complexity is >= 20% AND <=90%.

##
################## End Auto Strength ####################

AddBorders(8,24,8,24)


I made some changes ( Expect many changes, until I find the optimal settings, but we're close )
If you look at the script, I changed the "noise" method to feed noise up to a complexity level of 10. I also used the default value of 1 for luminance, instead of 1.5, as I had posted before. Then I changed the "sharpen" method to start at a complexity level of 20. Why?, because we don't want to sharpen low lit things close to the boundaries of the DCT blocks on dark scenes. So I started the sharpen filter from 20 up to 90, and left the last ~10% ( 91 to 99 ) untouched. Why?, so that the sharpest edges, highest frequencies, don't get sharpened at all. So this should kill some high frequency "Mosquito Effect"

Feedback welcome

-kwag
Reply With Quote
  #77  
11-13-2002, 11:50 AM
black prince black prince is offline
Free Member
 
Join Date: Jul 2002
Posts: 1,224
Thanks: 0
Thanked 0 Times in 0 Posts
Hi Kwag,

I compared the new settings for “Blockbuster” and “NoMoSmooth”:
Here's my subjective opinions about picture quality.

For noise-sharpen-nomosmooth - background blockiness has disappeared.
Still a little too sharp looking, but very realistic from a distance. Detail stands
out better with small amount of sharpen.

For noise-sharpen - not much different without NoMoSmooth except
file size is smaller. NoMoSmooth is set for default and needs some
tweaking.

For nofilters – blockiness appears on background wall, picture is slightly
blurry, detail doesn’t standout from distance. File size larger than
noise-sharpen.

These subtle changes are adding up to enhance overall picture quality.
Your getting there, Kwag. It’s good to see some file compression back
again with NoMoSmooth. Each update you have posted has increased
the overall picture quality. With the “mosquito noise” reduced, this will
best the best LBR ever.


-black prince
Reply With Quote
  #78  
11-13-2002, 12:58 PM
Holomatrix Holomatrix is offline
Free Member
 
Join Date: Aug 2002
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
Sorry to interject, but why do you use BiLinear resize and not the new Lanczos? so have you guys come to the conclusion that using Blockbuster in conjunction with nomosmooth is the best to use when doing DVD to SVCD conversion?
There are so many avisynth filters out there, I'm just looking for the best quality combination.
Thanks
Reply With Quote
  #79  
11-13-2002, 01:31 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Hi Holomatrix,

I've tried the Lanczos resize, but it seems that the "ladder" of "jagged" edges on diagonal lines, are more pronounced than with Bilinear resize. At least on 352x240 tests I've done. I have yet to see any filter combination that produces the quality that I've seen with the NoMoSmooth + Blockbuster combination. It's simply amazing. And there are no filters to my knowledge that reduce DCT blocks on dark areas. Only Blockbuster does that. Check the samples that I posted in this thread.

-kwag
Reply With Quote
  #80  
11-13-2002, 01:47 PM
black prince black prince is offline
Free Member
 
Join Date: Jul 2002
Posts: 1,224
Thanks: 0
Thanked 0 Times in 0 Posts
Hi Kwag,

Kwag wrote:
Quote:
I've tried the Lanczos resize, but it seems that the "ladder" of "jagged" edges on diagonal lines, are more pronounced than with Bilinear resize. At least on 352x240 tests I've done.
I use lanczosResize and didn't realize this was happening. I am
going to switch to bilinearResize.

-black prince
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
""""""Por favor me ajude" ficoboy Conversão e Codificação de Vídeo (Português) 49 08-24-2004 05:35 PM
Quais os codec's? """"""" ficoboy Conversão e Codificação de Vídeo (Português) 1 05-11-2004 10:14 AM
SansGrip's Filters: "I stopped working on the filters." SansGrip Avisynth Scripting 8 04-28-2004 07:38 PM
CQ con Tok "automatico" o CQ_VBR "manual" r1racing1 Convertir y Codificar Video (Español) 4 11-27-2003 05:14 PM
SansGrip Filters: How To Use "Overscan" together with Letterbox Jellygoose Avisynth Scripting 7 02-11-2003 05:57 AM




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