[FFmpeg-devel] [PATCH] Fix CCE decoding and cleanup

Måns Rullgård mans
Tue Sep 23 14:05:15 CEST 2008


Robert Swain wrote:
> 2008/9/18 Alex Converse <alex.converse at gmail.com>:
>> On Thu, Sep 18, 2008 at 5:45 PM, Michael Niedermayer <michaelni at gmx.at>
>> wrote:
>>>
>>> On Thu, Sep 18, 2008 at 05:19:39PM -0400, Alex Converse wrote:
>>> > Hi,
>>> >
>>> > The first patch fixes CCE decoding. The second patch cleans up some CCE
>>> > related documentation and variable names.
>>>
>>> [...]
>>>
>>> > @@ -1001,12 +1001,13 @@
>>> >                          int t = get_vlc2(gb, vlc_scalefactors.table, 7,
>>> 3) - 60;
>>> >                          if (t) {
>>> >                              int s = 1;
>>> > +                            int g;
>>> > +                            g = gain += t;
>>> >                              if (sign) {
>>> > -                                s  -= 2 * (t & 0x1);
>>> > -                                t >>= 1;
>>> > +                                s  -= 2 * (g & 0x1);
>>> > +                                g >>= 1;
>>> >                              }
>>> > -                            gain += t;
>>> > -                            gain_cache = pow(scale, gain) * s;
>>> > +                            gain_cache = pow(scale, -g) * s;
>>> >                          }
>>> >                      }
>>>
>>>    int t = get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
>>>    if (t) {
>>>        int s = 1;
>>>        t = (gain += t);
>>>        if (sign) {
>>>            s  -= 2 * (t & 1);
>>>            t >>= 1;
>>>        }
>>>        gain_cache = pow(scale, -t) * s;
>>>    }
>>> }
>>
>> Fixed.
>
> I'm not sure if they're needed but you omitted the parentheses around
> 'gain += t' in your fixed patch.

The = and += operators have the same precedence and right to left
associativity, so a = b += c is equivalent to a = (b += c).  Were
the associativity left to right, that would become (a = b) += c,
which isn't a valid expression, since an assignment isn't an lvalue.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list