Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 18th September 2018, 06:34   #1  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Treat interlaced as temporary progressive

This works fine:

Code:
c = core.std.SeparateFields(c, tff=True)
c = core.fmtc.resample(c, scalev=2, css="444",
                                 kernel="point")
#c = core.std.SetFieldBased(c, 0)
#c = core.std.SetFieldBased(c, 2)
c = core.fmtc.resample(c, scalev=0.5, css="444",
                                 kernel="point")
c = core.std.DoubleWeave(c, tff=True)[::2]
But comment out both SetFieldBased functions, there is a vertical shift.
Is it a bug or am I doing something wrong?

Last edited by Cary Knoop; 18th September 2018 at 06:54.
Cary Knoop is offline   Reply With Quote
Old 18th September 2018, 09:40   #2  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by Cary Knoop View Post
This works fine:

Code:
c = core.std.SeparateFields(c, tff=True)
c = core.fmtc.resample(c, scalev=2, css="444",
                                 kernel="point")
#c = core.std.SetFieldBased(c, 0)
#c = core.std.SetFieldBased(c, 2)
c = core.fmtc.resample(c, scalev=0.5, css="444",
                                 kernel="point")
c = core.std.DoubleWeave(c, tff=True)[::2]
But comment out both SetFieldBased functions, there is a vertical shift.
Is it a bug or am I doing something wrong?
Possibly because if it's neither frame/tff it must be bff. You then weave it as tff? Maybe the mismatch has something to do with it.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet

Last edited by Myrsloik; 18th September 2018 at 09:43.
Myrsloik is offline   Reply With Quote
Old 18th September 2018, 15:26   #3  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
The source is definitely TFF.

Interestingly this does work:

Code:
c = core.std.SeparateFields(c, tff=True)
c = core.fmtc.resample(c, scalev=2, css="444",
                                 kernel="point")
c = core.std.SetFieldBased(c, 0)
c = core.std.SetFieldBased(c, 2)
c = core.fmtc.resample(c, scalev=0.5, css="444",
                                 kernel="point")
c = core.std.DoubleWeave(c, tff=False)[::2]
And the stream actually remains TFF after the DoubleWeave!


Edited to add: uncommented the SetFieldBased functions

Last edited by Cary Knoop; 19th September 2018 at 18:30.
Cary Knoop is offline   Reply With Quote
Old 19th September 2018, 17:34   #4  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,377
I can't reproduce the original issue or vertical shift

I started with a 4:2:0 8bit TFF source . I checked with core.text.ClipInfo , and it's "labelled" TFF internally, and also checked with separatefields, so verified the content is also TFF . Also verified in avisynth

I tried both fmtc (going back to 8bit 4:2:0 with point), and zimg/zlib resizers, both work ok . You would expect it to be lossless operation using Point/nearest neighbor

No difference with MakeDiff, or amplified differences
poisondeathray is offline   Reply With Quote
Old 19th September 2018, 17:59   #5  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,377
using fmtc
(because fmtc resample only uses 16bit or 32bit , you have to go back down to 8bit 4:2:0 to compare to original)

Code:
a = core.d2v.Source(input=r'blah.d2v')

b = core.std.SeparateFields(a, tff=True)
b = core.fmtc.resample(b, scalev=2, css="444", kernel="point")
b = core.fmtc.resample(b, scalev=0.5, css="444", kernel="point")
b = core.fmtc.resample (b, css="420", kernel="point")
b = core.fmtc.bitdepth (b, bits=8)
b = core.std.DoubleWeave(b, tff=True)[::2]

d = core.std.MakeDiff(a,b, planes=[0,1,2])
da = core.std.Levels(d, min_in=127, max_in=129, gamma=1, min_out=0, max_out=255, planes=[0,1,2])

da.set_output()


For the DoubleWeave TFF vs BFF - if you wanted BFF , you would need to offset and select "odd" fields instead

so it would be
[1::2] instead of [::2]
or
clip = core.std.SelectEvery(clip, cycle=2, offsets=1)

And that works ok too




If there still is an issue, provide more info on the source, source filter , maybe upload a sample
poisondeathray is offline   Reply With Quote
Old 19th September 2018, 18:32   #6  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
The problem I have is not the resize, without the two SetFieldBased functions the resize works fine.
The problem comes when I add the two SetFieldBased functions.
Cary Knoop is offline   Reply With Quote
Old 19th September 2018, 19:01   #7  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,377
Quote:
Originally Posted by Cary Knoop View Post
But comment out both SetFieldBased functions, there is a vertical shift.
Quote:
Originally Posted by Cary Knoop View Post
The problem I have is not the resize, without the two SetFieldBased functions the resize works fine.
The problem comes when I add the two SetFieldBased functions.

?? Which is it ? With or without ?

Check both the flagging / internal field order with core.text.ClipInfo , and the actual field order by bobbing or separating fields
poisondeathray is offline   Reply With Quote
Old 19th September 2018, 19:04   #8  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by poisondeathray View Post
?? Which is it ? With or without ?

Check both the flagging / internal field order with core.text.ClipInfo , and the actual field order by bobbing or separating fields
I am sorry, yes I was not very clear about that.

Without the two SetFieldBased functions, everything works fine.
With the two SetFieldBased functions there is a shift that goes away when I set the DoubleWeave to BFF instead of TFF.
Cary Knoop is offline   Reply With Quote
Old 19th September 2018, 19:21   #9  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,377
What are you trying to do exactly ??

Why would you apply those two SetFieldBased functions after separating fields ?
poisondeathray is offline   Reply With Quote
Old 19th September 2018, 20:21   #10  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by poisondeathray View Post
What are you trying to do exactly ??

