ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | 
Tue Jan 25 14:44:20 2022 +0100| [4bbfe02ca08984d873cbdf06f9643abca63f1333] | 
committer: Andreas Rheinhardt

avcodec/mpegvideo: Move gop_picture_number to MPEG12EncContext

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4bbfe02ca08984d873cbdf06f9643abca63f1333
---

 libavcodec/mpeg12enc.c | 9 ++++++---
 libavcodec/mpegvideo.h | 1 -
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index bec522d8e7..eaab968425 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -66,6 +66,8 @@ typedef struct MPEG12EncContext {
     MpegEncContext mpeg;
     AVRational frame_rate_ext;
 
+    int gop_picture_number;  ///< index of the first picture of a GOP based on 
fake_pic_num
+
     int64_t timecode_frame_start; ///< GOP timecode frame start number, in non 
drop frame format
     AVTimecode tc;           ///< timecode context
     char *tc_opt_str;        ///< timecode option string
@@ -402,7 +404,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
     time_code = s->current_picture_ptr->f->coded_picture_number +
                 mpeg12->timecode_frame_start;
 
-    s->gop_picture_number = s->current_picture_ptr->f->coded_picture_number;
+    mpeg12->gop_picture_number = 
s->current_picture_ptr->f->coded_picture_number;
 
     av_assert0(mpeg12->drop_frame_timecode == !!(mpeg12->tc.flags & 
AV_TIMECODE_FLAG_DROPFRAME));
     if (mpeg12->drop_frame_timecode)
@@ -413,7 +415,8 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
     put_bits(&s->pb, 1, 1);
     put_bits(&s->pb, 6, (uint32_t)((time_code / fps) % 60));
     put_bits(&s->pb, 6, (uint32_t)((time_code % fps)));
-    put_bits(&s->pb, 1, !!(s->avctx->flags & AV_CODEC_FLAG_CLOSED_GOP) || 
s->intra_only || !s->gop_picture_number);
+    put_bits(&s->pb, 1, !!(s->avctx->flags & AV_CODEC_FLAG_CLOSED_GOP) ||
+                        s->intra_only || !mpeg12->gop_picture_number);
     put_bits(&s->pb, 1, 0);                     // broken link
 }
 
@@ -458,7 +461,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int 
picture_number)
 
     // RAL: s->picture_number instead of s->fake_picture_number
     put_bits(&s->pb, 10,
-             (s->picture_number - s->gop_picture_number) & 0x3ff);
+             (s->picture_number - mpeg12->gop_picture_number) & 0x3ff);
     put_bits(&s->pb, 3, s->pict_type);
 
     s->vbv_delay_ptr = s->pb.buf + put_bytes_count(&s->pb, 0);
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index fd9d60b03e..e5a4cc9b81 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -432,7 +432,6 @@ typedef struct MpegEncContext {
     GetBitContext gb;
 
     /* MPEG-1 specific */
-    int gop_picture_number;  ///< index of the first picture of a GOP based on 
fake_pic_num & MPEG-1 specific
     int last_mv_dir;         ///< last mv_dir, used for B-frame encoding
     uint8_t *vbv_delay_ptr;  ///< pointer to vbv_delay in the bitstream
 

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to