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 > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 24th August 2008, 08:58   #41  |  Link
Nikos
Registered User
 
Join Date: Jun 2002
Location: Greece
Posts: 236
Does eedi2Bob or nnediBob has similar problem with shift?
Also may i replace the Bob with FixedBob in MCBob function or in yadifmod?

s = last
interp=s.FixedBob().selecteven()
s.yadifmod(mode=0, edeint=interp)
__________________
Greece PAL User...

Last edited by Nikos; 24th August 2008 at 10:58.
Nikos is offline   Reply With Quote
Old 24th August 2008, 12:14   #42  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,168
@florinandrei,

Nit pick 1 :-
# Pick one if DirectShow can't decide
This implies in some alternate universe DirectShowSource knows something about field order. In this world it has no idea. For interlaced content you always have to work it out and script appropriately.

Nit pick 2 :-
Your edit to "Elum = " is not universally correct. For other pixel formats these are the Even and Odd complete data.

@Gavino,
Quote:
Originally Posted by Gavino
Considering that one of the advantages of the original method over that of bob-resize-Weave was speed, I would like to ask IanB how much of that advantage has been lost in the case of YV12, given the extra work it now has to do. Can the code possibly be tweaked to reduce the penalty?
Well it is doing 2 near identical resize operations instead of 1, plus a MergeChroma (half Blit). So a bit less than 50% speed.

In the 2.5 world there is no quick way to spec the resizer luma and chroma offsets independently. One could always razor the code, but it is hardly worth it. In the 2.6 development Sh0dan has added the beginnings of some chroma positioning options. This may allow Bob() to spec the resizer luma and chroma offsets independently. Also there is the Y8 pixel format available so each plane can be independently processed in a user script. Somewhat like this :-
Code:
...
  SeparateFields() 
  Shift=(GetParity() ? -0.25 : 0.25) * (Height()/Float(NewHeight/2)-1.0)
  Y = ConvertToY8() # Zero cost
  Ey = Y.SelectEven().Spline36resize(NewWidth, NewHeight/2, 0,    Shift) # Uniplanar
  Oy = Y.SelectOdd( ).Spline36resize(NewWidth, NewHeight/2, 0,   -Shift) # Uniplanar
  UV = Interleave(UtoY8(), VtoY8())  # Zero cost
  Euv = UV.SelectEvery(4, 0,1).Spline36Resize(NewWidth/2, NewHeight/4, 0,  Shift) # Uniplanar*2
  Ouv = UV.SelectEvery(4, 2,3).Spline36Resize(NewWidth/2, NewHeight/4, 0, -shift) # Uniplanar*2
  E = YToUV(SelectEven(Euv), SelectOdd(Euv), Ey) # Blit
  O = YToUV(SelectEven(Ouv), SelectOdd(Ouv), Oy) # Blit
  Interleave(E, O)
  Weave()
@henryho_hk,

Might be a little easier for us poor Humans to visualise but the dumb computer couldn't care less.

@Nikos,

eedi2Bob or nnediBob, we do not know, Tritical is sitting on the source code because they are part of his thesis. Why don't you test and report what you find.

It probably does not matter, the actual error here is really quite small. I had trouble building a suitable test pattern to reliably see this error. In normal use the chroma subsampling for interlaced 4:2:2 is severe enough that it out weighs our small displacement problem.
IanB is offline   Reply With Quote
Old 24th August 2008, 20:39   #43  |  Link
florinandrei
Registered User
 
Join Date: Jul 2006
Posts: 118
Quote:
Originally Posted by IanB View Post
It probably does not matter, the actual error here is really quite small. I had trouble building a suitable test pattern to reliably see this error. In normal use the chroma subsampling for interlaced 4:2:2 is severe enough that it out weighs our small displacement problem.
Maybe the chroma error introduces a tiny bit of blur?
__________________
Florin Andrei

http://florin.myip.org/
florinandrei is offline   Reply With Quote
Old 15th September 2008, 16:04   #44  |  Link
halsboss
likes to tinker
 
Join Date: Jan 2004
Location: girt by sea
Posts: 635
Quote:
Originally Posted by IanB View Post
Code:
  SeparateFields() 
  Shift=(GetParity() ? -0.25 : 0.25) * (Height()/Float(NewHeight/2)-1.0)
  Y = ConvertToY8() # Zero cost
  Ey = Y.SelectEven().Spline36resize(NewWidth, NewHeight/2, 0,    Shift) # Uniplanar
  Oy = Y.SelectOdd( ).Spline36resize(NewWidth, NewHeight/2, 0,   -Shift) # Uniplanar
  UV = Interleave(UtoY8(), VtoY8())  # Zero cost
  Euv = UV.SelectEvery(4, 0,1).Spline36Resize(NewWidth/2, NewHeight/4, 0,  Shift) # Uniplanar*2
  Ouv = UV.SelectEvery(4, 2,3).Spline36Resize(NewWidth/2, NewHeight/4, 0, -shift) # Uniplanar*2
  E = YToUV(SelectEven(Euv), SelectOdd(Euv), Ey) # Blit
  O = YToUV(SelectEven(Ouv), SelectOdd(Ouv), Oy) # Blit
  Interleave(E, O)
  Weave()
