Log in

View Full Version : deinterlacing BFF/TFF - which SelectEvery setting ?


halsboss
10th March 2008, 07:17
Can someone please clarify which "SelectEvery" settings to use for each of TFF and BFF interlaced input sources to re-interlace a clip back to the same type as the source.

I've seen both "SelectEvery(4,0,3)" and "SelectEvery(4,1,2)" used in different settings with different comments, and am left unsure as to the "proper" setting to turn the progressive result back into the same interlacing type as the source.

eg per http://forum.doom9.org/showthread.php?p=1110600#post1110600 which setting to use ?

1. BFF input (usually from an older DV camera)

AVISource("somevideo.avi")
ConvertToYV12(interlaced=true)
AssumeBFF()
TDeint(mode=1,order=0) # mode=0=deinterlace mode=1=doubleframerate, order=0=BFF order=1=TFF
# progressive-based denoising in here
AssumeBFF().SeparateFields().SelectEvery(??,??,??).Weave() # 4,0,3 for BFF ??


2. TFF input (usually form TV capture)

AVISource("somevideo.avi")
ConvertToYV12(interlaced=true)
AssumeTFF()
TDeint(mode=1,order=1) # mode=0=deinterlace mode=1=doubleframerate, order=0=BFF order=1=TFF
# progressive-based denoising in here
AssumeTFF().SeparateFields().SelectEvery(??,??,??).Weave() # 4,0,3 for TFF ??

:thanks:

stickboy
10th March 2008, 08:28
Reason it out.

Suppose your source material is TFF, for example. Then after you call SeparateFields(), your frames will be:

T B T B T B T B ... (T = Top field, B = Bottom)
0 1 2 3 4 5 6 7 (Frame numbers)If you then call SelectEvery(4, 0, 3), you'll end up with a top field followed by a bottom field. Therefore it preserves the original field dominance.

If instead you called SelectEvery(4, 1, 2), you'd end up with a bottom field followed by a top field. Therefore it reverses the field dominance.

IanB
10th March 2008, 08:38
It is always 4,0,3 when usingAssume?FF().SeparateFields().SelectEvery(4, 0,3).Weave()the 4,1,2 option is for inverting the field dominance.

1. E.g. Take a TFF source :-
[TB],[TB],[TB],...
Bob it
[Tb],[tB],[Tb],[tB],[Tb],[tB],... - Lowercase is interpolated fields
4,0,3 selects
[TB],[TB],[TB],...
4,1,2 selects
[bt],[bt],[bt],...

2. E.g. Take a BFF source :-
[BT],[BT],[BT],...
Bob it
[Bt],[bT],[Bt],[bT],[Bt],[bT],... - Lowercase interpolated fields
4,0,3 selects
[BT],[BT],[BT],...
4,1,2 selects
[tb],[tb],[tb],...

halsboss
10th March 2008, 09:01
Great. Thanks.

<snip>

halsboss
10th March 2008, 09:11
Oh I think I'd got mixed up. The TDEINT doco says "mode=1 - double rate output (bobbing)" = 50fps progressive, and IanB says "bob it", so may I assume that mode=1 is indeed bobbing it ... and
AssumeBFF().SeparateFields().SelectEvery(4,0,3).Weave()
is right for TDEINT(mode=1).

For TDEINT(mode=0) =25fps progressive, for both TFF and BFF after denoising it's ?

AssumeTFF().SeparateFields().Weave() # TFF or
AssumeBFF().SeparateFields().Weave() # BFF

halsboss
10th March 2008, 10:39
I guess this isn't right then http://forum.doom9.org/showthread.php?p=1046675#post1046675 ?
Easiest way i know is to dumb bob (without Motion compensation);
Bob(0,0.5)
Apply filters
Then re-interlace;
SeparateFields().SelectEvery(4,0,3).Weave() # bff
or
SeparateFields().SelectEvery(4,1,2).Weave() # tff

Thanks go to Didee for teaching me this.

and this ? http://forum.doom9.org/showthread.php?p=1105717#post1105717 which mentions "SelectEvery(4,1,2)".

scharfis_brain
10th March 2008, 12:15
long story short:

AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave() -> TFF
AssumeBFF().SeparateFields().SelectEvery(4, 0, 3).Weave() -> BFF
AssumeTFF().SeparateFields().SelectEvery(4, 1, 2).Weave() -> BFF
AssumeBFF().SeparateFields().SelectEvery(4, 1, 2).Weave() -> TFF

Didée
10th March 2008, 12:25
Addendum: Bob() flags the output always as BFF, even if the input is TFF.

Hence: The quoted code of R3Z basically would/should be wrong for the "TFF" case. However in this particular case, the result is correct, because the wrong code corrects the behaviour of Bob().

yup
10th March 2008, 15:01
Hi folks!
Very interesting. Please advice this script right or wrong?

Avisource("test.avi")#TFF source with BFF flag
AssumeTFF()
nnedi(field=-2)#using nnedi as bobber
some filters
SeparateFields()
SelectEvery(4,0,3)
Weave()# result will be TFF?

With kind regards yup.

Guest
10th March 2008, 15:07
Please advice this script right or wrong? Read scharfi's post again and then engage your cerebral cortex. It's not rocket science.

Alex_ander
29th November 2008, 08:56
Avisource("test.avi")#TFF source with BFF flag
AssumeTFF()
nnedi(field=-2)#using nnedi as bobber
some filters
SeparateFields()
SelectEvery(4,0,3)
Weave()# result will be TFF?


The resulting field order here will by default coincide with that on 'some filters' output. If you want to independently set TFF for output, use AssumeTFF() just before SeparateFields().

Alex_ander
29th November 2008, 09:41
BTW, there's also a shorter (without field separation) equivalent of <SeparateFields().SelectEvery(4,1,2).Weave()>, which also inverts field dominance:

DoubleWeave().SelectEvery(4,1)
or
AssumeBFF().DoubleWeave().SelectEvery(4,1)#TFF output
or
AssumeTFF().DoubleWeave().SelectEvery(4,1)#BFF output