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
350350 (s->picture_number - mpeg12->gop_picture_number) & 0x3ff);
351351 put_bits(&s->pb, 3, s->pict_type);
352352
353− s->vbv_delay_pos = put_bytes_count(&s->pb, 0);
353+ m->vbv_delay_pos = put_bytes_count(&s->pb, 0);
354354 put_bits(&s->pb, 16, 0xFFFF); /* vbv_delay */
355355
356356 // RAL: Forward f_code also needed for B-frames
libavcodec/mpegvideo.h+0−1
@@ -401,7 +401,6 @@ typedef struct MpegEncContext { · 400 unmodified lines
401401
402402 /* MPEG-1 specific */
403403 int last_mv_dir; ///< last mv_dir, used for B-frame encoding
404− int vbv_delay_pos; ///< offset of vbv_delay in the bitstream
405404
406405 /* MPEG-2-specific - I wished not to have to support this mess. */
407406 int progressive_sequence;
libavcodec/mpegvideo_enc.c+2−2
@@ -2023,9 +2023,9 @@ vbv_retry: · 2022 unmodified lines
20232023 double inbits = avctx->rc_max_rate *
20242024 av_q2d(avctx->time_base);
20252025 int minbits = m->frame_bits - 8 *
2026− (s->vbv_delay_pos - 1);
2026+ (m->vbv_delay_pos - 1);
20272027 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;
20292029
20302030 if (bits < 0)
20312031 av_log(avctx, AV_LOG_ERROR,
libavcodec/mpegvideoenc.h+3−0
@@ -72,6 +72,9 @@ typedef struct MPVMainEncContext { · 71 unmodified lines
7272 int lmin, lmax;
7373 int vbv_ignore_qmax;
7474
75+ /* MPEG-1/2 specific */
76+ int vbv_delay_pos; ///< offset of vbv_delay in the bitstream
77+
7578 const uint8_t *fcode_tab; ///< smallest fcode needed for each MV
7679
7780 /* 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