Log in

View Full Version : Really messed up Anime source. CHALLENGE!!


Adub
20th August 2008, 21:21
Hey guys, I am working on backing up some old R2 Captain Tsubasa DVD's, and just the OP is giving me a headache.

So I thought I'd call in the big guns here!!

I am seeing mixed interlaced, with rainbowing, blended fields, the works!

I challenge you brilliant encoders to fixing this to where it is even watchable, because frankly, I am stumped.

I will post a vob sample once it has finished uploading.

Edit: Here you go!!
http://www.mediafire.com/download.php?4nbhgytbhbs

thetoof
20th August 2008, 21:54
Hehehe, dunno if I'm considered one of the the big guns in here, but I'm certainly up to the challenge!
I have the feeling that this thread will be a lot of fun :p Happy toofy'll be waiting for your samples to test the amazing power of avisynth ^_^

Adub
20th August 2008, 22:03
Good to know!!

The upload failed on me already, but it should be another 2 minutes. And it's mediafire, in case anyone is worried.

martino
20th August 2008, 23:05
For the rainbows:

FFT3DFilter(sigma=3,sigma2=3,sigma3=14,sigma4=3,plane=3,bw=32,bh=32,bt=3,ow=16,oh=16)
MergeChroma(aWarpSharp(32,1)) #to fix some of the chroma bleeding caused by fft3d

As for the rest... I never tried to deal with it, even though it looks very similar like what I've seen so far on all my anime PAL DVDs. I guess I'm just happy enough with them sitting on the shelf.

Speaking of an overall good solution... Get the NTSC version?

Nightshiver
20th August 2008, 23:26
LOL, seriously. That would be preferable.

mikeytown2
21st August 2008, 00:08
IMO the most glaring issue: the need for temporal de-ghosting in the Y channel. I'm sure it's easier said then done. The previous and next frame give hints as to where the ghosting will take place. It only happens at full framerate movement as far as I can tell, which is usually the Adidas foot/soccer ball.

Adub
21st August 2008, 00:33
Yeah, those are a pain in the ass. I recieved a script that worked for most of the other stuff, but those ghosts are horrible.

Dark Shikari
21st August 2008, 00:50
In the spirit of awarpsharp(depth=1337)...

function nnediresize2x(clip c, bool pY, bool pU, bool pV)
{
v = c.nnedi(dh=true,Y=pY,U=pU,V=pV,field=0).turnleft()
v = v.nnedi(dh=true,Y=pY,U=pU,V=pV,field=0).turnright()
return v
}

function nnediresize_YUY2(clip c)
{
cy = c
cu = c.utoy()
cv = c.vtoy()
cy = nnediresize2x(cy,true,false,false)
cu = nnediresize2x(cu,true,false,false)
cv = nnediresize2x(cv,true,false,false)
return ytouv(cu,cv,cy)
}

function nnediresize_YV12(clip c)
{
return nnediresize2x(c,true,true,true)
}
DirectShowSource("Captain Tsubasa Road to 2002 Opening 1.VOB")
SeparateFields()
SelectEven()
last.nnedi(dh=true,Y=true,U=true,V=true,field=0)

dfttest()
FastLineDarken()
deen("a3d",4,8,9)
nnediresize_YV12()
AddBorders(4, 0, 4, 0)
aWarpSharp(depth=12,blurlevel=4,thresh=0.2,cm=1)
FastLineDarken()
aWarpSharp(depth=6,blurlevel=4,thresh=0.7,cm=1)
Crop(4,0,-4,0)
FastLineDarken()
DeHalo_Alpha()
fft3dgpu(bt=3,sigma=8,sharpen=1.3)
Spline36Resize(last.width/2,last.height/2)OK so I'm being really silly...

mikeytown2
21st August 2008, 01:43
Here's an attempt at creating a mask. what to do with it i have no idea...


MPEG2Source("Captain Tsubasa Road to 2002 Opening 1.d2v")
AssumeTFF()
TDeint(1)
bobed=last
dummyUV = BlankClip(last,width=width/2,height=height/2,color=$808080)
dummyY = BlankClip(last,color=$808080)

gray= YToUV(dummyUV,dummyUV,last)
v= YToUV(dummyUV,last.VToY(),dummyY)
u= YToUV(last.UToY(),dummyUV,dummyY)
uv= YToUV(last.UToY(),last.VToY(),dummyY)
full= YToUV(last.UToY(),last.VToY(),last)