So, was this the final script instead of that in post 38 http://forum.doom9.org/showthread.ph...85#post1174185 ??
halsboss is offline   Reply With Quote
Old 15th September 2008, 23:34   #45  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
well, interesting discussion!
not directly related, but now i understand, that pelclip in MVTools is not quite correct for chroma.
similar is that original points are (should) preverved
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 17th September 2008, 03:30   #46  |  Link
henryho_hk
Registered User
 
Join Date: Mar 2004
Posts: 889
Quote:
Originally Posted by IanB View Post
@henryho_hk,

Might be a little easier for us poor Humans to visualise but the dumb computer couldn't care less.
I thought the extracted UtoY and VtoY contain 1/4 data of their original image. Hence, It will be a bit faster (esp for 1080i or p footages).
henryho_hk is offline   Reply With Quote
Old 17th September 2008, 11:03   #47  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,168
Quote:
Originally Posted by florinandrei
Maybe the chroma error introduces a tiny bit of blur?
(I should have said 4:2:0) The issue is that the small offset error in the code is small compared to the chroma subsampling.

Quote:
Originally Posted by halsboss
So, was this the final script instead of that in post 38
No, that is a pseudo example of how you might be able to code it up in 2.6. Post 38 is an academically pure version for 2.5, given the trouble I had building a test pattern to actually see the error, I do not believe it is worthwhile.

@Fizick,

As above, I do not believe there is anything significant to worry about. But we are all a little anal about getting this stuff right, so it is good to document where we are wrong and how to eventually fix it.

@henryho_hk,

Yes, I guess if you are sufficiently motivated you could use UtoY to make a sightly faster version.
IanB is offline   Reply With Quote
Old 19th September 2008, 01:39   #48  |  Link
florinandrei
Registered User
 
Join Date: Jul 2006
Posts: 118
Quote:
Originally Posted by IanB View Post
No, that is a pseudo example of how you might be able to code it up in 2.6. Post 38 is an academically pure version for 2.5, given the trouble I had building a test pattern to actually see the error, I do not believe it is worthwhile.
On my system (AMD Phenom 4 core 9850), the "pure" version is only a little bit slower than the "brute" one. It's 10.3 fps "pure" vs 12.7 fps "brute" when transcoding from 1080i AVCHD (MainConcept decoder via DirectShow) to 480i MPEG2 (HCenc encoder with max quality profile).
__________________
Florin Andrei

http://florin.myip.org/
florinandrei is offline   Reply With Quote
Old 19th September 2008, 06:23   #49  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,168
Quote:
Originally Posted by florinandrei
... It's 10.3 fps "pure" vs 12.7 fps "brute" ...
So the "pure" takes 18.3ms out of 78.7ms per frame longer to process ... ... ...
IanB is offline   Reply With Quote
Old 19th September 2008, 11:15   #50  |  Link
halsboss
likes to tinker
 
Join Date: Jan 2004
Location: girt by sea
Posts: 635
Quote:
Originally Posted by IanB View Post
No, that is a pseudo example of how you might be able to code it up in 2.6. Post 38 is an academically pure version for 2.5, given the trouble I had building a test pattern to actually see the error, I do not believe it is worthwhile.
Quote:
Originally Posted by florinandrei View Post
On my system (AMD Phenom 4 core 9850), the "pure" version is only a little bit slower than the "brute" one. It's 10.3 fps "pure" vs 12.7 fps "brute" when transcoding from 1080i AVCHD (MainConcept decoder via DirectShow) to 480i MPEG2 (HCenc encoder with max quality profile).
Er, which was the "brute" one I could use and not notice the difference ? 10.3->12.7 is significant enough for me.
halsboss is offline   Reply With Quote
Old 19th September 2008, 11:40   #51  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,377
Quote:
Originally Posted by halsboss View Post
Er, which was the "brute" one I could use and not notice the difference ? 10.3->12.7 is significant enough for me.
The 'brute' version is the one that was generally accepted before I discovered the error and proposed the 'pure' solution. This is the 'pure' version:
Code:
function IResize(clip Clip, int NewWidth, int NewHeight) {
  Clip
  SeparateFields() 
  Shift=(GetParity() ? -0.25 : 0.25) * (Height()/Float(NewHeight/2)-1.0)
  E  = SelectEven().Spline36resize(NewWidth, NewHeight/2, 0,    Shift)
  O  = SelectOdd( ).Spline36resize(NewWidth, NewHeight/2, 0,   -Shift)
  Ec = SelectEven().Spline36Resize(NewWidth, NewHeight/2, 0,  2*Shift)
  Oc = SelectOdd( ).Spline36Resize(NewWidth, NewHeight/2, 0, -2*shift)
  Interleave(E, O)
  IsYV12() ? MergeChroma(Interleave(Ec, Oc)) : Last
  Weave()
}
Removing the lines in blue gives the 'brute' solution.

