ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | 
Mon Mar  3 17:26:00 2025 +0100| [c757f948d1d7ab784295044297d7bde350428481] | 
committer: Andreas Rheinhardt

avcodec/mpegvideo: Don't initialize [yc]_dc_scale_table by default

Only the H.263-based decoders as well as the encoders need it;
so move it to ff_h263_decode_init() as well as ff_mpv_encode_init().
Also for the latter make it only set these tables if none are
already set.

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c757f948d1d7ab784295044297d7bde350428481
---

 libavcodec/h263dec.c       | 5 ++++-
 libavcodec/mpegvideo.c     | 2 --
 libavcodec/mpegvideo_enc.c | 6 +++++-
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 2d806fc703..8434f6e7cf 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -41,8 +41,8 @@
 #include "mpeg_er.h"
 #include "mpeg4video.h"
 #include "mpeg4videodec.h"
-#include "mpeg4videodefs.h"
 #include "mpegvideo.h"
+#include "mpegvideodata.h"
 #include "mpegvideodec.h"
 #include "msmpeg4dec.h"
 #include "thread.h"
@@ -102,6 +102,9 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
     s->decode_mb       = ff_h263_decode_mb;
     s->low_delay       = 1;
 
+    s->y_dc_scale_table =
+    s->c_dc_scale_table = ff_mpeg1_dc_scale_table;
+
     // dct_unquantize defaults for H.263;
     // they might change on a per-frame basis for MPEG-4.
     s->dct_unquantize_intra = s->dct_unquantize_h263_intra;
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 4b69b5b65c..9cd67151aa 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -482,8 +482,6 @@ int ff_update_duplicate_context(MpegEncContext *dst, const 
MpegEncContext *src)
  */
 av_cold void ff_mpv_common_defaults(MpegEncContext *s)
 {
-    s->y_dc_scale_table      =
-    s->c_dc_scale_table      = ff_mpeg1_dc_scale_table;
     s->chroma_qscale_table   = ff_default_chroma_qscale_table;
     s->progressive_frame     = 1;
     s->progressive_sequence  = 1;
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 5c2f73b2d1..7eb381af36 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -276,7 +276,6 @@ static av_cold void mpv_encode_init_static(void)
 
 /**
  * Set the given MpegEncContext to defaults for encoding.
- * the changed fields will not depend upon the prior state of the 
MpegEncContext.
  */
 static av_cold void mpv_encode_defaults(MpegEncContext *s)
 {
@@ -288,6 +287,11 @@ static av_cold void mpv_encode_defaults(MpegEncContext *s)
 
     s->fcode_tab     = default_fcode_tab + MAX_MV;
 
+    if (!s->y_dc_scale_table) {
+        s->y_dc_scale_table =
+        s->c_dc_scale_table = ff_mpeg1_dc_scale_table;
+    }
+
     s->input_picture_number  = 0;
     s->picture_in_gop_number = 0;
 }

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to