This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 4f4cbed928725ce4499ecd61d285a8d22a8b8135
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Wed Jun 25 05:37:05 2025 +0200
Commit:     Andreas Rheinhardt <[email protected]>
CommitDate: Fri Jan 2 18:30:43 2026 +0100

    avcodec/msmpeg4: Initialize WMV2 generically
    
    WMV1 and WMV2 use other scantables and therefore
    ff_msmpeg4_common_init() reinitializes them. Yet WMV2
    also uses a different IDCT overwriting the ordinary one,
    so that the IDCT permutation changes and therefore
    ff_wmv2_common_init() (called after ff_msmpeg4_common_init())
    needs to reinitialize the scantables again.
    
    Avoid this by calling ff_wmv2_common_init() in
    ff_msmpeg4_common_init().
    
    Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavcodec/msmpeg4.c | 8 +++++++-
 libavcodec/wmv2.c    | 9 ---------
 libavcodec/wmv2dec.c | 2 --
 libavcodec/wmv2enc.c | 2 --
 4 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c
index 5ceb100333..79a43602b1 100644
--- a/libavcodec/msmpeg4.c
+++ b/libavcodec/msmpeg4.c
@@ -28,6 +28,7 @@
  */
 
 #include "config.h"
+#include "config_components.h"
 
 #include "libavutil/thread.h"
 #if ARCH_X86
@@ -42,6 +43,7 @@
 #include "mpeg4videodata.h"
 #include "msmpeg4data.h"
 #include "msmpeg4_vc1_data.h"
+#include "wmv2.h"
 
 /*
  * You can also call this codec: MPEG-4 with a twist!
@@ -133,8 +135,12 @@ av_cold void ff_msmpeg4_common_init(MpegEncContext *s)
             s->c_dc_scale_table= ff_mpeg4_c_dc_scale_table;
         }
         break;
-    case MSMP4_WMV1:
+#if CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER
     case MSMP4_WMV2:
+        ff_wmv2_common_init(s);
+        // fallthrough
+#endif
+    case MSMP4_WMV1:
         s->y_dc_scale_table= ff_wmv1_y_dc_scale_table;
         s->c_dc_scale_table= ff_wmv1_c_dc_scale_table;
         break;
diff --git a/libavcodec/wmv2.c b/libavcodec/wmv2.c
index 903c1c9a44..d36ae66581 100644
--- a/libavcodec/wmv2.c
+++ b/libavcodec/wmv2.c
@@ -21,7 +21,6 @@
 #include "avcodec.h"
 #include "idctdsp.h"
 #include "mpegvideo.h"
-#include "msmpeg4_vc1_data.h"
 #include "wmv2.h"
 
 
@@ -33,14 +32,6 @@ av_cold void ff_wmv2_common_init(MpegEncContext *s)
     s->idsp.perm_type = w->wdsp.idct_perm;
     ff_init_scantable_permutation(s->idsp.idct_permutation,
                                   w->wdsp.idct_perm);
-    ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable,
-                      ff_wmv1_scantable[1]);
-    ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable,
-                      ff_wmv1_scantable[0]);
-    ff_permute_scantable(s->permutated_intra_h_scantable, ff_wmv1_scantable[2],
-                         s->idsp.idct_permutation);
-    ff_permute_scantable(s->permutated_intra_v_scantable, ff_wmv1_scantable[3],
-                         s->idsp.idct_permutation);
     s->idsp.idct_put = w->wdsp.idct_put;
     s->idsp.idct_add = w->wdsp.idct_add;
     s->idsp.idct     = NULL;
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index 512d63b23e..5bac48385f 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -578,8 +578,6 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
     h->decode_header = wmv2_decode_picture_header;
     h->decode_mb = wmv2_decode_mb;
 
-    ff_wmv2_common_init(s);
-
     decode_ext_header(w);
 
     return ff_intrax8_common_init(avctx, &w->x8, h->block[0],
diff --git a/libavcodec/wmv2enc.c b/libavcodec/wmv2enc.c
index b6811fde0e..5b3e2ae116 100644
--- a/libavcodec/wmv2enc.c
+++ b/libavcodec/wmv2enc.c
@@ -233,8 +233,6 @@ static av_cold int wmv2_encode_init(AVCodecContext *avctx)
     if (ret < 0)
         return ret;
 
-    ff_wmv2_common_init(&s->c);
-
     avctx->extradata_size = WMV2_EXTRADATA_SIZE;
     avctx->extradata      = av_mallocz(avctx->extradata_size + 
AV_INPUT_BUFFER_PADDING_SIZE);
     if (!avctx->extradata)

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to