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 Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 3rd October 2021, 02:05   #1  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,056
converttorgb() versus converttorgb(interlaced=true)

If converttorgb() is applied to an interlaced image, an interesting and very noticeable artifact appears. It looks similar to interlacing, except that the "scanlines" are two pixels thick instead of one.

If converttorgb(interlaced=true) is applied to a progressive image, in the other hand, you probably won't be able to spot the difference without a map and a microscope.

Therefore, for content that mixes interlaced with progressive frames, (interlaced=true) is the superior setting to use, and I believe it should be the default setting in future versions of AVIsynth.
__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.
Katie Boundary is offline   Reply With Quote
Old 3rd October 2021, 03:54   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Sorry Katie, but aint no way in hell anybody is gonna screw up one helluva lot of existing scripts just to do that.

Quote:
Note, interlaced=true has an effect only on YV12↔YUY2 or YV12↔RGB conversions. More about that can be found here.
http://avisynth.nl/index.php/Convert

Also, most people would rather 'get away' from Interlaced stuff, not make it the default.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 3rd October 2021, 06:56   #3  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,056
Quote:
Originally Posted by StainlessS View Post
Sorry Katie, but aint no way in hell anybody is gonna screw up one helluva lot of existing scripts just to do that.
There's no way in hell it would "screw up" anything.

Quote:
Originally Posted by StainlessS View Post
Also, most people would rather 'get away' from Interlaced stuff
Unfortunately, we cannot wave a magic wand and change history and make all TV from the mid-80s to the mid-2000s progressive. Interlaced nonsense is here to stay.
__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.
Katie Boundary is offline   Reply With Quote
Old 3rd October 2021, 10:47   #4  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
Here's a function that converts using interlaced=true without the need to change it for an Avisynth filter that's probably had the same default for 20 years.

Code:
function KatieRGB(clip Source) { ConvertToRGB(Source, Interlaced=true) }
There's a function on the Avisynth wiki for converting "mixed" content, although I can't say I've used it myself as the first filter I'd add to a script for an interlaced source would be a deinterlacer.

Code:
function KatieToRGB(clip Source, int "threshold", bool "debug")
{
debug = default(debug, false)
global threshold = default(threshold, 20)

Vid1 = ConvertToRGB(Source, interlaced=false)
Vid2 = ConvertToRGB(Source, interlaced=true)
ConditionalFilter(Source, Vid1, Vid2, "IsCombed(threshold)", "equals", "true", show=debug)
}

Last edited by hello_hello; 3rd October 2021 at 10:53.
hello_hello is offline   Reply With Quote
Old 3rd October 2021, 11:20   #5  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
Interlacing is meant for broadcasting and storage. The proper way to process interlaced content is to deinterlace it first, process the progressive double-rate frames, and possibly interlace them again (if really required) at the very end of the processing.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 3rd October 2021, 11:40   #6  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Quote:
Originally Posted by cretindesalpes View Post
Interlacing is meant for broadcasting and storage. The proper way to process interlaced content is to deinterlace it first, process the progressive double-rate frames, and possibly interlace them again (if really required) at the very end of the processing.
This brings the quality (and artefacts) of the deinterlacer into the equation.
For temporal-spatial filters and if the interlaced format should be kept it may be preferable to
separatefields -> even/odd grouping -> filter the even and odd fields -> interleave -> weave.

Last edited by Sharc; 3rd October 2021 at 11:54.
Sharc is offline   Reply With Quote
Old 3rd October 2021, 11:54   #7  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,070
Quote:
Originally Posted by Sharc View Post
This brings the quality (and artefacts) of the deiterlacer into the equation.
For temporal and temporal-spatial filters it may be preferable to
separatefields -> even/odd grouping -> filter the even and odd fields -> interleave -> weave.
It may also degrade quality if processing will operate with some 'vertical direction' . For example MDegrain(N) try to move blocks and interpolate in both V and H directions and possibly may add more distortions.
Also some 4:2:0 interlaced processing may used 'mixed' block types - some blocks are treated as interlaced and some as progressive (to have better vertical colour resolution that degrades to 1/4 instead of 1/2 for progressive 4:2:0). When separate to fields - the 'progressive' blocks lost Nyquist limiting as being point-downsized 1/2 without pre-filtering. And later processing may cause additional distortions.

It is better to try both processing ways - with converting to progressive full frame height and with processing separated fields as progressive and pick best output.

Changing default interlaced to 'true' will degrade vertical colour resolution if processing progressive scanned frames. And as Avisynth was designed by PC programmers and not old video (moving pictures) engineers - PC (usually static) bitmaps typically progressively scanned so default interlaced was false from the initial Avisynth design I think.

