[Theora-dev] Encoding theora...

illiminable ogg
Wed Jun 30 08:16:42 PDT 2004

----- Original Message -----
From: "Timothy B. Terriberry" <tterribe at vt.edu>
To: "illiminable" <ogg at illiminable.com>
Sent: Wednesday, June 30, 2004 10:55 PM
Subject: RE: [Theora-dev] Encoding theora...

> >Is there some rough guestimation formula i can use to find it based on
> >parameters... or failing that... just the maximum possible size... though
> >considering i think i read theora can handle 2mil pixel squared images...
> >think an absolute max value is not really realistic...
> The maximum possible size is... large. 42 bits per sample (up to 3
> samples/pixel in 4:4:4 mode), plus additional motion vectors, quantizer
> settings, etc. But that assumes you've chosen the worst possible Huffman
> to encode with and managed to construct some horrendous noise to encode.
> not even sure you could create an artificial example that would require
> much space.

Oh... you've just made me realise it takes formats other than 4:2:0 (YV12
like)... if it can do 4:2:2 then i don't need to translate... as YUY2 is a
4:2:2 type. So that solves that problem... thanks.

> A more reasonable "guestimate" would be 1 or 1.25 times the uncompressed
> size. That's also probably extremely conservative.

So a good max estimate would be...
4:2:0 = width*height* 3
4:2:2 = width*height* 4
4:4:4 = width*height* 6


> Of course, it would be better if there were some way to report an error
> instead of crashing should the buffer actually be too smal..

It could report an error, but it would be very difficult to recover from
because of the way the allocators work... it could probably be done... but
it would be very painful to do without losing data already in the allocators
and causing flow on effects in the graph.

I think i'd rather just make it big... even if it wastes a few megs of
memory... most machines doing encoding are not going to be memory bound... i
think i'd rather my encoder uses some excess ram than for it stop with an
error part way through a big encode and force you to up the buffer and start

Thanks for your help,


More information about the Theora-dev mailing list