s->avctx = avctx;
static int vcr2_init_sequence(AVCodecContext *avctx){    Mpeg1Context *s1 = avctx->priv_data;    MpegEncContext *s = &s1->mpeg_enc_ctx;    int i, v;    /* start new mpeg1 context decoding */    s->out_format = FMT_MPEG1;    if (s1->mpeg_enc_ctx_allocated) {        MPV_common_end(s);    }    s->width = avctx->width;    s->height = avctx->height;    avctx->has_b_frames= 0; //true?    s->low_delay= 1;    s->avctx = avctx;    //get_format() or set_video(width,height,aspect,pix_fmt);    //until then pix_fmt may be changed right after codec init    if( avctx->pix_fmt == PIX_FMT_XVMC_MPEG2_IDCT )        if( avctx->idct_algo == FF_IDCT_AUTO )            avctx->idct_algo = FF_IDCT_SIMPLE;        if (MPV_common_init(s) < 0)        return -1;    exchange_uv(s);//common init reset pblocks, so we swap them here    s->swap_uv = 1;// in case of xvmc we need to swap uv for each MB     s1->mpeg_enc_ctx_allocated = 1;    for(i=0;i<64;i++) {        int j= s->dsp.idct_permutation[i];        v = ff_mpeg1_default_intra_matrix[i];        s->intra_matrix[j] = v;        s->chroma_intra_matrix[j] = v;        v = ff_mpeg1_default_non_intra_matrix[i];        s->inter_matrix[j] = v;        s->chroma_inter_matrix[j] = v;    }    s->progressive_sequence = 1;    s->progressive_frame = 1;    s->picture_structure = PICT_FRAME;    s->frame_pred_frame_dct = 1;    s->codec_id= s->avctx->codec_id= CODEC_ID_MPEG2VIDEO;    avctx->sub_id = 2; /* indicates mpeg2 */    return 0;}