Log in

View Full Version : How to prepare CIF video sequences for deinterlacer testing?


kumi
5th May 2009, 16:19
Hi folks,

I'm not sure how to properly interlace CIF test sequences (for example, MobCal). I downloaded "Mobile" from http://trace.eas.asu.edu/yuv/ , and loaded it like this:
RawSource("Z:\mobile_cif.yuv", 352, 288, "I420")
Spline36Resize(384, 288)
That outputs 300 progressive frames @ 25fps. Then I interlaced it like so:
SeparateFields().SelectEvery(4, 0, 3).Weave()
That outputs 150 interlaced frames @ 12.5fps (BFF)

Am I really interlacing this properly? I thought I was supposed to end up with 300 frames. :confused:

And am I supposed to end up with a 12.5fps clip? What I'd really like is to prepare the sequence in a way that I can deinterlace with a single-framerate deinterlacer like yadif(mode=0) and get 25fps output, without unnaturally speeding up the footage. Is that possible?

2Bdecided
5th May 2009, 18:11
You can't interlace CIF sequences. There's isn't enough information (temporally or spatially).

You need D1 resolution video to support interlacing - and 50p if you're going to interlace it yourself.


Better to grab these...
ftp://vqeg.its.bldrdoc.gov/HDTV/SVT_MultiFormat/
...from here...
http://forum.doom9.org/showthread.php?t=135034
...and resize and interlace them yourself.

Cheers,
David.

Manao
5th May 2009, 18:17
You can interlace CIF sequences. You don't need D1/SD resolution, but you do need a 50/60p source in order to interlace it and get a 50/60i sequence that you can deinterlace to a 25/30p sequence.

Now, for the interlacing process itself : SeparateFields().SelectEvery(4, 0, 3).Weave()That does indeed create a seemingly interlaced sequence, but it will not have the mathematical properties of an interlaced sequence, so imho its not a good way to test a deinterlacer. You need to do a lowpass before that. For example, downsize to half the vertical resolution, then upsize it back to the original resolution.

