Log in

View Full Version : Proper interlaced -> interlaced vertical resize


Pages : 1 [2]

eswrite
7th April 2005, 22:49
Your "bicubicresize" method is not better quality; it is *not* an interlaced resizing method at all, and consideration of it does not belong in this thread.

It may be of lesser quality and definitely not an interlaced resizing method, but I disagree its evaluation doesn't belong here. It is a "control" experiment to test the assertion that one must not do a blind, brute-force bicubicrezise or any other type of resize that does not take interlacing into account. If that assertion is true, interlaced resize tests should yield at least equal, and hopefully--at the performance cost they incur--better results. My experiment seems to suggest that except for one interlaced resize method (SmoothDeinterlacer), any interlaced resize method won't do and in fact won't do any better than a blind resize. I hope that's on topic and right in line with this thread. If not, my reading comprehension has really taken a dive since High School.

I hear your argument about resizing 720x480 to 360x240. I hadn't thought about that, and it makes sense at some level... until I ran another test resizing high quality 1920x1080i HD material to 720x480i. Most of the resizing algorithms suggested earlier in this thread fail to impress. For a sampling, check out the 2nd screen capture at http://eswrite.50megs.com/photo2.html. The jaggies ain't lyin', and they are quite noticeable during normal playback. The SmoothDeinterlacer method is the only one that seems to carry the day, and yes, notice how BicubicResize screws up in the 2nd screen shot--an illustration of why it too is inadequate.

Here's the script I used for this latest test (using the same i_resize.avs I posted earlier):

#Script for loading HDTV source video.
#De-interlace prior to processing, resize, and re-interlace.

#Load plugins
LoadPlugin("C:\Program Files\VDM\DGMPGDEC\DGDecode.dll")

#Include Interlace resizing functions
Import("C:\Program Files\VDM\include\i_resize.avs")

##################################################################################
#Load Audio & Video sources
MPEG2Source("movie_30sec.d2v").Crop(0,8,0,-8).AddBorders(0,8,0,8)
Video=last
#Audio=NICAC3Source("movie_30sec AC3 T01 3_2ch 384Kbps DELAY 66ms.ac3")
#AudioDub(Video,Audio)
#return ConvertToRGB(interlaced=true)

## Straight bicubic resize on interlaced material, bad, bad, bad
vo_1 = Video.BicubicResize(720, 480, 0, 0.5).Subtitle("BicubicResize")

## Straight Bob with Lanczos4 resize on interlaced material, so, so
vo_2 = BInterlacedResize(Video, 720, 480, true)

## SmoothInterlace with Lanczos4 resize on interlaced material, best
vo_3 = SInterlacedResize(Video, 720, 480, true)

## Interlaced resize from SimpleResize.dll: requires YV12->YUY2->YV12 conversion
vo_4 = ConvertToYUY2(Video).InterlacedResize(720, 480).ConvertToYV12().Subtitle("InterlacedResize")

## Offset Interlaced resize
#vo_5 = OInterlacedResize(Video, 720, 480, true)

## LeakKernelBob Interlaced resize
#vo_6 = LInterlacedResize(Video, 720, 480, true)

## Telecide Interlaced resize
#vo_6 = TInterlacedResize(Video, 720, 480, true)

return StackVertical(StackHorizontal(vo_1, vo_2), StackHorizontal(vo_3, vo_4))
#return StackVertical(StackHorizontal(vo_1, vo_2), StackHorizontal(vo_3, vo_4), StackHorizontal(vo_5, vo_6))
#return vo_2

Guest
7th April 2005, 23:01
Again, please make the source clip available. Is this the one you sent me email about, after I specifically asked you to PM me (I can't access my email at work)?

eswrite
7th April 2005, 23:25
Donald,

Please download from this link (http://f2.pg.briefcase.yahoo.com/bc/eswrite/vwp2?.tok=bcLXbIVBQ2qvbqIZ&.dir=/Video&.dnm=movie_short.zip&.src=bc). Let me know if it doesn't work.

Guest
7th April 2005, 23:44
1. You've resized the resulting frames on your HTML page. That means they are unreliable for assessing the results, e.g., proper, expected combing becomes banding.

2. The Smoothdeinterlaced frame you give shows no combing, so it is a progressive frame and is therefore not the correct result of an interlaced resize.

3. What you are calling "jaggies" is the expected combing in the output! If combing is not present then you have not done an interlaced resize.

4. The HD clip is telecined. Use IVTC to recover progressive frames and then resize normally.

I believe you are still confused about what an interlaced resize should produce.

eswrite
7th April 2005, 23:57
I believe you are still confused about what an interlaced resize should produce.
I didn't think it should produce more jagged edges during normal playback (not just on a frame-by-frame view) than what the original source has. I'll keep reading, I guess.

Wilbert
8th April 2005, 00:08
@neuron2,

If you look at his BInterlacedResize pic, the "combed lines" are two pixels wide instead of one. Perhaps that has something to do with that his source is telecined. Perhaps not, i don't understand it yet ...

Guest
8th April 2005, 00:13
Originally posted by Wilbert
If you look at his BInterlacedResize pic, the "combed lines" are two pixels wide instead of one. Perhaps that has something to do with that his source is telecined. Perhaps not, i don't understand it yet ... No, it's just because he resized the output screenshots for his web page! Those aren't 720x480. Remember, resized combing becomes banding.

I just don't see that he has ever demonstrated any problem. He should show us individual unresized output screenshots (no need for stacking).

eswrite
8th April 2005, 18:01
@neuron2

I spent last night going through your Decomb tutorial and users guide, and I think I'm a bit more grounded:

1) For the HD clip, you were right:
a) The combing is normal, and
b) Made worse by not applying IVTC.

