avcodec/mpegvideo: Move gop_picture_number to MPEG12EncContext

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-01-25 14:44:20 +01:00
parent b90ea35182
commit 4bbfe02ca0
2 changed files with 6 additions and 4 deletions

View File

@ -66,6 +66,8 @@ typedef struct MPEG12EncContext {
MpegEncContext mpeg; MpegEncContext mpeg;
AVRational frame_rate_ext; 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 int64_t timecode_frame_start; ///< GOP timecode frame start number, in non drop frame format
AVTimecode tc; ///< timecode context AVTimecode tc; ///< timecode context
char *tc_opt_str; ///< timecode option string 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 + time_code = s->current_picture_ptr->f->coded_picture_number +
mpeg12->timecode_frame_start; 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)); av_assert0(mpeg12->drop_frame_timecode == !!(mpeg12->tc.flags & AV_TIMECODE_FLAG_DROPFRAME));
if (mpeg12->drop_frame_timecode) 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, 1, 1);
put_bits(&s->pb, 6, (uint32_t)((time_code / fps) % 60)); 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, 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 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 // RAL: s->picture_number instead of s->fake_picture_number
put_bits(&s->pb, 10, 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); put_bits(&s->pb, 3, s->pict_type);
s->vbv_delay_ptr = s->pb.buf + put_bytes_count(&s->pb, 0); s->vbv_delay_ptr = s->pb.buf + put_bytes_count(&s->pb, 0);

View File

@ -432,7 +432,6 @@ typedef struct MpegEncContext {
GetBitContext gb; GetBitContext gb;
/* MPEG-1 specific */ /* 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 int last_mv_dir; ///< last mv_dir, used for B-frame encoding
uint8_t *vbv_delay_ptr; ///< pointer to vbv_delay in the bitstream uint8_t *vbv_delay_ptr; ///< pointer to vbv_delay in the bitstream