You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/mpeg_er: Allow to skip setting partitioned_frame, p[pb]_time
Instead of setting these unconditionally (they are always zero for H.261, MPEG-1/2, RV30/40, VC-1), add a variant of ff_mpeg_er_frame_start() that sets them and remove setting them from ff_mpeg_er_frame_start(). Also pass these values via parameters instead of reading them from the MPVContext itself. This will allow to move them from MPVContext. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -551,7 +551,8 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ff_mpeg_er_frame_start(s);
|
ff_mpv_er_frame_start_ext(s, s->partitioned_frame,
|
||||||
|
s->pp_time, s->pb_time);
|
||||||
|
|
||||||
/* the second part of the wmv2 header contains the MB skip bits which
|
/* the second part of the wmv2 header contains the MB skip bits which
|
||||||
* are stored in current_picture->mb_type which is not available before
|
* are stored in current_picture->mb_type which is not available before
|
||||||
|
@ -51,10 +51,7 @@ void ff_mpeg_er_frame_start(MpegEncContext *s)
|
|||||||
set_erpic(&er->next_pic, s->next_pic.ptr);
|
set_erpic(&er->next_pic, s->next_pic.ptr);
|
||||||
set_erpic(&er->last_pic, s->last_pic.ptr);
|
set_erpic(&er->last_pic, s->last_pic.ptr);
|
||||||
|
|
||||||
er->pp_time = s->pp_time;
|
|
||||||
er->pb_time = s->pb_time;
|
|
||||||
er->quarter_sample = s->quarter_sample;
|
er->quarter_sample = s->quarter_sample;
|
||||||
er->partitioned_frame = s->partitioned_frame;
|
|
||||||
|
|
||||||
ff_er_frame_start(er);
|
ff_er_frame_start(er);
|
||||||
}
|
}
|
||||||
|
@ -24,4 +24,13 @@
|
|||||||
int ff_mpeg_er_init(MpegEncContext *s);
|
int ff_mpeg_er_init(MpegEncContext *s);
|
||||||
void ff_mpeg_er_frame_start(MpegEncContext *s);
|
void ff_mpeg_er_frame_start(MpegEncContext *s);
|
||||||
|
|
||||||
|
static inline void ff_mpv_er_frame_start_ext(MPVContext *const s, int partitioned_frame,
|
||||||
|
uint16_t pp_time, uint16_t pb_time)
|
||||||
|
{
|
||||||
|
s->er.partitioned_frame = partitioned_frame;
|
||||||
|
s->er.pp_time = pp_time;
|
||||||
|
s->er.pb_time = pb_time;
|
||||||
|
ff_mpeg_er_frame_start(s);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* AVCODEC_MPEG_ER_H */
|
#endif /* AVCODEC_MPEG_ER_H */
|
||||||
|
@ -451,7 +451,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf,
|
|||||||
}
|
}
|
||||||
if ((ret = ff_mpv_frame_start(&h->c, avctx)) < 0)
|
if ((ret = ff_mpv_frame_start(&h->c, avctx)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
ff_mpeg_er_frame_start(&h->c);
|
ff_mpv_er_frame_start_ext(&h->c, 0, h->c.pp_time, h->c.pb_time);
|
||||||
} else {
|
} else {
|
||||||
if (h->c.cur_pic.ptr->f->pict_type != h->c.pict_type) {
|
if (h->c.cur_pic.ptr->f->pict_type != h->c.pict_type) {
|
||||||
av_log(h->c.avctx, AV_LOG_ERROR, "Slice type mismatch\n");
|
av_log(h->c.avctx, AV_LOG_ERROR, "Slice type mismatch\n");
|
||||||
|
Reference in New Issue
Block a user