MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / vcr2_init_sequence

Function vcr2_init_sequence

libavcodec/mpeg12.c:2049–2101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2047}
2048
2049static int vcr2_init_sequence(AVCodecContext *avctx)
2050{
2051 Mpeg1Context *s1 = avctx->priv_data;
2052 MpegEncContext *s = &s1->mpeg_enc_ctx;
2053 int i, v;
2054
2055 /* start new MPEG-1 context decoding */
2056 s->out_format = FMT_MPEG1;
2057 if (s1->mpeg_enc_ctx_allocated) {
2058 MPV_common_end(s);
2059 }
2060 s->width = avctx->coded_width;
2061 s->height = avctx->coded_height;
2062 avctx->has_b_frames= 0; //true?
2063 s->low_delay= 1;
2064
2065 avctx->pix_fmt = mpeg_get_pixelformat(avctx);
2066 avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt);
2067
2068 if( avctx->pix_fmt == PIX_FMT_XVMC_MPEG2_IDCT || avctx->hwaccel ||
2069 s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU )
2070 if( avctx->idct_algo == FF_IDCT_AUTO )
2071 avctx->idct_algo = FF_IDCT_SIMPLE;
2072
2073 if (MPV_common_init(s) < 0)
2074 return -1;
2075 exchange_uv(s);//common init reset pblocks, so we swap them here
2076 s->swap_uv = 1;// in case of xvmc we need to swap uv for each MB
2077 s1->mpeg_enc_ctx_allocated = 1;
2078
2079 for(i=0;i<64;i++) {
2080 int j= s->dsp.idct_permutation[i];
2081 v = ff_mpeg1_default_intra_matrix[i];
2082 s->intra_matrix[j] = v;
2083 s->chroma_intra_matrix[j] = v;
2084
2085 v = ff_mpeg1_default_non_intra_matrix[i];
2086 s->inter_matrix[j] = v;
2087 s->chroma_inter_matrix[j] = v;
2088 }
2089
2090 s->progressive_sequence = 1;
2091 s->progressive_frame = 1;
2092 s->picture_structure = PICT_FRAME;
2093 s->frame_pred_frame_dct = 1;
2094 s->chroma_format = 1;
2095 s->codec_id= s->avctx->codec_id= CODEC_ID_MPEG2VIDEO;
2096 avctx->sub_id = 2; /* indicates MPEG-2 */
2097 s1->save_width = s->width;
2098 s1->save_height = s->height;
2099 s1->save_progressive_seq = s->progressive_sequence;
2100 return 0;
2101}
2102
2103
2104static void mpeg_decode_user_data(AVCodecContext *avctx,

Callers 1

mpeg_decode_frameFunction · 0.85

Calls 5

MPV_common_endFunction · 0.85
mpeg_get_pixelformatFunction · 0.85
ff_find_hwaccelFunction · 0.85
MPV_common_initFunction · 0.85
exchange_uvFunction · 0.85

Tested by

no test coverage detected