2) For the VHS clip, I still see a problem on most frames where there is movement, probably because the whole thing is interlaced. I think that video is of such bad quality, I might as well write it to DVD as is and forget about it. There's not much I can do with it, it seems. Maybe a little Msharpen, if that.

I have had much better luck after I got out of the fog. See this thread (http://forum.doom9.org/showthread.php?s=&threadid=92738) for my latest HD efforts and, of course, questions ;)

Wilbert
8th April 2005, 21:38
For your photo2 clip (with the girl). A correct script is


mpeg2source("D:\Captures\Temp\movie.d2v")
Crop(0,0,0,-8)
Telecide(order=0)
Decimate(cycle=5)
BicubicResize(720,480)

but you probably found that out already.

As for your first clip, neuron2 is of course correct.

I used your script and made the following screenshot. I think it looks as it should look.

Guest
8th April 2005, 22:10
Originally posted by Wilbert
As for your first clip, neuron2 is of course correct.
I'm wrong often enough that the "of course" part can be deleted. :)

That's the great thing about the subject matter of this forum; it's so complex and continually evolving that nobody can ever master everything.

Thanks for posting the screenshot. It shows just what I was trying to state in words.

Si
9th April 2005, 00:12
This stuff looks very good but I'm having trouble finding a tree in the forest :)

Could someone point me to where they've uploaded a 1080i source avi/mpeg/m2v file.

I had a look at wed_short.zip but it just seems to have 720x480 material (unless I missed something in there :confused: )

regards

Simon

Guest
9th April 2005, 00:23
Si,

I'm off to the pool now, but this weekend I'll send you some laced 1080i material. Anything else you need?

Si
9th April 2005, 00:46
Don
Ta.
That'll do for starters.

Si

eswrite
9th April 2005, 03:12
@Si: did you try this link (http://f2.pg.briefcase.yahoo.com/bc/eswrite/vwp2?.tok=bcLXbIVBQ2qvbqIZ&.dir=/Video&.dnm=movie_short.zip&.src=bc)?

Guest
9th April 2005, 04:29
That's telecined; I think he wants pure interlaced.

IanB
9th April 2005, 07:18
Originally posted by eswrite
@IanB:
I've been meaning to ask you about this, because this isn't working for me at all. You can see what happens in the OInterlacedResize frame at http://eswrite.50megs.com/photo.html. (If you can't see it, the algorithm you suggested produces an image that is compressed to half its expected vertical size, with random scan lines on the bottom 1/2 of the frame.)
...<deleted>...

...<deleted>...
Tf=SelectEven().LanczosResize(..., v.Width(), v.Height())
Bf=SelectOdd().LanczosResize(..., v.Width(), v.Height())
...<deleted>...
Helps if you port it correctly ;)
## Resizing for interlaced material using offset method.
## Equivalent to "dumb Bob", but faster.
## Adapted from IanB's algorithm:
## Exact Interlaced Vertical Resize (http://forum.doom9.org/showthread.php?s=&postid=594339&highlight=Exact+Interlaced+Vertical+Resize#post594339)
function OInterlacedResize(clip V, int "dstWidth", int "dstHeight")
{
V.SeparateFields() # correctly Assume[TB]FF() before calling this function!!

Shift=(Height()/Float(dstHeight/2)-1.0)*0.25 # Field shift correction

Tf=SelectEven().LanczosResize(dstWidth, dstHeight/2, 0, -Shift, Width(), Height())
Bf=SelectOdd().LanczosResize(dstWidth, dstHeight/2, 0, Shift, Width(), Height())

return Interleave(Tf, Bf).Weave()
}The crap at the bottom is the last 2 lines interlace repeated to pad out the height :o

Regards
IanB

Si
9th April 2005, 08:38
@eswrite
I tried that link before and now but it just gives an error page.:(

regards
Simon

darkavatar1470
9th April 2005, 11:27
I remember that still frames on a interlaced source can be progresive(that is not combed), but if we use a seperate field resizing method, the resulting frame might get combed and have jaggered edges.
So maybe we can check the frame first, and if its progresive, use a normal resizer, instead of seperate field resizing for all frames.

IanB
9th April 2005, 13:16
darkavatar1470,

In addition static parts of an otherwise interlaced image will benefit from "progressive" resizing, this is why the highest quality resize of an interlaced image needs to use some form of intelligent Bob/deinterlacing. i.e.
SuperDuperInteligentBob(DoubleRate=True) # Pick one
xyzzyResize(NewW, NewH)
SeparateFields()
SelectEvery(4, 0, 3) # or 1, 2)
Weave()
However a correctly implemented seperate field resizing method won't cause additional combing or jaggered edges, the distortion caused is akin to that caused by using a simple dumb Bob. This is by definition because individual fields can't be combed. Combing requires 2 fields with some elements of the image having moved.

IanB

eswrite
12th April 2005, 16:39
@Ianb
Helps if you port it correctly

Thanks. It works now.