alpha/idctdsp: move idct init code out of dsputil
authorJames Almer <jamrial@gmail.com>
Tue, 8 Jul 2014 20:08:24 +0000 (17:08 -0300)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 8 Jul 2014 20:19:38 +0000 (22:19 +0200)
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/alpha/Makefile
libavcodec/alpha/dsputil_alpha.c
libavcodec/alpha/dsputil_alpha.h
libavcodec/alpha/idctdsp_alpha.c [new file with mode: 0644]
libavcodec/alpha/idctdsp_alpha.h [new file with mode: 0644]
libavcodec/alpha/idctdsp_alpha_asm.S [moved from libavcodec/alpha/dsputil_alpha_asm.S with 99% similarity]
libavcodec/alpha/simple_idct_alpha.c
libavcodec/idctdsp.c
libavcodec/idctdsp.h

index 8b7f1ab..34e5275 100644 (file)
@@ -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
index ad98cfa..06a1a6d 100644 (file)
 #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;
-//     }
 }
index 828cd16..bc29469 100644 (file)
 #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 (file)
index 0000000..73f4821
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2002 Falk Hueffner <falk@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 (file)
index 0000000..e52cd80
--- /dev/null
@@ -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 */
similarity index 99%
rename from libavcodec/alpha/dsputil_alpha_asm.S
rename to libavcodec/alpha/idctdsp_alpha_asm.S
index d801bcf..e3a8364 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Alpha optimized DSP utils
+ * Alpha optimized IDCT-related routines
  * Copyright (c) 2002 Falk Hueffner <falk@debian.org>
  *
  * This file is part of FFmpeg.
index 3bd1b33..04be0ce 100644 (file)
@@ -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)
index b0d4185..31a4854 100644 (file)
@@ -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)
index d93790e..b1fa6e2 100644 (file)
@@ -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,