}
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;
}
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);