Merge remote-tracking branch 'shariman/wmall'
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 16 Feb 2012 03:01:24 +0000 (04:01 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 16 Feb 2012 03:01:24 +0000 (04:01 +0100)
* shariman/wmall:
  Do not try to read residue if ave_mean <= 1
  Move some variable declarations to comply with C90
  Cosmetics: fix some whitespace errors
  Support 24-bit decoding
  wmall: remove ;;

Conflicts:
libavcodec/wmalosslessdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/wmalosslessdec.c

@@@ -709,24 -708,29 +708,29 @@@ static int decode_channel_residues(Wmal
      }
      //av_log(0, 0, "%8d: ", num_logged_tiles++);
      for(; i < tile_size; i++) {
 -      int quo = 0, rem, rem_bits, residue;
 -      while(get_bits1(&s->gb))
 -          quo++;
 -      if(quo >= 32)
 -          quo += get_bits_long(&s->gb, get_bits(&s->gb, 5) + 1);
 +        int quo = 0, rem, rem_bits, residue;
 +        while(get_bits1(&s->gb))
 +            quo++;
 +        if(quo >= 32)
 +            quo += get_bits_long(&s->gb, get_bits(&s->gb, 5) + 1);
  
-                ave_mean = (s->ave_sum[ch] + (1 << s->movave_scaling)) >> (s->movave_scaling + 1);
+               ave_mean = (s->ave_sum[ch] + (1 << s->movave_scaling)) >> (s->movave_scaling + 1);
+     if (ave_mean <= 1)
+         residue = quo;
+     else
+     {
          rem_bits = av_ceil_log2(ave_mean);
          rem = rem_bits ? get_bits(&s->gb, rem_bits) : 0;
          residue = (quo << rem_bits) + rem;
+     }
  
 -      s->ave_sum[ch] = residue + s->ave_sum[ch] - (s->ave_sum[ch] >> s->movave_scaling);
 +        s->ave_sum[ch] = residue + s->ave_sum[ch] - (s->ave_sum[ch] >> s->movave_scaling);
  
 -      if(residue & 1)
 -          residue = -(residue >> 1) - 1;
 -      else
 -          residue = residue >> 1;
 -      s->channel_residues[ch][i] = residue;
 +        if(residue & 1)
 +            residue = -(residue >> 1) - 1;
 +        else
 +            residue = residue >> 1;
 +        s->channel_residues[ch][i] = residue;
      }
      //dump_int_buffer(s->channel_residues[ch], 4, tile_size, 16);