Last edited by DTL; 3rd October 2021 at 12:01.
DTL is offline   Reply With Quote
Old 3rd October 2021, 11:59   #8  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Quote:
Originally Posted by DTL View Post
It is better to try both processing ways - with converting to progressive full frame height and with processing separated fields as progressive and pick best output.
Agree

Edit:
Also see this old discussion here:
https://forum.doom9.org/showthread.php?t=86394

with the summary in posts #32 and 48
https://forum.doom9.org/showpost.php...8&postcount=48

Last edited by Sharc; 3rd October 2021 at 12:44.
Sharc is offline   Reply With Quote
Old 3rd October 2021, 12:11   #9  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,070
Also if set interlaced=true I think Avisynth uses static treatment of all input as separated (in time) fields. It is fail-safe for moving areas but degrades vertical colour resolution on static areas. So better solution is not to use simple built-in conversion functions at all and use motion-adaptive ways. Motion-adaptive processing to and from 4:2:0 may possibly solve the issue with setting interlaced param manually and will save colour resolution where possible better.
I post some example already (though used motion-detector is not perfect and may pass errors).
It is also make some effect if source is 4:2:2 or better or the downscaling work performed (like creating interlaced 4:2:0 SD rip from HDTV/UHDTV source).
I think in the industry may already exist X:X:X to 4:2:0 interlaced converting hardware with motion-adaptive processing of different areas of the frame.

Last edited by DTL; 3rd October 2021 at 12:13.
DTL is offline   Reply With Quote
Old 3rd October 2021, 22:10   #10  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
Use interlaced=true if it's interlaced. Don't if it's not. I'm not sure what's so hard about that that would warrant changing a 20-year-old default.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 4th October 2021, 01:20   #11  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,056
Quote:
Originally Posted by cretindesalpes View Post
Interlacing is meant for broadcasting and storage. The proper way to process interlaced content is to deinterlace it first
Some approaches to deinterlacing require RGB colorspace, which is how I got into this mess.
__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.
Katie Boundary is offline   Reply With Quote
Old 4th October 2021, 07:08   #12  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
which is how I got into this mess.
Here a spade for you to dig a little deeper, faster,
Code:
Function KB_ConvertToRGB(clip c,string "matrix", bool "interlaced", string "chromaInPlacement", string "chromaResample") {
/*
    KB_ConvertToRGB(clip c,string "matrix"="Rec601", bool "interlaced"=True, string "chromaInPlacement"="MPEG2", string "chromaResample"="bicubic")
    Same as ConvertToRGB() / ConvertToRGB32() but with interlaced default = True.
    All other args passed to ConvertToRGB() where it will use builtin avisynth defaults if not provided.
        Args not provided, will be UnDefined within this function, and just passed on to the builtin ConvertToRGB which will then use its usual defaults.
        [EDIT: Above line excluding Interlaced, will be True if not provided, can provide as Interlaced=True/False as usual]
*/
    return ConvertToRGB(c, matrix, Default(interlaced,True) , chromaInPlacement, chromaResample)
}
Change the name if you like [but not to ConvertToRGB, script function names override builtins, and so would be recursive and crash / disappear - without error msg].

EDIT: !!!, However, if you're really planning a visit to China, can change function title by removing "KB_", and change internal

return ConvertToRGB =====>>> return ConvertToRGB32

And you're all set for the great journey [no crash]

EDIT: I dont recommend this for anyone else but Katie, she's special.
[***NOTE*** use at your own risk, I wouldn't]
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 4th October 2021 at 08:13.
StainlessS is offline   Reply With Quote
Old 4th October 2021, 08:29   #13  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
Quote:
Originally Posted by Katie Boundary View Post
Some approaches to deinterlacing require RGB colorspace, which is how I got into this mess.
Well don't leave us hanging.... which approach to deinterlacing are you referring to?
hello_hello is offline   Reply With Quote
Old 6th October 2021, 05:05   #14  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,056
Quote:
Originally Posted by StainlessS View Post
blah blah blah
What exactly is the point of all that?
__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.
Katie Boundary is offline   Reply With Quote
Old 6th October 2021, 09:08   #15  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
What exactly is the point of all that?
this

Quote:
Therefore, for content that mixes interlaced with progressive frames, (interlaced=true) is the superior setting to use, and I believe it should be the default setting in future versions of AVIsynth.
You can make it the default for yourself, no other sane person would want this. [we did not really need the 'other' word there]
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 6th October 2021 at 10:48.
StainlessS is offline   Reply With Quote
Reply

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 03:03.


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