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 > Announcements and Chat > General Discussion

Reply
 
Thread Tools Search this Thread Display Modes
Old 5th November 2010, 15:57   #1  |  Link
xerces8
Registered User
 
Join Date: Sep 2006
Posts: 10
Interlacers - high quality

Hi!

Are there any (high quality) interlacing programs (scripts, algorithms) available?
(besides the trivial "drop every second line", of course)

I mean a "box" that takes progressive video as input and "spits out" interlaced video as output.

It is for some research I will be doing (private).

Regards,
David
xerces8 is offline   Reply With Quote
Old 6th November 2010, 01:06   #2  |  Link
7ekno
Guest
 
Posts: n/a
Avisynth:

Code:
AssumeTFF()
SeparateFields()
?

Hope you are able to research your research better than Interlacing

7ek
  Reply With Quote
Old 6th November 2010, 01:18   #3  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
SeparateFields()
Trim(1,0)
Weave()
manono is offline   Reply With Quote
Old 6th November 2010, 11:28   #4  |  Link
xerces8
Registered User
 
Join Date: Sep 2006
Posts: 10
Thanks, but:
- SeparateFields assumes the input is already interlaced, just packed into frames

What I search for is something that takes for example 60p and outputs 60i.

- Weave is the opposite of interlacing.
- Trim(1,0) just drops the first field of the clip. (according to the wiki)
xerces8 is offline   Reply With Quote
Old 6th November 2010, 12:07   #5  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
You said you wanted to interlace a progressive video. If you'd stop writing gibberish and try that simple script you'd see that's exactly what it does.

If by 60i you mean 30 interlaced frames per second, then:

AssumeTFF()
SeparateFields()
SelectEvery(4,0,3)
Weave()

And if that's what you meant, then you should have said so to begin with. You said nothing about changing the framerate.

Last edited by manono; 6th November 2010 at 12:11.
manono is offline   Reply With Quote
Old 6th November 2010, 12:36   #6  |  Link
xerces8
Registered User
 
Join Date: Sep 2006
Posts: 10
Because I did not want to change the framerate.
That idea was suggested by others.

What I want is written in the first post quite nicely.

I also repeat one part that obviously nobody read:

(besides the trivial "drop every second line", of course)


Every programmer can write a program to drop every second line in a minute.

Now, can we please start over?

Maybe with an example:

I have a 10 second progressive video with 60 FPS.
That means (in case I wrote gibberish again) every 16.667 ms a picture of the subject is taken. 600 in total.

Now I want to broadcast the footage over TV (20-30 years back in time, when 60 fields per second interlace was the only option).

So how do convert the data (read: convert, not rearrange. The output must be a sequence of fields) ?
Besides method 1 "Drop every second line in each frame" (alternating between even and odd lines, obviously).

So what would be method 2 (and 3 etc.) ?

Last edited by xerces8; 6th November 2010 at 12:42.
xerces8 is offline   Reply With Quote
Old 6th November 2010, 13:13   #7  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
Nope, none of your posts until the most recent one were the least bit clear. And if you had fooled around with the script yourself you could have figured it out for yourself. What do you think a field is but every other scan line of a frame? Take my last script and leave out the last line and then see if it's what you had in mind:

AssumeTFF()
SeparateFields()
SelectEvery(4,0,3)

Until you change the rules again next time.
manono is offline   Reply With Quote
Old 6th November 2010, 13:18   #8  |  Link
xerces8
Registered User
 
Join Date: Sep 2006
Posts: 10
Nope, I wont change anything, I will just repeat the same thing for the third time: I already know the method of dropping half and retaining the other half as is. (It is trivial and obvious. Everyone knows it.)

If there is no other method you know, then let's just wait for someone who does. Deal?
xerces8 is offline   Reply With Quote
Old 6th November 2010, 13:19   #9  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
Sure thing. Good luck.
manono is offline   Reply With Quote
Old 6th November 2010, 14:30   #10  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,988
Take a look here:
http://svt.se/content/1/c8/02/02/85/...format_v10.pdf

Specifically the part that has to do with how their 2164p50 sequence was interlaced to 1080i50
Quote:
5.5. Interlacing
To aid the interlacing process a basic raster of 2164 lines (3840x2164p/50) was used as input.

For interlacing, every second 2164p-frame was shifted vertically two lines downwards. After
deleting the first two and last two lines in the frames that were shifted (and the last four lines
for the frames that were not shifted) to get 2160 lines again, each frame was filtered to 540
lines by line averaging (using Shake’s Box Filter). Horizontal filtering from 3840 to 1920
columns was performed using Shake’s Sinc Filter to benefit in perceived sharpness from the
“oversampled” master.

The two 540-line fields where then weaved into one single 1080-line interlaced frame.
This process resembles the process in any video camera performing interlace in the basic
default ‘Field Integration Mode’ – i.e. like a 2160 line video camera sensor reading out the
average of the sensor’s line 1+2+3+4 to Field 1; line 3+4+5+6 to Field 2; line 5+6+7+8 to
Field 1 etc.
I think this would be feasible in AviSynth, not sure exactly how to code it though, or if it would actually produce better results than the traditional
Code:
separatefields.selectevery(4,0,3).weave
Also, I'd suggest reading up on the AviSynth documentation. I think you're a little confused about what some of the filters do / are for.

