[Ffmpeg-devel] Reading blockless bitstream

Michael Niedermayer michaelni
Sun Mar 25 23:18:32 CEST 2007


Hi

On Sun, Mar 25, 2007 at 11:09:18PM +0200, Reimar D?ffinger wrote:
> Hello,
> On Sun, Mar 25, 2007 at 09:56:51PM +0100, M?ns Rullg?rd wrote:
> > M?ns Rullg?rd <mans at mansr.com> writes:
> > > Is there some trick that can be used to read an arbitrarily long
> > > bitstream with no division into blocks when it is supplied as a
> > > sequence of buffers?  Copying and merging all buffers is not an option
> > > as the length is unbounded.  What I'm looking for is some way to
> > > seamlessly shift a GetBitsContext from one buffer to another.  If
> > > anyone has done something like that, I'd appreciate if you'd share any
> > > hints.
> > 
> > Please, can someone at least say it's impossible?
> 
> Well, it certainly isn't impossible but it needs some meddling with
> GetBitContext internals. 

no it doesnt

we just keep reading from buffer N until we get close to its end
then we copy a little from N and N+1 into a tempoary buffer reinit
getbitcontext to it and skip the right amount of the initial bits
now we continue reading from this temporary buffer until we are over
the N/N+1 point then we repeat the whole switch and switch to N+1

if the memory after the buffers can safely be written too then we
can avoid the temporary buffer and half of the switches

there are of course many other ways to implement this like a wraper
around 2 getbitcontexts as suggested ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070325/823c7b3d/attachment.pgp>



More information about the ffmpeg-devel mailing list