[FFmpeg-cvslog] alpha/blockdsp: move clear_blocks out of dsputil

James Almer git at videolan.org
Thu Jun 19 22:52:00 CEST 2014


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Jun 19 17:28:26 2014 -0300| [05d95c53a70f983c124da112553502f7bcfec640] | committer: Michael Niedermayer

alpha/blockdsp: move clear_blocks out of dsputil

The blockdsp split did not cover Alpha optimizations

Signed-off-by: James Almer <jamrial at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/alpha/Makefile         |    3 ++-
 libavcodec/alpha/blockdsp_alpha.c |   51 +++++++++++++++++++++++++++++++++++++
 libavcodec/alpha/dsputil_alpha.c  |   22 ----------------
 libavcodec/blockdsp.c             |    2 ++
 libavcodec/blockdsp.h             |    1 +
 5 files changed, 56 insertions(+), 23 deletions(-)

diff --git a/libavcodec/alpha/Makefile b/libavcodec/alpha/Makefile
index 6f22137..8b7f1ab 100644
--- a/libavcodec/alpha/Makefile
+++ b/libavcodec/alpha/Makefile
@@ -1,4 +1,5 @@
-OBJS += alpha/dsputil_alpha.o                                           \
+OBJS += alpha/blockdsp_alpha.o                                          \
+        alpha/dsputil_alpha.o                                           \
         alpha/dsputil_alpha_asm.o                                       \
         alpha/motion_est_alpha.o                                        \
         alpha/motion_est_mvi_asm.o                                      \
diff --git a/libavcodec/alpha/blockdsp_alpha.c b/libavcodec/alpha/blockdsp_alpha.c
new file mode 100644
index 0000000..ded439d
--- /dev/null
+++ b/libavcodec/alpha/blockdsp_alpha.c
@@ -0,0 +1,51 @@
+/*
+ * Alpha optimised block operations
+ * Copyright (c) 2002 Falk Hueffner <falk at debian.org>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdint.h>
+
+#include "libavutil/attributes.h"
+#include "libavcodec/blockdsp.h"
+#include "asm.h"
+
+static void clear_blocks_axp(int16_t *blocks) {
+    uint64_t *p = (uint64_t *) blocks;
+    int n = sizeof(int16_t) * 6 * 64;
+
+    do {
+        p[0] = 0;
+        p[1] = 0;
+        p[2] = 0;
+        p[3] = 0;
+        p[4] = 0;
+        p[5] = 0;
+        p[6] = 0;
+        p[7] = 0;
+        p += 8;
+        n -= 8 * 8;
+    } while (n);
+}
+
+av_cold void ff_blockdsp_init_alpha(BlockDSPContext *c, unsigned high_bit_depth)
+{
+    if (!high_bit_depth) {
+        c->clear_blocks = clear_blocks_axp;
+    }
+}
diff --git a/libavcodec/alpha/dsputil_alpha.c b/libavcodec/alpha/dsputil_alpha.c
index 03ba0a8..a075c3a 100644
--- a/libavcodec/alpha/dsputil_alpha.c
+++ b/libavcodec/alpha/dsputil_alpha.c
@@ -101,32 +101,10 @@ void add_pixels_clamped_mvi(const int16_t *block, uint8_t *pixels,
 }
 #endif
 
-static void clear_blocks_axp(int16_t *blocks) {
-    uint64_t *p = (uint64_t *) blocks;
-    int n = sizeof(int16_t) * 6 * 64;
-
-    do {
-        p[0] = 0;
-        p[1] = 0;
-        p[2] = 0;
-        p[3] = 0;
-        p[4] = 0;
-        p[5] = 0;
-        p[6] = 0;
-        p[7] = 0;
-        p += 8;
-        n -= 8 * 8;
-    } while (n);
-}
-
 av_cold void ff_dsputil_init_alpha(DSPContext *c, AVCodecContext *avctx)
 {
     const int high_bit_depth = avctx->bits_per_raw_sample > 8;
 
-    if (!high_bit_depth) {
-        c->clear_blocks = clear_blocks_axp;
-    }
-
     /* amask clears all bits that correspond to present features.  */
     if (amask(AMASK_MVI) == 0) {
         c->put_pixels_clamped = put_pixels_clamped_mvi_asm;
diff --git a/libavcodec/blockdsp.c b/libavcodec/blockdsp.c
index 6335b60..f5259f6 100644
--- a/libavcodec/blockdsp.c
+++ b/libavcodec/blockdsp.c
@@ -65,6 +65,8 @@ av_cold void ff_blockdsp_init(BlockDSPContext *c, AVCodecContext *avctx)
     c->fill_block_tab[0] = fill_block16_c;
     c->fill_block_tab[1] = fill_block8_c;
 
+    if (ARCH_ALPHA)
+        ff_blockdsp_init_alpha(c, high_bit_depth);
     if (ARCH_ARM)
         ff_blockdsp_init_arm(c, high_bit_depth);
     if (ARCH_PPC)
diff --git a/libavcodec/blockdsp.h b/libavcodec/blockdsp.h
index 47212f7..c7ad265 100644
--- a/libavcodec/blockdsp.h
+++ b/libavcodec/blockdsp.h
@@ -40,6 +40,7 @@ typedef struct BlockDSPContext {
 
 void ff_blockdsp_init(BlockDSPContext *c, AVCodecContext *avctx);
 
+void ff_blockdsp_init_alpha(BlockDSPContext *c, unsigned high_bit_depth);
 void ff_blockdsp_init_arm(BlockDSPContext *c, unsigned high_bit_depth);
 void ff_blockdsp_init_ppc(BlockDSPContext *c, unsigned high_bit_depth);
 #if FF_API_XVMC



More information about the ffmpeg-cvslog mailing list