[FFmpeg-cvslog] avcodec/mpegvideo_enc: Set gob_index once during init
Andreas Rheinhardt
git at videolan.org
Mon May 26 06:24:49 EEST 2025
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sat May 17 19:30:02 2025 +0200| [99187419676dadeb6560950fac4706577fdc2bfb] | committer: Andreas Rheinhardt
avcodec/mpegvideo_enc: Set gob_index once during init
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=99187419676dadeb6560950fac4706577fdc2bfb
---
libavcodec/ituh263enc.c | 3 +++
libavcodec/mpegvideo_enc.c | 18 +++++-------------
2 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index b9d903a220..9a6d5dc201 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -842,6 +842,9 @@ av_cold void ff_h263_encode_init(MPVMainEncContext *const m)
if (s->c.modified_quant)
s->c.chroma_qscale_table = ff_h263_chroma_qscale_table;
+ // Only used for H.263 and H.263+
+ s->c.gob_index = H263_GOB_HEIGHT(s->c.height);
+
// use fcodes >1 only for MPEG-4 & H.263 & H.263+ FIXME
switch(s->c.codec_id){
case AV_CODEC_ID_H263P:
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 0023e88dc1..948022c1c2 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -3007,25 +3007,17 @@ static int encode_thread(AVCodecContext *c, void *arg){
s->c.last_dc[0] = 128 * 8 / 13;
s->c.last_dc[1] = 128 * 8 / 14;
s->c.last_dc[2] = 128 * 8 / 14;
+#if CONFIG_MPEG4_ENCODER
+ } else if (s->c.partitioned_frame) {
+ av_assert1(s->c.codec_id == AV_CODEC_ID_MPEG4);
+ ff_mpeg4_init_partitions(s);
+#endif
}
s->c.mb_skip_run = 0;
memset(s->c.last_mv, 0, sizeof(s->c.last_mv));
s->last_mv_dir = 0;
- switch (s->c.codec_id) {
- case AV_CODEC_ID_H263:
- case AV_CODEC_ID_H263P:
- case AV_CODEC_ID_FLV1:
- if (CONFIG_H263_ENCODER)
- s->c.gob_index = H263_GOB_HEIGHT(s->c.height);
- break;
- case AV_CODEC_ID_MPEG4:
- if (CONFIG_MPEG4_ENCODER && s->c.partitioned_frame)
- ff_mpeg4_init_partitions(s);
- break;
- }
-
s->c.resync_mb_x = 0;
s->c.resync_mb_y = 0;
s->c.first_slice_line = 1;
More information about the ffmpeg-cvslog
mailing list