OSDN Git Service

Merge commit '5a5db90edf71ef4c60db8ad7b0ebaa9a810c2d9e'
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>
Tue, 3 May 2016 09:17:34 +0000 (10:17 +0100)
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>
Tue, 3 May 2016 09:17:34 +0000 (10:17 +0100)
* commit '5a5db90edf71ef4c60db8ad7b0ebaa9a810c2d9e':
  svq3: move pict_type to the SVQ3Context

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
1  2 
libavcodec/svq3.c

@@@ -914,8 -909,8 +916,8 @@@ static int svq3_decode_mb(SVQ3Context *
      }
  
      if (!IS_INTRA16x16(mb_type) &&
-         (!IS_SKIP(mb_type) || h->pict_type == AV_PICTURE_TYPE_B)) {
+         (!IS_SKIP(mb_type) || s->pict_type == AV_PICTURE_TYPE_B)) {
 -        if ((vlc = svq3_get_ue_golomb(&h->gb)) >= 48{
 +        if ((vlc = svq3_get_ue_golomb(&h->gb)) >= 48U){
              av_log(h->avctx, AV_LOG_ERROR, "cbp_vlc=%"PRIu32"\n", vlc);
              return -1;
          }
@@@ -1478,10 -1436,9 +1478,10 @@@ static int svq3_decode_frame(AVCodecCon
          h->block_offset[48 + 32 + i] = (4 * ((scan8[i] - scan8[0]) & 7)) + 8 * sl->uvlinesize * ((scan8[i] - scan8[0]) >> 3);
      }
  
-     if (h->pict_type != AV_PICTURE_TYPE_I) {
+     if (s->pict_type != AV_PICTURE_TYPE_I) {
          if (!s->last_pic->f->data[0]) {
              av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n");
 +            av_frame_unref(s->last_pic->f);
              ret = get_buffer(avctx, s->last_pic);
              if (ret < 0)
                  return ret;
                     s->last_pic->f->linesize[2]);
          }
  
-         if (h->pict_type == AV_PICTURE_TYPE_B && !s->next_pic->f->data[0]) {
+         if (s->pict_type == AV_PICTURE_TYPE_B && !s->next_pic->f->data[0]) {
              av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n");
 +            av_frame_unref(s->next_pic->f);
              ret = get_buffer(avctx, s->next_pic);
              if (ret < 0)
                  return ret;
                  return -1;
              }
  
 -            if (mb_type != 0)
 +            if (mb_type != 0 || sl->cbp)
                  hl_decode_mb(s, h, &h->slice_ctx[0]);
  
-             if (h->pict_type != AV_PICTURE_TYPE_B && !h->low_delay)
+             if (s->pict_type != AV_PICTURE_TYPE_B && !h->low_delay)
                  h->cur_pic.mb_type[s->mb_x + s->mb_y * s->mb_stride] =
-                     (h->pict_type == AV_PICTURE_TYPE_P && mb_type < 8) ? (mb_type - 1) : -1;
+                     (s->pict_type == AV_PICTURE_TYPE_P && mb_type < 8) ? (mb_type - 1) : -1;
          }
  
          ff_draw_horiz_band(avctx, s->cur_pic->f,
                             h->low_delay);
      }
  
-     if (h->pict_type == AV_PICTURE_TYPE_B || h->low_delay)
 +    left = buf_size*8 - get_bits_count(&h->gb);
 +
 +    if (sl->mb_y != h->mb_height || sl->mb_x != h->mb_width) {
 +        av_log(avctx, AV_LOG_INFO, "frame num %d incomplete pic x %d y %d left %d\n", avctx->frame_number, sl->mb_y, sl->mb_x, left);
 +        //av_hex_dump(stderr, buf+buf_size-8, 8);
 +    }
 +
 +    if (left < 0) {
 +        av_log(avctx, AV_LOG_ERROR, "frame num %d left %d\n", avctx->frame_number, left);
 +        return -1;
 +    }
 +
+     if (s->pict_type == AV_PICTURE_TYPE_B || h->low_delay)
          ret = av_frame_ref(data, s->cur_pic->f);
      else if (s->last_pic->f->data[0])
          ret = av_frame_ref(data, s->last_pic->f);