[FFmpeg-cvslog] alpha/idctdsp: move idct init code out of dsputil

James Almer git at videolan.org
Tue Jul 8 22:59:59 CEST 2014


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue Jul  8 17:08:24 2014 -0300| [2375b094734e95c031defb475b5492ac1b659391] | committer: Michael Niedermayer

alpha/idctdsp: move idct init code out of dsputil

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=2375b094734e95c031defb475b5492ac1b659391
---

 libavcodec/alpha/Makefile                          |   14 ++---
 libavcodec/alpha/dsputil_alpha.c                   |   22 --------
 libavcodec/alpha/dsputil_alpha.h                   |   13 -----
 libavcodec/alpha/idctdsp_alpha.c                   |   55 ++++++++++++++++++++
 libavcodec/alpha/idctdsp_alpha.h                   |   34 ++++++++++++
 .../{dsputil_alpha_asm.S => idctdsp_alpha_asm.S}   |    2 +-
 libavcodec/alpha/simple_idct_alpha.c               |    2 +-
 libavcodec/idctdsp.c                               |    2 +
 libavcodec/idctdsp.h                               |    2 +
 9 files changed, 102 insertions(+), 44 deletions(-)

diff --git a/libavcodec/alpha/Makefile b/libavcodec/alpha/Makefile
index 8b7f1ab..34e5275 100644
--- a/libavcodec/alpha/Makefile
+++ b/libavcodec/alpha/Makefile
@@ -1,10 +1,10 @@
-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                                      \
-        alpha/simple_idct_alpha.o                                       \
-
+OBJS-$(CONFIG_BLOCKDSP)                 += alpha/blockdsp_alpha.o
+OBJS-$(CONFIG_DSPUTIL)                  += alpha/dsputil_alpha.o        \
+                                           alpha/motion_est_alpha.o     \
+                                           alpha/motion_est_mvi_asm.o
 OBJS-$(CONFIG_HPELDSP)                  += alpha/hpeldsp_alpha.o        \
                                            alpha/hpeldsp_alpha_asm.o
+OBJS-$(CONFIG_IDCTDSP)                  += alpha/idctdsp_alpha.o        \
+                                           alpha/idctdsp_alpha_asm.o    \
+                                           alpha/simple_idct_alpha.o
 OBJS-$(CONFIG_MPEGVIDEO)                += alpha/mpegvideo_alpha.o
diff --git a/libavcodec/alpha/dsputil_alpha.c b/libavcodec/alpha/dsputil_alpha.c
index ad98cfa..06a1a6d 100644
--- a/libavcodec/alpha/dsputil_alpha.c
+++ b/libavcodec/alpha/dsputil_alpha.c
@@ -24,11 +24,6 @@
 #include "dsputil_alpha.h"
 #include "asm.h"
 
-void (*put_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels,
-                                 int line_size);
-void (*add_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels,
-                                 int line_size);
-
 #if 0
 /* These functions were the base for the optimized assembler routines,
    and remain here for documentation purposes.  */
@@ -107,11 +102,6 @@ av_cold void ff_dsputil_init_alpha(DSPContext *c, AVCodecContext *avctx)
 
     /* amask clears all bits that correspond to present features.  */
     if (amask(AMASK_MVI) == 0) {
-//      Disabled as these have been moved to a different context
-//      Patch to update these is welcome!
-//         c->put_pixels_clamped = put_pixels_clamped_mvi_asm;
-//         c->add_pixels_clamped = add_pixels_clamped_mvi_asm;
-
         if (!high_bit_depth)
             c->get_pixels   = get_pixels_mvi;
         c->diff_pixels      = diff_pixels_mvi;
@@ -124,16 +114,4 @@ av_cold void ff_dsputil_init_alpha(DSPContext *c, AVCodecContext *avctx)
         c->pix_abs[0][3]    = pix_abs16x16_xy2_mvi;
     }
 
-//      Disabled as these have been moved to a different context
-//      Patch to update these is welcome!
-//     put_pixels_clamped_axp_p = c->put_pixels_clamped;
-//     add_pixels_clamped_axp_p = c->add_pixels_clamped;
-//
-//     if (!avctx->lowres && avctx->bits_per_raw_sample <= 8 &&
-//         (avctx->idct_algo == FF_IDCT_AUTO ||
-//          avctx->idct_algo == FF_IDCT_SIMPLEALPHA)) {
-//         c->idct_put = ff_simple_idct_put_axp;
-//         c->idct_add = ff_simple_idct_add_axp;
-//         c->idct =     ff_simple_idct_axp;
-//     }
 }
diff --git a/libavcodec/alpha/dsputil_alpha.h b/libavcodec/alpha/dsputil_alpha.h
index 828cd16..bc29469 100644
--- a/libavcodec/alpha/dsputil_alpha.h
+++ b/libavcodec/alpha/dsputil_alpha.h
@@ -22,19 +22,6 @@
 #include <stddef.h>
 #include <stdint.h>
 
