Merge commit '037fea388e0df2a22441bc1ed86794152161baf1'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 2 Nov 2013 09:19:12 +0000 (10:19 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 2 Nov 2013 09:19:12 +0000 (10:19 +0100)
* commit '037fea388e0df2a22441bc1ed86794152161baf1':
  flashsv: K&R formatting cosmetics

Conflicts:
libavcodec/flashsv.c

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

@@@ -244,12 -238,10 +242,12 @@@ static int calc_deflate_block_size(int 
  static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
                                  int *got_frame, AVPacket *avpkt)
  {
-     int buf_size       = avpkt->size;
-     FlashSVContext *s  = avctx->priv_data;
+     int buf_size = avpkt->size;
+     FlashSVContext *s = avctx->priv_data;
      int h_blocks, v_blocks, h_part, v_part, i, j, ret;
      GetBitContext gb;
 +    int last_blockwidth = s->block_width;
 +    int last_blockheight= s->block_height;
  
      /* no supplementary picture */
      if (buf_size == 0)
      init_get_bits(&gb, avpkt->data, buf_size * 8);
  
      /* start to parse the bitstream */
-     s->block_width  = 16 * (get_bits(&gb,  4) + 1);
-     s->image_width  =       get_bits(&gb, 12);
-     s->block_height = 16 * (get_bits(&gb,  4) + 1);
-     s->image_height =       get_bits(&gb, 12);
+     s->block_width  = 16 * (get_bits(&gb, 4) + 1);
+     s->image_width  = get_bits(&gb, 12);
+     s->block_height = 16 * (get_bits(&gb, 4) + 1);
+     s->image_height = get_bits(&gb, 12);
  
 +    if (   last_blockwidth != s->block_width
 +        || last_blockheight!= s->block_height)
 +        av_freep(&s->blocks);
 +
      if (s->ver == 2) {
          skip_bits(&gb, 6);
          if (get_bits1(&gb)) {
      if (s->is_keyframe) {
          s->keyframedata = av_realloc(s->keyframedata, avpkt->size);
          memcpy(s->keyframedata, avpkt->data, avpkt->size);
 -        s->blocks = av_realloc(s->blocks,
 -                               (v_blocks + !!v_part) * (h_blocks + !!h_part) *
 -                               sizeof(s->blocks[0]));
      }
-         s->blocks = av_mallocz((v_blocks + !!v_part) * (h_blocks + !!h_part)
-                                 * sizeof(s->blocks[0]));
 +    if(s->ver == 2 && !s->blocks)
++        s->blocks = av_mallocz((v_blocks + !!v_part) * (h_blocks + !!h_part) *
++                               sizeof(s->blocks[0]));
  
      av_dlog(avctx, "image: %dx%d block: %dx%d num: %dx%d part: %dx%d\n",
              s->image_width, s->image_height, s->block_width, s->block_height,