View Full Version : Bob filter question...
DoctorM
18th July 2008, 07:05
I was messing around with several bob filters today, including tdeint, dgbob and leakkernelbob.
I realized, that none that I have found allow the option to prevent output at the original frame height.
That is, if the video is 480i, the output is 480p, since bobbing really upscales the fields, they all use a resizers of unknown origin.
What if I wanted to use 320x240 after bobbing so as not to upscale?
Or what about using a better resizer like spline36?
Heck, what if my goal is something between 240 and 480?
Then the bob resizes from 240 to 480 and I have to resize down to my target size afterwards.
It seems inefficient. Do any (decent) bob filters exist that allow you to prevent the upscale step?
Ranguvar
18th July 2008, 08:58
Try reading this: http://www.100fps.com/
and this: http://en.wikipedia.org/wiki/Interlace
and this: http://en.wikipedia.org/wiki/Deinterlacing
Old info, but still useful.
Your concept of interlacing is off :)
DoctorM
18th July 2008, 17:32
Yeah, not particularly.
Why don't you read those links yourself and see what bobbing does?
neuron2
18th July 2008, 18:15
It's not just about resizing; shifting is also involved. When you separate the fields, the bottom field becomes shifted up by half a line. So the result is not usable at half height unless you resample to allow for that shift. One way is to resample the top by 1/4 line and the bottom by 1/4 line in opposite directions. That way you don't have resampling on only one field, which would likely be noticable. VirtualDub has a field shift filter that allows for this.
So you can't avoid an expensive operation to make a field-separated stream usable.
You can write filters that resize and shift at the same time, but making a general purpose one for any desired output size would not be trivial.
Gavino
18th July 2008, 18:36
To add to what neuron2 correctly says, if you want a different height or a different resizer, you can do it by manually replacing xxxBob with a combination of SeparateFields, SelectOdd/Even, the resizer of your choice and Interleave, using the float src_height parameter of the resizer to allow for the relative half-pixel shift.
The code is left as an exercise to the reader :D, or :search:
Edit: After seeing neuron2's edit, I've just realised that what I said is fine for replacing plain Bob with a different resizer, but no good for xxxBob if you still want the special xxx features it provides.
DoctorM
18th July 2008, 21:47
To be clear, I'm talking about a simple bob, where the desired output is double the frame rate (for purposes of later frame rate change).
I'm quite aware that bob filters shift the frames, but then again if they didn't all it would be is separatefields with a resize afterwards.
I guess I was under the mistaken assumptions that once the fields were separated, they were aligned before upscaling, so that even at half height the result would be right (except for an incorrect AR of course).
That's pretty slick doing it manually with the src_height parameter. I'll definitely look into it.
neuron2
18th July 2008, 22:09
I guess I was under the mistaken assumptions that once the fields were separated, they were aligned before upscaling You never noticed when watching field separated clips that they "jump up and and down" when you step? You never noticed the misalignment???
The first line of the bottom field moves to line 0 (0-based) when separated. It should move to the position 0.5.
DoctorM
18th July 2008, 23:30
No, I know when you separate fields they are misaligned.
I meant I was under the mistaken assumptions that once A BOB FILTER separated the fields, they were aligned before upscaling...
So the result is not usable at half height unless you resample to allow for that shift.
Suggests that the half height, 1/2 line shifted video is not properly aligned UNTIL it is resized. (Which still doesn't make sense in my head, but I'll go with it.)
Gavino
18th July 2008, 23:42
That's pretty slick doing it manually with the src_height parameter. I'll definitely look into it.
I meant to say src_top, not src_height, ie the vertical offset.
Try this (completely untested :))
function MyBob(clip c, int "h") {
h = Default(h, c.Height()/2)
shift = GetParity(c) ? 0.25 : -0.25
c.SeparateFields()
even=SelectEven().Spline36Resize(Width(), h, 0, shift, 0, 0)
odd=SelectOdd().Spline36Resize(Width(), h, 0, -shift, 0, 0)
Interleave(even, odd)
}
You can change it to use your own favourite resizer if you like.
neuron2
19th July 2008, 00:13
Suggests that the half height, 1/2 line shifted video is not properly aligned UNTIL it is resized. (Which still doesn't make sense in my head, but I'll go with it.) Only one of the fields (bottom) is 1/2 line shifted; that's why there is a misalignment!
You make another mistake by assuming that resizing and/or shifting is necessarily involved in bobbing. The process [separatefields/correct shift/resize] is just one way to do bobbing. Consider this way, which has no resize (for TFF video):
Duplicate all frames pairwise, i.e., A B C becomes A A B B C C.
Now, in even frames ditch the odd lines and replace them by interpolating from the even lines. In the odd frames ditch the even lines and interpolate them from the odd lines.
You can make it smart by ditching only "moving" pixels. That preserves full vertical resolution in static areas, a desirable thing.
The above is what my Smart Bob filter for VirtualDub does. Bobbing without resizing. And no shift is needed because the lines were never moved from their original positions.
Leak
19th July 2008, 00:53
Bobbing without resizing. And no shift is needed because the lines were never moved from their original positions.
Ummm... you're interpolating pixels where there's motion - and a resizer is just a glorified interpolator at the end of the day...
So they're still doing the same thing, just in different amounts (due to the motion mask)...
np: Cadence Weapon - Getting Dumb (Afterparty Babies)
neuron2
19th July 2008, 01:09
Point accepted. But no shift correction is required, compared to separatefields() etc.
DoctorM
19th July 2008, 05:56
/me's head explodes.
I am now too far out of my depth. :)
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.