Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
24th February 2011, 21:06 | #62 | Link |
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
I already posted here an earlier version of this script. It is a bit rough and has to be finetuned (especially for the motion search clip), but the basic concept remains the same.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding |
26th February 2011, 16:33 | #63 | Link |
Registered User
Join Date: Nov 2009
Posts: 2,361
|
It produces flatter color areas and preserves more details, compared to my gradfun workflow. Lossless compressed to FFV1 chunk weighted less (163Mb) than the gradfun method (189Mb) which indicates that it is more efficient fot bits allocation in h.264. Im using a very high bitrate for h.264 but (ordered) dither encodes nicely. Its perfect for 2D animation. Im gonna try your last suggestions, and methods to see if I can improve quality or optimization.
edit: It also deals nicely with the problem I was having with GradFun2DBmod (ghosting)
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread Last edited by Dogway; 26th February 2011 at 16:42. |
27th February 2011, 15:12 | #65 | Link | |
LaTo INV.
Join Date: Jun 2007
Location: France
Posts: 701
|
Quote:
Set temp=-1 (disable temporal stabilization) in GF2DBmod is a good workaround. |
|
27th February 2011, 16:41 | #66 | Link |
Registered User
Join Date: Nov 2009
Posts: 2,361
|
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread |
27th February 2011, 18:33 | #67 | Link |
Registered User
Join Date: Oct 2009
Posts: 212
|
@cretindesalpes
Very nice! I have a two questions. This is a standard usage call for Dither? h = Height () w = Width () dfttest (lsb=true) # Output contains stacked MSB-LSB on the same frame. msb = last.Crop (0, 0, w, h) lsb = last.Crop (0, h, w, h) DitherPost (msb, lsb, prot=false) and Could one for example use only Dithering? TiA Last edited by SilaSurfer; 27th February 2011 at 18:38. |
27th February 2011, 18:55 | #68 | Link |
Registered User
Join Date: Nov 2009
Posts: 2,361
|
@SilaSurfer: if thats all you are going to do after dfttest, then I think you can just use:
dfttest (lsb=true) DitherPost (stacked=true, prot=false)
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread |
27th February 2011, 19:12 | #69 | Link | |
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
Indeed, this is haloing, not ghosting. This issue with gradfun2db is known and has been described here. This is related to how the gf2db filter works. Gradfun2db averages a large area around the processed pixel (box filtering), because box filtering is very fast and its speed is almost constant whatever the size of the box. The resulting 16-bit pixel value is compared to the current pixel and replaces it if the difference is small enough (with a smooth curve controlled by thr). Then, the result is dithered to 8 bits using error diffusion.
Actually the box filter + threshold is intended to be a simplification of a bilateral filter. It should have rejected input values which are too far away from the processed pixel, but instead it rejects output values which are not very close from the current pixel. In most case this works pretty well, but sometimes it fails and generates large, subtle halos near gradient boundaries. Yes for the purpose of debanding, but now you can write this even simpler: Code:
dfttest (lsb=true) DitherPost (prot=false, stacked=true) Quote:
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding |
|
27th February 2011, 19:39 | #70 | Link |
Registered User
Join Date: Oct 2009
Posts: 212
|
I'm confused here.
dfttest (lsb=true) DitherPost (prot=false, stacked=true) #Debanding What if I wanted to use Mdegrain also? Sorry guys for the confusion, can't test this since encode is running here for the next 22 hours. Last edited by SilaSurfer; 27th February 2011 at 19:46. |
27th February 2011, 19:51 | #71 | Link | |
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
Quote:
MDegrain* (lsb=true) does the same job as dfttest, but only temporally. Therefore it cannot remove banding when it is already in the source, but won't introduce new banding.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding |
|
27th February 2011, 20:18 | #73 | Link |
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
Yes, just replace MDegrain with MDegrain1/MDegrain2/MDegrain3, and add at least the mandatory parameters required for the MDegrain* filters (superclip and motion vectors, see the MVTools2 documentation).
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding |
27th February 2011, 21:19 | #74 | Link |
Registered User
Join Date: Jul 2003
Location: Italy
Posts: 1,135
|
For what I've seen, debanding filters in general suffers on dark areas. For example a thick black line in a dark gray background once debanded have the risk to be completely lost. I'm currently interested in only debanding (not denoise+debanding) so I think I'd need to use SmoothGrad (am I right?). In that case, have SmoothGrad some routines to avoid this (seems) common problem in dark areas without lowering the debanding strength on all other parts of the image? (I've not tested it yet, so I'm just asking). Thanks.
|
27th February 2011, 23:36 | #75 | Link | |
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
Quote:
However SmoothGrad was intended to be a postprocessor for the main filtering functions and therefore operates directly on a 16-bit clip, so you'll have to convert your clip to 16 bits. Just stack it on the top of a BlankClip with color_yuv=$000000. GradFun3 is a more or less sophisticated wrapper around SmoothGrad + DitherPost that would replace gradfun2db, but I'm not totally happy with its current implementation. I may rework it later.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding |
|
6th April 2011, 04:08 | #76 | Link |
Registered User
Join Date: Nov 2009
Posts: 2,361
|
I found out that you dont need the quotes when using the filter string in ditherpre. But I wanted to note that despite it works wonders when it works, in ocassions it can smooth too much the results, more than dithering banding. I can tell from the last source Im testing with, it causes the lineart to blur. I can post comparisons.
What I thought was to use no dither (mode=-1) for lineart, and dither for the rest, but the effect is the same and running 2 instances (one with ditherpre, and one without) is a bit of CPU waste, moreover when Im using tnlmeans. The code would come as follows: Code:
line=src.MT("tnlmeans(ax=10,ay=10,az=2,sx=2,sy=2,bx=1,by=1,h=0.6,sse=false)",2,2) flat=Dither2Pre(line,stacked=true) Also I have discovered some big ghosting problems (not halo-like like gradfun) in fast motion scenes. This is strange because I didnt think "Dither" had temporal qualities.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread Last edited by Dogway; 6th April 2011 at 06:58. |
7th April 2011, 19:08 | #77 | Link | ||
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
Quote:
Quote:
Code:
Dither2Pre (flt="tnlmeans(ax=10,ay=10,az=2,sx=2,sy=2,bx=1,by=1,h=0.6,sse=false)", stacked=true) The ghosting comes from dfttest used in DitherPre as default filter. Dfttest is not protected against ghosting, therefore you have to MCompensate/Interleave the previous and next frames first, and SelectEvery the result (see the dfttestMC function). Regarding motion compensation, it is advised to do it outside the DitherPre functions. Avoid using dfttestMC (or other motion-aware filters) in the filter string, because the motion estimation may fail on the material actually submitted to the filter.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding |
||
7th April 2011, 23:07 | #78 | Link |
Registered User
Join Date: Nov 2009
Posts: 2,361
|
Thank you. In this case tnlmeans works best with MT. I had to use three quotes, which is what I did first, but Dither weakens the denoise effect so I thought it wasn't working at all or something. Then I got fooled with the "clip" parameter I guess.
That explains all the issues I was having, so hopefuly I dont need any edgemask workaround anymore. Now what Im trying to do is some resizing in between, the code I have is as follows, but Im unsure if I can resize msb and lsb without ditherposting them first. Code:
den=Dither2Pre(flt="""MT("tnlmeans(settings)",2,2)""",stacked=true) msb=den.Crop(0,0,w,h) lsb=den.Crop(0,h,w,h) rounded=den.SmoothGrad (stacked=true).DitherPost(mode=-1,stacked=true,prot=false) contraV=rounded.splinaa(720,480).LSFmod() contra_d=mt_makediff (contraV,rounded.spline36resize(720,480),y=3,u=3,v=3) msb_sharp=mt_adddiff(msb.spline36resize(720,480),contra_d,y=3,u=3,v=3) mask=DitherBuildMask(msb_sharp,msb.spline36resize(720,480)) DitherPost(msb_sharp,lsb.spline36resize(720,480),prot=false,mask=mask) tnlmeans(ax=10,ay=10,az=2,sx=2,sy=2,bx=1,by=1,h=0.6) tnlmeans(ax=20,ay=20,az=4,sx=4,sy=4,bx=1,by=1,h=2.4) Are you sure filter behaviour is maintained?
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread Last edited by Dogway; 8th April 2011 at 02:33. |
10th April 2011, 10:53 | #79 | Link | ||
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
Quote:
Quote:
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding |
||
10th April 2011, 13:26 | #80 | Link |
Registered User
Join Date: Nov 2009
Posts: 2,361
|
uhmm As you said doubling only a and h seemed to work almost identical, I then applied your suggestions to ditherpost. Only after I realised of some artifacts so-to-speak, which I linked to the fact of resizing in 16bits. So I run a few tests up to a simple ditherpre-ditherpost, and still there, so maybe there's need to tweak more tnlmeans parameters, or they are wrong....
These are the two shots for comparison, the first one running only tnlmeans and dithering with gradfun, the second one with this workaround with dither. I want you look at the wall, grass loses some detail too. old-workflow dither-workflow edit: the issue could be in ditherpost as well, although I tried several modes(-1,0,6,7) and didn't see any improve. edit2:about ResampleHQ it would be nice in the meantime, bear in mind even yv12 dither isn't implemented. Its a bit pity to develop a 16b processing filter to benefit from wider bitdepth, and then crush it down to 8 back again.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread Last edited by Dogway; 10th April 2011 at 14:09. |
Tags |
color banding, deblocking, noise reduction |
|
|