[FFmpeg-cvslog] avcodec/wmv2: Move ff_wmv2_add_mb() to the wmv2dec

Andreas Rheinhardt git at videolan.org
Tue Jan 4 18:21:02 EET 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu Dec 23 03:57:55 2021 +0100| [b821a58741fddce0e103b2d9a93c313904241003] | committer: Andreas Rheinhardt

avcodec/wmv2: Move ff_wmv2_add_mb() to the wmv2dec

Only the decoder ever used it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavcodec/wmv2.c    | 44 --------------------------------------------
 libavcodec/wmv2dec.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/libavcodec/wmv2.c b/libavcodec/wmv2.c
index 327c5bdae1..fd64a0938f 100644
--- a/libavcodec/wmv2.c
+++ b/libavcodec/wmv2.c
@@ -23,7 +23,6 @@
 #include "mpegutils.h"
 #include "mpegvideo.h"
 #include "msmpeg4data.h"
-#include "simple_idct.h"
 #include "wmv2.h"
 #include "wmv2data.h"
 
@@ -54,49 +53,6 @@ av_cold void ff_wmv2_common_init(Wmv2Context *w)
     s->idsp.idct     = NULL;
 }
 
-static void wmv2_add_block(Wmv2Context *w, int16_t *block1,
-                           uint8_t *dst, int stride, int n)
-{
-    MpegEncContext *const s = &w->s;
-
-    if (s->block_last_index[n] >= 0) {
-        switch (w->abt_type_table[n]) {
-        case 0:
-            w->wdsp.idct_add(dst, stride, block1);
-            break;
-        case 1:
-            ff_simple_idct84_add(dst, stride, block1);
-            ff_simple_idct84_add(dst + 4 * stride, stride, w->abt_block2[n]);
-            s->bdsp.clear_block(w->abt_block2[n]);
-            break;
-        case 2:
-            ff_simple_idct48_add(dst, stride, block1);
-            ff_simple_idct48_add(dst + 4, stride, w->abt_block2[n]);
-            s->bdsp.clear_block(w->abt_block2[n]);
-            break;
-        default:
-            av_log(s->avctx, AV_LOG_ERROR, "internal error in WMV2 abt\n");
-        }
-    }
-}
-
-void ff_wmv2_add_mb(MpegEncContext *s, int16_t block1[6][64],
-                    uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr)
-{
-    Wmv2Context *const w = (Wmv2Context *) s;
-
-    wmv2_add_block(w, block1[0], dest_y,                       s->linesize, 0);
-    wmv2_add_block(w, block1[1], dest_y + 8,                   s->linesize, 1);
-    wmv2_add_block(w, block1[2], dest_y + 8 * s->linesize,     s->linesize, 2);
-    wmv2_add_block(w, block1[3], dest_y + 8 + 8 * s->linesize, s->linesize, 3);
-
-    if (s->avctx->flags & AV_CODEC_FLAG_GRAY)
-        return;
-
-    wmv2_add_block(w, block1[4], dest_cb, s->uvlinesize, 4);
-    wmv2_add_block(w, block1[5], dest_cr, s->uvlinesize, 5);
-}
-
 void ff_mspel_motion(MpegEncContext *s, uint8_t *dest_y,
                      uint8_t *dest_cb, uint8_t *dest_cr,
                      uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index c500e3e779..f7745c5a83 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -27,9 +27,53 @@
 #include "mpegvideo.h"
 #include "msmpeg4.h"
 #include "msmpeg4data.h"
+#include "simple_idct.h"
 #include "wmv2.h"
 
 
+static void wmv2_add_block(Wmv2Context *w, int16_t *block1,
+                           uint8_t *dst, int stride, int n)
+{
+    MpegEncContext *const s = &w->s;
+
+    if (s->block_last_index[n] >= 0) {
+        switch (w->abt_type_table[n]) {
+        case 0:
+            w->wdsp.idct_add(dst, stride, block1);
+            break;
+        case 1:
+            ff_simple_idct84_add(dst, stride, block1);
+            ff_simple_idct84_add(dst + 4 * stride, stride, w->abt_block2[n]);
+            s->bdsp.clear_block(w->abt_block2[n]);
+            break;
+        case 2:
+            ff_simple_idct48_add(dst, stride, block1);
+            ff_simple_idct48_add(dst + 4, stride, w->abt_block2[n]);
+            s->bdsp.clear_block(w->abt_block2[n]);
+            break;
+        default:
+            av_log(s->avctx, AV_LOG_ERROR, "internal error in WMV2 abt\n");
+        }
+    }
+}
+
+void ff_wmv2_add_mb(MpegEncContext *s, int16_t block1[6][64],
+                    uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr)
+{
+    Wmv2Context *const w = (Wmv2Context *) s;
+
+    wmv2_add_block(w, block1[0], dest_y,                       s->linesize, 0);
+    wmv2_add_block(w, block1[1], dest_y + 8,                   s->linesize, 1);
+    wmv2_add_block(w, block1[2], dest_y + 8 * s->linesize,     s->linesize, 2);
+    wmv2_add_block(w, block1[3], dest_y + 8 + 8 * s->linesize, s->linesize, 3);
+
+    if (s->avctx->flags & AV_CODEC_FLAG_GRAY)
+        return;
+
+    wmv2_add_block(w, block1[4], dest_cb, s->uvlinesize, 4);
+    wmv2_add_block(w, block1[5], dest_cr, s->uvlinesize, 5);
+}
+
 static int parse_mb_skip(Wmv2Context *w)
 {
     int mb_x, mb_y;



More information about the ffmpeg-cvslog mailing list