BlendedPALsux() - New and improved! (kind of)

This forum is for questions and discussion of all the aspects of handling and cleaning up your footage with Avisynth.
Locked
User avatar
mirkosp
The Absolute Mudman
Joined: Mon Apr 24, 2006 6:24 am
Status: (」・ワ・)」(⊃・ワ・)⊃
Location: Gallarate (VA), Italy
Contact:
Org Profile

BlendedPALsux() - New and improved! (kind of)

Post by mirkosp » Wed Jul 01, 2009 9:12 pm

Old version of the post available under spoiler:
Spoiler :
So yeah... I was working with this old full field blended PAL animu made in the 90s... it was fully interlaced so my obvious reaction was to tomsmocomp(1,5,1) it (works wonders with PAL footage generally <.< ).
Generally, I just get 1 blended frame or at most 2 in a row... but then again, checking the output, I reached a 10 or so frames long sequence in which all the frames were blended like shit. It was awful. How was I supposed to use that if I needed it? :|
So yeah, what I decided to do is try to see how the single fields looked like. It turned out that with the single fields it would have been possible to pick the original frames since they were still there. However, just deinterlacing wouldn't work, 'cause they were in a pretty random order in there, and they were still there only 'cause the animation was originally at 13 fps.
But I don't care about that, since it still means that I can just pick the good frames while editing. It's a bit of effort since it requires manually picking one every 2 frames when editing (doing a 200% speedup without frame blend might work, but if you're not lucky the frames that will be picked will be the blended ones and not the original ones), but it's better than having everything blended, if you were to ask me.
So well, you might ask how does this differ from any other Bob deinterlacer... well, this uses nnedi2, which is awesome with x2 enlargements.
So yes, you will want to get the nnedi2() from here for this to work.
Now, for the actual code... (remember to save it as a .avsi )

Code: Select all

#####################################
#
# BlendedPALsux ver 1.0 by mirkosp
#
# Requires nnedi2()
#
# This avsi is pretty lame but can be useful for those that are using full field blended pal anime footage that was animated at 13 fps or so.
# This will require you to manually go and pick the good frames after you use it, but it's better than having a completely blended sequence.
# The output fps will be twice the input fps, btw. So with PAL, output will be 50 fps.
# Input must be YV12...if it isn't, it'll be converted to it, so meh.
# That's about it...
#
# Usage: BlendedPALsux(qual)
#
# qual must be 1, 2 or 3. 1 is default. I like 2, personally, though you can use 3 if you wish. I doubt you'll notice any difference between them, though.
#
#####################################

function BlendedPALsux(clip clpchk, int "qual")

{
	clpchk = clpchk.isYV12() ? clpchk : clpchk.converttoyv12()
	ox = clpchk.width
	oy = clpchk.height
qual = default(qual,1)
	clpchk.separatefields()
	sauce = last.nnedi2_rpow2(2,qual,true,"spline36resize",ox,oy).converttorgb32()
	even = sauce.selecteven().crop(0,1,0,0).addborders(0,0,0,1)
	odd = sauce.selectodd()
	interleave(even,odd).converttoyv12()
}

#####################################
#
# PS: YES I SUCK AT AVISYNTH CODING, THANKS FOR ASKING KTHXBAI.
#
#####################################
Hopefully this will help the unlucky ones that, like me, have to work with sucky PAL footage. ;_;

PS: I believe that there are better bob deinterlacers out there, some which use the nnedi2 already, but meh... this is pretty simple and fast and works pretty much perfectly for what it's needed for. =ç=
Ok, well, so I updated the code a bit.
What this does now is restoring the original 23.976 framerate after bobbing with nnedi2. It does so by picking the frames that should be clean with the selectevery.
Of course, it is highly hit or miss, and if you find it to not work well enough with the default sel value (0), you can try changing it to 1 and see how it works. If you still are getting too many blended frames without their clean version in the previous/following frame, then you're out of luck as that means that the original clean frame really isn't there anymore. Also, if you set sel to any other value (meaning something else from 0 or 1), it'll still be a simple bob deinterlacer like it was before, so if you were using it just as a simple bobber, it will still do so, though not at default values. :P
So well, here's the updated code:

Code: Select all

#####################################
#
# BlendedPALsux ver 2.0 by mirkosp
#
# Requires nnedi2.dll ver 1.3 or higher
#
# Changed this up a bit. Now it's not just a bobber anymore.
# Basically, it now attempts to restore the original 23.976 framerate by picking the frames that shouldn't be blended.
# Of course, it doesn't actually look for the frames that aren't blended, but just goes in an order that should be free of blending.
# If you get a lot of blended frames without the clean version of them in the previous or following frame, you might want to change the sel value to 1 and see if you have any luck.
# If you are still getting a lot of blended frames without any possibility to manually restore them, well, not much to do: the clean frame isn't there anymore.
# In any case, if you want to keep using it as just a bobber, you can still do so.
#
# Usage: BlendedPALsux(nsize,qual,sel)
#
# nsize must be 0 or 1. It's speed vs quality, 0 being the default (faster) option. The difference between the two gets more noticeable with higher qual value.
# qual must be 1, 2 or 3. 1 is default. The higher the number, the better the interpolation quality, at expense of speed.
# sel must be 0, 1 or any other int. Default is 0. Setting 1 will change the picked frames, other values will make the filter be a simple bobber.
#
#####################################

function BlendedPALsux(clip clpchk, int "nsize", int "qual", int "sel")

{
	clpchk = clpchk.isYV12() ? clpchk : clpchk.converttoyv12()
	ox = clpchk.width
	oy = clpchk.height
nsize = default(nsize,0)
qual = default(qual,1)
sel = default(sel,0)
	clpchk.separatefields()
	sauce = last.nnedi2_rpow2(rfactor=2,nsize=nsize,qual=qual,pscrn=true,cshift="spline36resize",fwidth=ox,fheight=oy).converttorgb32()
	even = sauce.selecteven().crop(0,1,0,0).addborders(0,0,0,1)
	odd = sauce.selectodd()
	interleave(even,odd).converttoyv12()
	sel == 0 ? Eval("""selectevery(50,0,2,4,6,8,10,13,15,17,19,21,23,25,27,29,31,33,35,38,40,42,44,46,48).assumefps(24000,1001,true)""") : sel == 1 ? Eval("""selectevery(50,1,3,4,7,9,11,14,16,18,20,22,24,26,28,30,32,34,36,39,41,43,45,47,49).assumefps(24000,1001,true)""") : last
}

#####################################
#
# PS: YES I SUCK AT AVISYNTH CODING, THANKS FOR ASKING KTHXBAI.
#
#####################################
Hope to get some feedback as for what you think about it... it's far from perfect but it should be better than other deinterlacers when a lot of blending occurs. :?
Image

User avatar
mirkosp
The Absolute Mudman
Joined: Mon Apr 24, 2006 6:24 am
Status: (」・ワ・)」(⊃・ワ・)⊃
Location: Gallarate (VA), Italy
Contact:
Org Profile

Re: BlendedPALsux()

Post by mirkosp » Mon Jul 06, 2009 3:26 pm

EDIT: Putting this under spoiler since it's an older version, should have done so sooner. :P
Spoiler :
So nnedi2 got updated to v 1.3 and a new parameter was introduced, so that the script won't work. I fixed it since it was something quick to fix, though I doubt anyone is really interested into this little bob-deinterlacer I wrote. It surely looks better than the standard bob() but there are better bob deinterlacers out there. Oh well, anyway, here's the updated code, if anyone cares about it. :|

Code: Select all

#####################################
#
# BlendedPALsux ver 1.1 by mirkosp
#
# Requires nnedi2.dll ver 1.3
#
# This avsi is pretty lame but can be useful for those that are using full field blended pal anime footage that was animated at 13 fps or so.
# This will require you to manually go and pick the good frames after you use it, but it's better than having a completely blended sequence.
# The output fps will be twice the input fps, btw. So with PAL, output will be 50 fps.
# So yes, it is just a bob-deinterlacer that uses nnedi2_rpow2() since it's awesome with enlargements.
# Input must be YV12...if it isn't, it'll be converted to it, so meh.
# That's about it...
#
# Usage: BlendedPALsux(nsize,qual)
#
# nsize must be 0 or 1. It's speed vs quality, 0 being the default (faster) option. The difference between the two gets more noticeable with higher qual value.
# qual must be 1, 2 or 3. 1 is default. I like 2, personally, though you can use 3 if you wish. I doubt you'll notice any difference between them, though.
#
#####################################

function BlendedPALsux(clip clpchk, int "nsize", int "qual")

{
	clpchk = clpchk.isYV12() ? clpchk : clpchk.converttoyv12()
	ox = clpchk.width
	oy = clpchk.height
nsize = default(nsize,0)
qual = default(qual,1)
	clpchk.separatefields()
	sauce = last.nnedi2_rpow2(2,nsize,qual,true,"spline36resize",ox,oy).converttorgb32()
	even = sauce.selecteven().crop(0,1,0,0).addborders(0,0,0,1)
	odd = sauce.selectodd()
	interleave(even,odd).converttoyv12()
}

#####################################
#
# PS: YES I SUCK AT AVISYNTH CODING, THANKS FOR ASKING KTHXBAI.
#
#####################################
Image

ffxdean
Joined: Fri Apr 06, 2007 7:02 am
Location: Australia
Org Profile

Re: BlendedPALsux()

Post by ffxdean » Thu Jul 16, 2009 10:53 pm

what is it suppose to do? Does it remove blended frames without sacrificing motion?

User avatar
mirkosp
The Absolute Mudman
Joined: Mon Apr 24, 2006 6:24 am
Status: (」・ワ・)」(⊃・ワ・)⊃
Location: Gallarate (VA), Italy
Contact:
Org Profile

Re: BlendedPALsux()

Post by mirkosp » Fri Jul 17, 2009 8:02 am

No really, it's just a bob deinterlacer. Just that it uses nnedi2 which has better looking results.
Image

User avatar
mirkosp
The Absolute Mudman
Joined: Mon Apr 24, 2006 6:24 am
Status: (」・ワ・)」(⊃・ワ・)⊃
Location: Gallarate (VA), Italy
Contact:
Org Profile

Re: BlendedPALsux() - New and improved! (kind of)

Post by mirkosp » Mon Aug 10, 2009 3:35 pm

Update here: Changed the code around so that it tries to restore the 23.976 by picking the frames that should be clean. Refer to the first post for the code and more.
Image

User avatar
Bauzi
Joined: Fri May 21, 2004 12:48 pm
Status: Under High Voltage
Location: Austria (uhm the other country without kangaroos^^)
Contact:
Org Profile

Re: BlendedPALsux() - New and improved! (kind of)

Post by Bauzi » Wed Aug 19, 2009 7:12 pm

I think I will try this one for my PAL dvd sources. Let's see if it works better than Mrestore()
You can find me on YT under "Bauzi514". Subscribe to never miss my AMV releases. :amv:

User avatar
Bauzi
Joined: Fri May 21, 2004 12:48 pm
Status: Under High Voltage
Location: Austria (uhm the other country without kangaroos^^)
Contact:
Org Profile

Re: BlendedPALsux() - New and improved! (kind of)

Post by Bauzi » Wed Aug 19, 2009 7:25 pm

Requires nnedi2.dll ver 1.3
You're sure about this? I just downloaded it and used it. I got: There is no function named nnedi2_rpow2

I use the parameters: BlendedPALsux(nsize=0, qual=0)
You can find me on YT under "Bauzi514". Subscribe to never miss my AMV releases. :amv:

User avatar
mirkosp
The Absolute Mudman
Joined: Mon Apr 24, 2006 6:24 am
Status: (」・ワ・)」(⊃・ワ・)⊃
Location: Gallarate (VA), Italy
Contact:
Org Profile

Re: BlendedPALsux() - New and improved! (kind of)

Post by mirkosp » Thu Aug 20, 2009 8:43 am

Bauzi wrote:
Requires nnedi2.dll ver 1.3
You're sure about this? I just downloaded it and used it. I got: There is no function named nnedi2_rpow2

I use the parameters: BlendedPALsux(nsize=0, qual=0)
Well, it works both with the version 1.3 and the 1.4, so you might want to get 1.4, but it should work just fine with the 1.3, since it worked before O_o. Also, the qual=0 parameter won't do, it has to be 1, 2 or 3. Nsize, as of v 1.4 of nnedi2, can be 0, 1 or 2, but iirc in ver 1.3 it could be just 0 or 1, so that's what I tell in the usage lines.
Image

User avatar
mirkosp
The Absolute Mudman
Joined: Mon Apr 24, 2006 6:24 am
Status: (」・ワ・)」(⊃・ワ・)⊃
Location: Gallarate (VA), Italy
Contact:
Org Profile

Re: BlendedPALsux() - New and improved! (kind of)

Post by mirkosp » Fri Aug 21, 2009 7:03 pm

Just came to my mind, but try to manually import the dll. Maybe autoload is failing.
Image

Locked

Return to “AviSynth Help”