1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

vc1: use the AVFrame API properly.

This commit is contained in:
Anton Khirnov 2013-11-09 10:14:46 +01:00
parent 042aec41ae
commit 6792559f8a
2 changed files with 11 additions and 7 deletions

View File

@ -380,7 +380,7 @@ typedef struct VC1Context{
//@{
int new_sprite;
int two_sprites;
AVFrame sprite_output_frame;
AVFrame *sprite_output_frame;
int output_width, output_height, sprite_width, sprite_height;
uint8_t* sr_rows[2][2]; ///< Sprite resizer line cache
//@}

View File

@ -5364,8 +5364,8 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd)
int width = v->output_width>>!!plane;
for (row = 0; row < v->output_height>>!!plane; row++) {
uint8_t *dst = v->sprite_output_frame.data[plane] +
v->sprite_output_frame.linesize[plane] * row;
uint8_t *dst = v->sprite_output_frame->data[plane] +
v->sprite_output_frame->linesize[plane] * row;
for (sprite = 0; sprite <= v->two_sprites; sprite++) {
uint8_t *iplane = s->current_picture.f.data[plane];
@ -5455,8 +5455,8 @@ static int vc1_decode_sprites(VC1Context *v, GetBitContext* gb)
v->two_sprites = 0;
}
av_frame_unref(&v->sprite_output_frame);
if (ff_get_buffer(avctx, &v->sprite_output_frame, 0) < 0) {
av_frame_unref(v->sprite_output_frame);
if (ff_get_buffer(avctx, v->sprite_output_frame, 0) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@ -5673,6 +5673,10 @@ 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;
@ -5714,7 +5718,7 @@ av_cold int ff_vc1_decode_end(AVCodecContext *avctx)
VC1Context *v = avctx->priv_data;
int i;
av_frame_unref(&v->sprite_output_frame);
av_frame_free(&v->sprite_output_frame);
for (i = 0; i < 4; i++)
av_freep(&v->sr_rows[i >> 1][i & 1]);
@ -6085,7 +6089,7 @@ image:
if (vc1_decode_sprites(v, &s->gb))
goto err;
#endif
if ((ret = av_frame_ref(pict, &v->sprite_output_frame)) < 0)
if ((ret = av_frame_ref(pict, v->sprite_output_frame)) < 0)
goto err;
*got_frame = 1;
} else {