Commit 375cd3f2 authored by Clément Bœsch's avatar Clément Bœsch

pp: rework the way templating is done.

This refactoring simplifies the usage of the template: define the
profile and include the template is all that is required. It should now
be easier to add more instruction sets.

The HAVE_* flags are changed with TEMPLATE_PP_* setting to avoid messing
them up.

See the top comment in postprocess_template.c for details.
parent 6535d81d
......@@ -538,85 +538,37 @@ static av_always_inline void do_a_deblock_C(uint8_t *src, int step, int stride,
//Note: we have C, MMX, MMX2, 3DNOW version there is no 3DNOW+MMX2 one
//Plain C versions
//we always compile C for testing which needs bitexactness
#define COMPILE_C
#if HAVE_ALTIVEC
#define COMPILE_ALTIVEC
#endif //HAVE_ALTIVEC
#if ARCH_X86 && HAVE_INLINE_ASM
#if (HAVE_MMX_INLINE && !HAVE_AMD3DNOW_INLINE && !HAVE_MMXEXT_INLINE) || CONFIG_RUNTIME_CPUDETECT
#define COMPILE_MMX
#endif
#if HAVE_MMXEXT_INLINE || CONFIG_RUNTIME_CPUDETECT
#define COMPILE_MMX2
#endif
#if (HAVE_AMD3DNOW_INLINE && !HAVE_MMXEXT_INLINE) || CONFIG_RUNTIME_CPUDETECT
#define COMPILE_3DNOW
#endif
#endif /* ARCH_X86 */
#undef HAVE_MMX_INLINE
#define HAVE_MMX_INLINE 0
#undef HAVE_MMXEXT_INLINE
#define HAVE_MMXEXT_INLINE 0
#undef HAVE_AMD3DNOW_INLINE
#define HAVE_AMD3DNOW_INLINE 0
#undef HAVE_ALTIVEC
#define HAVE_ALTIVEC 0
#ifdef COMPILE_C
#define RENAME(a) a ## _C
#include "postprocess_template.c"
#endif
#ifdef COMPILE_ALTIVEC
#undef RENAME
#undef HAVE_ALTIVEC
#define HAVE_ALTIVEC 1
#define RENAME(a) a ## _altivec
#include "postprocess_altivec_template.c"
#include "postprocess_template.c"
#endif
//MMX versions
#ifdef COMPILE_MMX
#undef RENAME
#undef HAVE_MMX_INLINE
#define HAVE_MMX_INLINE 1
#define RENAME(a) a ## _MMX
#define TEMPLATE_PP_C 1
#include "postprocess_template.c"
#endif
//MMX2 versions
#ifdef COMPILE_MMX2
#undef RENAME
#undef HAVE_MMX_INLINE
#undef HAVE_MMXEXT_INLINE
#define HAVE_MMX_INLINE 1
#define HAVE_MMXEXT_INLINE 1
#define RENAME(a) a ## _MMX2
#include "postprocess_template.c"
#if HAVE_ALTIVEC
# define TEMPLATE_PP_ALTIVEC 1
# include "postprocess_altivec_template.c"
# include "postprocess_template.c"
#endif
//3DNOW versions
#ifdef COMPILE_3DNOW
#undef RENAME
#undef HAVE_MMX_INLINE
#undef HAVE_MMXEXT_INLINE
#undef HAVE_AMD3DNOW_INLINE
#define HAVE_MMX_INLINE 1
#define HAVE_MMXEXT_INLINE 0
#define HAVE_AMD3DNOW_INLINE 1
#define RENAME(a) a ## _3DNow
#include "postprocess_template.c"
#if ARCH_X86 && HAVE_INLINE_ASM
# if CONFIG_RUNTIME_CPUDETECT
# define TEMPLATE_PP_MMX 1
# include "postprocess_template.c"
# define TEMPLATE_PP_MMXEXT 1
# include "postprocess_template.c"
# define TEMPLATE_PP_3DNOW 1
# include "postprocess_template.c"
# else
# if HAVE_MMXEXT_INLINE
# define TEMPLATE_PP_MMXEXT 1
# include "postprocess_template.c"
# elif HAVE_AMD3DNOW_INLINE
# define TEMPLATE_PP_3DNOW 1
# include "postprocess_template.c"
# elif HAVE_MMX_INLINE
# define TEMPLATE_PP_MMX 1
# include "postprocess_template.c"
# endif
# endif
#endif
// minor note: the HAVE_xyz is messed up after that line so do not use it.
static inline void postProcess(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
const QP_STORE_T QPs[], int QPStride, int isColor, pp_mode *vm, pp_context *vc)
{
......
......@@ -825,7 +825,7 @@ static inline void dering_altivec(uint8_t src[], int stride, PPContext *c) {
#define doHorizDefFilter_altivec(a...) doHorizDefFilter_C(a)
#define do_a_deblock_altivec(a...) do_a_deblock_C(a)
static inline void RENAME(tempNoiseReducer)(uint8_t *src, int stride,
static inline void tempNoiseReducer_altivec(uint8_t *src, int stride,
uint8_t *tempBlurred, uint32_t *tempBlurredPast, int *maxNoise)
{
const vector signed char neg1 = vec_splat_s8(-1);
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment