[FFmpeg-soc] [soc]: r282 - in jpeg2000: checkout.sh ffmpeg.patch j2k.h j2kenc.c

Michael Niedermayer michaelni at gmx.at
Mon Jun 25 14:07:04 CEST 2007


Hi

On Mon, Jun 25, 2007 at 12:28:41PM +0200, k.nowosad wrote:
> Author: k.nowosad
> Date: Mon Jun 25 12:28:41 2007
> New Revision: 282
> 
> Log:
> The basics of encoder. Quantization, dwt 9-7 and some smaller features will be added.

[...]
> +#ifndef _J2K_H_
> +#define _J2K_H_

stuff starting with _ is reserved in C


[...]
> +/* 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?


[...]
> +/* arithmetic entropy coder routines: */
> +static void aec_initenc(J2kAec *aec, uint8_t *bp)
> +{
> +    bzero(aec->contexts, 19*sizeof(J2kAecContext));
> +    aec->contexts[J2K_T1_CTX_UNI].state = 46;
> +    aec->contexts[J2K_T1_CTX_RL].state = 3;
> +    aec->contexts[0].state = 4;
> +    aec->curctx = aec->contexts;
> +
> +    aec->a = 0x8000;
> +    aec->c = 0;
> +    aec->bp = bp-1;
> +    aec->bpstart = bp;
> +    if (*aec->bp == 0xff)
> +        aec->ct = 13;
> +    else
> +        aec->ct = 12;
> +}
> +
> +static void aec_byteout_l(J2kAec *aec)
> +{
> +    aec->bp++;
> +    *aec->bp = aec->c >> 19;
> +    aec->c &= 0x7ffff;
> +    aec->ct = 8;
> +}

please put the arithmetic coder stuff into a seperate file


[...]
> +void free(J2kEncoderContext *s)
> +{

i dont think this function name is a good idea


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

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-soc/attachments/20070625/f7bf229a/attachment.pgp>


More information about the FFmpeg-soc mailing list