ffmpeg / libavcodec / i386 / dsputil_mmx.h @ 97d1d009
History | View | Annotate | Download (3.77 KB)
1 |
/*
|
---|---|
2 |
* MMX optimized DSP utils
|
3 |
* Copyright (c) 2007 Aurelien Jacobs <aurel@gnuage.org>
|
4 |
*
|
5 |
* This file is part of FFmpeg.
|
6 |
*
|
7 |
* FFmpeg is free software; you can redistribute it and/or
|
8 |
* modify it under the terms of the GNU Lesser General Public
|
9 |
* License as published by the Free Software Foundation; either
|
10 |
* version 2.1 of the License, or (at your option) any later version.
|
11 |
*
|
12 |
* FFmpeg is distributed in the hope that it will be useful,
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15 |
* Lesser General Public License for more details.
|
16 |
*
|
17 |
* You should have received a copy of the GNU Lesser General Public
|
18 |
* License along with FFmpeg; if not, write to the Free Software
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
20 |
*/
|
21 |
|
22 |
#ifndef FFMPEG_DSPUTIL_MMX_H
|
23 |
#define FFMPEG_DSPUTIL_MMX_H
|
24 |
|
25 |
#include <stdint.h> |
26 |
#include "dsputil.h" |
27 |
|
28 |
typedef struct { uint64_t a, b; } xmm_t; |
29 |
|
30 |
extern const uint64_t ff_bone; |
31 |
extern const uint64_t ff_wtwo; |
32 |
|
33 |
extern const uint64_t ff_pdw_80000000[2]; |
34 |
|
35 |
extern const uint64_t ff_pw_3; |
36 |
extern const uint64_t ff_pw_4; |
37 |
extern const xmm_t ff_pw_5; |
38 |
extern const uint64_t ff_pw_8; |
39 |
extern const uint64_t ff_pw_15; |
40 |
extern const xmm_t ff_pw_16; |
41 |
extern const uint64_t ff_pw_20; |
42 |
extern const xmm_t ff_pw_32; |
43 |
extern const uint64_t ff_pw_42; |
44 |
extern const uint64_t ff_pw_64; |
45 |
extern const uint64_t ff_pw_96; |
46 |
extern const uint64_t ff_pw_128; |
47 |
extern const uint64_t ff_pw_255; |
48 |
|
49 |
extern const uint64_t ff_pb_1; |
50 |
extern const uint64_t ff_pb_3; |
51 |
extern const uint64_t ff_pb_7; |
52 |
extern const uint64_t ff_pb_3F; |
53 |
extern const uint64_t ff_pb_A1; |
54 |
extern const uint64_t ff_pb_FC; |
55 |
|
56 |
extern const double ff_pd_1[2]; |
57 |
extern const double ff_pd_2[2]; |
58 |
|
59 |
/* in/out: mma=mma+mmb, mmb=mmb-mma */
|
60 |
#define SUMSUB_BA( a, b ) \
|
61 |
"paddw "#b", "#a" \n\t"\ |
62 |
"paddw "#b", "#b" \n\t"\ |
63 |
"psubw "#a", "#b" \n\t" |
64 |
|
65 |
#define SBUTTERFLY(a,b,t,n,m)\
|
66 |
"mov" #m " " #a ", " #t " \n\t" /* abcd */\ |
67 |
"punpckl" #n " " #b ", " #a " \n\t" /* aebf */\ |
68 |
"punpckh" #n " " #b ", " #t " \n\t" /* cgdh */\ |
69 |
|
70 |
#define TRANSPOSE4(a,b,c,d,t)\
|
71 |
SBUTTERFLY(a,b,t,wd,q) /* a=aebf t=cgdh */\
|
72 |
SBUTTERFLY(c,d,b,wd,q) /* c=imjn b=kolp */\
|
73 |
SBUTTERFLY(a,c,d,dq,q) /* a=aeim d=bfjn */\
|
74 |
SBUTTERFLY(t,b,c,dq,q) /* t=cgko c=dhlp */
|
75 |
|
76 |
#ifdef ARCH_X86_64
|
77 |
// permutes 01234567 -> 05736421
|
78 |
#define TRANSPOSE8(a,b,c,d,e,f,g,h,t)\
|
79 |
SBUTTERFLY(a,b,%%xmm8,wd,dqa)\ |
80 |
SBUTTERFLY(c,d,b,wd,dqa)\ |
81 |
SBUTTERFLY(e,f,d,wd,dqa)\ |
82 |
SBUTTERFLY(g,h,f,wd,dqa)\ |
83 |
SBUTTERFLY(a,c,h,dq,dqa)\ |
84 |
SBUTTERFLY(%%xmm8,b,c,dq,dqa)\ |
85 |
SBUTTERFLY(e,g,b,dq,dqa)\ |
86 |
SBUTTERFLY(d,f,g,dq,dqa)\ |
87 |
SBUTTERFLY(a,e,f,qdq,dqa)\ |
88 |
SBUTTERFLY(%%xmm8,d,e,qdq,dqa)\ |
89 |
SBUTTERFLY(h,b,d,qdq,dqa)\ |
90 |
SBUTTERFLY(c,g,b,qdq,dqa)\ |
91 |
"movdqa %%xmm8, "#g" \n\t" |
92 |
#else
|
93 |
#define TRANSPOSE8(a,b,c,d,e,f,g,h,t)\
|
94 |
"movdqa "#h", "#t" \n\t"\ |
95 |
SBUTTERFLY(a,b,h,wd,dqa)\ |
96 |
"movdqa "#h", 16"#t" \n\t"\ |
97 |
"movdqa "#t", "#h" \n\t"\ |
98 |
SBUTTERFLY(c,d,b,wd,dqa)\ |
99 |
SBUTTERFLY(e,f,d,wd,dqa)\ |
100 |
SBUTTERFLY(g,h,f,wd,dqa)\ |
101 |
SBUTTERFLY(a,c,h,dq,dqa)\ |
102 |
"movdqa "#h", "#t" \n\t"\ |
103 |
"movdqa 16"#t", "#h" \n\t"\ |
104 |
SBUTTERFLY(h,b,c,dq,dqa)\ |
105 |
SBUTTERFLY(e,g,b,dq,dqa)\ |
106 |
SBUTTERFLY(d,f,g,dq,dqa)\ |
107 |
SBUTTERFLY(a,e,f,qdq,dqa)\ |
108 |
SBUTTERFLY(h,d,e,qdq,dqa)\ |
109 |
"movdqa "#h", 16"#t" \n\t"\ |
110 |
"movdqa "#t", "#h" \n\t"\ |
111 |
SBUTTERFLY(h,b,d,qdq,dqa)\ |
112 |
SBUTTERFLY(c,g,b,qdq,dqa)\ |
113 |
"movdqa 16"#t", "#g" \n\t" |
114 |
#endif
|
115 |
|
116 |
#define MOVQ_WONE(regd) \
|
117 |
asm volatile ( \ |
118 |
"pcmpeqd %%" #regd ", %%" #regd " \n\t" \ |
119 |
"psrlw $15, %%" #regd ::) |
120 |
|
121 |
void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx);
|
122 |
|
123 |
#endif /* FFMPEG_DSPUTIL_MMX_H */ |