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

Michael Niedermayer michaelni at gmx.at
Sat Jun 30 18:00:15 CEST 2007


Hi

On Sat, Jun 30, 2007 at 04:14:54PM +0200, k.nowosad wrote:
> Author: k.nowosad
> Date: Sat Jun 30 16:14:53 2007
> New Revision: 287
> 
> Log:
> moved the arithmetic coder into a separate file
> 
> 
[...]
> +typedef struct {
> +        unsigned int qe;
> +        unsigned int nmps;
> +        unsigned int nlps;
> +        unsigned int sw;
> +} AecCxState;

smaller datatypes seem to suffice ...


[...]
> +void aec_initenc(AecState *aec, uint8_t *bp);

ff prefix missing


> +
> +/**
> + * code bit d with context cx
> + * */
> +void aec_encode(AecState *aec, int cx, int d);

if this is speed critical then maybe it should be moved into the
header so it can be inlined
though this this isnt really critical, it can stay here until
after SOC if we are short on time


[...]
> +static void byteout(AecState *aec)
> +{
> +    if (*aec->bp == 0xff){
> +        byteout_r(aec);
> +    }
> +    else
> +    {
> +        if ((aec->c & 0x8000000) == 0){
> +            byteout_l(aec);
> +        }
> +        else{
> +            (*aec->bp)++;
> +            if (*aec->bp == 0xff){
> +                aec->c &= 0x7ffffff;
> +                byteout_r(aec);
> +            }
> +            else{
> +                byteout_l(aec);
> +            }
> +        }
> +    }
> +}

retry:
if(*aec->bp == 0xff)
    byteout_r(aec);
else if(aec->c & 0x8000000){
    (*aec->bp)++;
    aec->c &= 0x7ffffff;
    goto retry;
}else
    byteout_l(aec);

and the {} placement is inconsistant sometimes its
}
else{

sometimes
}
else
{


> +
> +static void renorme(AecState *aec)
> +{
> +    do{
> +        aec->a = aec->a << 1;
> +        aec->c = aec->c << 1;

aec->a += aec->a;
aec->c += aec->c;


> +        aec->ct--;
> +        if (!aec->ct)
> +            byteout(aec);

if(!--aec->ct)
    byteout(aec);


> +    }
> +    while ((aec->a & 0x8000) == 0);

while(!(aec->a & 0x8000));


> +}
> +
> +static void codelps(AecState *aec)
> +{
> +    int qe = cx_states[aec->curctx->state].qe;
> +    aec->a -= qe;
> +    if (aec->a < qe)
> +        aec->c += qe;
> +    else
> +        aec->a = qe;
> +    if (cx_states[aec->curctx->state].sw)
> +        aec->curctx->mps = 1 - aec->curctx->mps;

aec->curctx->mps ^= cx_states[aec->curctx->state].sw;


[...]
> +    if (*aec->bp == 0xff)
> +        aec->ct = 13;
> +    else
> +        aec->ct = 12;

aec->ct = 12 + (*aec->bp == 0xff);


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

I hate to see young programmers poisoned by the kind of thinking
Ulrich Drepper puts forward since it is simply too narrow -- Roman Shaposhnik
-------------- 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/20070630/3ca93c34/attachment.pgp>


More information about the FFmpeg-soc mailing list