[theora-dev] Understanding the Theora Bitstream
Mike Melanson
melanson at pcisys.net
Fri Mar 26 15:15:36 PST 2004
Hi,
I checked out the Theora source code for the first time as I
figured that's the only way the Theora quirks will get documented (and
subsequently re-implemented in libavcodec). I see that most of the code
cribs the original VP3 source code, including the misspelled comments.
Moving right along, I can't reconcile the way bits are packed in the
stream. In VP3, the first byte of an encoded frame is supposed to contain:
bit 7: 0 = golden frame, 1 = interframe
bit 6: unused
bits 5-0: Quality index (0..63)
According to {theora}/lib/decode.c, it goes frame type (1 bit), Q index (6
bits), then spare bit (1 bit). With some strategically-placed printf()'s,
I'm seeing data like this:
hey! Theora packet has 9 bytes
first 8 bytes: 32 00 0B D7 69 F6 FF DC
header: frame type 0, Q index = 0x32, spare bits = 0
(I would have expected 0110 0100 = 0x64 for the first byte)
hey! Theora packet has 9 bytes
first 8 bytes: 5A 3F 09 E7 E1 3D E0 00
header: frame type 1, Q index = 0x1A, spare bits = 0
(I would have expected 1011 0100 = 0xB4 for the first byte)
hey! Theora packet has 497 bytes
first 8 bytes: 50 38 CF 1E 36 68 B7 9C
header: frame type 1, Q index = 0x10, spare bits = 0
(I would have expected 1010 0000 = 0xA0 for the first byte)
I remember reading in a spec somewhere that Ogg uses some nutty logic for
packing bitstreams. Is this a manifestation of said logic?
Thanks...
--
-Mike Melanson
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'theora-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Theora-dev
mailing list