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. |
6th November 2011, 02:28 | #341 | Link |
Registered User
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
|
I made a function for convolutions, so I am sharing it here.
Code:
function Convolve(clip c, val hor, val ver, float "tot", bool "lsb", int "hctr", int "vctr", int "y", int "u", int "v", bool "info") { #Performs flat convolution of given dimensions...v0.1 by redfordxx #needed Dither 1.12 # issues: Dither_resize16 applies kernel in reverse # Dither_resize16 normalizes kernel, so tot parameter is ignored in 16bits #Usage parameters: #hor, ver arguments...dimensions of the convolution or kernels #tot...divider, negative values are relative to sum of elements, so for 3x3 convo and tot=-2 the resul is tot=18, tot=0 is automatic. Doesnot work in 16bits #lsb...is input stacked 16bit? #hctr,vctr...centerpoints of the convolution string, by default in the middle...ignored if given hor and ver are kernels #info...shows convolution strings on screen y=default(y,3) u=default(u,3) v=default(v,3) htext = IsString(hor) ? hor : "" vtext = IsString(ver) ? ver : "" hi = IsString(hor) ? 1 : int(hor) vi = IsString(ver) ? 1 : int(ver) lsb=default(lsb,false) info=default(info,false) horcenter=default(hctr,(hi+1)/2) vercenter=default(vctr,(vi+1)/2) sum=hi*vi tot=default(tot,0.0) tot = (tot>0) ? tot \ : (tot<0) ? -sum*tot \ : 0 hcoef = 1 vcoef = 1 uh = " "+ string(hcoef) uv = " "+ string(vcoef) uhl =strlen(uh) uvl =strlen(uv) flt=((int(tot)!=tot)&&(lsb==false)) ? ".0" : "" shl=(hi-2*horcenter+1)*(lsb ? -1 : 1 ) #Dither applies convolution in reverse svl=(vi-2*vercenter+1)*(lsb ? -1 : 1 ) strh=uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh+uh strv=uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv+uv str0=" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" hh=leftstr(str0,max(2*shl,0))+leftstr(strh,uhl*hi)+flt+leftstr(str0,max(-2*shl,0)) vv=leftstr(str0,max(2*svl,0))+leftstr(strv,uvl*vi)+flt+leftstr(str0,max(-2*svl,0)) hh=(htext=="") ? hh : htext vv=(vtext=="") ? vv : vtext hvsame=(hh==vv) # when hor and vertical is same, do 16bit in one pass c (!lsb && tot==0) ? mt_convolution(horizontal=hh,vertical=vv,y=y,u=u,v=v) : nop (!lsb && tot>0) ? mt_convolution(horizontal=hh,vertical=vv,total=tot,y=y,u=u,v=v) : nop (lsb && hh!="1" && hvsame) ? Dither_resize16 (Width(), Height()/2, kernel="impulse "+hh, fh=-1, fv=-1, center=false) : nop (lsb && hh!="1" && !hvsame) ? Dither_resize16 (Width(), Height()/2, kernel="impulse "+hh, fh=-1, center=false) : nop (lsb && vv!="1" && !hvsame) ? Dither_resize16 (Width(), Height()/2, kernel="impulse "+vv, fv=-1, center=false) : nop info ? Subtitle(" h=("+hh+") v=("+vv+")") : nop info ? Subtitle(" 16bit="+string(lsb)+" total=("+string(tot)+") size=("+string(hor)+","+string(ver)+") center=("+string(horcenter)+","+string(vercenter)+") ",y=24) : nop return last } Code:
convolve(5, 4, info=true) convolve(5, 4, tot=-2, lsb=false, hctr=-3, vctr=1, info=true) convolve(5, 4, tot=0, lsb=true, hctr=-3, vctr=1, info=true) convolve("1 0 -1 0 1", 4, tot=0, lsb=false, hctr=-3, vctr=1, info=true) @cretindesalpes: I wonder whether these are intents or bugs Now I believe that it was main reason why I was confused with using Dither_resize16 Last edited by redfordxx; 6th November 2011 at 09:02. Reason: Bug |
6th November 2011, 03:10 | #342 | Link | |
Registered User
Join Date: Aug 2008
Posts: 233
|
Quote:
|
|
6th November 2011, 10:54 | #343 | Link |
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
Not really a bug nor an intent. I implemented the convolution in the simplest possible way, and didn't care about the kernel traversal sign, because resizing kernels are symmetric. I'll fix these issues in the next release.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding |
7th November 2011, 22:32 | #344 | Link | |
Registered User
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 805
|
Quote:
In the function dither_lut8_lsb, line 850, it checks if u or v are defined, but if they are, it then tries to check what y is. But if y is not defined, it fails. You need to set y=default(y,3) somewhere. Don't know if there are other places with this error. Also, a feature request... Would it be possible to convert into any colorspace by defining the matrix yourself? Last edited by ajp_anton; 7th November 2011 at 22:35. |
|
9th November 2011, 23:23 | #345 | Link |
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
Dither updated to v1.13.0:
Do you have a specific use in mind? I could add other standard matrices, if required. Or give control over the kr, kg and kr parameters. But defining the 9 matrix coefficients + 3 constants would be a bit more complex.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding |
13th November 2011, 19:06 | #347 | Link |
Registered User
Join Date: Nov 2009
Posts: 2,352
|
I'd like to ask if currently the staticnoise option of ditherpost works like the wOxxOm workflow, or instead noise is spread evenly in the image. Ideally one would want noise only where ditherpost is dithering more aggresively.
I also noticed gradfun3 needs the staticnoise option. It could be a RAM problem but gradfun for smode=2 at least feels very unstable I usually have crashes, raising ampo over 1 also makes it unstable but I'm not sure which one is the trigger. My tests are in 16bit pipeline. I'm tackling fine banding here. GradFun3(0.6,14,lsb_in=true,smode=2,lsb=true) ditherpost(mode=0,ampn=0.5,staticnoise=true,ampo=1.2) BTW I'd like to know if it's ok to use ampn with ampo at the same time when using ordered dither as in the example. Another idea I had is to use floyd-steingberg on detailed areas to shoot for accuracy, but ordered dither on low gradients, if it leaves banding then use the staticnoise as mentioned. The drawback is having to use 2 ditherposts. I don't know if mixing 2 different algos harms too much. At last to confirm something I didnt get clear: Code:
(interlaced source) separatefields dfttest(lsb=true,tbsize=1) ditherpost(mode=6,interlaced=true) weave Last edited by Dogway; 19th November 2011 at 10:55. |
19th November 2011, 18:42 | #348 | Link | |||||
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
Quote:
Quote:
Quote:
Quote:
Quote:
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding |
|||||
29th November 2011, 00:03 | #349 | Link |
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
The Dither package has been updated to v1.13.1:
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding |
29th November 2011, 00:39 | #350 | Link |
Registered User
Join Date: Aug 2010
Posts: 134
|
This is very sweet!
Seeing as vector scaling is being developed again, can I ask if this is possible: Manalyze on half size clip with pel=1 Mflow/blur/whatever on full clip with pel 2 or 4 I've tried tinkering with adjustSubPel and other settings but there seems to be no way, and using pelsearch=0 + blank pel clip is not very clean. Also, vector scaling doesn't work with divide>0. I didn't want to bug Vit with this but since you've included vector scaling it would be great if you could look into it :o |
30th November 2011, 17:24 | #351 | Link | |
Registered User
Join Date: Jul 2010
Posts: 448
|
Quote:
Maybe you had a different idea...? Yes, this is true and should be added to the documentation. I'd had enough after deciphering the internal layout/format of standard multilevel blocks/padding. I guess I'll add that final (rarely used) layer at some stage. |
|
4th December 2011, 18:35 | #352 | Link |
Registered User
Join Date: Nov 2009
Posts: 2,352
|
I had a look to your workaround to make yuy2 colorspace sources be processed by ditherpost, but I'm having a hard time to understand how it works.
Do you apply that code to an 8 bit interleaved yuy2 ? I'm testing by comparing the next to its yv12 counterpart: Code:
(interleaved 8 bit yuy2 source) y = ConvertToYV12 () u = UToY ().ConvertToYV12 () v = VToY ().ConvertToYV12 () YToUV (u, v, StackVertical (y, y)) dfttest(lsb=true) ditherpost(mode=0) y = Crop (0, 0, 0, Height () / 2).ConvertToYUY2 () u = UToY ().ConvertToYUY2 () v = VToY ().ConvertToYUY2 () YToUV (u, v, y) |
4th December 2011, 22:13 | #353 | Link |
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
Yes this code applies to standard YUY2. It works by copying the chroma planes from the YUY2 clip to the YV12. Therefore the overall height must be doubled, so I have to stack two original luma planes. The filtering will work only if each plane is processed separately because chroma and luma are not synchronized. Fortunately, this is the case with dfttest and DitherPost.
If you compare the result with a YV12 source, it's normal you get something different on the chroma planes: regular YV12 to YUY2 conversions are not lossless because of the chroma placement and the interpolation method. If you bypass the dfttest/DitherPost lines in your code, you should obtain the exact source clip.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding |
12th December 2011, 16:20 | #354 | Link |
Registered User
Join Date: Nov 2009
Posts: 2,352
|
I almost finished implementing it to my script but there's something that doesn't work.
Code:
separatefields interleaved2planar super_search=MSuper(planar=true) bv2=super_search.MAnalyse(isb = true, delta = 2) fv2=super_search.MAnalyse(isb = false, delta = 2) MDegrain1(super_search, bv2, fv2, thSAD=300,planar=true,lsb=true) |
13th December 2011, 15:22 | #355 | Link |
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
Indeed, there was a bug with planar=true and lsb=true. Fixed in Dither 1.13.2.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding |
13th December 2011, 17:53 | #356 | Link |
Registered User
Join Date: Nov 2009
Posts: 327
|
cretindesalpes,
Where are these custom versions of dfttest and mvtools you use coming from? I can't find any information about a dfttest 1.9 or mvtools 2.5.14. Can you provide a link to the original versions of these filters or are they solely your creation? |
14th December 2011, 15:39 | #358 | Link | |
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
Quote:
No, I don't think it will change anything.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding |
|
15th December 2011, 14:57 | #359 | Link |
Registered User
Join Date: Sep 2008
Posts: 365
|
Do the modified MVtools in the dither package contain the threading fixes from the QTGMC modded plugins package by -Vit- ?
Little annoying that there are multiple forks of mvtools2 out there now, the official one, one from the dither package, one from QTGMC and one from www.svp-team.com |
15th December 2011, 15:43 | #360 | Link |
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
Yes, this version has the QTGMC threading fixes.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding |
Tags |
color banding, deblocking, noise reduction |
Thread Tools | Search this Thread |
Display Modes | |
|
|