[FFmpeg-devel] rmdec.c: add SIPR codec try #2

Kostya kostya.shishkov
Tue Mar 17 17:56:32 CET 2009


On Tue, Mar 17, 2009 at 12:01:41PM -0400, Ronald S. Bultje wrote:
> Hi Kostya,
> 
> On Tue, Mar 17, 2009 at 10:28 AM, Kostya <kostya.shishkov at gmail.com> wrote:
> > On Tue, Mar 17, 2009 at 09:29:39AM -0400, Ronald S. Bultje wrote:
> >> + ? ? ? ? ? ? ? ? ? ?/* swap 4bit-nibbles of block 'i' with 'o' */
> >> + ? ? ? ? ? ? ? ? ? ?for (j = 0; j < bs; j++, i++, o++) {
> >> + ? ? ? ? ? ? ? ? ? ? ? ?int x = (buf[i >> 1] >> (4 * (i & 1))) & 0xF,
> >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ?y = (buf[o >> 1] >> (4 * (o & 1))) & 0xF;
> > [style nit suppressed]
> >> +
> >> + ? ? ? ? ? ? ? ? ? ? ? ?buf[o >> 1] = (x << (4 * (o & 1))) |
> >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ?(buf[o >> 1] & (0xF << (4 * !(o & 1))));
> >> + ? ? ? ? ? ? ? ? ? ? ? ?buf[i >> 1] = (y << (4 * (i & 1))) |
> >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ?(buf[i >> 1] & (0xF << (4 * !(i & 1))));
> >
> > this is not very readable and the value is swapped twice.
> > I think full swapping should be done at each iteration, probably
> > with splitting for (i&1 == o&1) and (i&1 != o&1) cases
> 
> I'd prefer get_bits(), this is ideally suited for that. Can I seek in
> GetBitContexts, or "get 4 bits at offset X"?

I'm not sure you can seek backwards.
 
> Ronald




More information about the ffmpeg-devel mailing list