[FFmpeg-cvslog] avcodec/mpegvideo: Check h263_aic, not h263_plus for allocating dc_val
Andreas Rheinhardt
git at videolan.org
Mon May 26 06:25:20 EEST 2025
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Wed May 21 01:57:52 2025 +0200| [8987c293908b0ba82f0320c04caf7ad601497c5a] | committer: Andreas Rheinhardt
avcodec/mpegvideo: Check h263_aic, not h263_plus for allocating dc_val
This means that these buffers won't be allocated any more
for H.263+ with AIC disabled.
Also remove setting h263_plus for the RV20 encoder,
as it has only been done to force allocating dc_val.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8987c293908b0ba82f0320c04caf7ad601497c5a
---
libavcodec/mpegvideo.c | 4 +++-
libavcodec/mpegvideo_enc.c | 3 ++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 55f7178bed..f3e4d4c386 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -335,9 +335,11 @@ av_cold int ff_mpv_init_context_frame(MpegEncContext *s)
s->coded_block = s->coded_block_base + s->b8_stride + 1;
}
- if (s->h263_pred || s->h263_plus || !s->encoding) {
+ if (s->h263_pred || s->h263_aic || !s->encoding) {
/* dc values */
// MN: we need these for error resilience of intra-frames
+ // Allocating them unconditionally for decoders also means
+ // that we don't need to reinitialize when e.g. h263_aic changes.
if (!FF_ALLOCZ_TYPED_ARRAY(s->dc_val_base, yc_size))
return AVERROR(ENOMEM);
s->dc_val[0] = s->dc_val_base + s->b8_stride + 1;
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 27a01d1063..241e0a148f 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -944,8 +944,9 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
avctx->delay = 0;
s->c.low_delay = 1;
s->c.modified_quant = 1;
+ // Set here to force allocation of dc_val;
+ // will be set later on a per-frame basis.
s->c.h263_aic = 1;
- s->c.h263_plus = 1;
s->c.loop_filter = 1;
s->c.unrestricted_mv = 0;
break;
More information about the ffmpeg-cvslog
mailing list