aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2014-08-31 11:45:15 -0700
committerDiego Biurrun <diego@biurrun.de>2014-09-02 14:41:13 -0700
commit95c0cec03acec0a80cc1c7db48f3b2355d9e767b (patch)
treee1ad21afa12a7f9b90b9d14ca0102bc7ab5b5904
parent91d305790ea0f6fe0f54b48236da42181c39c18b (diff)
downloadffmpeg-95c0cec03acec0a80cc1c7db48f3b2355d9e767b.tar.gz
idctdsp: Add global function pointers for {add|put}_pixels_clamped functions
These function pointers already existed in the ARM code. Adding them globally allows calls to the function pointers to access arch-optimized versions of the functions transparently.
-rw-r--r--libavcodec/arm/idctdsp_init_arm.c7
-rw-r--r--libavcodec/dct.h2
-rw-r--r--libavcodec/idctdsp.c22
-rw-r--r--libavcodec/idctdsp.h3
-rw-r--r--libavcodec/jrevdct.c14
-rw-r--r--libavcodec/x86/simple_idct.c7
6 files changed, 32 insertions, 23 deletions
diff --git a/libavcodec/arm/idctdsp_init_arm.c b/libavcodec/arm/idctdsp_init_arm.c
index 0b32df0613..8207c31589 100644
--- a/libavcodec/arm/idctdsp_init_arm.c
+++ b/libavcodec/arm/idctdsp_init_arm.c
@@ -29,10 +29,6 @@
#include "idct.h"
#include "idctdsp_arm.h"
-/* XXX: local hack */
-static void (*ff_put_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size);
-static void (*ff_add_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size);
-
void ff_add_pixels_clamped_arm(const int16_t *block, uint8_t *dest,
int line_size);
@@ -67,9 +63,6 @@ av_cold void ff_idctdsp_init_arm(IDCTDSPContext *c, AVCodecContext *avctx,
{
int cpu_flags = av_get_cpu_flags();
- ff_put_pixels_clamped = c->put_pixels_clamped;
- ff_add_pixels_clamped = c->add_pixels_clamped;
-
if (!high_bit_depth) {
if (avctx->idct_algo == FF_IDCT_AUTO ||
avctx->idct_algo == FF_IDCT_ARM) {
diff --git a/libavcodec/dct.h b/libavcodec/dct.h
index 3fd4e27833..4a31f54fcb 100644
--- a/libavcodec/dct.h
+++ b/libavcodec/dct.h
@@ -59,5 +59,7 @@ void ff_fdct248_islow_8(int16_t *data);
void ff_fdct248_islow_10(int16_t *data);
void ff_j_rev_dct(int16_t *data);
+void ff_jref_idct_put(uint8_t *dest, int line_size, int16_t *block);
+void ff_jref_idct_add(uint8_t *dest, int line_size, int16_t *block);
#endif /* AVCODEC_DCT_H */
diff --git a/libavcodec/idctdsp.c b/libavcodec/idctdsp.c
index 6beb2b2acc..2a979bc581 100644
--- a/libavcodec/idctdsp.c
+++ b/libavcodec/idctdsp.c
@@ -79,6 +79,9 @@ av_cold void ff_init_scantable_permutation(uint8_t *idct_permutation,
}
}
+void (*ff_put_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size);
+void (*ff_add_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size);
+
static void put_pixels_clamped_c(const int16_t *block, uint8_t *restrict pixels,
int line_size)
{
@@ -141,18 +144,6 @@ static void add_pixels_clamped_c(const int16_t *block, uint8_t *restrict pixels,
}
}
-static void jref_idct_put(uint8_t *dest, int line_size, int16_t *block)
-{
- ff_j_rev_dct(block);
- put_pixels_clamped_c(block, dest, line_size);
-}
-
-static void jref_idct_add(uint8_t *dest, int line_size, int16_t *block)
-{
- ff_j_rev_dct(block);
- add_pixels_clamped_c(block, dest, line_size);
-}
-
av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
{
const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8;
@@ -163,8 +154,8 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
c->idct = ff_simple_idct_10;
c->perm_type = FF_IDCT_PERM_NONE;
} else if (avctx->idct_algo == FF_IDCT_INT) {
- c->idct_put = jref_idct_put;
- c->idct_add = jref_idct_add;
+ c->idct_put = ff_jref_idct_put;
+ c->idct_add = ff_jref_idct_add;
c->idct = ff_j_rev_dct;
c->perm_type = FF_IDCT_PERM_LIBMPEG2;
} else if (avctx->idct_algo == FF_IDCT_FAAN) {
@@ -183,6 +174,9 @@ 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;
+ ff_put_pixels_clamped = c->put_pixels_clamped;
+ ff_add_pixels_clamped = c->add_pixels_clamped;
+
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 b88cc829c2..c49a4ca15a 100644
--- a/libavcodec/idctdsp.h
+++ b/libavcodec/idctdsp.h
@@ -95,6 +95,9 @@ typedef struct IDCTDSPContext {
enum idct_permutation_type perm_type;
} IDCTDSPContext;
+extern void (*ff_put_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size);
+extern void (*ff_add_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size);
+
void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx);
void ff_idctdsp_init_arm(IDCTDSPContext *c, AVCodecContext *avctx,
diff --git a/libavcodec/jrevdct.c b/libavcodec/jrevdct.c
index e6846a1d78..8261269b25 100644
--- a/libavcodec/jrevdct.c
+++ b/libavcodec/jrevdct.c
@@ -63,7 +63,9 @@
*/
#include "libavutil/common.h"
+
#include "dct.h"
+#include "idctdsp.h"
#define EIGHT_BIT_SAMPLES
@@ -940,3 +942,15 @@ void ff_j_rev_dct(DCTBLOCK data)
dataptr++; /* advance pointer to next column */
}
}
+
+void ff_jref_idct_put(uint8_t *dest, int line_size, int16_t *block)
+{
+ ff_j_rev_dct(block);
+ ff_put_pixels_clamped(block, dest, line_size);
+}
+
+void ff_jref_idct_add(uint8_t *dest, int line_size, int16_t *block)
+{
+ ff_j_rev_dct(block);
+ ff_add_pixels_clamped(block, dest, line_size);
+}
diff --git a/libavcodec/x86/simple_idct.c b/libavcodec/x86/simple_idct.c
index 1002a782c0..71763dbf75 100644
--- a/libavcodec/x86/simple_idct.c
+++ b/libavcodec/x86/simple_idct.c
@@ -23,6 +23,9 @@
#include "libavutil/internal.h"
#include "libavutil/mem.h"
#include "libavutil/x86/asm.h"
+
+#include "libavcodec/idctdsp.h"
+
#include "idctdsp.h"
#include "simple_idct.h"
@@ -1159,12 +1162,12 @@ void ff_simple_idct_mmx(int16_t *block)
void ff_simple_idct_put_mmx(uint8_t *dest, int line_size, int16_t *block)
{
idct(block);
- ff_put_pixels_clamped_mmx(block, dest, line_size);
+ ff_put_pixels_clamped(block, dest, line_size);
}
void ff_simple_idct_add_mmx(uint8_t *dest, int line_size, int16_t *block)
{
idct(block);
- ff_add_pixels_clamped_mmx(block, dest, line_size);
+ ff_add_pixels_clamped(block, dest, line_size);
}
#endif /* HAVE_INLINE_ASM */