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. |
20th November 2005, 15:17 | #1 | Link |
Registered User
Join Date: Jul 2005
Posts: 48
|
A (probably) stupid question regarding mod16
I'm currently backing up one of my DVDs. It's a 4:3 PAL disc, now at a few places during the movie (certain scenes) it switches to 16:9 encoded as 4:3 - black borders top and bottom encoded.
I was busy adding my own borders (to remove that soft "feathered" effect at the edges) when I started wonder whether in cases like this if it mattered if the the actual video area is a mod16 resolution. I'm guessing it doesn't matter, but would just like someone to put my worries to rest. Thanks. |
20th November 2005, 17:21 | #4 | Link |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
You might want to make sure that in those letterboxed sequences the border boundaries are aligned to the codec's blocks, i.e. that the letterbox borders have a mod8 height.
If this is not the case, the border boundaries will go "through" codec blocks, and you'll likely get mosquito noise around those border boundaries.
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
20th November 2005, 22:08 | #6 | Link |
Registered User
Join Date: Jan 2002
Location: France
Posts: 2,856
|
mod8 is a must. mod16 would be better IF you can do it, because that way borders will be entirely skipped ( else, they'll be most likely encoded with 4 mvs, two of them being useless, which takes more bits ). But it's only some bits lost, whereas non mod8 implies a real quality loss.
__________________
|
15th April 2007, 11:07 | #8 | Link |
Registered User
Join Date: Oct 2006
Location: Hannover, Germany
Posts: 7
|
Deleting horizontal garbage lines and complying with mod8 and mod16 rules
When deleting x garbage lines at the bottom of a digitzed analogue video with
#Crop(clip clip, int left, int top, int -right, int -bottom, bool align) cropped=crop(video,0,0,0,x) does the above imply y=(x modulo 8) blown=addborders(cropped,0,0,0,y) to preserve the quality of the remaining video? I assume vertical line cutting requires the same treatment. Regards Last edited by smallbrain; 15th April 2007 at 18:54. Reason: logical error in problem description |
19th April 2007, 08:33 | #9 | Link |
Angel of Night
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
|
If it's not interlaced, then no, you're better off resizing with lanczos or spline36. Black borders will harm compression significantly. If it's interlaced you can't resize, so you should clone the lowest remaining x lines onto the bottom (minus 1 for odd x, to repect field order). That'll be less trouble for the DCT encoding.
|
19th April 2007, 21:37 | #10 | Link |
x264 developer
Join Date: Sep 2004
Posts: 2,392
|
If for whatever reason you can't scale to mod16 (e.g. interlace), do not use addborders nor clone the remaining lines in avisynth, unless you have some hardware requirement for a specific resolution. You get better quality per bitrate by cropping off all the letterbox, and leaving the height non-mod16. The codec itself will clone the bottom lines in order to internally fill mod16, and that way the codec knows which pixels will be displayed and which are virtual.
|
22nd April 2007, 15:23 | #11 | Link |
Mr. Woof
Join Date: Jan 2002
Location: USA
Posts: 784
|
@akupenguin
In your above post, does x264 work the same way regarding a non-mod16 being ok because the encoder will clone the bottom lines...even if the source is progressive film? In my previous and some current DVD encodes I'm doing, I've been putting addborders at the end to achieve a mod16 rather than overcropping to reach a mod16. |
23rd April 2007, 16:19 | #13 | Link |
Mr. Woof
Join Date: Jan 2002
Location: USA
Posts: 784
|
Does the height need to constrain to at least mod8 in this case, or for best bitrate efficiency do you advocate simply cropping off all mattes without regard for final 'active' frame size? This is a new concept to me so I'm very curious about this.
|
24th April 2007, 06:21 | #14 | Link |
x264 developer
Join Date: Sep 2004
Posts: 2,392
|
Yes, you get a penalty to compression ratio if the height of the active picture is not mod16, and that penalty is slightly alleviated (though not by much) if it's mod8.
But the point is: adding mattes, or leaving mattes if they came with the source, does not help in any way, and only compounds the penalty. non-mod16 is bad, but non-mod16 plus a black border to bring it up to mod16 is even worse. There are only three sane choices if your content is not inherently mod16: (1) let the codec deal with it. (2) scale it to the nearest multiple of 16. (3) crop off some of the picture. If you were going to downscale it anyway, then of course scaling to mod16 is better. But if you wanted to keep the whole input resolution, then I honestly don't know which is better. (1) causes the codec to introduce distortion to compensate for the wasted bits. (2) introduces distortion during the scaling because no scaler is perfect. (3) introduces distortion by losing some pixels entirely. The tradeoff probably depends on resolution and bitrate, with higher resolution and higher bitrate favoring (1) and lower resolution and lower bitrate favoring (2). But I have no idea what the threshold is, and it's hard to benchmark because there's no good metric to compare the quality of two encodes at slightly different resolutions. (3) isn't even possible to compare objectively, since it's a very different type of distortion, so that's purely an aesthetic choice. Last edited by akupenguin; 24th April 2007 at 06:27. |
24th April 2007, 15:09 | #15 | Link |
Mr. Woof
Join Date: Jan 2002
Location: USA
Posts: 784
|
I was asking this with downscaling in mind but understand your clear explanation. Basically the problem is two-fold in coming up with a maximum compressibility scheme (from a resolution modulus standpoint): First, when downscaling (standard DVD source assumed) you have to determine the exact PAR of the original and resize with that in mind (if you're a perfectionist), and second to achieve a final resolution (after any cropping and resizing) that would ideally constrain to mod16. Often times the active pixel portion is not natively mod16 and therefore will not be when downsized. The options in this case are to leave (or add) mattes after resizing or overcrop to mod16. I'm very hesitant to overcrop any active pixels even though this loss of 2 or 4 is seemingly minor in the overall picture but find it's often better to resort to this rather than add mattes back into the frame.
After reading this, would you still feel that in my case it is most efficient for bitrate to overcrop to reach mod16, or to simply resize based on the exact PAR (but still leaving no mattes) and thus potentially not have a mod16 resolution? |
25th April 2007, 03:09 | #18 | Link |
Mr. Woof
Join Date: Jan 2002
Location: USA
Posts: 784
|
I'm assuming backups created for computer playback only. But you bring up a good point-should one simply crop mattes from full DVD resolution and set the DAR for the stream when muxing (matroska assumed)? I'm still trying to figure out what would be...best...in my case.
|
25th April 2007, 06:40 | #19 | Link |
Registered User
Join Date: Mar 2004
Posts: 889
|
Actually, some ppls even suggest cropping mod8 (or 16?) to fit in the DVD MPEG2 macroblocks to maximize encoding performance. Indeed, I do not understand your original question at the 1st place. If those 16:9 scenes are intentional parts of the footage, why do you bother about them?
|
25th April 2007, 19:28 | #20 | Link |
Mr. Woof
Join Date: Jan 2002
Location: USA
Posts: 784
|
In my original question I was asking akupenguin if x264 behaved the same way as the previously-mentioned xvid when encoding a non-mod16 resolution. In my previous post I'm asking if it would perhaps be better in my case (again, PC archival and playback of DVD movies) to encode the full-frame (720x480) rather than downsize but to set in the container options 16:9 or 4:3 playback. I generally have been downsizing to 640xX and either overcropping or adding back mattes (which I now understand to be the worst thing to do) to reach mod16.
|
|
|