Hi, On Mon, Oct 12, 2015 at 1:37 PM, Christophe Gisquet < christophe.gisq...@gmail.com> wrote:
> This should be reused for a generic simple_idct10 function. > Requires a bit of trickery to declare common constants in C. > --- > libavcodec/x86/constants.c | 28 +++ > libavcodec/x86/constants.h | 16 ++ > libavcodec/x86/proresdsp.asm | 263 +------------------------- > libavcodec/x86/simple_idct10_template.asm | 299 > ++++++++++++++++++++++++++++++ > 4 files changed, 346 insertions(+), 260 deletions(-) > create mode 100644 libavcodec/x86/simple_idct10_template.asm > > diff --git a/libavcodec/x86/constants.c b/libavcodec/x86/constants.c > index 3f3ee0f..9592fa7 100644 > --- a/libavcodec/x86/constants.c > +++ b/libavcodec/x86/constants.c > @@ -87,3 +87,31 @@ DECLARE_ALIGNED(32, const ymm_reg, ff_pd_32) = { > 0x0000002000000020ULL, 0x000 > > 0x0000002000000020ULL, 0x0000002000000020ULL }; > DECLARE_ALIGNED(32, const ymm_reg, ff_pd_65535)= { > 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, > > 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL }; > + > +/* simple idct 10 */ > +#define W1sh2 22725 // W1 = 90901 = 22725<<2 + 1 > +#define W2sh2 21407 // W2 = 85627 = 21407<<2 - 1 > +#define W3sh2 19265 // W3 = 77062 = 19265<<2 + 2 > +#define W4sh2 16384 // W4 = 65535 = 16384<<2 - 1 > +#define W5sh2 12873 // W5 = 51491 = 12873<<2 - 1 > +#define W6sh2 8867 // W6 = 35468 = 8867<<2 > +#define W7sh2 4520 // W7 = 18081 = 4520<<2 + 1 > + > +#define TIMES4(a, b) > \ > + > > (((b)&0xFFFFLL)<<48)+(((a)&0xFFFFLL)<<32)+(((b)&0xFFFFLL)<<16)+((a)&0xFFFFLL), > \ > + > (((b)&0xFFFFLL)<<48)+(((a)&0xFFFFLL)<<32)+(((b)&0xFFFFLL)<<16)+((a)&0xFFFFLL) > + > +#if ARCH_X86_64 > +DECLARE_ALIGNED(16, const xmm_reg, ff_w4_plus_w2) = { TIMES4(W4sh2, > W2sh2) }; > +DECLARE_ALIGNED(16, const xmm_reg, ff_w4_min_w2) = { TIMES4(W4sh2, > -W2sh2) }; > +DECLARE_ALIGNED(16, const xmm_reg, ff_w4_plus_w6) = { TIMES4(W4sh2, > +W6sh2) }; > +DECLARE_ALIGNED(16, const xmm_reg, ff_w4_min_w6) = { TIMES4(W4sh2, > -W6sh2) }; > +DECLARE_ALIGNED(16, const xmm_reg, ff_w1_plus_w3) = { TIMES4(W1sh2, > +W3sh2) }; > +DECLARE_ALIGNED(16, const xmm_reg, ff_w3_min_w1) = { TIMES4(W3sh2, > -W1sh2) }; > +DECLARE_ALIGNED(16, const xmm_reg, ff_w7_plus_w3) = { TIMES4(W7sh2, > +W3sh2) }; > +DECLARE_ALIGNED(16, const xmm_reg, ff_w3_min_w7) = { TIMES4(W3sh2, > -W7sh2) }; > +DECLARE_ALIGNED(16, const xmm_reg, ff_w1_plus_w5) = { TIMES4(W1sh2, > +W5sh2) }; > +DECLARE_ALIGNED(16, const xmm_reg, ff_w5_min_w1) = { TIMES4(W5sh2, > -W1sh2) }; > +DECLARE_ALIGNED(16, const xmm_reg, ff_w5_plus_w7) = { TIMES4(W5sh2, > +W7sh2) }; > +DECLARE_ALIGNED(16, const xmm_reg, ff_w7_min_w5) = { TIMES4(W7sh2, > -W5sh2) }; > +#endif No no no no no no no no no no no no no no no ^1000001. Check out "const" in x86inc.asm. %macro mymacro 2 const w4_plus_w2 times 4 dw %1, %2 %endmacro mymacro(W4sh2, W2sh2) etc. And then use cextern in the files where you want to access this constant. Ronald _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel