Log in

View Full Version : UnboxB - dotcrawl remover


*.mp4 guy
6th July 2009, 23:27
This is a dotcrawl remover, it relies on a plugin that likes to crash,But thanks to a wokaround from Didée It should behave pretty well now. Sources should not be scaled in any way before being input, though they should be ivtced/deinterlaced, but not decimated. It can compensate for video having been scaled, or decimated to a certain extent, and it does this by default, but this means that if your video has been cropped, and not scaled to a resolution below 720*480, you must set the calcwidth and calcheight parameters to its resolution before it was cropped, but no higher then 720/480. Recomended usage is to call it twice, first with strong =1, then with strong=0. Higher taps settings will be more precise, but slower, the default should always be good enough.

function unboxB(clip c, int "taps", int "strong", int "calcwidth", int "calcheight")
{

calcwidth = default(calcwidth, c.width)
calcheight = default(calcheight, c.height)
calcwidth2 = c.width
calcheight2 = c.height

taps = default(taps, 7)
strong = default(strong, 0)


c = c#.addborders(704 - calcwidth2, 480 - calcheight2, 0, 0)
t2 = c
t1 = c.Trim(0, -1)+c.Trim(0, c.framecount-1)
t3 = c.Trim(1, 0)+c.Trim(c.framecount, 0)


t2s0 = t2
t2s1 = lanczosresize(t2, c.width, c.height, 0, calcheight/480, c.width, c.height, taps=taps)
t2s2 = lanczosresize(t2, c.width, c.height, (calcwidth + (188 * calcwidth / 720 )) / 376, 0, c.width, c.height, taps=taps)
t2s3 = lanczosresize(t2, c.width, c.height, -(calcwidth + (188 * calcwidth / 720 )) / 376, 0, c.width, c.height, taps=taps)
t2s4 = lanczosresize(t2, c.width, c.height, 0, -calcheight/480, c.width, c.height, taps=taps)
BasicSpatial = strong >= 1 ? average(t2s0, 0.5, t2s1, 0.125, t2s2, 0.125, t2s3, 0.125, t2s4, 0.125) : t2s0

t1s0 = t1
t1s1 = lanczosresize(t1, c.width, c.height, 0, calcheight/480, c.width, c.height, taps=taps)
t1s2 = lanczosresize(t1, c.width, c.height, (calcwidth + (188 * calcwidth / 720 )) / 376, 0, c.width, c.height, taps=taps)
t1s3 = lanczosresize(t1, c.width, c.height, -(calcwidth + (188 * calcwidth / 720 )) / 376, 0, c.width, c.height, taps=taps)
t1s4 = lanczosresize(t1, c.width, c.height, 0, -calcheight/480, c.width, c.height, taps=taps)

t3s0 = t3
t3s1 = lanczosresize(t3, c.width, c.height, 0, calcheight/480, c.width, c.height, taps=taps)
t3s2 = lanczosresize(t3, c.width, c.height, (calcwidth + (188 * calcwidth / 720 )) / 376, 0, c.width, c.height, taps=taps)
t3s3 = lanczosresize(t3, c.width, c.height, -(calcwidth + (188 * calcwidth / 720 )) / 376, 0, c.width, c.height, taps=taps)
t3s4 = lanczosresize(t3, c.width, c.height, 0, -calcheight/480, c.width, c.height, taps=taps)


str=0.5
smix1 = average(t2s0, 1-str, t2s1, str)
smix2 = average(t2s0, 1-str, t2s2, str)
smix3 = average(t2s0, 1-str, t2s3, str)
smix4 = average(t2s0, 1-str, t2s4, str)

tmix1 = average(t2s0, 1-str, t1s0, str)
tmix2 = average(t2s0, 1-str, t3s0, str)


Interleaved = interleave(smix1, smix2, smix3, smix4, tmix1, tmix2, BasicSpatial)
Interleaved = blankclip(Interleaved).merge(Interleaved,0.999)
Median = Interleaved.medianblurt(radiusy=0, radiusu=0, radiusv=0, temporalradius=3, mc=false, calcborder=true, markscenechange=false)
Out = Median.selectevery(7, 3)

Out#.crop(704 - calcwidth2, 480 - calcheight2, 0, 0)

return(last)}

[edit[
This function requires the Average, Masktools 2, and MedianblurT plugins

J_Darnley
7th July 2009, 16:23
Is this what you have been working on for a while? If I wanted to use this on PAL video, would you recommend running it on the top 480 and bottom 480 lines, or on the top 480 and bottom 96 lines?

*.mp4 guy
7th July 2009, 16:37
I wrote it a while ago, then I got annoyed that I couldn't get it to work properly, and stopped working on it. Later I realised it was still probably better then most of the other dotcrawl removers, so I asked some other people to test it. They liked it, so I tried to do some additional work on it, none of it worked well, so I just hardcoded a workaround into the function and forgot about it again. Someone recently pmed me asking for it out of the blue, so I made a thread here for it.

For getting it to work on PAL, I would recomend taking out the workaround lines and determining the closest to PAL resolution you can use that doesn't crash. I will see about writing a PAL version.

Although, all of the above is based on Assuming PAL uses the same color sub carrieer muxing etc. that NTSC uses.

Keiyakusha
7th July 2009, 16:43
So there is no way to work with 720x480? Exept cropping to 704x480 and then adding cropped lines back? I don't remember when last time I had DVDs with black borders higher then ~2px... And cropping good pixels is pointless. How about splitting frame to 360x480 +360x480?
EDIT: if splitting the frame (with overlapping?) can be done, maybe we can have some modes like NTSC704, NTSC720, PAL etc. ?

lansing
7th July 2009, 17:03
tested on my anime, seems like it blurs too much on panning scenes.

source:
http://img16.imageshack.us/img16/5490/sourceu.png


And then unboxb:
tfm()
Crop(12, 0, -4, -0)
unboxb(strong =1)
unboxb(strong =0)
tdecimate()


http://img17.imageshack.us/img17/3522/unboxb.png

*.mp4 guy
7th July 2009, 17:37
Yes these two issues are why it wasn't posted earlier. Also, the resolution thing isn't a size issue, the medianblur plugin just randomly crashes at some resolutions, such as 720*480. You can remove the workaround lines and figure out what resolutions you can get it to run on by trial and error if you want.

[edit]
@lansing
Your source is a bit blurry already, try just calling it once with strong=0

Didée
7th July 2009, 20:21
Ah, MedianblurT ... yup, it behaves :devil:

I remember it reliably crashed when using it on a clip that had been cropped ... but iirc it got pretty stable with a little workaround like this:

a = [whatever resolution]
b = a.crop(..)

c = blankclip(b).merge(b,0.999)

... and then apply MedianblurT on the "c" clip.

Seems that MedianblurT is not sober regarding video pitch, or something. The Merge() workaround creates a fresh clip with properties that MedianblurT can handle. Even FullHD, even mod4 resolutions.

*.mp4 guy
7th July 2009, 22:08
That is quite a nice trick. It apears to resolve the issue when I use it on the clip after it has been interleaved. Thanks Didée.

Guest
7th July 2009, 22:11
If you point me to the MedianBlurT source code, I can fix the pitch problem.

Reuf Toc
7th July 2009, 22:22
If you point me to the MedianBlurT source code, I can fix the pitch problem.

Medianblur thread with link to plugin and source : here (http://forum.doom9.org/showthread.php?t=84636)

Gavino
7th July 2009, 23:08
Version 0.82 was said to have fixed a pitch problem in MedianBlurT.

version 0.82 fixed a bug that caused a access violating in medianblurt and ml3dex
Fixed the bug that caused a access violation. It was caused by different pitch in some of the source frames. Get version 0.82 above.

Guest
7th July 2009, 23:19
Can someone provide a source file and simple script with just medianblur that causes a crash with 0.84?

Didée
7th July 2009, 23:53
a = colorbars(pixel_type="YV12")

b1 = a.crop(214,0,-2,0)
b2 = a.crop(210,0,-6,0)
b3 = a.crop(206,0,-10,0)
b4 = a.crop(202,0,-14,0)

b = interleave(b1,b2,b3,b4)
bb = blankclip(b).merge(b,0.999)

c = b.medianblurt(0,0,0,3)
cc = bb.medianblurt(0,0,0,3)

stackhorizontal(b,c,cc)

To be precise, it doesn't "crash" for me, but produces unusable result. Image data is garbled in diagonal stripes.

*.mp4 guy
8th July 2009, 00:08
Yes I was a bit imprecise, it produces garbled output, then will usually crash on an attempt to reload the script, or Ironically, on attempting to close the program running the script.

Scintilla
8th July 2009, 11:32
To be precise, it doesn't "crash" for me, but produces unusable result. Image data is garbled in diagonal stripes.
That sounds exactly like the problem I had with using MPEG2Dec3DG (stop laughing) to serve up my D2V files with AVISynth 2.5.8 (naturally, all such footage was also at 720x480!).
I had initially upgraded to 2.5.8 in order to take advantage of the new math functions like Max(), but this problem forced me to roll back to 2.5.6.

Perhaps there is some issue common to some of these older plugins that makes them fail in AVISynth 2.5.7+?

IanB
8th July 2009, 13:22
For those compelled to use the buggy forebears of MPEG2Dec* there is SetPlanarLegacyAlignment(true) to side step the invalid assumptions about pitch that the early code made. But given this and all the other errors fixed in the newer versions by Neuron2 I fail to understand that compunction.

SetPlanarLegacyAlignment() was included from version 2.5.6, where the default value was set as True, from 2.5.7 the default was changed to False, which guaranteed that the chroma planes for YV12 are aligned to mod 16 addresses for SSE2 code.

Guest
8th July 2009, 13:26
But given this and all the other errors fixed in the newer versions by neuron2 And by tritical.