PDA

View Full Version : Resizing Over By 1 Pixel


JohnMK
22nd September 2002, 21:52
I'm encoding 2010 - The Year We Make Contact, a highly compressible movie that fits on 1 CD with virtually no quality compromises. Even at 656x272, it's at 70.4% compressibility. Trouble is, the vertical height as autocropped by GKnot is 271, not 272, so while the horizontal is resized down from 718, the vertical is resized up to 272 (271+1). Is this a bad thing to do? My instinct tells me yes, but I'm at a loss as to what else I can possibly do. Should i just crop by one less resolution point in the vertical, and get a one pixel black line running along the bottom?

Any hints and tips appreciated.

Thank you,

John

Acaila
22nd September 2002, 22:01
I sincerely doubt upsizing by 1 pixel could have any bad effect on the movie. Much less than keeping an extra line of black I'm sure.

However, since YUY2 (as avisynth processes it) can only deal with even dimensions, it would be better I think to crop by an additional pixel instead (for a whooping upsize total of 2! :) ).

JohnMK
22nd September 2002, 22:15
But it's resized to 656x272 before it hits that stage, I think, so it's not necessary to crop by 1 additional pixel then, right?

manono
23rd September 2002, 00:56
Hi-

As Acaila says, the last thing you want to do is have a piece of the black bar remaining. My suggestion is to reset your W-Mod back to 32 from the 16 you have now, pixel crop manually to remove the black bars, and then Smart Crop Left-Right. With any luck you should wind up with 640x272 and it will be slightly less narrow than what you have now.

I always try to have my horizontal and vertical crops be even numbers to avoid any YUY2 problems.

JohnMK
23rd September 2002, 01:42
Sage like advice, both of you -- thank you. One question: what kinds of problems does one run into by blindly trusting the autocropping in GKnot? I've trusted it for a long time now and never noticed any problems in the resulting encodes, and probably many of my movies have used crops not divisible by 2.

jggimi
23rd September 2002, 06:57
SimpleResize can give you a green bar on the right side of the encoding in some cases using AutoCrop. Click on this sticky (http://forum.doom9.org/showthread.php?s=&threadid=25608) from the Gknot forum for more info.

JohnMK
23rd September 2002, 07:13
Since I usually use neutral bicubic, I don't think this applies to me, but thanks anyway, interesting read.

manono
23rd September 2002, 07:20
Hi-

I'll give you another example (jggimi's point is well taken-Auto Crop doesn't always abide by the "Horizontal Crop Divisible By 4" Rule, and some of the filters require it). I have just finished a movie. It's a 1.33:1 movie at 512x384. I had Pixel Cropped it with (clockwise from left) 4,0,16,2 and had an Aspect Error of -0.2%. I just Auto Cropped it and it came out with 5,0,11,2 with an Aspect Error of -0.4% and 4 pixels of black along the right. I don't much trust the Auto Crop. I'm not saying don't use it. I'm saying to scroll it when done and check the edges to make sure all the black is gone.

Acaila
23rd September 2002, 13:41
But it's resized to 656x272 before it hits that stage, I think, so it's not necessary to crop by 1 additional pixel then, right?

Not true. Everything that happens from calling the source in the avisynth script up the last line is being processed in YUY2. This includes cropping and resizing, and every other filter before, between and after that.
Some filters will choke on an odd resolution, some will just give you weird output without telling you anything is wrong, and some will process it correctly without caring what the resolution is (by interpolating the chroma of the missing pixel).

The point is, always crop so that you get a resolution divisible by 2 just to be on the safe side. Some filters require more than this; carefully read the documentation of every filter you use to make sure you abide by their input rules, especially ones you've never used before, so you won't be taken by surprises.

bb
24th September 2002, 08:21
@Acaila:

If you crop one line from the top, and another one from the bottom, wouldn't you get only half the color information for the first & last line of the cropped video? I believe a YUY2 filter would still need to interpolate, although the resolution is even (but the crop values are not).

I think the correct recommendation should sound like this:
Each of the top, bottom, left, and right crop values should be even (divisible by 2).

bb

Acaila
24th September 2002, 11:40
Hi bb,

Actually, I think you're correct. I'm no coder (yet), so I don't know how filters do things exactly, but what you said makes a lot of sense.

Thanks for correcting me :)

neuron2
24th September 2002, 14:59
If you crop one line from the top, and another one from the bottom, wouldn't you get only half the color information for the first & last line of the cropped video?No, YUY2 chroma is subsampled horizontally but fully sampled vertically.

bb
25th September 2002, 08:25
Thanks, neuron2. So it was a misunderstanding on my side.

Sorry, Acaila - I didn't know it better...

bb

mikeson
3rd October 2002, 10:38
No, YUY2 chroma is subsampled horizontally but fully sampled vertically.

So what does it mean? Should be "top & bottom" or "left & right" or both of them divisible by 2?

I don't want black bars, but I also don't want to get into the movie (delete few lines), so I rather keep few black bars to have correct AR and keep left,top,right,bottom values divisible by 2. I am doing something wrong?

Thanks for answering

neuron2
3rd October 2002, 13:44
I cannot speak for all filters, because authors implement different limitations based on factors other than the color sampling (e.g., for things destined for MPEG encoding often a width multiple of 4 pixels is enforced). But having said that, it is the case that considering only the color sampling, the height can be arbitrary and need not be a multiple, while the width should be a multiple of 2.

I know some codecs will not properly handle widths that are not multiples of 4, but if you are not using those codecs, then you will be fine.