[XviD-devel] Aspect Ratio

Christoph Lampert xvid-devel@xvid.org
Tue, 22 Oct 2002 11:18:24 +0200 (CEST)


Hi,

there was a question at transcode mailing list to add support for 
aspect ratio information to XviD (mplayer and ffmpeg-Dshow might support
it one for viewing). 

It would be _very_ easy to implement, just change the line

	BitstreamPutBits(bs, 1, 4);	// aspect_ratio_info (1=1:1)

in bitstream/bitstream.c to some other value than 1, following the table
6-12 "Meaning of pixel aspect ratio":

0000 Forbidden 
0001 1:1 (Square) 
0010 12:11 (625-type for 4:3 picture) 
0011 10:11 (525-type for 4:3 picture) 
0100 16:11 (625-type stretched for 16:9 picture) 
0101 40:33 (525-type stretched for 16:9 picture)
0110-1110 Reserved 
1111 extended 

if we ignore "extented" for the moment, then we either have to pass the 
3 or 4-bit value to encoder when writing VOL-Header using some extra
field or use flags for the 5 possible values, e.g. 3 flags
XVID_AR_ flags indicating

no flag = 1:1, like before
XVID_AR_NTSC-PAL   use 525 lines otherwise 625  (=bit 0 from right)
XVID_AR_4-3        write 4:3 stretch (=bit 1 from right)
XVID_AR_16-9       write 16:9 stretch  (=bit 2 from right) 

We do have some bits to spare (in dev-api-3 and in stable, too, e.g.
old XVID_ME_XXX, which is not needed for INTRA-FRAME (=VOL header)
anyway. 

I can of course easily add this, my question is only: What should we do?
Add 3 flags to API (backport to "stable" perhaps later), or add another
field to API-3 to support "extented" mode (arbitrary aspect ratios), too?

gruel

P.S. This is another feature which no other codec has ;-> great for
homepage announcements...