-void ff_simple_idct_axp(int16_t *block);
-void ff_simple_idct_put_axp(uint8_t *dest, int line_size, int16_t *block);
-void ff_simple_idct_add_axp(uint8_t *dest, int line_size, int16_t *block);
-
-void put_pixels_clamped_mvi_asm(const int16_t *block, uint8_t *pixels,
-                                int line_size);
-void add_pixels_clamped_mvi_asm(const int16_t *block, uint8_t *pixels,
-                                int line_size);
-extern void (*put_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels,
-                                        int line_size);
-extern void (*add_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels,
-                                        int line_size);
-
 void get_pixels_mvi(int16_t *restrict block,
                     const uint8_t *restrict pixels, int line_size);
 void diff_pixels_mvi(int16_t *block, const uint8_t *s1, const uint8_t *s2,
diff --git a/libavcodec/alpha/idctdsp_alpha.c b/libavcodec/alpha/idctdsp_alpha.c
new file mode 100644
index 0000000..73f4821
--- /dev/null
+++ b/libavcodec/alpha/idctdsp_alpha.c
@@ -0,0 +1,55 @@
+/*
+ * 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 "libavutil/attributes.h"
+#include "libavcodec/idctdsp.h"
+#include "idctdsp_alpha.h"
+#include "asm.h"
+
+void put_pixels_clamped_mvi_asm(const int16_t *block, uint8_t *pixels,
+                                int line_size);
+void add_pixels_clamped_mvi_asm(const int16_t *block, uint8_t *pixels,
+                                int line_size);
+
+void (*put_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels,
+                                 int line_size);
+void (*add_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels,
+                                 int line_size);
+
+av_cold void ff_idctdsp_init_alpha(IDCTDSPContext *c, AVCodecContext *avctx,
+                                   unsigned high_bit_depth)
+{
+    /* amask clears all bits that correspond to present features.  */
+    if (amask(AMASK_MVI) == 0) {
+        c->put_pixels_clamped = put_pixels_clamped_mvi_asm;
+        c->add_pixels_clamped = add_pixels_clamped_mvi_asm;
+    }
+
+    put_pixels_clamped_axp_p = c->put_pixels_clamped;
+    add_pixels_clamped_axp_p = c->add_pixels_clamped;
+
+    if (!high_bit_depth && !avctx->lowres &&
+        (avctx->idct_algo == FF_IDCT_AUTO ||
+         avctx->idct_algo == FF_IDCT_SIMPLEALPHA)) {
+        c->idct_put = ff_simple_idct_put_axp;
+        c->idct_add = ff_simple_idct_add_axp;
+        c->idct =     ff_simple_idct_axp;
+    }
+}
diff --git a/libavcodec/alpha/idctdsp_alpha.h b/libavcodec/alpha/idctdsp_alpha.h
new file mode 100644
index 0000000..e52cd80
--- /dev/null
+++ b/libavcodec/alpha/idctdsp_alpha.h
@@ -0,0 +1,34 @@
+/*
+ * 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
+ */
+
+#ifndef AVCODEC_ALPHA_IDCTDSP_ALPHA_H
+#define AVCODEC_ALPHA_IDCTDSP_ALPHA_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+extern void (*put_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels,
+                                        int line_size);
+extern void (*add_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels,
+                                        int line_size);
+
+void ff_simple_idct_axp(int16_t *block);
+void ff_simple_idct_put_axp(uint8_t *dest, int line_size, int16_t *block);
+void ff_simple_idct_add_axp(uint8_t *dest, int line_size, int16_t *block);
+
+#endif /* AVCODEC_ALPHA_IDCTDSP_ALPHA_H */
diff --git a/libavcodec/alpha/dsputil_alpha_asm.S b/libavcodec/alpha/idctdsp_alpha_asm.S
similarity index 99%
rename from libavcodec/alpha/dsputil_alpha_asm.S
rename to libavcodec/alpha/idctdsp_alpha_asm.S
index d801bcf..e3a8364 100644
--- a/libavcodec/alpha/dsputil_alpha_asm.S
+++ b/libavcodec/alpha/idctdsp_alpha_asm.S
@@ -1,5 +1,5 @@
 /*
- * Alpha optimized DSP utils
+ * Alpha optimized IDCT-related routines
  * Copyright (c) 2002 Falk Hueffner <falk at debian.org>
  *
  * This file is part of FFmpeg.
diff --git a/libavcodec/alpha/simple_idct_alpha.c b/libavcodec/alpha/simple_idct_alpha.c
index 3bd1b33..04be0ce 100644
--- a/libavcodec/alpha/simple_idct_alpha.c
+++ b/libavcodec/alpha/simple_idct_alpha.c
@@ -26,7 +26,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "dsputil_alpha.h"
+#include "idctdsp_alpha.h"
 #include "asm.h"
 
 // cos(i * M_PI / 16) * sqrt(2) * (1 << 14)
diff --git a/libavcodec/idctdsp.c b/libavcodec/idctdsp.c
index b0d4185..31a4854 100644
--- a/libavcodec/idctdsp.c
+++ b/libavcodec/idctdsp.c
@@ -299,6 +299,8 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
     c->put_signed_pixels_clamped = put_signed_pixels_clamped_c;
     c->add_pixels_clamped        = add_pixels_clamped_c;
 
+    if (ARCH_ALPHA)
+        ff_idctdsp_init_alpha(c, avctx, high_bit_depth);
     if (ARCH_ARM)
         ff_idctdsp_init_arm(c, avctx, high_bit_depth);
     if (ARCH_PPC)
diff --git a/libavcodec/idctdsp.h b/libavcodec/idctdsp.h
index d93790e..b1fa6e2 100644
--- a/libavcodec/idctdsp.h
+++ b/libavcodec/idctdsp.h
@@ -94,6 +94,8 @@ typedef struct IDCTDSPContext {
 
 void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx);
 
+void ff_idctdsp_init_alpha(IDCTDSPContext *c, AVCodecContext *avctx,
+                           unsigned high_bit_depth);
 void ff_idctdsp_init_arm(IDCTDSPContext *c, AVCodecContext *avctx,
                          unsigned high_bit_depth);
 void ff_idctdsp_init_ppc(IDCTDSPContext *c, AVCodecContext *avctx,



More information about the ffmpeg-cvslog mailing list