[Ffmpeg-devel] [RFC] WavPack lossless audio decoder

Michael Niedermayer michaelni
Mon Sep 25 12:47:33 CEST 2006


Hi

On Mon, Sep 25, 2006 at 11:42:58AM +0300, Kostya wrote:
> Here is $subj for review and comments.

[...]
> +    if(ctx->zeroes){
> +        ctx->zeroes--;
> +        return 0;
> +    }else if(!(ctx->median[0] & ~1) && !(ctx->median[3] & ~1) && !ctx->zero && !ctx->one){

isnt that the same as
ctx->median[0] < 2U && ctx->median[3] < 2U && !ctx->zero && !ctx->one


> +        t = get_unary(gb);
> +        if(t >= 2) t = get_bits(gb, t - 1) | (1 << (t-1));
> +        ctx->zeroes = t;
> +        if(ctx->zeroes){
> +            memset(ctx->median, 0, 6 * sizeof(int));

maybe sizeof(ctx->median) would be clearer then 6*...


> +            ctx->zeroes--;
> +            return 0;
> +        }
> +    }
> +
> +    if(ctx->zero){
> +        t = 0;
> +        ctx->zero = 0;
> +    }else{
> +        t = get_unary(gb);
> +        if(get_bits_count(gb) >= ctx->data_size){
> +            *last = 1;
> +            return 0;
> +        }
> +        t2 = 0;

t2 looks "unused" in the sense that it is always writen after this but before
every read


[...]
> +            j = 0;
> +            if(t > 8){
> +                if(t & 1)
> +                    A = 2 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1];
> +                else
> +                    A = (3 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1]) >> 1;
> +                s->decorr[i].samplesA[1] = s->decorr[i].samplesA[0];
> +                j = 0;

this or the above j=0 is redundant


[...]
> +                if(s->decorr[i].value > 8){
> +                    s->decorr[i].samplesA[0] = wp_exp2((int16_t)LE_16(buf)); buf += 2;
> +                    s->decorr[i].samplesA[1] = wp_exp2((int16_t)LE_16(buf)); buf += 2;

i think the int16_t casts are unneeded

[...]

excepet these iam fine with the patch


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list