* [FFmpeg-devel] [BUMP PATCH 1/2] avcodec: change AVCodecContext.frame_number to int64_t
@ 2023-01-26 22:46 Marton Balint
2023-01-26 22:46 ` [FFmpeg-devel] [BUMP PATCH 2/2] avutil/frame: change AVFrame.*_picture_number " Marton Balint
2023-01-27 10:07 ` [FFmpeg-devel] [BUMP PATCH 1/2] avcodec: change AVCodecContext.frame_number " Anton Khirnov
0 siblings, 2 replies; 8+ messages in thread
From: Marton Balint @ 2023-01-26 22:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
Frame counters can overflow relatively easily (INT_MAX number of frames is
slightly more than 1 year for 60 fps content), so make sure we use 64 bit
values for them.
Most of the changes are printf() format string updates, which is kind of the
necessary evil of this change, because API users need to do this as well. The
alternative would be to introduce separate 64-bit counters for the int64 type,
and keep the two values in sync, but that would be also quite ugly.
So let's do what we already did for AVFormatContext.bit_rate some years ago and
simply change the type.
Signed-off-by: Marton Balint <cus@passwd.hu>
---
doc/APIchanges | 4 ++++
doc/examples/decode_video.c | 4 ++--
libavcodec/4xm.c | 2 +-
libavcodec/atrac3plus.c | 2 +-
libavcodec/avcodec.h | 2 +-
libavcodec/decode.c | 2 +-
libavcodec/evrcdec.c | 2 +-
libavcodec/flashsv2enc.c | 6 +++---
libavcodec/flashsvenc.c | 4 ++--
libavcodec/g2meet.c | 2 +-
libavcodec/h261dec.c | 2 +-
libavcodec/interplayvideo.c | 2 +-
libavcodec/mpegutils.c | 2 +-
libavcodec/options_table.h | 2 +-
libavcodec/qcelpdec.c | 2 +-
libavcodec/rv10.c | 2 +-
libavcodec/svq3.c | 4 ++--
libavcodec/vp3.c | 2 +-
libavcodec/wmaprodec.c | 6 +++---
tools/scale_slice_test.c | 2 +-
tools/venc_data_dump.c | 2 +-
21 files changed, 31 insertions(+), 27 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index a11acadecd..cdd407799a 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,10 @@ libavutil: 2021-04-27
API changes, most recent first:
+2023-xx-xx - xxxxxxxxxx - lavc 60.0.100 - avcodec.h
+ AVCodecContext.frame_number was changed to 64bit, make sure you update any
+ printf() or other type sensitive code
+
2023-01-13 - xxxxxxxxxx - lavu 57.44.100 - ambient_viewing_environment.h frame.h
Adds a new structure for holding H.274 Ambient Viewing Environment metadata,
AVAmbientViewingEnvironment.
diff --git a/doc/examples/decode_video.c b/doc/examples/decode_video.c
index 7238e38103..37199352dd 100644
--- a/doc/examples/decode_video.c
+++ b/doc/examples/decode_video.c
@@ -69,12 +69,12 @@ static void decode(AVCodecContext *dec_ctx, AVFrame *frame, AVPacket *pkt,
exit(1);
}
- printf("saving frame %3d\n", dec_ctx->frame_number);
+ printf("saving frame %3"PRId64"\n", dec_ctx->frame_number);
fflush(stdout);
/* the picture is allocated by the decoder. no need to
free it */
- snprintf(buf, sizeof(buf), "%s-%d", filename, dec_ctx->frame_number);
+ snprintf(buf, sizeof(buf), "%s-%"PRId64, filename, dec_ctx->frame_number);
pgm_save(frame->data[0], frame->linesize[0],
frame->width, frame->height, buf);
}
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index 5636fdef2d..3027ce9e20 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -911,7 +911,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
frame_size = cfrm->size;
if (id != avctx->frame_number)
- av_log(f->avctx, AV_LOG_ERROR, "cframe id mismatch %d %d\n",
+ av_log(f->avctx, AV_LOG_ERROR, "cframe id mismatch %d %"PRId64"\n",
id, avctx->frame_number);
if (f->version <= 1)
diff --git a/libavcodec/atrac3plus.c b/libavcodec/atrac3plus.c
index a0836f1178..0fcf3a386e 100644
--- a/libavcodec/atrac3plus.c
+++ b/libavcodec/atrac3plus.c
@@ -1391,7 +1391,7 @@ static int decode_band_numwavs(GetBitContext *gb, Atrac3pChanUnitCtx *ctx,
if (band_has_tones[sb]) {
if (ctx->waves_info->tones_index + dst[sb].num_wavs > 48) {
av_log(avctx, AV_LOG_ERROR,
- "Too many tones: %d (max. 48), frame: %d!\n",
+ "Too many tones: %d (max. 48), frame: %"PRId64"!\n",
ctx->waves_info->tones_index + dst[sb].num_wavs,
avctx->frame_number);
return AVERROR_INVALIDDATA;
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 0ac581d660..6236c7936a 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1043,7 +1043,7 @@ typedef struct AVCodecContext {
* @note the counter is not incremented if encoding/decoding resulted in
* an error.
*/
- int frame_number;
+ int64_t frame_number;
/**
* number of bytes per packet if constant and known or 0
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 0abc88737b..7af8770a32 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -758,7 +758,7 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame)
if (changed) {
avci->changed_frames_dropped++;
- av_log(avctx, AV_LOG_INFO, "dropped changed frame #%d pts %"PRId64
+ av_log(avctx, AV_LOG_INFO, "dropped changed frame #%"PRId64" pts %"PRId64
" drop count: %d \n",
avctx->frame_number, frame->pts,
avci->changed_frames_dropped);
diff --git a/libavcodec/evrcdec.c b/libavcodec/evrcdec.c
index c4b0ad2957..393cfe59a6 100644
--- a/libavcodec/evrcdec.c
+++ b/libavcodec/evrcdec.c
@@ -221,7 +221,7 @@ static evrc_packet_rate determine_bitrate(AVCodecContext *avctx,
static void warn_insufficient_frame_quality(AVCodecContext *avctx,
const char *message)
{
- av_log(avctx, AV_LOG_WARNING, "Frame #%d, %s\n",
+ av_log(avctx, AV_LOG_WARNING, "Frame #%"PRId64", %s\n",
avctx->frame_number, message);
}
diff --git a/libavcodec/flashsv2enc.c b/libavcodec/flashsv2enc.c
index 668ca6a85f..0aa24efd68 100644
--- a/libavcodec/flashsv2enc.c
+++ b/libavcodec/flashsv2enc.c
@@ -105,7 +105,7 @@ typedef struct FlashSV2Context {
int rows, cols;
- int last_key_frame;
+ int64_t last_key_frame;
int image_width, image_height;
int block_width, block_height;
@@ -874,7 +874,7 @@ static int flashsv2_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
&& avctx->frame_number > s->last_key_frame + avctx->keyint_min) {
recommend_keyframe(s, &keyframe);
if (keyframe)
- av_log(avctx, AV_LOG_DEBUG, "Recommending key frame at frame %d\n", avctx->frame_number);
+ av_log(avctx, AV_LOG_DEBUG, "Recommending key frame at frame %"PRId64"\n", avctx->frame_number);
}
if (keyframe) {
@@ -892,7 +892,7 @@ static int flashsv2_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
new_key_frame(s);
s->last_key_frame = avctx->frame_number;
pkt->flags |= AV_PKT_FLAG_KEY;
- av_log(avctx, AV_LOG_DEBUG, "Inserting key frame at frame %d\n", avctx->frame_number);
+ av_log(avctx, AV_LOG_DEBUG, "Inserting key frame at frame %"PRId64"\n", avctx->frame_number);
}
pkt->size = res;
diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c
index 3a35876d9c..b7cad8c970 100644
--- a/libavcodec/flashsvenc.c
+++ b/libavcodec/flashsvenc.c
@@ -65,7 +65,7 @@ typedef struct FlashSVContext {
AVBufferRef *prev_frame_buf;
int image_width, image_height;
unsigned packet_size;
- int last_key_frame;
+ int64_t last_key_frame;
uint8_t tmpblock[3 * 256 * 256];
} FlashSVContext;
@@ -230,7 +230,7 @@ static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
//mark the frame type so the muxer can mux it correctly
if (I_frame) {
s->last_key_frame = avctx->frame_number;
- ff_dlog(avctx, "Inserting keyframe at frame %d\n", avctx->frame_number);
+ ff_dlog(avctx, "Inserting keyframe at frame %"PRId64"\n", avctx->frame_number);
}
if (I_frame)
diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c
index 761fd22fc3..5b4c0a1f81 100644
--- a/libavcodec/g2meet.c
+++ b/libavcodec/g2meet.c
@@ -931,7 +931,7 @@ static int epic_jb_decode_tile(G2MContext *c, int tile_x, int tile_y,
if (ret) {
av_log(avctx, AV_LOG_ERROR,
- "ePIC: tile decoding failed, frame=%d, tile_x=%d, tile_y=%d\n",
+ "ePIC: tile decoding failed, frame=%"PRId64", tile_x=%d, tile_y=%d\n",
avctx->frame_number, tile_x, tile_y);
return AVERROR_INVALIDDATA;
}
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 57f7e8bf35..a35bf7426e 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -610,7 +610,7 @@ static int h261_decode_frame(AVCodecContext *avctx, AVFrame *pict,
MpegEncContext *s = &h->s;
int ret;
- ff_dlog(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size);
+ ff_dlog(avctx, "*****frame %"PRId64" size=%d\n", avctx->frame_number, buf_size);
ff_dlog(avctx, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]);
h->gob_start_code_skipped = 0;
diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c
index 655326a7f1..136b0635db 100644
--- a/libavcodec/interplayvideo.c
+++ b/libavcodec/interplayvideo.c
@@ -1144,7 +1144,7 @@ static void ipvideo_decode_format_11_opcodes(IpvideoContext *s, AVFrame *frame)
ret = ipvideo_decode_block16[opcode](s, frame);
}
if (ret != 0) {
- av_log(s->avctx, AV_LOG_ERROR, "decode problem on frame %d, @ block (%d, %d)\n",
+ av_log(s->avctx, AV_LOG_ERROR, "decode problem on frame %"PRId64", @ block (%d, %d)\n",
s->avctx->frame_number, x, y);
return;
}
diff --git a/libavcodec/mpegutils.c b/libavcodec/mpegutils.c
index 36d75b9633..814bd7817e 100644
--- a/libavcodec/mpegutils.c
+++ b/libavcodec/mpegutils.c
@@ -230,7 +230,7 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict,
if (mbcount) {
AVFrameSideData *sd;
- av_log(avctx, AV_LOG_DEBUG, "Adding %d MVs info to frame %d\n", mbcount, avctx->frame_number);
+ av_log(avctx, AV_LOG_DEBUG, "Adding %d MVs info to frame %"PRId64"\n", mbcount, avctx->frame_number);
sd = av_frame_new_side_data(pict, AV_FRAME_DATA_MOTION_VECTORS, mbcount * sizeof(AVMotionVector));
if (!sd) {
av_freep(&mvs);
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 7924ca6144..d2aebbe9e4 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -98,7 +98,7 @@ static const AVOption avcodec_options[] = {
#endif
{"cutoff", "set cutoff bandwidth", OFFSET(cutoff), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|E},
{"frame_size", NULL, OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|E},
-{"frame_number", NULL, OFFSET(frame_number), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"frame_number", NULL, OFFSET(frame_number), AV_OPT_TYPE_INT64, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
{"delay", NULL, OFFSET(delay), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
{"qcomp", "video quantizer scale compression (VBR). Constant of ratecontrol equation. "
"Recommended range for default rc_eq: 0.0-1.0",
diff --git a/libavcodec/qcelpdec.c b/libavcodec/qcelpdec.c
index 277c55100a..6c79c2d804 100644
--- a/libavcodec/qcelpdec.c
+++ b/libavcodec/qcelpdec.c
@@ -646,7 +646,7 @@ static qcelp_packet_rate determine_bitrate(AVCodecContext *avctx,
static void warn_insufficient_frame_quality(AVCodecContext *avctx,
const char *message)
{
- av_log(avctx, AV_LOG_WARNING, "Frame #%d, IFQ: %s\n",
+ av_log(avctx, AV_LOG_WARNING, "Frame #%"PRId64", IFQ: %s\n",
avctx->frame_number, message);
}
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index a45683228e..1980522c07 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -603,7 +603,7 @@ static int rv10_decode_frame(AVCodecContext *avctx, AVFrame *pict,
int slice_count;
const uint8_t *slices_hdr = NULL;
- ff_dlog(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size);
+ ff_dlog(avctx, "*****frame %"PRId64" size=%d\n", avctx->frame_number, buf_size);
/* no supplementary picture */
if (buf_size == 0) {
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index b96c4f61f6..d9ce5091c2 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -1542,12 +1542,12 @@ static int svq3_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
left = buf_size*8 - get_bits_count(&s->gb_slice);
if (s->mb_y != s->mb_height || s->mb_x != s->mb_width) {
- av_log(avctx, AV_LOG_INFO, "frame num %d incomplete pic x %d y %d left %d\n", avctx->frame_number, s->mb_y, s->mb_x, left);
+ av_log(avctx, AV_LOG_INFO, "frame num %"PRId64" incomplete pic x %d y %d left %d\n", avctx->frame_number, s->mb_y, s->mb_x, left);
//av_hex_dump(stderr, buf+buf_size-8, 8);
}
if (left < 0) {
- av_log(avctx, AV_LOG_ERROR, "frame num %d left %d\n", avctx->frame_number, left);
+ av_log(avctx, AV_LOG_ERROR, "frame num %"PRId64" left %d\n", avctx->frame_number, left);
return -1;
}
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index b731bc0669..8b879156ff 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2654,7 +2654,7 @@ static int vp3_decode_frame(AVCodecContext *avctx, AVFrame *frame,
s->qps[i] = -1;
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
- av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n",
+ av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%"PRId64": Q index = %d\n",
s->keyframe ? "key" : "", avctx->frame_number + 1, s->qps[0]);
s->skip_loop_filter = !s->filter_limit_values[s->qps[0]] ||
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index fbfe75ee33..0fcc099a3c 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -1678,7 +1678,7 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s,
skip_bits(gb, 2);
} else {
int num_frames = get_bits(gb, 6);
- ff_dlog(avctx, "packet[%d]: number of frames %d\n", avctx->frame_number, num_frames);
+ ff_dlog(avctx, "packet[%"PRId64"]: number of frames %d\n", avctx->frame_number, num_frames);
packet_sequence_number = 0;
}
@@ -1687,10 +1687,10 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s,
if (avctx->codec_id != AV_CODEC_ID_WMAPRO) {
skip_bits(gb, 3);
s->skip_packets = get_bits(gb, 8);
- ff_dlog(avctx, "packet[%d]: skip packets %d\n", avctx->frame_number, s->skip_packets);
+ ff_dlog(avctx, "packet[%"PRId64"]: skip packets %d\n", avctx->frame_number, s->skip_packets);
}
- ff_dlog(avctx, "packet[%d]: nbpf %x\n", avctx->frame_number,
+ ff_dlog(avctx, "packet[%"PRId64"]: nbpf %x\n", avctx->frame_number,
num_bits_prev_frame);
/** check for packet loss */
diff --git a/tools/scale_slice_test.c b/tools/scale_slice_test.c
index d869eaae74..93cb6db7d1 100644
--- a/tools/scale_slice_test.c
+++ b/tools/scale_slice_test.c
@@ -100,7 +100,7 @@ static int process_frame(DecodeContext *dc, AVFrame *frame)
if (memcmp(pd->frame_ref->data[i], pd->frame_dst->data[i],
pd->frame_ref->linesize[i] * (pd->frame_ref->height >> shift))) {
- fprintf(stderr, "mismatch frame %d seed %u\n",
+ fprintf(stderr, "mismatch frame %"PRId64" seed %u\n",
dc->decoder->frame_number - 1, pd->random_seed);
return AVERROR(EINVAL);
}
diff --git a/tools/venc_data_dump.c b/tools/venc_data_dump.c
index 3a3543f80f..8e91aaa402 100644
--- a/tools/venc_data_dump.c
+++ b/tools/venc_data_dump.c
@@ -38,7 +38,7 @@ static int process_frame(DecodeContext *dc, AVFrame *frame)
if (!frame)
return 0;
- fprintf(stdout, "frame %d\n", dc->decoder->frame_number - 1);
+ fprintf(stdout, "frame %"PRId64"\n", dc->decoder->frame_number - 1);
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_VIDEO_ENC_PARAMS);
if (sd) {
--
2.35.3
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* [FFmpeg-devel] [BUMP PATCH 2/2] avutil/frame: change AVFrame.*_picture_number to int64_t
2023-01-26 22:46 [FFmpeg-devel] [BUMP PATCH 1/2] avcodec: change AVCodecContext.frame_number to int64_t Marton Balint
@ 2023-01-26 22:46 ` Marton Balint
2023-01-27 10:07 ` [FFmpeg-devel] [BUMP PATCH 1/2] avcodec: change AVCodecContext.frame_number " Anton Khirnov
1 sibling, 0 replies; 8+ messages in thread
From: Marton Balint @ 2023-01-26 22:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
Frame counters can overflow relatively easily (INT_MAX number of frames is
slightly more than 1 year for 60 fps content), so make sure we use 64 bit
values for them.
We also change MpegEncContext picture number members to 64 bit in this change,
because mpeg(ish) decoding/encoding usually use and set AVFrame attributes
based on the MpegEncContext picture number members, so it makes sense to use
the same type. Same is true for H264Context.coded_picture_number.
There are also a couple of printf() format string updates, which is the
necessary evil of this change, because API users need to do this as well. The
alternative would be to introduce separate 64-bit counters for the int64 type,
and keep the two values in sync, but that would be also quite ugly.
So let's do what we already did for AVFormatContext.bit_rate some years ago and
simply change the type.
Signed-off-by: Marton Balint <cus@passwd.hu>
---
doc/APIchanges | 4 ++++
doc/examples/demuxing_decoding.c | 2 +-
libavcodec/flvdec.c | 2 +-
libavcodec/h264dec.h | 2 +-
libavcodec/mpeg12enc.c | 2 +-
libavcodec/mpegvideo.h | 6 +++---
libavcodec/mpegvideo_enc.c | 6 +++---
libavcodec/ratecontrol.c | 6 +++---
libavutil/frame.h | 4 ++--
9 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index cdd407799a..b8dd6fc6ec 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,10 @@ libavutil: 2021-04-27
API changes, most recent first:
+2023-xx-xx - xxxxxxxxxx - lavu 58.0.100 - frame.h
+ AVFrame.coded_picture_number and AVFrame.display_picture_number was changed
+ to 64bit, make sure you update any printf() or other type sensitive code
+
2023-xx-xx - xxxxxxxxxx - lavc 60.0.100 - avcodec.h
AVCodecContext.frame_number was changed to 64bit, make sure you update any
printf() or other type sensitive code
diff --git a/doc/examples/demuxing_decoding.c b/doc/examples/demuxing_decoding.c
index 999a78db0d..b16436b55b 100644
--- a/doc/examples/demuxing_decoding.c
+++ b/doc/examples/demuxing_decoding.c
@@ -73,7 +73,7 @@ static int output_video_frame(AVFrame *frame)
return -1;
}
- printf("video_frame n:%d coded_n:%d\n",
+ printf("video_frame n:%d coded_n:%"PRId64"\n",
video_frame_count++, frame->coded_picture_number);
/* copy decoded frame to destination buffer:
diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c
index 09fefd3d1c..19fb23563d 100644
--- a/libavcodec/flvdec.c
+++ b/libavcodec/flvdec.c
@@ -103,7 +103,7 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
s->avctx->sample_aspect_ratio= (AVRational){1,2};
if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
- av_log(s->avctx, AV_LOG_DEBUG, "%c esc_type:%d, qp:%d num:%d\n",
+ av_log(s->avctx, AV_LOG_DEBUG, "%c esc_type:%d, qp:%d num:%"PRId64"\n",
s->droppable ? 'D' : av_get_picture_type_char(s->pict_type),
s->h263_flv - 1, s->qscale, s->picture_number);
}
diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h
index 9a1ec1bace..dd3f06a03b 100644
--- a/libavcodec/h264dec.h
+++ b/libavcodec/h264dec.h
@@ -354,7 +354,7 @@ typedef struct H264Context {
int chroma_x_shift, chroma_y_shift;
int droppable;
- int coded_picture_number;
+ int64_t coded_picture_number;
int context_initialized;
int flags;
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index a6663a158b..690c401432 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -76,7 +76,7 @@ typedef struct MPEG12EncContext {
AVRational frame_rate_ext;
unsigned frame_rate_index;
- int gop_picture_number; ///< index of the first picture of a GOP based on fake_pic_num
+ int64_t 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
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 42275953b9..3e932d3ab5 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -114,9 +114,9 @@ typedef struct MpegEncContext {
/* sequence parameters */
int context_initialized;
- int input_picture_number; ///< used to set pic->display_picture_number, should not be used for/by anything else
- int coded_picture_number; ///< used to set pic->coded_picture_number, should not be used for/by anything else
- int picture_number; //FIXME remove, unclear definition
+ int64_t input_picture_number; ///< used to set pic->display_picture_number, should not be used for/by anything else
+ int64_t coded_picture_number; ///< used to set pic->coded_picture_number, should not be used for/by anything else
+ int64_t picture_number; //FIXME remove, unclear definition
int extradata_parsed;
int picture_in_gop_number; ///< 0-> first pic in gop, ...
int mb_width, mb_height; ///< number of MBs horizontally & vertically
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index bb101612e5..d2becc7003 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1095,8 +1095,8 @@ static int alloc_picture(MpegEncContext *s, Picture *pic, int shared)
static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
{
Picture *pic = NULL;
- int64_t pts;
- int i, display_picture_number = 0, ret;
+ int64_t pts, display_picture_number = 0;
+ int i, ret;
int encoding_delay = s->max_b_frames ? s->max_b_frames
: (s->low_delay ? 0 : 1);
int flush_offset = 1;
@@ -1484,7 +1484,7 @@ static int select_input_picture(MpegEncContext *s)
if (s->avctx->flags & AV_CODEC_FLAG_PASS2) {
for (i = 0; i < s->max_b_frames + 1; i++) {
- int pict_num = s->input_picture[0]->f->display_picture_number + i;
+ int64_t pict_num = s->input_picture[0]->f->display_picture_number + i;
if (pict_num >= s->rc_context.num_entries)
break;
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index 4829172c2c..299d82223c 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -37,7 +37,7 @@
void ff_write_pass1_stats(MpegEncContext *s)
{
snprintf(s->avctx->stats_out, 256,
- "in:%d out:%d type:%d q:%d itex:%d ptex:%d mv:%d misc:%d "
+ "in:%"PRId64" out:%"PRId64" type:%d q:%d itex:%d ptex:%d mv:%d misc:%d "
"fcode:%d bcode:%d mc-var:%"PRId64" var:%"PRId64" icount:%d skipcount:%d hbits:%d;\n",
s->current_picture_ptr->f->display_picture_number,
s->current_picture_ptr->f->coded_picture_number,
@@ -571,7 +571,7 @@ av_cold int ff_rate_control_init(MpegEncContext *s)
p = s->avctx->stats_in;
for (i = 0; i < rcc->num_entries - s->max_b_frames; i++) {
RateControlEntry *rce;
- int picture_number;
+ int64_t picture_number;
int e;
char *next;
@@ -580,7 +580,7 @@ av_cold int ff_rate_control_init(MpegEncContext *s)
(*next) = 0; // sscanf is unbelievably slow on looong strings // FIXME copy / do not write
next++;
}
- e = sscanf(p, " in:%d ", &picture_number);
+ e = sscanf(p, " in:%"PRId64" ", &picture_number);
av_assert0(picture_number >= 0);
av_assert0(picture_number < rcc->num_entries);
diff --git a/libavutil/frame.h b/libavutil/frame.h
index bbe909ee2d..da06a2f868 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -454,11 +454,11 @@ typedef struct AVFrame {
/**
* picture number in bitstream order
*/
- int coded_picture_number;
+ int64_t coded_picture_number;
/**
* picture number in display order
*/
- int display_picture_number;
+ int64_t display_picture_number;
/**
* quality (between 1 (good) and FF_LAMBDA_MAX (bad))
--
2.35.3
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [BUMP PATCH 1/2] avcodec: change AVCodecContext.frame_number to int64_t
2023-01-26 22:46 [FFmpeg-devel] [BUMP PATCH 1/2] avcodec: change AVCodecContext.frame_number to int64_t Marton Balint
2023-01-26 22:46 ` [FFmpeg-devel] [BUMP PATCH 2/2] avutil/frame: change AVFrame.*_picture_number " Marton Balint
@ 2023-01-27 10:07 ` Anton Khirnov
2023-01-27 17:59 ` Marton Balint
1 sibling, 1 reply; 8+ messages in thread
From: Anton Khirnov @ 2023-01-27 10:07 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Marton Balint
I still think we should do a deprecation+replacement like we do for
everything else.
--
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [BUMP PATCH 1/2] avcodec: change AVCodecContext.frame_number to int64_t
2023-01-27 10:07 ` [FFmpeg-devel] [BUMP PATCH 1/2] avcodec: change AVCodecContext.frame_number " Anton Khirnov
@ 2023-01-27 17:59 ` Marton Balint
2023-01-27 18:04 ` Anton Khirnov
0 siblings, 1 reply; 8+ messages in thread
From: Marton Balint @ 2023-01-27 17:59 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Fri, 27 Jan 2023, Anton Khirnov wrote:
> I still think we should do a deprecation+replacement like we do for
> everything else.
You mean you want to introduce a new 64 bit member and deprecate the old
32 bit field?
E.g.
int64_t frame_num;
attribute_deprcated
int frame_number
And during the transition you want to sync the value between the 64bit and
the 32bit ?
Thanks,
Marton
>
> --
> Anton Khirnov
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [BUMP PATCH 1/2] avcodec: change AVCodecContext.frame_number to int64_t
2023-01-27 17:59 ` Marton Balint
@ 2023-01-27 18:04 ` Anton Khirnov
2023-01-27 18:16 ` James Almer
0 siblings, 1 reply; 8+ messages in thread
From: Anton Khirnov @ 2023-01-27 18:04 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Quoting Marton Balint (2023-01-27 18:59:39)
>
>
> On Fri, 27 Jan 2023, Anton Khirnov wrote:
>
> > I still think we should do a deprecation+replacement like we do for
> > everything else.
>
> You mean you want to introduce a new 64 bit member and deprecate the old
> 32 bit field?
>
> E.g.
>
> int64_t frame_num;
>
> attribute_deprcated
> int frame_number
>
> And during the transition you want to sync the value between the 64bit and
> the 32bit ?
yes
--
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [BUMP PATCH 1/2] avcodec: change AVCodecContext.frame_number to int64_t
2023-01-27 18:04 ` Anton Khirnov
@ 2023-01-27 18:16 ` James Almer
2023-01-27 18:41 ` Marton Balint
0 siblings, 1 reply; 8+ messages in thread
From: James Almer @ 2023-01-27 18:16 UTC (permalink / raw)
To: ffmpeg-devel
On 1/27/2023 3:04 PM, Anton Khirnov wrote:
> Quoting Marton Balint (2023-01-27 18:59:39)
>>
>>
>> On Fri, 27 Jan 2023, Anton Khirnov wrote:
>>
>>> I still think we should do a deprecation+replacement like we do for
>>> everything else.
>>
>> You mean you want to introduce a new 64 bit member and deprecate the old
>> 32 bit field?
>>
>> E.g.
>>
>> int64_t frame_num;
>>
>> attribute_deprcated
>> int frame_number
>>
>> And during the transition you want to sync the value between the 64bit and
>> the 32bit ?
>
> yes
We did make changes like int -> size_t without adding new fields in
places like AVBufferRef. See 14040a1d91.
It does however probably need an FF_API_ dance, much like in that example.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [BUMP PATCH 1/2] avcodec: change AVCodecContext.frame_number to int64_t
2023-01-27 18:16 ` James Almer
@ 2023-01-27 18:41 ` Marton Balint
2023-01-28 18:14 ` Marton Balint
0 siblings, 1 reply; 8+ messages in thread
From: Marton Balint @ 2023-01-27 18:41 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Fri, 27 Jan 2023, James Almer wrote:
> On 1/27/2023 3:04 PM, Anton Khirnov wrote:
>> Quoting Marton Balint (2023-01-27 18:59:39)
>>>
>>>
>>> On Fri, 27 Jan 2023, Anton Khirnov wrote:
>>>
>>>> I still think we should do a deprecation+replacement like we do for
>>>> everything else.
>>>
>>> You mean you want to introduce a new 64 bit member and deprecate the old
>>> 32 bit field?
>>>
>>> E.g.
>>>
>>> int64_t frame_num;
>>>
>>> attribute_deprcated
>>> int frame_number
>>>
>>> And during the transition you want to sync the value between the 64bit
>>> and
>>> the 32bit ?
>>
>> yes
>
> We did make changes like int -> size_t without adding new fields in places
> like AVBufferRef. See 14040a1d91.
Or AVFormatContext bit_rate sometime before.
> It does however probably need an FF_API_ dance, much like in that example.
If no new field is added, and no old field is deprecated, then if the type
change is done directly before the bump, then the dance is not needed,
beacuse you'd just remove the dance at the bump.
Regards,
Marton
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [BUMP PATCH 1/2] avcodec: change AVCodecContext.frame_number to int64_t
2023-01-27 18:41 ` Marton Balint
@ 2023-01-28 18:14 ` Marton Balint
0 siblings, 0 replies; 8+ messages in thread
From: Marton Balint @ 2023-01-28 18:14 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Fri, 27 Jan 2023, Marton Balint wrote:
>
>
> On Fri, 27 Jan 2023, James Almer wrote:
>
>> On 1/27/2023 3:04 PM, Anton Khirnov wrote:
>>> Quoting Marton Balint (2023-01-27 18:59:39)
>>>>
>>>>
>>>> On Fri, 27 Jan 2023, Anton Khirnov wrote:
>>>>
>>>>> I still think we should do a deprecation+replacement like we do for
>>>>> everything else.
>>>>
>>>> You mean you want to introduce a new 64 bit member and deprecate the
>>>> old
>>>> 32 bit field?
>>>>
>>>> E.g.
>>>>
>>>> int64_t frame_num;
>>>>
>>>> attribute_deprcated
>>>> int frame_number
>>>>
>>>> And during the transition you want to sync the value between the 64bit
>>>> and
>>>> the 32bit ?
>>>
>>> yes
>>
>> We did make changes like int -> size_t without adding new fields in places
>> like AVBufferRef. See 14040a1d91.
>
> Or AVFormatContext bit_rate sometime before.
>
>> It does however probably need an FF_API_ dance, much like in that example.
>
> If no new field is added, and no old field is deprecated, then if the type
> change is done directly before the bump, then the dance is not needed,
> beacuse you'd just remove the dance at the bump.
Anyhow, I will send and alternate patch series which is introducing a new
field for the 64-bit variant. That series is not dependant of the API
bump, can be applied before or after.
If people prefer that, fine with me.
Regards,
Marton
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-01-28 18:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-26 22:46 [FFmpeg-devel] [BUMP PATCH 1/2] avcodec: change AVCodecContext.frame_number to int64_t Marton Balint
2023-01-26 22:46 ` [FFmpeg-devel] [BUMP PATCH 2/2] avutil/frame: change AVFrame.*_picture_number " Marton Balint
2023-01-27 10:07 ` [FFmpeg-devel] [BUMP PATCH 1/2] avcodec: change AVCodecContext.frame_number " Anton Khirnov
2023-01-27 17:59 ` Marton Balint
2023-01-27 18:04 ` Anton Khirnov
2023-01-27 18:16 ` James Almer
2023-01-27 18:41 ` Marton Balint
2023-01-28 18:14 ` Marton Balint
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git