libavcodec/vc1dec.c:5712: error: Uninitialized Value
  The value read from n_slices1 was never initialized.

libavcodec/vc1dec.c:5712:32: 
5710.                 s->end_mb_y = (i == n_slices     ) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height);
5711.             else
5712.                 s->end_mb_y = (i <= n_slices1 + 1) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height);
                                     ^
5713.             vc1_decode_blocks(v);
5714.             if (i != n_slices)

static int vc1_decode_frame(AVCodecContext *avctx, void *data,
                            int *data_size, AVPacket *avpkt)
{
    const uint8_t *buf = avpkt->data;
    int buf_size = avpkt->size, n_slices = 0, i;
    VC1Context *v = avctx->priv_data;
    MpegEncContext *s = &v->s;
    AVFrame *pict = data;
    uint8_t *buf2 = NULL;
    const uint8_t *buf_start = buf;
    int mb_height, n_slices1;
    struct {
        uint8_t *buf;
        GetBitContext gb;
        int mby_start;
    } *slices = NULL, *tmp;
    if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == VC1_CODE_ENDOFSEQ)) {
        if (s->low_delay == 0 && s->next_picture_ptr) {
            *pict = *(AVFrame*)s->next_picture_ptr;
            s->next_picture_ptr = NULL;
            *data_size = sizeof(AVFrame);
        }
        return 0;
    }
    if (s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) {
        if (v->profile < PROFILE_ADVANCED)
            avctx->pix_fmt = PIX_FMT_VDPAU_WMV3;
        else
            avctx->pix_fmt = PIX_FMT_VDPAU_VC1;
    }
    if (avctx->codec_id == CODEC_ID_VC1 || avctx->codec_id == CODEC_ID_VC1IMAGE) {
        int buf_size2 = 0;
        buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
        if (IS_MARKER(AV_RB32(buf))) {
            const uint8_t *start, *end, *next;
            int size;
            next = buf;
            for (start = buf, end = buf + buf_size; next < end; start = next) {
                next = find_next_marker(start + 4, end);
                size = next - start - 4;
                if (size <= 0) continue;
                switch (AV_RB32(start)) {
                case VC1_CODE_FRAME:
                    if (avctx->hwaccel ||
                        s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
                        buf_start = start;
                    buf_size2 = vc1_unescape_buffer(start + 4, size, buf2);
                    break;
                case VC1_CODE_FIELD: {
                    int buf_size3;
                    slices = av_realloc(slices, sizeof(*slices) * (n_slices+1));
                    if (!slices)
                        goto err;
                    slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
                    if (!slices[n_slices].buf)
                        goto err;
                    buf_size3 = vc1_unescape_buffer(start + 4, size,
                                                    slices[n_slices].buf);
                    init_get_bits(&slices[n_slices].gb, slices[n_slices].buf,
                                  buf_size3 << 3);
                    slices[n_slices].mby_start = s->mb_height >> 1;
                    n_slices1 = n_slices - 1;
                    n_slices++;
                    break;
                }
                case VC1_CODE_ENTRYPOINT:
                    buf_size2 = vc1_unescape_buffer(start + 4, size, buf2);
                    init_get_bits(&s->gb, buf2, buf_size2 * 8);
                    vc1_decode_entry_point(avctx, v, &s->gb);
                    break;
                case VC1_CODE_SLICE: {
                    int buf_size3;
                    slices = av_realloc(slices, sizeof(*slices) * (n_slices+1));
                    if (!slices)
                        goto err;
                    slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
                    if (!slices[n_slices].buf)
                        goto err;
                    buf_size3 = vc1_unescape_buffer(start + 4, size,
                                                    slices[n_slices].buf);
                    init_get_bits(&slices[n_slices].gb, slices[n_slices].buf,
                                  buf_size3 << 3);
                    slices[n_slices].mby_start = get_bits(&slices[n_slices].gb, 9);
                    n_slices++;
                    break;
                }
                }
            }
        } else if (v->interlace && ((buf[0] & 0xC0) == 0xC0)) {
            const uint8_t *divider;
            int buf_size3;
            divider = find_next_marker(buf, buf + buf_size);
            if ((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD) {
                av_log(avctx, AV_LOG_ERROR, "Error in WVC1 interlaced frame\n");
                goto err;
            } else {
                tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1));
                if (!tmp)
                    goto err;
                slices = tmp;
                slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
                if (!slices[n_slices].buf)
                    goto err;
                buf_size3 = vc1_unescape_buffer(divider + 4, buf + buf_size - divider - 4, slices[n_slices].buf);
                init_get_bits(&slices[n_slices].gb, slices[n_slices].buf,
                              buf_size3 << 3);
                slices[n_slices].mby_start = s->mb_height >> 1;
                n_slices1 = n_slices - 1;
                n_slices++;
            }
            buf_size2 = vc1_unescape_buffer(buf, divider - buf, buf2);
        } else {
            buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2);
        }
        init_get_bits(&s->gb, buf2, buf_size2*8);
    } else
        init_get_bits(&s->gb, buf, buf_size*8);
    if (v->res_sprite) {
        v->new_sprite  = !get_bits1(&s->gb);
        v->two_sprites =  get_bits1(&s->gb);
        if (avctx->codec_id == CODEC_ID_WMV3IMAGE || avctx->codec_id == CODEC_ID_VC1IMAGE) {
            if (v->new_sprite) {
                avctx->width  = avctx->coded_width  = v->sprite_width;
                avctx->height = avctx->coded_height = v->sprite_height;
            } else {
                goto image;
            }
        }
    }
    if (s->context_initialized &&
        (s->width  != avctx->coded_width ||
         s->height != avctx->coded_height)) {
        vc1_decode_end(avctx);
    }
    if (!s->context_initialized) {
        if (ff_msmpeg4_decode_init(avctx) < 0 || vc1_decode_init_alloc_tables(v) < 0)
            return -1;
        s->low_delay = !avctx->has_b_frames || v->res_sprite;
        if (v->profile == PROFILE_ADVANCED) {
            s->h_edge_pos = avctx->coded_width;
            s->v_edge_pos = avctx->coded_height;
        }
    }
    if (s->current_picture_ptr == NULL || s->current_picture_ptr->f.data[0]) {
        int i = ff_find_unused_picture(s, 0);
        if (i < 0)
            goto err;
        s->current_picture_ptr = &s->picture[i];
    }
    v->pic_header_flag = 0;
    if (v->profile < PROFILE_ADVANCED) {
        if (vc1_parse_frame_header(v, &s->gb) == -1) {
            goto err;
        }
    } else {
        if (vc1_parse_frame_header_adv(v, &s->gb) == -1) {
            goto err;
        }
    }
    if ((avctx->codec_id == CODEC_ID_WMV3IMAGE || avctx->codec_id == CODEC_ID_VC1IMAGE)
        && s->pict_type != AV_PICTURE_TYPE_I) {
        av_log(v->s.avctx, AV_LOG_ERROR, "Sprite decoder: expected I-frame\n");
        goto err;
    }
    s->current_picture_ptr->f.repeat_pict = 0;
    if (v->rff) {
        s->current_picture_ptr->f.repeat_pict = 1;
    } else if (v->rptfrm) {
        s->current_picture_ptr->f.repeat_pict = v->rptfrm * 2;
    }
    s->current_picture.f.pict_type = s->pict_type;
    s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I;
    if (s->last_picture_ptr == NULL && (s->pict_type == AV_PICTURE_TYPE_B || s->dropable)) {
        goto err;
    }
    if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) ||
        (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) ||
         avctx->skip_frame >= AVDISCARD_ALL) {
        goto end;
    }
    if (s->next_p_frame_damaged) {
        if (s->pict_type == AV_PICTURE_TYPE_B)
            goto end;
        else
            s->next_p_frame_damaged = 0;
    }
    if (MPV_frame_start(s, avctx) < 0) {
        goto err;
    }
    s->me.qpel_put = s->dsp.put_qpel_pixels_tab;
    s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab;
    if ((CONFIG_VC1_VDPAU_DECODER)
        &&s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
        ff_vdpau_vc1_decode_picture(s, buf_start, (buf + buf_size) - buf_start);
    else if (avctx->hwaccel) {
        if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0)
            goto err;
        if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0)
            goto err;
        if (avctx->hwaccel->end_frame(avctx) < 0)
            goto err;
    } else {
        ff_er_frame_start(s);
        v->bits = buf_size * 8;
        if (v->field_mode) {
            uint8_t *tmp[2];
            s->current_picture.f.linesize[0] <<= 1;
            s->current_picture.f.linesize[1] <<= 1;
            s->current_picture.f.linesize[2] <<= 1;
            s->linesize                      <<= 1;
            s->uvlinesize                    <<= 1;
            tmp[0]          = v->mv_f_last[0];
            tmp[1]          = v->mv_f_last[1];
            v->mv_f_last[0] = v->mv_f_next[0];
            v->mv_f_last[1] = v->mv_f_next[1];
            v->mv_f_next[0] = v->mv_f[0];
            v->mv_f_next[1] = v->mv_f[1];
            v->mv_f[0] = tmp[0];
            v->mv_f[1] = tmp[1];
        }
        mb_height = s->mb_height >> v->field_mode;
        for (i = 0; i <= n_slices; i++) {
            if (i > 0 &&  slices[i - 1].mby_start >= mb_height) {
                v->second_field = 1;
                v->blocks_off   = s->mb_width  * s->mb_height << 1;
                v->mb_off       = s->mb_stride * s->mb_height >> 1;
            } else {
                v->second_field = 0;
                v->blocks_off   = 0;
                v->mb_off       = 0;
            }
            if (i) {
                v->pic_header_flag = 0;
                if (v->field_mode && i == n_slices1 + 2)
                    vc1_parse_frame_header_adv(v, &s->gb);
                else if (get_bits1(&s->gb)) {
                    v->pic_header_flag = 1;
                    vc1_parse_frame_header_adv(v, &s->gb);
                }
            }
            s->start_mb_y = (i == 0) ? 0 : FFMAX(0, slices[i-1].mby_start % mb_height);
            if (!v->field_mode || v->second_field)
                s->end_mb_y = (i == n_slices     ) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height);
            else
                s->end_mb_y = (i <= n_slices1 + 1) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height);
            vc1_decode_blocks(v);
            if (i != n_slices)
                s->gb = slices[i].gb;
        }
        if (v->field_mode) {
            v->second_field = 0;
            if (s->pict_type == AV_PICTURE_TYPE_B) {
                memcpy(v->mv_f_base, v->mv_f_next_base,
                       2 * (s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2));
            }
            s->current_picture.f.linesize[0] >>= 1;
            s->current_picture.f.linesize[1] >>= 1;
            s->current_picture.f.linesize[2] >>= 1;
            s->linesize                      >>= 1;
            s->uvlinesize                    >>= 1;
        }
        ff_er_frame_end(s);
    }
    MPV_frame_end(s);
    if (avctx->codec_id == CODEC_ID_WMV3IMAGE || avctx->codec_id == CODEC_ID_VC1IMAGE) {
image:
        avctx->width  = avctx->coded_width  = v->output_width;
        avctx->height = avctx->coded_height = v->output_height;
        if (avctx->skip_frame >= AVDISCARD_NONREF)
            goto end;
#if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER
        if (vc1_decode_sprites(v, &s->gb))
            goto err;
#endif
        *pict      = v->sprite_output_frame;
        *data_size = sizeof(AVFrame);
    } else {
        if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
            *pict = *(AVFrame*)s->current_picture_ptr;
        } else if (s->last_picture_ptr != NULL) {
            *pict = *(AVFrame*)s->last_picture_ptr;
        }
        if (s->last_picture_ptr || s->low_delay) {
            *data_size = sizeof(AVFrame);
            ff_print_debug_info(s, pict);
        }
    }
