From 182f56cb0ce5136fe43dc4ec72d60f6a55834e84 Mon Sep 17 00:00:00 2001 From: Aurelien Jacobs Date: Tue, 27 Nov 2007 22:23:34 +0000 Subject: [PATCH] make ff_p* vars extern so that they can be used in various *_mmx.c files Originally committed as revision 11100 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/i386/cavsdsp_mmx.c | 8 +---- libavcodec/i386/dsputil_mmx.c | 53 +++++++++++++++++-------------- libavcodec/i386/dsputil_mmx.h | 56 +++++++++++++++++++++++++++++++++ libavcodec/i386/h264dsp_mmx.c | 1 + libavcodec/i386/mpegvideo_mmx.c | 4 +-- libavcodec/i386/vc1dsp_mmx.c | 4 +-- 6 files changed, 89 insertions(+), 37 deletions(-) create mode 100644 libavcodec/i386/dsputil_mmx.h diff --git a/libavcodec/i386/cavsdsp_mmx.c b/libavcodec/i386/cavsdsp_mmx.c index 6230533144..c509d09c78 100644 --- a/libavcodec/i386/cavsdsp_mmx.c +++ b/libavcodec/i386/cavsdsp_mmx.c @@ -23,15 +23,9 @@ */ #include "dsputil.h" +#include "dsputil_mmx.h" #include "common.h" -DECLARE_ALIGNED_8(static const uint64_t,ff_pw_4 ) = 0x0004000400040004ULL; -DECLARE_ALIGNED_8(static const uint64_t,ff_pw_5 ) = 0x0005000500050005ULL; -DECLARE_ALIGNED_8(static const uint64_t,ff_pw_7 ) = 0x0007000700070007ULL; -DECLARE_ALIGNED_8(static const uint64_t,ff_pw_42) = 0x002A002A002A002AULL; -DECLARE_ALIGNED_8(static const uint64_t,ff_pw_64) = 0x0040004000400040ULL; -DECLARE_ALIGNED_8(static const uint64_t,ff_pw_96) = 0x0060006000600060ULL; - /***************************************************************************** * * inverse transform diff --git a/libavcodec/i386/dsputil_mmx.c b/libavcodec/i386/dsputil_mmx.c index 1310eb4eef..2649a286b9 100644 --- a/libavcodec/i386/dsputil_mmx.c +++ b/libavcodec/i386/dsputil_mmx.c @@ -23,6 +23,7 @@ */ #include "dsputil.h" +#include "dsputil_mmx.h" #include "simple_idct.h" #include "mpegvideo.h" #include "x86_cpu.h" @@ -40,33 +41,37 @@ extern void ff_idct_xvid_mmx2(short *block); int mm_flags; /* multimedia extension flags */ /* pixel operations */ -static const uint64_t mm_bone attribute_used __attribute__ ((aligned(8))) = 0x0101010101010101ULL; -static const uint64_t mm_wone attribute_used __attribute__ ((aligned(8))) = 0x0001000100010001ULL; -static const uint64_t mm_wtwo attribute_used __attribute__ ((aligned(8))) = 0x0002000200020002ULL; +DECLARE_ALIGNED_8 (const uint64_t, mm_bone) = 0x0101010101010101ULL; +DECLARE_ALIGNED_8 (const uint64_t, mm_wone) = 0x0001000100010001ULL; +DECLARE_ALIGNED_8 (const uint64_t, mm_wtwo) = 0x0002000200020002ULL; +DECLARE_ALIGNED_8 (const uint64_t, mm_wabs) = 0xFFFFFFFFFFFFFFFFULL; -static const uint64_t ff_pdw_80000000[2] attribute_used __attribute__ ((aligned(16))) = +DECLARE_ALIGNED_16(const uint64_t, ff_pdw_80000000[2]) = {0x8000000080000000ULL, 0x8000000080000000ULL}; -static const uint64_t ff_pw_20 attribute_used __attribute__ ((aligned(8))) = 0x0014001400140014ULL; -static const uint64_t ff_pw_3 attribute_used __attribute__ ((aligned(8))) = 0x0003000300030003ULL; -static const uint64_t ff_pw_4 attribute_used __attribute__ ((aligned(8))) = 0x0004000400040004ULL; -static const uint64_t ff_pw_5 attribute_used __attribute__ ((aligned(8))) = 0x0005000500050005ULL; -static const uint64_t ff_pw_8 attribute_used __attribute__ ((aligned(8))) = 0x0008000800080008ULL; -static const uint64_t ff_pw_16 attribute_used __attribute__ ((aligned(8))) = 0x0010001000100010ULL; -static const uint64_t ff_pw_32 attribute_used __attribute__ ((aligned(8))) = 0x0020002000200020ULL; -static const uint64_t ff_pw_64 attribute_used __attribute__ ((aligned(8))) = 0x0040004000400040ULL; -static const uint64_t ff_pw_15 attribute_used __attribute__ ((aligned(8))) = 0x000F000F000F000FULL; - -static const uint64_t ff_pb_1 attribute_used __attribute__ ((aligned(8))) = 0x0101010101010101ULL; -static const uint64_t ff_pb_3 attribute_used __attribute__ ((aligned(8))) = 0x0303030303030303ULL; -static const uint64_t ff_pb_7 attribute_used __attribute__ ((aligned(8))) = 0x0707070707070707ULL; -static const uint64_t ff_pb_3F attribute_used __attribute__ ((aligned(8))) = 0x3F3F3F3F3F3F3F3FULL; -static const uint64_t ff_pb_A1 attribute_used __attribute__ ((aligned(8))) = 0xA1A1A1A1A1A1A1A1ULL; -static const uint64_t ff_pb_5F attribute_used __attribute__ ((aligned(8))) = 0x5F5F5F5F5F5F5F5FULL; -static const uint64_t ff_pb_FC attribute_used __attribute__ ((aligned(8))) = 0xFCFCFCFCFCFCFCFCULL; - -static const double ff_pd_1[2] attribute_used __attribute__ ((aligned(16))) = { 1.0, 1.0 }; -static const double ff_pd_2[2] attribute_used __attribute__ ((aligned(16))) = { 2.0, 2.0 }; +DECLARE_ALIGNED_8 (const uint64_t, ff_pw_3 ) = 0x0003000300030003ULL; +DECLARE_ALIGNED_8 (const uint64_t, ff_pw_4 ) = 0x0004000400040004ULL; +DECLARE_ALIGNED_8 (const uint64_t, ff_pw_5 ) = 0x0005000500050005ULL; +DECLARE_ALIGNED_8 (const uint64_t, ff_pw_8 ) = 0x0008000800080008ULL; +DECLARE_ALIGNED_8 (const uint64_t, ff_pw_15 ) = 0x000F000F000F000FULL; +DECLARE_ALIGNED_8 (const uint64_t, ff_pw_16 ) = 0x0010001000100010ULL; +DECLARE_ALIGNED_8 (const uint64_t, ff_pw_20 ) = 0x0014001400140014ULL; +DECLARE_ALIGNED_8 (const uint64_t, ff_pw_32 ) = 0x0020002000200020ULL; +DECLARE_ALIGNED_8 (const uint64_t, ff_pw_42 ) = 0x002A002A002A002AULL; +DECLARE_ALIGNED_8 (const uint64_t, ff_pw_64 ) = 0x0040004000400040ULL; +DECLARE_ALIGNED_8 (const uint64_t, ff_pw_96 ) = 0x0060006000600060ULL; +DECLARE_ALIGNED_16(const uint64_t, ff_pw_128) = 0x0080008000800080ULL; + +DECLARE_ALIGNED_8 (const uint64_t, ff_pb_1 ) = 0x0101010101010101ULL; +DECLARE_ALIGNED_8 (const uint64_t, ff_pb_3 ) = 0x0303030303030303ULL; +DECLARE_ALIGNED_8 (const uint64_t, ff_pb_7 ) = 0x0707070707070707ULL; +DECLARE_ALIGNED_8 (const uint64_t, ff_pb_3F ) = 0x3F3F3F3F3F3F3F3FULL; +DECLARE_ALIGNED_8 (const uint64_t, ff_pb_5F ) = 0x5F5F5F5F5F5F5F5FULL; +DECLARE_ALIGNED_8 (const uint64_t, ff_pb_A1 ) = 0xA1A1A1A1A1A1A1A1ULL; +DECLARE_ALIGNED_8 (const uint64_t, ff_pb_FC ) = 0xFCFCFCFCFCFCFCFCULL; + +DECLARE_ALIGNED_16(const double, ff_pd_1[2]) = { 1.0, 1.0 }; +DECLARE_ALIGNED_16(const double, ff_pd_2[2]) = { 2.0, 2.0 }; #define JUMPALIGN() __asm __volatile (ASMALIGN(3)::) #define MOVQ_ZERO(regd) __asm __volatile ("pxor %%" #regd ", %%" #regd ::) diff --git a/libavcodec/i386/dsputil_mmx.h b/libavcodec/i386/dsputil_mmx.h new file mode 100644 index 0000000000..96c920da78 --- /dev/null +++ b/libavcodec/i386/dsputil_mmx.h @@ -0,0 +1,56 @@ +/* + * MMX optimized DSP utils + * Copyright (c) 2007 Aurelien Jacobs + * + * 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 FFMPEG_DSPUTIL_MMX_H +#define FFMPEG_DSPUTIL_MMX_H + +extern const uint64_t mm_bone; +extern const uint64_t mm_wone; +extern const uint64_t mm_wtwo; +extern const uint64_t mm_wabs; + +extern const uint64_t ff_pdw_80000000[2]; + +extern const uint64_t ff_pw_3; +extern const uint64_t ff_pw_4; +extern const uint64_t ff_pw_5; +extern const uint64_t ff_pw_8; +extern const uint64_t ff_pw_15; +extern const uint64_t ff_pw_16; +extern const uint64_t ff_pw_20; +extern const uint64_t ff_pw_32; +extern const uint64_t ff_pw_42; +extern const uint64_t ff_pw_64; +extern const uint64_t ff_pw_96; +extern const uint64_t ff_pw_128; + +extern const uint64_t ff_pb_1; +extern const uint64_t ff_pb_3; +extern const uint64_t ff_pb_7; +extern const uint64_t ff_pb_3F; +extern const uint64_t ff_pb_5F; +extern const uint64_t ff_pb_A1; +extern const uint64_t ff_pb_FC; + +extern const double ff_pd_1[2]; +extern const double ff_pd_2[2]; + +#endif /* FFMPEG_DSPUTIL_MMX_H */ diff --git a/libavcodec/i386/h264dsp_mmx.c b/libavcodec/i386/h264dsp_mmx.c index df6cedae1c..879da6e3cc 100644 --- a/libavcodec/i386/h264dsp_mmx.c +++ b/libavcodec/i386/h264dsp_mmx.c @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "dsputil_mmx.h" /***********************************/ /* IDCT */ diff --git a/libavcodec/i386/mpegvideo_mmx.c b/libavcodec/i386/mpegvideo_mmx.c index 8b7e62c673..bc91c56ac3 100644 --- a/libavcodec/i386/mpegvideo_mmx.c +++ b/libavcodec/i386/mpegvideo_mmx.c @@ -23,15 +23,13 @@ */ #include "dsputil.h" +#include "dsputil_mmx.h" #include "mpegvideo.h" #include "avcodec.h" #include "x86_cpu.h" extern uint16_t inv_zigzag_direct16[64]; -static const unsigned long long int mm_wabs __attribute__ ((aligned(8))) = 0xffffffffffffffffULL; -static const unsigned long long int mm_wone __attribute__ ((aligned(8))) = 0x0001000100010001ULL; - static void dct_unquantize_h263_intra_mmx(MpegEncContext *s, DCTELEM *block, int n, int qscale) diff --git a/libavcodec/i386/vc1dsp_mmx.c b/libavcodec/i386/vc1dsp_mmx.c index 7fe473e21d..418c2bd407 100644 --- a/libavcodec/i386/vc1dsp_mmx.c +++ b/libavcodec/i386/vc1dsp_mmx.c @@ -25,6 +25,7 @@ */ #include "dsputil.h" +#include "dsputil_mmx.h" #include "x86_cpu.h" /** Add rounder from mm7 to mm3 and pack result at destination */ @@ -103,9 +104,6 @@ static void vc1_put_ver_16b_shift2_mmx(int16_t *dst, ); } -/** To remove bias allowing use of MMX 16bits arithmetic */ -DECLARE_ALIGNED_16(static const uint64_t, ff_pw_128) = 0x0080008000800080ULL; - /** * Data is already unpacked, so some operations can directly be made from * memory.