Log in

View Full Version : Crop & resize... safe?


kumi
26th February 2007, 00:17
Hi,

I looking to remove the black borders that are present in a few of my DVDs. I figure I could add to the DVD Rebuilder filter editor something like:

Crop(16, 16, -16, -16)
LanczosResize(last, 720, 480)

Is this type of "crop + resize" operation safe for interlaced sources and progressive sources? I seem to remember reading somewhere about problems with vertical resizing and interlacing, but I couldn't find the thread in question.

Thanks

jdobbs
26th February 2007, 03:18
Normally for interlaced sources you would want to separate the fields, resize, and then put them back together again.
Also, when you remove part of the picture (the borders) you have to account for the difference (in aspect ratio )between the horizontal and vertical axis.

kumi
26th February 2007, 10:59
Thank you, jdobbs, it looks like I need to do some research.

In the meantime, just one question: in a DVDRB .AVS, if the ConvertToYV12() function call contains an interlaced=true argument, I can safely crop and resize as if it were progressive, right?

If so, I can get started on my progressive DVDs before I figure out the right procedure for interlaced.

TIA

jdobbs
26th February 2007, 11:58
It will still work, but the clarity will be better if you separate fields. The reason is that the fields in a true interlaced source don't necessarily represent two parts of a single point-in-time picture, but instead represent two different points-in-time. So when you resize, adjoining pixels from the two fields that are dissimilar (like when there is rapid movement) may get averaged into a single "soft" representation of themselves.

kumi
26th February 2007, 12:31
Sorry, I miswrote what I meant to say:

if the ConvertToYV12() function call doesn't contain an interlaced=true argument, I can safely crop and resize as if it were progressive, right?

As far as interlaced sources go, I'll do some testing with InterlacedResize() and see if the softening is worth it or not. Some of my DVDs have so many border pixels it just might be. :)

Rippraff
26th February 2007, 14:35
if the ConvertToYV12() function call doesn't contain an interlaced=true argument, I can safely crop and resize as if it were progressive, right?
If there is no interlaced=true it IS a progressive source.

This isn't reliable the other way. I guess the majority of PAL movies which say interlaced=true for the main movie, contain a wrong flag and are truely progressive.
That's why I always do a frame by frame comparison (VirtualDub) in these cases.

Cu Rippraff

Video Dude
26th February 2007, 23:13
For interlaced resizing:


SeparateFields()
# Resize here
Weave()


You could also bob, resize, and then re-interlace.

jdobbs
27th February 2007, 02:03
But... remember that the resize would only have half the height because it's being applied against a field rather than a frame... so NTSC would be 720x240 for instance.

kumi
27th February 2007, 02:23
Indeed, thank you. I ran some tests with separatefields().resize.Weave() on some particularly detailed material, and the results were unacceptably soft.

I've read suggestions for using a smart bobber to increase the quality of interlaced resizing, but I'm wary of introducing artifacts, as well have having to tweak parameters on each source...

Will plain-vanilla bobbing, resizing and then re-interlacing preserve more detail than separatefields().resize().weave()? Or perhaps one of you have a suggestion for a relatively "plug-and-play" script that will work with all interlaced sources and give better quality than my tests?

Boulder
27th February 2007, 07:15
For interlaced resizing:


SeparateFields()
# Resize here
Weave()


You could also bob, resize, and then re-interlace.Separating the fields, resizing and then weaving results in spatial misalignment of the fields. Bob-resize-reinterlace is the proper way to go in this case. You could simply try TDeint(mode=1) for smart bobbing.

manono
27th February 2007, 16:10
Indeed, thank you. I ran some tests with separatefields().resize.Weave() on some particularly detailed material, and the results were unacceptably soft.

Yep, you discovered why that's not such a good way to do it. Boulder suggested TDeint(Mode=1) as the smart bobber. If only because it's a bit faster, I prefer LeakKernelBob:

LeakKernelBob(Order=1)#if TFF
#do any cropping, resizing, or other filtering here
SeparateFields()
SelectEvery(4,0,3)#if TFF
Weave()
ConvertToYUY2(Interlaced=True)

kumi
3rd March 2007, 03:31
Thanks for the two suggestions. I tried them both...

This one gives me interlaced artifacts (http://img81.imageshack.us/img81/8181/leakkerneldeintqx5.png) all over the place
AssumeTFF()
LeakKernelBob(order=1)
Crop(12, 12, -12, -12).LanczosResize(720,480)
AssumeTFF()
SeparateFields().SelectEvery(4,0,3).Weave()

And this works well (http://img81.imageshack.us/img81/7495/tdeintkc4.png). Better vertical resolution than bob() and no artifacts:
AssumeTFF()
TDeint(mode=1)
Crop(12, 12, -12, -12).LanczosResize(720,480)
AssumeTFF()
SeparateFields().SelectEvery(4,0,3).Weave()

I guess I'll have to go with the slower TDeint, after I confirm on some more sources that it doesn't introduce any artifacts. I know I could tweak LeakKernelBob's parameters, but I'm more interested in a quick plug and play solution :p

Boulder
3rd March 2007, 10:24
Lower the threshold in LeakKernelBob, the default is quite high at 10. Try something like 3 or 4 and see how it looks like.