Edit : for more information on how to interlace a video sequence, check that document (http://www.ebu.ch/CMSimages/en/tec_svt_multiformat_v10_tcm6-43174.pdf). It describes how a 2160p50 sequence was converted to 1080i50 and 576i50

kumi
6th May 2009, 02:05
2Bdecided: Yeah, I guess if I really want 25p/30p deinterlaced output I'll have to go find some 50p/60p clips.

Manao: thanks for that very informative document. Based on that, I now have this:
RawSource("...")
Spline36Resize(last.width,last.height/2)
ConvertToRGB32()
top = SelectEven()
bottom = SelectOdd().Crop(0, 1, 0, 0).AddBorders(0, 0, 0, 1)
Interleave(top,bottom)
ConvertToYV12()
AssumeFieldBased().ComplementParity().Weave()

I think that's what you meant by downsizing and then upsizing back, right?


EDIT: Uh-oh, something's definitely not right. When I deinterlace Waterfall (http://trace.eas.asu.edu/yuv/), TGMC produces some jittery 3D-ish motion. Same thing with the Flowers clip. It does not happen when I interlace the sequence with SeparateFields().SelectEvery(4, 0, 3).Weave()... Script:
RawSource("C:\waterfall_cif.y4m",352,288,"I420")

Spline36Resize(384,last.height/2)

ConvertToRGB32()
top = SelectEven()
bottom = SelectOdd().Crop(0, 1, 0, 0).AddBorders(0, 0, 0, 1)
Interleave(top,bottom)
ConvertToYV12()

AssumeFieldBased().ComplementParity().Weave()

TempGaussMC_beta1(EdiMode="NNEDI")

Manao
6th May 2009, 05:15
source = RawSource("C:\waterfall_cif.y4m",352,288,"I420")

width = source.width
height = source.height

video = source.Spline36Resize(width,height/2)
video = video.Spline36Resize(width,height)

video = video.assumetff.separatefields.selectevery(4,0,3).weave

return video.TempGaussMC_beta1(EdiMode="NNEDI")

kumi
6th May 2009, 05:44
Thanks Manao, I tested that with the "Husky" clip using yadif(), and the output looks... normal now. Without your vertical blurring, yadif() makes a complete mess. Can you explain why this is necessary?

Manao
6th May 2009, 05:59
Can you explain why this is necessary?When you take one line every two lines, you create a mathematical nightmare called aliasing (http://en.wikipedia.org/wiki/Aliasing). Look at the first two screenshots in that link. Without vertical blurring, you give to the deinterlacer the second picture. That's why it creates a mess.

kumi
6th May 2009, 06:18
Thanks. That makes sense, and also explains why the SVT test sets were interlaced the way they were.

2Bdecided
6th May 2009, 11:14
I'm aware of the SVT description of interlacing, and the need for anti-aliasing.

But many real world cameras just don't work like that. Many are quite sharp vertically, and few are as blurred as your half-vertical-resolution script.

There's a very long thread about HD>SD downsizing which discusses the trade-offs (http://forum.doom9.org/showthread.php?p=1171877#post1171877). There's no single "right" way, and there's certainly no single way which matches the output of all interlaced cameras.

Cheers,
David.

P.S. still not convinced CIF images are a useful source for interlaced images - yes, I know in theory you could start with 50p and output 50i, and that 50i could be fed to a deinterlacer to get 50p again - but IMO one vital check of 50i is watching it on a CRT - CIF is the wrong size - you'd have to watch it as a little box floating in the middle of the screen, because it's not at a resolution which normally support interlacing.

Manao
6th May 2009, 11:24
But many real world cameras just don't work like that. Many are quite sharp vertically, and few are as blurred as your half-vertical-resolution script.Indeed, but none are as sharp as no lowpassing at all. You can control the lowpass strength by resizing less (to 3/4th for example).

2Bdecided
6th May 2009, 14:08
Indeed, but none are as sharp as no lowpassing at all.Neither is your example - that would require point resize from an infinite sized source!

However, the HV20 (for example) does zero additional filtering of its interlaced output compared to its progressive output.

You can control the lowpass strength by resizing less (to 3/4th for example). To match the HV20, you simply don't need this step.

FWIW, I've used the trick you're using (resizing to a lower resolution as a poor man's low pass filter) in other applications, and it's OK, but not ideal. You have more filter stages that you need, with less control over them. A dedicated filter is better and more flexible, but not worth the speed hit in AVIsynth IMO (unless there's a faster way than mt_convolution).

Cheers,
David.

Manao
6th May 2009, 14:34
However, the HV20 (for example) does zero additional filtering of its interlaced output compared to its progressive output.[...]To match the HV20, you simply don't need this step.I know nothing of cameras, but if HV20 wasn't doing any lowpassing at all, the output wouldn't be watchable. And after having search a little on the internet, aren't you mistaking telecining with interlacing for HV20 ? Because there are indeed no lowpassing occuring during telecining - but it's not interlacing either...

um3k
6th May 2009, 15:58
I can attest, in the interlaced HV20 footage I've shot, there is no evidence of additional lowpass filtering. However, the camera has a Bayer pattern sensor, and so does fairly heavy optical low-pass filtering.

Manao
6th May 2009, 16:43
I can attest, in the interlaced HV20 footage I've shot, there is no evidence of additional lowpass filteringHow do you detect a lowpass filtering ?

2Bdecided
6th May 2009, 17:01
You compare the same still shot in 25p and 50i mode and note that the results are identical!

Cheers,
David.

Manao
6th May 2009, 17:16
Provided the images are bit identical, that would just tell you that 50i has the same amount of filtering as 25p.

2Bdecided
6th May 2009, 22:39
Provided the images are bit identical, that would just tell you that 50i has the same amount of filtering as 25p.

the HV20 (for example) does zero additional filtering of its interlaced output compared to its progressive output.

;)

Cheers,
David.