[FFmpeg-devel] [PATCH] ALS decoder

Thilo Borgmann thilo.borgmann
Mon Sep 7 00:20:23 CEST 2009


Michael Niedermayer schrieb:
> On Sun, Sep 06, 2009 at 01:52:57PM +0200, Thilo Borgmann wrote:
>> Michael Niedermayer schrieb:
> [...]
>>>>
>>>>
>>>>>> +    if (sconf->bgmc) {
>>>>>> +        // TODO: BGMC mode
>>>>>> +    } else {
>>>>>> +        s[0] = get_bits(gb, 4 + (sconf->resolution > 1));
>>>>>> +        for (k = 1; k < sub_blocks; k++)
>>>>>> +            s[k] = s[k - 1] + decode_rice(gb, 0);
>>>>>> +    }
>>>>>> +
>>>>>> +    if (get_bits1(gb))
>>>>>> +        *shift_lsbs = get_bits(gb, 4) + 1;
>>>>>> +
>>>>>> +
>>>>>> +    if (!sconf->rlslms) {
>>>>>> +        if (sconf->adapt_order) {
>>>>>> +            int opt_order_length = FFMAX(av_ceil_log2((block_length >> 3) - 1), 1);
>>>>>> +            opt_order_length     = FFMIN(av_ceil_log2(sconf->max_order+1), opt_order_length);
>>>>> this can be calculated as
>>>>> av_ceil_log2(av_clip(...))
>>>>>
>>>>> which should be simpler and faster
>>>> Justin mentioned this during his GSoC review and we agreed that this is
>>>> not an av_clip() case. I could not find an equal solution, can you?
>>> a quick try: (entirely untested, might contain errors)
>>>
>>> a = FFMAX(av_ceil_log2((block_length >> 3) - 1), 1);
>>> opt_order_length = FFMIN(av_ceil_log2(sconf->max_order+1), a);
>>>
>>> a = FFMAX((block_length >> 3) - 1, 2);
>>> opt_order_length = av_ceil_log2(FFMIN(sconf->max_order+1, a));
>>>
>>> opt_order_length = av_ceil_log2(FFMIN(sconf->max_order+1, FFMAX((block_length >> 3) - 1, 2)));
>>>
>>> opt_order_length = av_ceil_log2(FFMIN(sconf->max_order+1, FFMAX((block_length >> 3) - 1, 2)));
>>>
>>> opt_order_length = av_ceil_log2(av_clip((block_length >> 3) - 1, 2, sconf->max_order+1))
>> This can be assumed by the values we see here, but mathematically this
>> is not equal - a block_length == 16 proves this wrong (opt_order_length
>> == 1 which is not possible in the av_clip case).
>>
>> Also the specs explicitly shows a block_length == 16 case.
> 
> if you think there is a problem, first provide a example
> a example involves giving all variables a value, max_order does need one as
> well

Oh! I'm sorry I missed log2(2) == 1...

In that case I'm absolutely ok with it.
I apologize for being so hastly!

Thanks!

-Thilo



More information about the ffmpeg-devel mailing list