Why would you apply those two SetFieldBased functions after separating fields ?
Obviously, between those two functions, I do various forms of processing.
Cary Knoop is offline   Reply With Quote
Old 19th September 2018, 20:34   #11  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,377
Quote:
Originally Posted by Cary Knoop View Post
Obviously, between those two functions, I do various forms of processing.
It's not that obvious.

Can you give a scenario where you would actually use that?

When you separate fields , it's no longer field based ... technically all operations should be progressive after that point

Once you weave it back into fields, then it's field based. Then all operations should be treated as fields
poisondeathray is offline   Reply With Quote
Old 19th September 2018, 20:43   #12  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by poisondeathray View Post
When you separate fields , it's no longer field based ... technically all operations should be progressive after that point

Once you weave it back into fields, then it's field based. Then all operations should be treated as fields
And that is exactly what I am doing. But what I get is a shift unless I set TFF = False during the DoubleWeave().

That seems like a bug to me.

I isolated the problem I found during coding, not sure why questioning what I am using it for has any bearing if something is a bug or not.

Last edited by Cary Knoop; 19th September 2018 at 20:47.
Cary Knoop is offline   Reply With Quote
Old 19th September 2018, 21:04   #13  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,377
Quote:
Originally Posted by Cary Knoop View Post
And that is exactly what I am doing. But what I get is a shift unless I set TFF = False during the DoubleWeave().

That seems like a bug to me.

I isolated the problem I found during coding, not sure why questioning what I am using it for has any bearing if something is a bug or not.
But why add the SetFieldBased lines at all??

When you separate fields, it's no longer "field based", nothing has to be "set" .

You would apply whatever operations/filters in a progressive manner (because fields are current separated it's technically progressive)

You don't have to manually override anything. Setting props are only used when you have something flagged incorrectly (e.g. content might be TFF, but flagged BFF or vice versa) , or progressive content flagged incorrectly or vice versa . That can affect other operations e.g if you resize interlaced material in a progressive manner, it will produce artifacts .
poisondeathray is offline   Reply With Quote
Old 19th September 2018, 21:16   #14  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Perhaps I was wrong in even reporting this on this forum, how silly of me thinking I was doing a service to the Vapoursynth product, reporting that something might be a bug

Last edited by Cary Knoop; 19th September 2018 at 21:18.
Cary Knoop is offline   Reply With Quote
Old 19th September 2018, 21:22   #15  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,227
How about posting a short sample of your source?
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 19th September 2018, 21:48   #16  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,377
Quote:
Originally Posted by Cary Knoop View Post
Perhaps I was wrong in even reporting this on this forum, how silly of me thinking I was doing a service to the Vapoursynth product, reporting that something might be a bug

Don't be discouraged to report bugs...

I can reproduce the behaviour, and I guess you could argue it's a "bug" ... maybe it's a glass half empty / half full thing

But on the other hand , you could argue it's not "field based", and you shouldn't be using SetFieldBased for that...

If you wanted to do this for some reason, you should be using SetFrameProp after separatefields, which works and passes that info to the next filter like fmtc

e.g

Code:
c = core.std.SetFrameProp(c, prop="_FieldBased", intval=2)
 #0=frame based (progressive), 1=bottom field first, 2=top field first.
Of course in real life that makes no sense to have interlaced separated fields, but....it works
poisondeathray is offline   Reply With Quote
Old 19th September 2018, 21:48   #17  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by SeeMoreDigital View Post
How about posting a short sample of your source?
I already did that:

Code:
c = core.std.SeparateFields(c, tff=True)
c = core.fmtc.resample(c, scalev=2, css="444",
                                 kernel="point")
#c = core.std.SetFieldBased(c, 0)
#c = core.std.SetFieldBased(c, 2)
c = core.fmtc.resample(c, scalev=0.5, css="444",
                                 kernel="point")
c = core.std.DoubleWeave(c, tff=True)[::2]
Easy to reproduce, get an interlaced TFF file and assign it to c and see if you observe a shift once you uncomment the SetFieldBased functions.
Cary Knoop is offline   Reply With Quote
Old 19th September 2018, 21:52   #18  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,377
It looks to me like the SetFieldBased isn't being passed to the 2nd fmtc.resample correctly

If you "forced" it by adding interlaced=True, tff=1, to make it matching it also works

Code:
c = core.std.SetFieldBased(c, 2)
c = core.fmtc.resample(c, scalev=0.5, css="444",  kernel="point", interlaced=True, tff=1)

But SetFrameProp seems more robust and can set/override more parameters
poisondeathray is offline   Reply With Quote
Old 19th September 2018, 21:56   #19  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by poisondeathray View Post
If you wanted to do this for some reason, you should be using SetFrameProp after separatefields, which works and passes that info to the next filter like fmtc

e.g

Code:
c = core.std.SetFrameProp(c, prop="_FieldBased", intval=2)
 #0=frame based (progressive), 1=bottom field first, 2=top field first.
Thank you, that is helpful!

Quote:
Originally Posted by poisondeathray View Post
Of course in real life that makes no sense to have interlaced separated fields, but....it works
Code sometimes works in mysterious ways

Last edited by Cary Knoop; 19th September 2018 at 21:59.
Cary Knoop is offline   Reply With Quote
Old 20th September 2018, 06:29   #20  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by poisondeathray View Post
If you wanted to do this for some reason, you should be using SetFrameProp after separatefields, which works and passes that info to the next filter like fmtc

e.g

Code:
c = core.std.SetFrameProp(c, prop="_FieldBased", intval=2)
 #0=frame based (progressive), 1=bottom field first, 2=top field first.
Hmm, I have trouble to get this to work properly, can you confirm this actually works for you in the test case I provided?
Cary Knoop is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 22:11.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.