|
|
@@ -428,30 +428,10 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) |
|
|
|
|
|
|
|
if (!avctx->extradata_size || !avctx->extradata) |
|
|
|
return -1; |
|
|
|
if (!CONFIG_GRAY || !(avctx->flags & AV_CODEC_FLAG_GRAY)) |
|
|
|
avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts); |
|
|
|
else { |
|
|
|
avctx->pix_fmt = AV_PIX_FMT_GRAY8; |
|
|
|
if (avctx->color_range == AVCOL_RANGE_UNSPECIFIED) |
|
|
|
avctx->color_range = AVCOL_RANGE_MPEG; |
|
|
|
} |
|
|
|
v->s.avctx = avctx; |
|
|
|
|
|
|
|
if ((ret = ff_vc1_init_common(v)) < 0) |
|
|
|
return ret; |
|
|
|
// ensure static VLC tables are initialized |
|
|
|
if ((ret = ff_msmpeg4_decode_init(avctx)) < 0) |
|
|
|
return ret; |
|
|
|
if ((ret = ff_vc1_decode_init_alloc_tables(v)) < 0) |
|
|
|
return ret; |
|
|
|
// Hack to ensure the above functions will be called |
|
|
|
// again once we know all necessary settings. |
|
|
|
// That this is necessary might indicate a bug. |
|
|
|
ff_vc1_decode_end(avctx); |
|
|
|
|
|
|
|
ff_blockdsp_init(&s->bdsp, avctx); |
|
|
|
ff_h264chroma_init(&v->h264chroma, 8); |
|
|
|
ff_qpeldsp_init(&s->qdsp); |
|
|
|
|
|
|
|
if (avctx->codec_id == AV_CODEC_ID_WMV3 || avctx->codec_id == AV_CODEC_ID_WMV3IMAGE) { |
|
|
|
int count = 0; |
|
|
@@ -524,14 +504,38 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) |
|
|
|
v->res_sprite = (avctx->codec_id == AV_CODEC_ID_VC1IMAGE); |
|
|
|
} |
|
|
|
|
|
|
|
v->sprite_output_frame = av_frame_alloc(); |
|
|
|
if (!v->sprite_output_frame) |
|
|
|
return AVERROR(ENOMEM); |
|
|
|
|
|
|
|
avctx->profile = v->profile; |
|
|
|
if (v->profile == PROFILE_ADVANCED) |
|
|
|
avctx->level = v->level; |
|
|
|
|
|
|
|
if (!CONFIG_GRAY || !(avctx->flags & AV_CODEC_FLAG_GRAY)) |
|
|
|
avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts); |
|
|
|
else { |
|
|
|
avctx->pix_fmt = AV_PIX_FMT_GRAY8; |
|
|
|
if (avctx->color_range == AVCOL_RANGE_UNSPECIFIED) |
|
|
|
avctx->color_range = AVCOL_RANGE_MPEG; |
|
|
|
} |
|
|
|
|
|
|
|
// ensure static VLC tables are initialized |
|
|
|
if ((ret = ff_msmpeg4_decode_init(avctx)) < 0) |
|
|
|
return ret; |
|
|
|
if ((ret = ff_vc1_decode_init_alloc_tables(v)) < 0) |
|
|
|
return ret; |
|
|
|
// Hack to ensure the above functions will be called |
|
|
|
// again once we know all necessary settings. |
|
|
|
// That this is necessary might indicate a bug. |
|
|
|
ff_vc1_decode_end(avctx); |
|
|
|
|
|
|
|
ff_blockdsp_init(&s->bdsp, avctx); |
|
|
|
ff_h264chroma_init(&v->h264chroma, 8); |
|
|
|
ff_qpeldsp_init(&s->qdsp); |
|
|
|
|
|
|
|
// Must happen after calling ff_vc1_decode_end |
|
|
|
// to avoid de-allocating the sprite_output_frame |
|
|
|
v->sprite_output_frame = av_frame_alloc(); |
|
|
|
if (!v->sprite_output_frame) |
|
|
|
return AVERROR(ENOMEM); |
|
|
|
|
|
|
|
avctx->has_b_frames = !!avctx->max_b_frames; |
|
|
|
|
|
|
|
if (v->color_prim == 1 || v->color_prim == 5 || v->color_prim == 6) |
|
|
|