[libav-devel] [PATCH] VBLE Decoder

Derek Buitenhuis derek.buitenhuis at gmail.com
Wed Nov 9 08:06:19 CET 2011


On 09/11/2011 1:32 AM, Kostya Shishkov wrote:
> On Tue, Nov 08, 2011 at 11:13:48PM -0500, Derek Buitenhuis wrote:
> I think you mean "more than half a decade ago for a short time". I 
> remember hearing about it but didn't bother to RE it even then. Still, 
> nice to have it. Can you also provide samples? 

Sure, and a binary. I just need a place to put them.

>> +    uint32_t src = get_bits_long(gb, 32);
>> +
>> +    skip_bits_long(gb, -32);
> src = show_bits_long(gb, 32);

Seems I wanted show_bits. Fixed.

>> +    for(int i = 0; i<  32; i++) {
>> +        if(src&  (1<<  i)) {
>> +            skip_bits_long(gb, i + 1);
>> +            return i;
>> +        }
>> +    }
>> +
>> +    return -1;
>> +}
> Also the function is strange IMO, numbers like
>
> 00000000010 and
> 11111111110 will be treated the same
>
> Also please declare loop variables once and don't use for(int i=...

Rewritten as discussed on IRC.

Loop variables eradicated.

>
>> 0] + lengths[1] + lengths[2] + lengths[3];
>> +
>> +        if(sum != 0)
>> +            ctx->val[i] = get_bits_long(gb, sum);
>> +        else
>> +            ctx->val[i] = 0;
> a check for sum>  32 wouldn't hurt

Added.

> +    /* Codec is YV12-only */
> +    pic->linesize[0] = w;
> +    pic->linesize[1] = pic->linesize[2] = w / 2;
> That's abuse, you shouldn't touch linesizes. If you want continuous buffer
> then allocate it and copy data into pic later.

Will fix, and rest of code will be changed to compensate.

I'll also implement the other things we've discussed, and
formatted the code more consistently.

Thanks for the input!

- Derek


More information about the libav-devel mailing list