[FFmpeg-cvslog] r21799 - in trunk/libavcodec: Makefile alsdec.c bgmc.c bgmc.h

Thilo Borgmann thilo.borgmann
Thu Feb 18 11:24:42 CET 2010


Am 18.02.10 06:31, schrieb Alex Converse:
> On Sat, Feb 13, 2010 at 1:24 PM, thilo.borgmann <subversion at mplayerhq.hu>wrote:
> 
>> Author: thilo.borgmann
>> Date: Sat Feb 13 19:24:13 2010
>> New Revision: 21799
>>
>> Log:
>> Support arithmetic decoding in ALS.
>>
> 
> Just a few things I noticed that seemed off...
> 
> 
>> Modified: trunk/libavcodec/alsdec.c
>>
>> ==============================================================================
>> --- trunk/libavcodec/alsdec.c   Sat Feb 13 19:23:46 2010        (r21798)
>> +++ trunk/libavcodec/alsdec.c   Sat Feb 13 19:24:13 2010        (r21799)
>> @@ -591,9 +617,15 @@ static int read_var_block_data(ALSDecCon
>>
>>     sb_length = bd->block_length >> log2_sub_blocks;
>>
>> -
>>     if (sconf->bgmc) {
>> -        // TODO: BGMC mode
>> +        s[0] = get_bits(gb, 8 + (sconf->resolution > 1));
>> +        for (k = 1; k < sub_blocks; k++)
>> +            s[k] = s[k - 1] + decode_rice(gb, 2);
>> +
>> +        for (k = 0; k < sub_blocks; k++) {
>> +            sx[k]   = s[k] & 0x0F;
>> +            s [k] >>= 4;
>> +        }
>>     } else {
>>         s[0] = get_bits(gb, 4 + (sconf->resolution > 1));
>>         for (k = 1; k < sub_blocks; k++)
>> @@ -697,9 +729,76 @@ static int read_var_block_data(ALSDecCon
>>
>>     // read all residuals
>>     if (sconf->bgmc) {
>> -        // TODO: BGMC mode
>> +        unsigned int delta[sub_blocks];
>> +        unsigned int k    [sub_blocks];
>>
> 
> Can these be made fixed length arrays. The max value of sub_blocks is 8, no?

Yes, will be done.


> 
> 
>> +        unsigned int b = av_clip((av_ceil_log2(bd->block_length) - 3) >>
>> 1, 0, 5);
>> +        unsigned int i = start;
>>
> What is the function of this initialization (i = start)

>> +        for (sb = 0; sb < sub_blocks; sb++, i = 0) {
>>
> and this assignment (i = 0)?
> 

>> +        // read least significant bits and tails
>> +        i = start;
>>
> And this one?

i is a sample counter and if this is a random access frame, the first
few samples of the first subblock are already decoded. Thus the samples
to decode are:

subblock 1:       3 4 5 ..
subblock 2:   1 2 3 4 5 ..
subblock 3:   1 2 3 4 5 ..

and start stores "3" in this case, the offset to begin with in the first
block. And therefore i has to be set to start before the first subblock
and reset after the first subblock.

Thanks!
-Thilo



More information about the ffmpeg-cvslog mailing list