mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-27 17:53:13 +00:00
avcodec/mpegvideo_enc: Pass AVFrame*, not Picture* to alloc_picture()
It now only deals with the AVFrame and no longer with the accessories. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
89ca63cc9c
commit
8225d2da73
@ -1091,30 +1091,30 @@ static int get_intra_count(MpegEncContext *s, const uint8_t *src,
|
|||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int alloc_picture(MpegEncContext *s, Picture *pic)
|
static int alloc_picture(MpegEncContext *s, AVFrame *f)
|
||||||
{
|
{
|
||||||
AVCodecContext *avctx = s->avctx;
|
AVCodecContext *avctx = s->avctx;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
pic->f->width = avctx->width + 2 * EDGE_WIDTH;
|
f->width = avctx->width + 2 * EDGE_WIDTH;
|
||||||
pic->f->height = avctx->height + 2 * EDGE_WIDTH;
|
f->height = avctx->height + 2 * EDGE_WIDTH;
|
||||||
|
|
||||||
ret = ff_encode_alloc_frame(avctx, pic->f);
|
ret = ff_encode_alloc_frame(avctx, f);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = ff_mpv_pic_check_linesize(avctx, pic->f, &s->linesize, &s->uvlinesize);
|
ret = ff_mpv_pic_check_linesize(avctx, f, &s->linesize, &s->uvlinesize);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
for (int i = 0; pic->f->data[i]; i++) {
|
for (int i = 0; f->data[i]; i++) {
|
||||||
int offset = (EDGE_WIDTH >> (i ? s->chroma_y_shift : 0)) *
|
int offset = (EDGE_WIDTH >> (i ? s->chroma_y_shift : 0)) *
|
||||||
pic->f->linesize[i] +
|
f->linesize[i] +
|
||||||
(EDGE_WIDTH >> (i ? s->chroma_x_shift : 0));
|
(EDGE_WIDTH >> (i ? s->chroma_x_shift : 0));
|
||||||
pic->f->data[i] += offset;
|
f->data[i] += offset;
|
||||||
}
|
}
|
||||||
pic->f->width = avctx->width;
|
f->width = avctx->width;
|
||||||
pic->f->height = avctx->height;
|
f->height = avctx->height;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1186,7 +1186,7 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
|
|||||||
return ret;
|
return ret;
|
||||||
pic->shared = 1;
|
pic->shared = 1;
|
||||||
} else {
|
} else {
|
||||||
ret = alloc_picture(s, pic);
|
ret = alloc_picture(s, pic->f);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
ret = av_frame_copy_props(pic->f, pic_arg);
|
ret = av_frame_copy_props(pic->f, pic_arg);
|
||||||
@ -1607,7 +1607,7 @@ no_output_pic:
|
|||||||
// input is a shared pix, so we can't modify it -> allocate a new
|
// input is a shared pix, so we can't modify it -> allocate a new
|
||||||
// one & ensure that the shared one is reuseable
|
// one & ensure that the shared one is reuseable
|
||||||
av_frame_move_ref(s->new_pic, s->reordered_input_picture[0]->f);
|
av_frame_move_ref(s->new_pic, s->reordered_input_picture[0]->f);
|
||||||
ret = alloc_picture(s, s->reordered_input_picture[0]);
|
ret = alloc_picture(s, s->reordered_input_picture[0]->f);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user