end:
    av_free(buf2);
    for (i = 0; i < n_slices; i++)
        av_free(slices[i].buf);
    av_free(slices);
    return buf_size;
err:
    av_free(buf2);
    for (i = 0; i < n_slices; i++)
        av_free(slices[i].buf);
    av_free(slices);
    return -1;
}
['static int vc1_decode_frame(AVCodecContext *avctx, void *data,\n                            int *data_size, AVPacket *avpkt)\n{\n    const uint8_t *buf = avpkt->data;\n    int buf_size = avpkt->size, n_slices = 0, i;\n    VC1Context *v = avctx->priv_data;\n    MpegEncContext *s = &v->s;\n    AVFrame *pict = data;\n    uint8_t *buf2 = NULL;\n    const uint8_t *buf_start = buf;\n    int mb_height, n_slices1;\n    struct {\n        uint8_t *buf;\n        GetBitContext gb;\n        int mby_start;\n    } *slices = NULL, *tmp;\n    if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == VC1_CODE_ENDOFSEQ)) {\n        if (s->low_delay == 0 && s->next_picture_ptr) {\n            *pict = *(AVFrame*)s->next_picture_ptr;\n            s->next_picture_ptr = NULL;\n            *data_size = sizeof(AVFrame);\n        }\n        return 0;\n    }\n    if (s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) {\n        if (v->profile < PROFILE_ADVANCED)\n            avctx->pix_fmt = PIX_FMT_VDPAU_WMV3;\n        else\n            avctx->pix_fmt = PIX_FMT_VDPAU_VC1;\n    }\n    if (avctx->codec_id == CODEC_ID_VC1 || avctx->codec_id == CODEC_ID_VC1IMAGE) {\n        int buf_size2 = 0;\n        buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);\n        if (IS_MARKER(AV_RB32(buf))) {\n            const uint8_t *start, *end, *next;\n            int size;\n            next = buf;\n            for (start = buf, end = buf + buf_size; next < end; start = next) {\n                next = find_next_marker(start + 4, end);\n                size = next - start - 4;\n                if (size <= 0) continue;\n                switch (AV_RB32(start)) {\n                case VC1_CODE_FRAME:\n                    if (avctx->hwaccel ||\n                        s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)\n                        buf_start = start;\n                    buf_size2 = vc1_unescape_buffer(start + 4, size, buf2);\n                    break;\n                case VC1_CODE_FIELD: {\n                    int buf_size3;\n                    slices = av_realloc(slices, sizeof(*slices) * (n_slices+1));\n                    if (!slices)\n                        goto err;\n                    slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);\n                    if (!slices[n_slices].buf)\n                        goto err;\n                    buf_size3 = vc1_unescape_buffer(start + 4, size,\n                                                    slices[n_slices].buf);\n                    init_get_bits(&slices[n_slices].gb, slices[n_slices].buf,\n                                  buf_size3 << 3);\n                    slices[n_slices].mby_start = s->mb_height >> 1;\n                    n_slices1 = n_slices - 1;\n                    n_slices++;\n                    break;\n                }\n                case VC1_CODE_ENTRYPOINT:\n                    buf_size2 = vc1_unescape_buffer(start + 4, size, buf2);\n                    init_get_bits(&s->gb, buf2, buf_size2 * 8);\n                    vc1_decode_entry_point(avctx, v, &s->gb);\n                    break;\n                case VC1_CODE_SLICE: {\n                    int buf_size3;\n                    slices = av_realloc(slices, sizeof(*slices) * (n_slices+1));\n                    if (!slices)\n                        goto err;\n                    slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);\n                    if (!slices[n_slices].buf)\n                        goto err;\n                    buf_size3 = vc1_unescape_buffer(start + 4, size,\n                                                    slices[n_slices].buf);\n                    init_get_bits(&slices[n_slices].gb, slices[n_slices].buf,\n                                  buf_size3 << 3);\n                    slices[n_slices].mby_start = get_bits(&slices[n_slices].gb, 9);\n                    n_slices++;\n                    break;\n                }\n                }\n            }\n        } else if (v->interlace && ((buf[0] & 0xC0) == 0xC0)) {\n            const uint8_t *divider;\n            int buf_size3;\n            divider = find_next_marker(buf, buf + buf_size);\n            if ((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD) {\n                av_log(avctx, AV_LOG_ERROR, "Error in WVC1 interlaced frame\\n");\n                goto err;\n            } else {\n                tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1));\n                if (!tmp)\n                    goto err;\n                slices = tmp;\n                slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);\n                if (!slices[n_slices].buf)\n                    goto err;\n                buf_size3 = vc1_unescape_buffer(divider + 4, buf + buf_size - divider - 4, slices[n_slices].buf);\n                init_get_bits(&slices[n_slices].gb, slices[n_slices].buf,\n                              buf_size3 << 3);\n                slices[n_slices].mby_start = s->mb_height >> 1;\n                n_slices1 = n_slices - 1;\n                n_slices++;\n            }\n            buf_size2 = vc1_unescape_buffer(buf, divider - buf, buf2);\n        } else {\n            buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2);\n        }\n        init_get_bits(&s->gb, buf2, buf_size2*8);\n    } else\n        init_get_bits(&s->gb, buf, buf_size*8);\n    if (v->res_sprite) {\n        v->new_sprite  = !get_bits1(&s->gb);\n        v->two_sprites =  get_bits1(&s->gb);\n        if (avctx->codec_id == CODEC_ID_WMV3IMAGE || avctx->codec_id == CODEC_ID_VC1IMAGE) {\n            if (v->new_sprite) {\n                avctx->width  = avctx->coded_width  = v->sprite_width;\n                avctx->height = avctx->coded_height = v->sprite_height;\n            } else {\n                goto image;\n            }\n        }\n    }\n    if (s->context_initialized &&\n        (s->width  != avctx->coded_width ||\n         s->height != avctx->coded_height)) {\n        vc1_decode_end(avctx);\n    }\n    if (!s->context_initialized) {\n        if (ff_msmpeg4_decode_init(avctx) < 0 || vc1_decode_init_alloc_tables(v) < 0)\n            return -1;\n        s->low_delay = !avctx->has_b_frames || v->res_sprite;\n        if (v->profile == PROFILE_ADVANCED) {\n            s->h_edge_pos = avctx->coded_width;\n            s->v_edge_pos = avctx->coded_height;\n        }\n    }\n    if (s->current_picture_ptr == NULL || s->current_picture_ptr->f.data[0]) {\n        int i = ff_find_unused_picture(s, 0);\n        if (i < 0)\n            goto err;\n        s->current_picture_ptr = &s->picture[i];\n    }\n    v->pic_header_flag = 0;\n    if (v->profile < PROFILE_ADVANCED) {\n        if (vc1_parse_frame_header(v, &s->gb) == -1) {\n            goto err;\n        }\n    } else {\n        if (vc1_parse_frame_header_adv(v, &s->gb) == -1) {\n            goto err;\n        }\n    }\n    if ((avctx->codec_id == CODEC_ID_WMV3IMAGE || avctx->codec_id == CODEC_ID_VC1IMAGE)\n        && s->pict_type != AV_PICTURE_TYPE_I) {\n        av_log(v->s.avctx, AV_LOG_ERROR, "Sprite decoder: expected I-frame\\n");\n        goto err;\n    }\n    s->current_picture_ptr->f.repeat_pict = 0;\n    if (v->rff) {\n        s->current_picture_ptr->f.repeat_pict = 1;\n    } else if (v->rptfrm) {\n        s->current_picture_ptr->f.repeat_pict = v->rptfrm * 2;\n    }\n    s->current_picture.f.pict_type = s->pict_type;\n    s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I;\n    if (s->last_picture_ptr == NULL && (s->pict_type == AV_PICTURE_TYPE_B || s->dropable)) {\n        goto err;\n    }\n    if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) ||\n        (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) ||\n         avctx->skip_frame >= AVDISCARD_ALL) {\n        goto end;\n    }\n    if (s->next_p_frame_damaged) {\n        if (s->pict_type == AV_PICTURE_TYPE_B)\n            goto end;\n        else\n            s->next_p_frame_damaged = 0;\n    }\n    if (MPV_frame_start(s, avctx) < 0) {\n        goto err;\n    }\n    s->me.qpel_put = s->dsp.put_qpel_pixels_tab;\n    s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab;\n    if ((CONFIG_VC1_VDPAU_DECODER)\n        &&s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)\n        ff_vdpau_vc1_decode_picture(s, buf_start, (buf + buf_size) - buf_start);\n    else if (avctx->hwaccel) {\n        if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0)\n            goto err;\n        if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0)\n            goto err;\n        if (avctx->hwaccel->end_frame(avctx) < 0)\n            goto err;\n    } else {\n        ff_er_frame_start(s);\n        v->bits = buf_size * 8;\n        if (v->field_mode) {\n            uint8_t *tmp[2];\n            s->current_picture.f.linesize[0] <<= 1;\n            s->current_picture.f.linesize[1] <<= 1;\n            s->current_picture.f.linesize[2] <<= 1;\n            s->linesize                      <<= 1;\n            s->uvlinesize                    <<= 1;\n            tmp[0]          = v->mv_f_last[0];\n            tmp[1]          = v->mv_f_last[1];\n            v->mv_f_last[0] = v->mv_f_next[0];\n            v->mv_f_last[1] = v->mv_f_next[1];\n            v->mv_f_next[0] = v->mv_f[0];\n            v->mv_f_next[1] = v->mv_f[1];\n            v->mv_f[0] = tmp[0];\n            v->mv_f[1] = tmp[1];\n        }\n        mb_height = s->mb_height >> v->field_mode;\n        for (i = 0; i <= n_slices; i++) {\n            if (i > 0 &&  slices[i - 1].mby_start >= mb_height) {\n                v->second_field = 1;\n                v->blocks_off   = s->mb_width  * s->mb_height << 1;\n                v->mb_off       = s->mb_stride * s->mb_height >> 1;\n            } else {\n                v->second_field = 0;\n                v->blocks_off   = 0;\n                v->mb_off       = 0;\n            }\n            if (i) {\n                v->pic_header_flag = 0;\n                if (v->field_mode && i == n_slices1 + 2)\n                    vc1_parse_frame_header_adv(v, &s->gb);\n                else if (get_bits1(&s->gb)) {\n                    v->pic_header_flag = 1;\n                    vc1_parse_frame_header_adv(v, &s->gb);\n                }\n            }\n            s->start_mb_y = (i == 0) ? 0 : FFMAX(0, slices[i-1].mby_start % mb_height);\n            if (!v->field_mode || v->second_field)\n                s->end_mb_y = (i == n_slices     ) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height);\n            else\n                s->end_mb_y = (i <= n_slices1 + 1) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height);\n            vc1_decode_blocks(v);\n            if (i != n_slices)\n                s->gb = slices[i].gb;\n        }\n        if (v->field_mode) {\n            v->second_field = 0;\n            if (s->pict_type == AV_PICTURE_TYPE_B) {\n                memcpy(v->mv_f_base, v->mv_f_next_base,\n                       2 * (s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2));\n            }\n            s->current_picture.f.linesize[0] >>= 1;\n            s->current_picture.f.linesize[1] >>= 1;\n            s->current_picture.f.linesize[2] >>= 1;\n            s->linesize                      >>= 1;\n            s->uvlinesize                    >>= 1;\n        }\n        ff_er_frame_end(s);\n    }\n    MPV_frame_end(s);\n    if (avctx->codec_id == CODEC_ID_WMV3IMAGE || avctx->codec_id == CODEC_ID_VC1IMAGE) {\nimage:\n        avctx->width  = avctx->coded_width  = v->output_width;\n        avctx->height = avctx->coded_height = v->output_height;\n        if (avctx->skip_frame >= AVDISCARD_NONREF)\n            goto end;\n#if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER\n        if (vc1_decode_sprites(v, &s->gb))\n            goto err;\n#endif\n        *pict      = v->sprite_output_frame;\n        *data_size = sizeof(AVFrame);\n    } else {\n        if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {\n            *pict = *(AVFrame*)s->current_picture_ptr;\n        } else if (s->last_picture_ptr != NULL) {\n            *pict = *(AVFrame*)s->last_picture_ptr;\n        }\n        if (s->last_picture_ptr || s->low_delay) {\n            *data_size = sizeof(AVFrame);\n            ff_print_debug_info(s, pict);\n        }\n    }\nend:\n    av_free(buf2);\n    for (i = 0; i < n_slices; i++)\n        av_free(slices[i].buf);\n    av_free(slices);\n    return buf_size;\nerr:\n    av_free(buf2);\n    for (i = 0; i < n_slices; i++)\n        av_free(slices[i].buf);\n    av_free(slices);\n    return -1;\n}']