History

avcodec/mpegvideo: Move vbv_delay_pos to MPVMainEncContext

Andreas Rheinhardt committed 1 year ago

Commit bceeb351 parent bf4dedd4 files · +6 −4Browse files

Showing the changes to libavcodec (4 of 4 files). Show all

Unified · Split

4 files
  1. libavcodec/mpeg12enc.c +1 −1
  2. libavcodec/mpegvideo.h +0 −1
  3. libavcodec/mpegvideo_enc.c +2 −2
  4. libavcodec/mpegvideoenc.h +3 −0
libavcodec/mpeg12enc.c+1−1
@@ -350,7 +350,7 @@ static int mpeg1_encode_picture_header(MPVMainEncContext *const m) · 349 unmodified lines
350 (s->picture_number - mpeg12->gop_picture_number) & 0x3ff);350 (s->picture_number - mpeg12->gop_picture_number) & 0x3ff);
351 put_bits(&s->pb, 3, s->pict_type);351 put_bits(&s->pb, 3, s->pict_type);
352 352
353 s->vbv_delay_pos = put_bytes_count(&s->pb, 0);353 m->vbv_delay_pos = put_bytes_count(&s->pb, 0);
354 put_bits(&s->pb, 16, 0xFFFF); /* vbv_delay */354 put_bits(&s->pb, 16, 0xFFFF); /* vbv_delay */
355 355
356 // RAL: Forward f_code also needed for B-frames356 // RAL: Forward f_code also needed for B-frames
libavcodec/mpegvideo.h+0−1
@@ -401,7 +401,6 @@ typedef struct MpegEncContext { · 400 unmodified lines
401 401
402 /* MPEG-1 specific */402 /* MPEG-1 specific */
403 int last_mv_dir; ///< last mv_dir, used for B-frame encoding403 int last_mv_dir; ///< last mv_dir, used for B-frame encoding
404 int vbv_delay_pos; ///< offset of vbv_delay in the bitstream
405 404
406 /* MPEG-2-specific - I wished not to have to support this mess. */405 /* MPEG-2-specific - I wished not to have to support this mess. */
407 int progressive_sequence;406 int progressive_sequence;
libavcodec/mpegvideo_enc.c+2−2
@@ -2023,9 +2023,9 @@ vbv_retry: · 2022 unmodified lines
2023 double inbits = avctx->rc_max_rate *2023 double inbits = avctx->rc_max_rate *
2024 av_q2d(avctx->time_base);2024 av_q2d(avctx->time_base);
2025 int minbits = m->frame_bits - 8 *2025 int minbits = m->frame_bits - 8 *
2026 (s->vbv_delay_pos - 1);2026 (m->vbv_delay_pos - 1);
2027 double bits = m->rc_context.buffer_index + minbits - inbits;2027 double bits = m->rc_context.buffer_index + minbits - inbits;
2028 uint8_t *const vbv_delay_ptr = s->pb.buf + s->vbv_delay_pos;2028 uint8_t *const vbv_delay_ptr = s->pb.buf + m->vbv_delay_pos;
2029 2029
2030 if (bits < 0)2030 if (bits < 0)
2031 av_log(avctx, AV_LOG_ERROR,2031 av_log(avctx, AV_LOG_ERROR,
libavcodec/mpegvideoenc.h+3−0
@@ -72,6 +72,9 @@ typedef struct MPVMainEncContext { · 71 unmodified lines
72 int lmin, lmax;72 int lmin, lmax;
73 int vbv_ignore_qmax;73 int vbv_ignore_qmax;
74 74
75 /* MPEG-1/2 specific */
76 int vbv_delay_pos; ///< offset of vbv_delay in the bitstream
77
75 const uint8_t *fcode_tab; ///< smallest fcode needed for each MV78 const uint8_t *fcode_tab; ///< smallest fcode needed for each MV
76 79
77 /* frame skip options */80 /* frame skip options */

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