bitstreams

Andreas Lobinger andreas.lobinger at netsurf.de
Fri Jul 9 08:05:55 EDT 2004


Aloha,

Michael Hudson wrote:
> Andreas Lobinger <andreas.lobinger at netsurf.de> writes:
>>can anyone here recommend a implementation for bitstreams?
>>
>>For a project i need to extract bitfields from a file containing
>>one large bitstream (length >> 1000bit). The bitfields (1bit-24bit)
>>are not aligned to char boundaries (8bit).

> Well, a thousand bits really isn't very many.  Read the lot and slurp
> it into a long?  

Thanks to both replies by now. Two points. length>>1000bits means
that i'm talking about an implementation that runs up to 1000000bits.
In the moment i'm working with a string in memory and use a state
maschine to get to the first byte, use string.struct to get
the word/long containing all bits and a little bit masking.

There is no real problem writing code for this, but i thought that
it could be that there are already implementations for bitstreams
f.e. mpeg-reading, a zlib implementation or other coding/decoding
things...

Wishing a happy day
		LOBI



More information about the Python-list mailing list