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

Michael Niedermayer michaelni
Wed Mar 18 06:25:17 CET 2009


On Tue, Mar 17, 2009 at 06:56:32PM +0200, Kostya wrote:
> 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.

skip_bits_long() allows it but it may be slow

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

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090318/ca3c9d25/attachment.pgp>



More information about the ffmpeg-devel mailing list