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

Zoltan Hidvegi mplayer at hzoli.2y.net
Wed Mar 3 01:13:35 CET 2004


> Quoting D Richard Felker III (dalias at aerifal.cx):
> > No, this is completely idiotic. Normally you should SCALE after crop,
> > in which case any even dimensions are valid for crop. On the other
> > hand, it should also be an error if you _scale_ to invalid dimensions.
> 
> But if you round the dimensions you scale to to multiples of 16, you're liable
> to screw up the aspect ratio. Maybe you don't care about aspect ratio, but
> I've seen quite enough Paula Abdul videos for one lifetime.

So instead of flaming, why do not we all just run some test to see
exactly what are the effects of non-multiple of 16 encoding.  If as
Rich claims, it is bad for quality, than we should be able to measure
that.  So I've encoded the Acacemy Award HDTV broadcast like this:

mencoder -cache 8192 The_76th_Annual_Academy_Awards.ts -vop hqdn3d=4:3:3,scale=960:540,field,crop=1912:1076:0:0 -tsprog 1 -sws 7 -tskeepbroken -oac copy -ovc lavc -lavcopts vcodec=mpeg4:psnr:mbd=2:v4mv:aspect=16/9:vmax_b_frames=1:trell:cbp:cmp=2:precmp=2:subcmp=2:vpass=1:vqcomp=0.7:vqscale=4 -passlogfile The_76th_Annual_Academy_Awards.log -o The_76th_Annual_Academy_Awards.avi

The result:

Video stream: 1538.929 kbit/s  (192366 bps)  size: 2077779380 bytes  10801.168 secs  323692 frames

Audio stream:  384.000 kbit/s  (48000 bps)  size: 518441408 bytes  10800.862 secs
PSNR: Y:44.52, Cb:46.88, Cr:47.59, All:45.25

As you see, this is 540p, and 540 is not even a multiple os 8.  So I've rerun the encoder changing the y dimension to 544:

mencoder -cache 8192 The_76th_Annual_Academy_Awards.ts -vop hqdn3d=4:3:3,scale=960:544,field,crop=1912:1076:0:0 -tsprog 1 -sws 7 -tskeepbroken -oac copy -ovc lavc -lavcopts vcodec=mpeg4:psnr:mbd=2:v4mv:aspect=16/9:vmax_b_frames=1:trell:cbp:cmp=2:precmp=2:subcmp=2:vpass=1:vqcomp=0.7:vqscale=4 -passlogfile The_76th_Annual_Academy_Awards.log -o The_76th_Annual_Academy_Awards.avi

Video stream: 1542.273 kbit/s  (192784 bps)  size: 2082294121 bytes  10801.168 secs  323692 frames

Audio stream:  384.000 kbit/s  (48000 bps)  size: 518441408 bytes  10800.862 secs
PSNR: Y:44.51, Cb:46.86, Cr:47.57, All:45.24

This change to 544 lines increased the bitrate and lowered the PSNR,
so it has not convinced me that I should stick to a multiple of 16.
The changes in bitrate and PSNR are so low that it is negligible.  I'm
doing the second pass now, but it takes 8 hours, I'll tell the second
pass results when it's ready.

But this experiment does not really prove anything, since scaling
changes the image, and the difference can come from the slaler.  In
this comparison, both test samples were scaled, only the final
dimension was different, and the number of macro blocks were the same
in the two encodes, so this makes it a more convincing test.  But it
is a high resolution encode, at lower resolutions the edge/area ratio
is higher, so bad dimensions will have a more significant effect.  Can
anyone who really knows the details of mpeg4 enlighten us how bad is
it to use dimensions not a multiple of 16 or 8?  Does anyone have any
experiment showing the effects of bad dimensions?

Zoli




More information about the MPlayer-dev-eng mailing list