Spline36Resize can be replaced by another resizer if you wish.
Gavino is offline   Reply With Quote
Old 20th September 2008, 06:54   #52  |  Link
halsboss
likes to tinker
 
Join Date: Jan 2004
Location: girt by sea
Posts: 635
Well, that's floored me, look at the signs on SHIFT in this link http://forum.doom9.org/showthread.ph...81#post1172981
Code:
Function Foo(clip clip, float shift) {
  Clip
  Tc=SelectEven().Spline36resize(NewWidth, NewHeight/2, 0, -Shift, Width(), Height()) 
  Bc=SelectOdd().Spline36resize(NewWidth, NewHeight/2, 0, Shift, Width(), Height()) 
  Interleave(Tc, Bc)
  Weave()
}
which, just a few posts later http://forum.doom9.org/showthread.ph...85#post1174185 turns into
Code:
SeparateFields()

Shift = (GetParity() ? -0.25 : 0.25) * (Height()/Float(NewHeight/2)-1.0)

Elum = SelectEven().Spline36Resize(NewWidth, NewHeight/2, 0,    Shift)
Olum = SelectOdd() .Spline36Resize(NewWidth, NewHeight/2, 0,   -Shift)
Echr = SelectEven().Spline36Resize(NewWidth, NewHeight/2, 0,  2*Shift)
Ochr = SelectOdd() .Spline36Resize(NewWidth, NewHeight/2, 0, -2*shift)

Interleave(Elum, Olum)
IsYV12() ? MergeChroma(Interleave(Echr, Ochr)) : Last
Weave()
whihc is it ??
halsboss is offline   Reply With Quote
Old 20th September 2008, 11:05   #53  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,377
@halsboss

In the first link, function Foo was part of a test IanB was doing to verify the correct value of the shift, varying shift from -1.0 to +1.0, so on its own it is incomplete.

The second link shows one way of expressing the complete 'pure' solution, and is equivalent to what I posted (#51).

Last edited by Gavino; 20th September 2008 at 11:07.
Gavino is offline   Reply With Quote
Old 21st September 2008, 02:26   #54  |  Link
halsboss
likes to tinker
 
Join Date: Jan 2004
Location: girt by sea
Posts: 635
OK. Thankyou for clarifying that. Cheers !
halsboss is offline   Reply With Quote
Old 25th September 2018, 18:20   #55  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 581
This is all fascinating. Regarding bob-deinterlacers and YCbCr colorspaces, I'm afraid I don't understand why such complex solutions are necessary. Couldn't you just write them so they function like this:

Quote:
L=bob()
C=separatefields().bicubicresize(720,480)
Mergechroma(L,C)
?
__________________
If I ask "How do I do X?" or "what happens if I do X?", and X is a very bad thing that no one would ever normally do, assume that I already know this, and that I have Katie reasons for asking anyway.

Last edited by Katie Boundary; 26th September 2018 at 07:34.
Katie Boundary is offline   Reply With Quote
Old 27th September 2018, 23:01   #56  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,642
For the same reason bob exists in the first place. You wouldn't do separatefields().bicubicresize() on luma, so why would you do it on chroma? There is top field chroma and bottom field chrome just as there is top field luma and bottom field luma. Separatefields "loses" information on their proper positioning.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 28th September 2018, 00:39   #57  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,096
I think that if you want to do a bob() that can then immediately be recombined to give you exactly what you started with, you use this:

Code:
bob(0.0,1.0)
Obviously you would never actually bob and then do this:

Code:
separatefields().selectevery(4,1,2).weave()
to put everything back together, but there are all sorts of scripts where it is important not to introduce shifts.
johnmeyer is offline   Reply With Quote
Old 30th September 2018, 00:34   #58  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 581
Yes but the question is whether or not preserving the original scanlines is a good idea when dealing with YCbCr colorspaces.
__________________
If I ask "How do I do X?" or "what happens if I do X?", and X is a very bad thing that no one would ever normally do, assume that I already know this, and that I have Katie reasons for asking anyway.
Katie Boundary is offline   Reply With Quote
Old 30th September 2018, 01:30   #59  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,063
Quote:
Originally Posted by Katie Boundary View Post
This is all fascinating. Regarding bob-deinterlacers and YCbCr colorspaces, I'm afraid I don't understand why such complex solutions are necessary. Couldn't you just write them so they function like this:



?
I'm pretty sure that if you do that to an actually interlaced source, the chroma will appear to jump up and down because you're treating the top and bottom field chroma sample positions as if they were in the same spatial positions, which they aren't.

The question whether it's a good idea to preserve the original pixels has been extensively discussed in this thread already. I'm of the opinion that there's no inherent reason as to why doing so would make the image look any better, and many bob-style deinterlacers either don't preserve original pixels at all or does so only by coincidence.

Last edited by TheFluff; 30th September 2018 at 01:39.
TheFluff is offline   Reply With Quote
Reply

Tags
yv12 chroma offset

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 18:26.


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