[FFmpeg-devel] [PATCH] ALS decoder

Michael Niedermayer michaelni
Mon Sep 7 00:07:19 CEST 2009


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


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

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090907/58b4dbb9/attachment.pgp>



More information about the ffmpeg-devel mailing list