History

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.

Andreas Rheinhardt committed 1 year ago

Commit 09847241 parent 3c06d874 files · +12 −5Browse files

Unified · Split

4 files
  1. libavcodec/h263dec.c +2 −1
  2. libavcodec/mpeg_er.c +0 −3
  3. libavcodec/mpeg_er.h +9 −0
  4. libavcodec/rv10.c +1 −1
libavcodec/h263dec.c+2−1
@@ -551,7 +551,8 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 550 unmodified lines
551 return ret;551 return ret;
552 }552 }
553 553
554 ff_mpeg_er_frame_start(s);554 ff_mpv_er_frame_start_ext(s, s->partitioned_frame,
555 s->pp_time, s->pb_time);
555 556
556 /* the second part of the wmv2 header contains the MB skip bits which557 /* the second part of the wmv2 header contains the MB skip bits which
557 * are stored in current_picture->mb_type which is not available before558 * are stored in current_picture->mb_type which is not available before
libavcodec/mpeg_er.c+0−3
@@ -51,10 +51,7 @@ void ff_mpeg_er_frame_start(MpegEncContext *s) · 50 unmodified lines
51 set_erpic(&er->next_pic, s->next_pic.ptr);51 set_erpic(&er->next_pic, s->next_pic.ptr);
52 set_erpic(&er->last_pic, s->last_pic.ptr);52 set_erpic(&er->last_pic, s->last_pic.ptr);
53 53
54 er->pp_time = s->pp_time;
55 er->pb_time = s->pb_time;
56 er->quarter_sample = s->quarter_sample;54 er->quarter_sample = s->quarter_sample;
57 er->partitioned_frame = s->partitioned_frame;
58 55
59 ff_er_frame_start(er);56 ff_er_frame_start(er);
60}57}
libavcodec/mpeg_er.h+9−0
@@ -24,4 +24,13 @@ · 23 unmodified lines
24int ff_mpeg_er_init(MpegEncContext *s);24int ff_mpeg_er_init(MpegEncContext *s);
25void ff_mpeg_er_frame_start(MpegEncContext *s);25void ff_mpeg_er_frame_start(MpegEncContext *s);
26 26
27static inline void ff_mpv_er_frame_start_ext(MPVContext *const s, int partitioned_frame,
28 uint16_t pp_time, uint16_t pb_time)
29{
30 s->er.partitioned_frame = partitioned_frame;
31 s->er.pp_time = pp_time;
32 s->er.pb_time = pb_time;
33 ff_mpeg_er_frame_start(s);
34}
35
27#endif /* AVCODEC_MPEG_ER_H */36#endif /* AVCODEC_MPEG_ER_H */
libavcodec/rv10.c+1−1
@@ -451,7 +451,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, · 450 unmodified lines
451 }451 }
452 if ((ret = ff_mpv_frame_start(&h->c, avctx)) < 0)452 if ((ret = ff_mpv_frame_start(&h->c, avctx)) < 0)
453 return ret;453 return ret;
454 ff_mpeg_er_frame_start(&h->c);454 ff_mpv_er_frame_start_ext(&h->c, 0, h->c.pp_time, h->c.pb_time);
455 } else {455 } else {
456 if (h->c.cur_pic.ptr->f->pict_type != h->c.pict_type) {456 if (h->c.cur_pic.ptr->f->pict_type != h->c.pict_type) {
457 av_log(h->c.avctx, AV_LOG_ERROR, "Slice type mismatch\n");457 av_log(h->c.avctx, AV_LOG_ERROR, "Slice type mismatch\n");

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t