I see your point, thanks for interesting suggestion!
2010/6/23 Brian Willoughby <[email protected]>: > Oops. I proofread my email a little too late. I corrected the example. > Hopefully what I am suggesting is clear. > > Brian Willoughby > Sound Consulting > > > On Jun 22, 2010, at 22:15, Brian Willoughby wrote: >> >> What you need to do is write a bitStream function. It should only read >> each byte from the stream once and completely deal with all 8 bits before >> reading the next byte. You should never look ahead beyond the current byte. >> Instead, you need an accumulator to collect the incoming bits. Each time >> you read a byte, add 8 to your bit count, and shift any existing bits in >> your accumulator around to make room for the new bits. When pulling values >> out of the accumulator, you do that based upon the number of bits requested. >> The accumulator will have to be (long long) because you will sometimes >> request more than 32 bits. >> >> In other words, instead of: >> >> GetEndianBytes(streamArray, streamOffset, numBytes); >> >> ... you should implement: >> >> (long long)GetBigEndianStreamBits(streamHandle, (unsigned)numBits); >> >> The return value will have to be 64-bit to handle totalSamples. The nice >> thing is that you won't need any indexing or bit shifting, because >> GetBigEndianStreamBits() will directly return the value you ask for, based >> upon the number of bits requested. > > > _______________________________________________ Flac-dev mailing list [email protected] http://lists.xiph.org/mailman/listinfo/flac-dev