i=32
UVchan=uv.levels(128-i,1,128+i,0,255)
Ymask=Overlay(CreateMask(bobed,4),CreateMask(bobed,6), mode="subtract")

StackVertical(StackHorizontal(UVchan,full),StackHorizontal(gray,Ymask))

Function CreateMask(clip c, int threshold)
{
c.MSharpen(mask=true,threshold=threshold)
ConvertToRGB32().ResetMask()
ColorKeyMask($008800)
ShowAlpha()
Crop(16,16,-16,-16)
AddBorders(16,16,16,16)
ConvertToYV12()
}


Frames 1880-1904 really show where this is an issue.



One thing I noticed is the ghosting has really bad halo's, if you use halo's to detect where the problem is you might be able to fix it.

Adub
22nd August 2008, 16:52
So, no one here can crush this thing then eh? Shucks. I might have to look into getting the NTSC version.

Nightshiver
22nd August 2008, 20:21
It'd be easier than trying to correct this crap....

thetoof
23rd August 2008, 07:37
Ok... this is my first time dealing with PAL and all its wonders, but here's what I got atm. Dunno if its accurate... seems to work anyways.
By bobbing the clip, I noticed that the motion went back and forth, so I guessed the fields were in the wrong order and tried the following code to inverse them.
At the separatefields() step, I saw that there were blends in some of them, so I called cdeblend() right after.
Then, I put this all back together and bobbed it with various filters. TempGaussMC_beta1 (well, I used beta2, but it does the same thing + native multithreading with the new mvtools) gave me the best visual results. After, I saw that there was a duplicate for almost every frame (if not a duplicate, modification of the image due to aliasing or ghosting), so I called tdecimate to get back to 25fps.
Maybe the original framerate was 23,976fps... if so, uncomment the last line
s=mpeg2source("Captain Tsubasa Road to 2002 Opening 1.d2v")
a=s.separatefields()
b=a.selecteven()
c=a.selectodd()
interleave(c,b)
cdeblend()
weave()
tempgaussmc_beta2()
tdecimate(1,3,6)
#assumefps(24000,1001)
Still some work to do, but already better :p
Many other filters are needed to deal with your source (I think msmooth could help quite a bit... will test later), so I'll work on the rest of the script, unless someone posts a killer script for the rest of the problems... ;) Challenge time! :)

Edit: adding
msmooth(threshold=3,strength=5)
fft3dgpu(sigma=6, bw=32, bh=32, bt=4, plane=3, precision=2)
dehalo_alpha()
sharpaamc()
already helps with many issues... needs tweaking and some other filters (to come)

Adub
27th August 2008, 16:53
Huh, that is a very interesting script!!

I am running an encode right now, so I will see how it turns out.

One question:
Why separate fields, flip them around, and then call cdeblend?

Oh, and if this thing works out, possibly a new mode for AnimeIVTC, eh? UberBadAssMode=true?

Nightshiver
27th August 2008, 20:51
Because the fields are blended. You must unblend them first.

Adub
27th August 2008, 21:16
Yes, I know that. I was just a little surprised about the way he went about it. Not the usually mrestore().

thetoof
27th August 2008, 21:30
Because I saw a way of removing the blends before doing MC stuff on the clip, which is, unless I'm mistaken, a lot better for motion vectors calculation.
'bout the ''field flipping'', I'll give you some frame # to illustrate what I explained in my previous post.

Adub
28th August 2008, 23:26
Ah, I remember instances like that, I just never made the connection that all of the fields were reversed.

sangofe
31st August 2008, 12:05
It'd be easier than trying to correct this crap....

Easier, maybe. Less expensive? No, since I already bought the french dvds, and I'm currently a student...

Nightshiver
31st August 2008, 13:40
I never said it would be cheap, only easier.

martino
1st September 2008, 13:52
Just some additions, however their effect is much more visible during more static(-y) scenes, not really present in the opening.

#helps with leftovers from the blending
s1=last
ml3dex(blksize=4,searchparam=200,lambda=0,thSCD1=64,pel=4)
Repair(last,s1,17)

#if you feel like being anal about doing some scene stabilization (very very very ugly on high motion sections and pans)
s2=last
a=TemporalSoften(10,30,30,30)
b=TemporalCleaner(1,2)
Repair(a,b,16)


P.S. Hi sangofe!