[Ffmpeg-devel] Reading blockless bitstream
Måns Rullgård
mans
Sun Mar 25 23:53:18 CEST 2007
Michael Niedermayer <michaelni at gmx.at> writes:
> 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 ...
I was thinking along those lines, but figured I'd ask in case someone
had some neat trick I hadn't thought of.
Guess I'll just do it the hard way.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list