mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/mpegvideo_dec: Combine two loops
(I think the check for !reference is unnecessary.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
0446282320
commit
02ad827226
|
@ -279,12 +279,12 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
|
||||||
ff_mpeg_unref_picture(s->avctx, s->last_picture_ptr);
|
ff_mpeg_unref_picture(s->avctx, s->last_picture_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* release forgotten pictures */
|
/* release non reference/forgotten frames */
|
||||||
/* if (MPEG-124 / H.263) */
|
|
||||||
for (int i = 0; i < MAX_PICTURE_COUNT; i++) {
|
for (int i = 0; i < MAX_PICTURE_COUNT; i++) {
|
||||||
if (&s->picture[i] != s->last_picture_ptr &&
|
if (!s->picture[i].reference ||
|
||||||
|
(&s->picture[i] != s->last_picture_ptr &&
|
||||||
&s->picture[i] != s->next_picture_ptr &&
|
&s->picture[i] != s->next_picture_ptr &&
|
||||||
s->picture[i].reference && !s->picture[i].needs_realloc) {
|
!s->picture[i].needs_realloc)) {
|
||||||
ff_mpeg_unref_picture(s->avctx, &s->picture[i]);
|
ff_mpeg_unref_picture(s->avctx, &s->picture[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -293,12 +293,6 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
|
||||||
ff_mpeg_unref_picture(s->avctx, &s->last_picture);
|
ff_mpeg_unref_picture(s->avctx, &s->last_picture);
|
||||||
ff_mpeg_unref_picture(s->avctx, &s->next_picture);
|
ff_mpeg_unref_picture(s->avctx, &s->next_picture);
|
||||||
|
|
||||||
/* release non reference frames */
|
|
||||||
for (int i = 0; i < MAX_PICTURE_COUNT; i++) {
|
|
||||||
if (!s->picture[i].reference)
|
|
||||||
ff_mpeg_unref_picture(s->avctx, &s->picture[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s->current_picture_ptr && !s->current_picture_ptr->f->buf[0]) {
|
if (s->current_picture_ptr && !s->current_picture_ptr->f->buf[0]) {
|
||||||
// we already have an unused image
|
// we already have an unused image
|
||||||
// (maybe it was set before reading the header)
|
// (maybe it was set before reading the header)
|
||||||
|
|
Loading…
Reference in New Issue