Derek
__________________
These are all my personal statements, not those of my employer :)

Last edited by Blue_MiSfit; 6th November 2010 at 14:33.
Blue_MiSfit is offline   Reply With Quote
Old 6th November 2010, 14:47   #11  |  Link
xerces8
Registered User
 
Join Date: Sep 2006
Posts: 10
Quote:
Originally Posted by Blue_MiSfit View Post
Excellent! Thank you very much.
Quote:
Also, I'd suggest reading up on the AviSynth documentation. I think you're a little confused about what some of the filters do / are for.
SeparateFields - separate even and odd lines of frame
SelectEvery - drop some frames/fields thru the clip
Trim - drop frames/fields at begin and/or end of clip
Weave - combine two and two fields into a frame

What do you think is missing?
xerces8 is offline   Reply With Quote
Old 6th November 2010, 15:01   #12  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
Code:
function interlace(clip c, bool "bff", float "lowpassing")
{
  bff = default(bff, false)
  lowpassing = default(lowpassing, 0.75)
  width = c.width
  height = c.height
  low_height = round(height * lowpassing)

  downpassed = c.lanczosresize(width, low_height).lanczosresize(width, height)
  
  return (bff ? downpassed.assumebff : downpassed.assumetff).separatefields.selectevery(4,0,3).weave
}
It's does something akin to what was done with the SVT sequence, but uses lanczos instead of a plain average in order to low pass the video. If you don't lowpass (lowpassing = 1.0), it gives the same results as separatefields.selectevery.weave. Lowpassing under 0.5 are too strong, but you can use any value between 0.5 and 1.0 (the lower the value, the blurrier the results, but too high value will create visible aliasing, even on a CRT screen or with a good deinterlacer.
__________________
Manao is offline   Reply With Quote
Old 6th November 2010, 17:49   #13  |  Link
xerces8
Registered User
 
Join Date: Sep 2006
Posts: 10
Quote:
Originally Posted by Blue_MiSfit View Post
1.) The conversion from 3840x2160p to 1080p is not described. Do you know how they did it?

2.) Are the files (or part of them) available for download?
xerces8 is offline   Reply With Quote
Old 6th November 2010, 18:01   #14  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Quote:
Originally Posted by xerces8 View Post
2.) Are the files (or part of them) available for download?
The pdf gives a link where you can download the 16-bit 4:4:4 SGI samples
http://www.its.bldrdoc.gov/vqeg/
ftp://vqeg.its.bldrdoc.gov/HDTV/SVT_MultiFormat/

You can download some of the other versions here
http://media.xiph.org/video/derf/
poisondeathray is offline   Reply With Quote
Old 6th November 2010, 21:22   #15  |  Link
GodofaGap
Registered User
 
Join Date: Feb 2006
Posts: 823
Quote:
Originally Posted by Manao View Post
It's does something akin to what was done with the SVT sequence, but uses lanczos instead of a plain average in order to low pass the video. If you don't lowpass (lowpassing = 1.0), it gives the same results as separatefields.selectevery.weave. Lowpassing under 0.5 are too strong, but you can use any value between 0.5 and 1.0 (the lower the value, the blurrier the results, but too high value will create visible aliasing, even on a CRT screen or with a good deinterlacer.
Doesn't a vertical blur achieve a similar effect? Or is resizing preferred?
GodofaGap is offline   Reply With Quote
Old 6th November 2010, 21:50   #16  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
Quote:
Doesn't a vertical blur achieve a similar effect?
Somewhat. Blur does a lowpass. But I find it easier to control the cutoff frequency with a resize.
__________________
Manao is offline   Reply With Quote
Old 7th November 2010, 04:19   #17  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,988
Interesting, I thought this might spark some good discussion!

I'm interested to see how a traditional "drop fields" approach compares to this more comprehensive approach with extremely detailed content.

Not that I often deal with double-rate progressive sources, but still!

Am I correct in assuming that a process like this is designed to minimize flicker / "single field detail" that will look ugly on a proper interlaced CRT or on a progressive display, even with a competent deinterlacer?

Derek
__________________
These are all my personal statements, not those of my employer :)
Blue_MiSfit is offline   Reply With Quote
Old 8th November 2010, 13:50   #18  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: UK
Posts: 1,673
Quote:
Originally Posted by Blue_MiSfit View Post
Take a look here:
http://svt.se/content/1/c8/02/02/85/...format_v10.pdf

Specifically the part that has to do with how their 2164p50 sequence was interlaced to 1080i50
Yes, but that's not supposed to be a good way to do it!

It's an intentionally sub-optimal way which mimics the way they think some cameras might do it.


manono has already given the right answer. As subsequently discussed, the only "improvement" is vertically blurring the image before you start, to reduce twitter on interlaced CRTs.

