[FFmpeg-soc] [soc]: r282 - in jpeg2000: checkout.sh ffmpeg.patch j2k.h j2kenc.c
Kamil Nowosad
k.nowosad at students.mimuw.edu.pl
Sat Jun 30 16:35:10 CEST 2007
Hi
On Mon, Jun 25, 2007 at 02:07:04PM +0200, Michael Niedermayer wrote:
> > +/* bitstream routines */
> > +
> > +/* put n times val bit */
> > +static void put_bits(J2kEncoderContext *s, int val, int n) // TODO: optimize
> > +{
> > + while (n-- > 0){
> > + if (s->bit_index == 8)
> > + {
> > + s->bit_index = *s->buf == 0xff ? 1:0;
> > + *(++s->buf) = 0;
> > + }
> > + *s->buf |= val << (7 - s->bit_index++);
> > + }
> > +}
> > +
> > +/* put n least significant bits of a number num */
> > +static void put_num(J2kEncoderContext *s, int num, int n)
> > +{
> > + while(--n >= 0)
> > + put_bits(s, (num & (1<<n)) ? 1:0, 1);
> > +}
>
> maybe something from libavcodec/bitstream.h could be used?
I've read that through, but unfortunately nothing looked useful for me.
--
Best regards,
Kamil Nowosad
More information about the FFmpeg-soc
mailing list