[MPlayer-dev-eng] Recommend error for bad dimensions

D Richard Felker III dalias at aerifal.cx
Tue Mar 2 05:11:10 CET 2004


On Mon, Mar 01, 2004 at 07:25:05PM -0600, Zoltan Hidvegi wrote:
> > Would anyone object if I modify ve_lavc's config to FAIL by default if
> > dimensions are not multiples of 16? There would be an option to
> > override ("forcebadsize" maybe?) but IMO too many newbies refuse to
> > RTFM and generate poor encodes (which some players won't even play) by
> > choosing bad dimensions.
> 
> Well, this 16 limitation is not really spelled out in the docs.  Only
> DOCS/tech/encoding-tips.txt mentions it and even there it is not clear
> how important it is to keep the dimensions a multiple of 16.  I do not
> really care about other players, I only care about quality and size.
> E.g., the default 1080i HDTV resolution is not a multiple of 16.
> Also, when encoding DVDs I prefer not to scale them, I just crop the
> borders, so if I do not want to scale, is it better to leave it
> uncropped?  Or it is better to crop it then epand it so that only two
> edges have black borders?  What is the exact quality loss I would
> have?  If I use v4mv, then is it OK to use multiple of 8 dimensions?

I really don't understand the objection some people have to scaling.
The quality loss from scaling to a nearby size is almost nothing,
probably a lot less than the quality loss from borders/bad alignment.
If you use the sinc scaler and scale up to the next multiple of 16,
the process is 100% reversible except for minor rounding errors
(smaller than quantization errors in the encoding anyway), but other
scalers will probably look better.

I would understand trying to keep things 'identical' to the DVD if the
DVD were a good original, but it's not. It's a sloppily encoded
low-res copy of the actual film, and so IMO the goal should be to make
your reencoding look as good as possible, not as close to the DVD as
possible.

Anyway, with regard to your questions... It's hard to say which is
better. My opinion, if you don't want to scale, is that you should
overcrop to the next smaller multiple of 16. This is since the edges
of the picture are probably meant to be overscan anyway, and contain
lots of ringing artefacts due to misaligned edges when the DVD was
encoded.

But I would strongly recommend against crop+expand. This will be worse
than not aligning the borders at multiples of 16, since the artificial
ultrasharp edge between picture and black will have to be encoded. My
understanding (tho this may be wrong) is that if your dimensions
aren't multiples of 16, the "extra" space up to the next multiple of
16 can be encoded as whatever junk the encoder pleases, and thus it
should use less space than having to encode black.

And as for v4mv, I don't think it will help at all. You still have to
encode full macroblocks (16x16). Aligning at multiple-of-8 is better
than no alignment at all, though.

And don't even THINK about using odd dimensions or odd crop offsets.
This will ruin chroma alignment!

Rich




More information about the MPlayer-dev-eng mailing list