There's plenty of discussion of this in the various HD>SD threads, e.g.
http://forum.doom9.org/showthread.php?t=139102&page=6

My own preference (after trying more complicated solutions) is...
PHP Code:
Blur(0.0,1.0).Sharpen(0.0,0.5)
assumetff()
separatefields().SelectEvery(4,0,3).Weave() 
...which looks fine on a CRT.

mp4guy has a filter to do a much sharper cut-off (in the frequency domain) here...
http://forum.doom9.org/showthread.ph...70#post1165270
...but I don't like the ringing (or the sharp frequency cut-off for that matter).

Hope this helps.

Cheers,
David.
2Bdecided is offline   Reply With Quote
Old 9th November 2010, 16:03   #19  |  Link
*.mp4 guy
Registered User
 
*.mp4 guy's Avatar
 
Join Date: Feb 2004
Posts: 1,348
If your going to use a strong lowpass, this is probably better. However, I don't use interlaced displays, so I don't really know.

Code:
Function BlurV(clip c, int "rad", Float "CW")
{
	
	Rad = Default(rad, 1)
	CW = Default(CW, 0.5)
	
	Center = C
	Down = C.PointResize(C.width, C.height, 0, -rad, C.width, C.height)
	Up = C.PointResize(C.width, C.height, 0, rad, C.width, C.height)
	
	Average(Center, CW/2, Down, (1-CW)/2, Up, (1-CW)/2, Center, CW/2)
	
Return(last)
}

Function NLLV(Clip C, int "rad")
{


	Rad = Default(Rad, 1)

	B1 = C.BlurV(1*rad, 0.439)
	B2 = C.BlurV(3*rad, 0.833)
	B3 = C.BlurV(5*rad, 0.934)
	B4= C.BlurV(7*rad, 0.983)

		B1_D = Mt_Makediff(B1, C, u=1, v=1)
		B2_D = Mt_MakeDiff(C, B2, u=1, v=1)
		B3_D = Mt_MakeDiff(B3, C, u=1, v=1)
		B4_D = Mt_MakeDiff(C, B4, u=1, v=1)

			B2_DT = Mt_LutXY(B1_D, B2_D, " X 128 - Y 128 - X 128 - abs Y 128 - abs * 1 + * X 128 - abs Y 128 - abs * Y 128 - abs 2.273 * X 128 - abs - 0 > Y 128 - abs 2.273 * X 128 - abs - 0 ?  X 128 - abs 0 > X 128 - abs -1 X 128 - abs 0 > X 128 - 1 ? / ^ 1 ? / 1 * + 1 + / +  128 + ", u=1, v=1)
			B3_DT = Mt_LutXY(B2_DT, B3_D, " X 128 - Y 128 - X 128 - abs Y 128 - abs * 1 + * X 128 - abs Y 128 - abs * Y 128 - abs 2.67 * X 128 - abs - 0 > Y 128 - abs 2.67 * X 128 - abs - 0 ?  X 128 - abs 0 > X 128 - abs -1 X 128 - abs 0 > X 128 - 1 ? / ^ 1 ? / 1 * + 1 + / +  128 + ", u=1, v=1)
			B4_DT = Mt_LutXY(B3_DT, B4_D, " X 128 - Y 128 - X 128 - abs Y 128 - abs * 1 + * X 128 - abs Y 128 - abs * Y 128 - abs 2.9 * X 128 - abs - 0 > Y 128 - abs 2.9 * X 128 - abs - 0 ?  X 128 - abs 0 > X 128 - abs -1 X 128 - abs 0 > X 128 - 1 ? / ^ 1 ? / 1 * + 1 + / +  128 + ", u=1, v=1)

	Mt_AddDiff(B4_DT, C)

Return(last)
}


NLLV()
mt_convolution(horizontal=" 1 ", \
                 vertical=" 0.000001065433025438 -0.000016063451766901  0.000104412436485276 -0.000360697507858256  0.000574268400669151  0.000417649745941195 -0.003967672586441010  0.007304608821868880 -0.000365443527698423 -0.023179560899734431  0.041660562157630920 -0.003967672586440983 -0.118038259446620930  0.269801735877990670  0.660062134265899660  0.269801735877990670 -0.118038259446620930 -0.003967672586440983  0.041660562157630920 -0.023179560899734431 -0.000365443527698423  0.007304608821868880 -0.003967672586441010  0.000417649745941195  0.000574268400669151 -0.000360697507858256  0.000104412436485276 -0.000016063451766901  0.000001065433025438", u=3, v=3)
*.mp4 guy is offline   Reply With Quote
Old 12th November 2010, 09:31   #20  |  Link
Biggiesized
Registered User
 
Biggiesized's Avatar
 
Join Date: Apr 2007
Location: Pittsburgh, PA
Posts: 225
http://en.wikipedia.org/wiki/Kell_factor
Biggiesized is offline   Reply With Quote
Reply

Tags
interlace

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 11:16.


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