]> git.sesse.net Git - x264/blob - common/x86/pixel.h
Fix crash when using libx264.dll compiled with ICL for X86_64
[x264] / common / x86 / pixel.h
1 /*****************************************************************************
2  * pixel.h: x86 pixel metrics
3  *****************************************************************************
4  * Copyright (C) 2003-2012 x264 project
5  *
6  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
7  *          Loren Merritt <lorenm@u.washington.edu>
8  *          Fiona Glaser <fiona@x264.com>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
23  *
24  * This program is also available under a commercial proprietary license.
25  * For more information, contact us at licensing@x264.com.
26  *****************************************************************************/
27
28 #ifndef X264_I386_PIXEL_H
29 #define X264_I386_PIXEL_H
30
31 #define DECL_PIXELS( ret, name, suffix, args ) \
32     ret x264_pixel_##name##_16x16_##suffix args;\
33     ret x264_pixel_##name##_16x8_##suffix args;\
34     ret x264_pixel_##name##_8x16_##suffix args;\
35     ret x264_pixel_##name##_8x8_##suffix args;\
36     ret x264_pixel_##name##_8x4_##suffix args;\
37     ret x264_pixel_##name##_4x16_##suffix args;\
38     ret x264_pixel_##name##_4x8_##suffix args;\
39     ret x264_pixel_##name##_4x4_##suffix args;\
40
41 #define DECL_X1( name, suffix ) \
42     DECL_PIXELS( int, name, suffix, ( pixel *, intptr_t, pixel *, intptr_t ) )
43
44 #define DECL_X4( name, suffix ) \
45     DECL_PIXELS( void, name##_x3, suffix, ( pixel *, pixel *, pixel *, pixel *, intptr_t, int * ) )\
46     DECL_PIXELS( void, name##_x4, suffix, ( pixel *, pixel *, pixel *, pixel *, pixel *, intptr_t, int * ) )
47
48 DECL_X1( sad, mmx2 )
49 DECL_X1( sad, sse2 )
50 DECL_X4( sad, sse2_misalign )
51 DECL_X1( sad, sse3 )
52 DECL_X1( sad, sse2_aligned )
53 DECL_X1( sad, ssse3 )
54 DECL_X1( sad, ssse3_aligned )
55 DECL_X4( sad, mmx2 )
56 DECL_X4( sad, sse2 )
57 DECL_X4( sad, sse3 )
58 DECL_X4( sad, ssse3 )
59 DECL_X1( ssd, mmx )
60 DECL_X1( ssd, mmx2 )
61 DECL_X1( ssd, sse2slow )
62 DECL_X1( ssd, sse2 )
63 DECL_X1( ssd, ssse3 )
64 DECL_X1( ssd, avx )
65 DECL_X1( ssd, xop )
66 DECL_X1( satd, mmx2 )
67 DECL_X1( satd, sse2 )
68 DECL_X1( satd, ssse3 )
69 DECL_X1( satd, sse4 )
70 DECL_X1( satd, avx )
71 DECL_X1( satd, xop )
72 DECL_X1( sa8d, mmx2 )
73 DECL_X1( sa8d, sse2 )
74 DECL_X1( sa8d, ssse3 )
75 DECL_X1( sa8d, sse4 )
76 DECL_X1( sa8d, avx )
77 DECL_X1( sa8d, xop )
78 DECL_X1( sad, cache32_mmx2 );
79 DECL_X1( sad, cache64_mmx2 );
80 DECL_X1( sad, cache64_sse2 );
81 DECL_X1( sad, cache64_ssse3 );
82 DECL_X4( sad, cache32_mmx2 );
83 DECL_X4( sad, cache64_mmx2 );
84 DECL_X4( sad, cache64_sse2 );
85 DECL_X4( sad, cache64_ssse3 );
86
87 DECL_PIXELS( uint64_t, var, mmx2, ( pixel *pix, intptr_t i_stride ))
88 DECL_PIXELS( uint64_t, var, sse2, ( pixel *pix, intptr_t i_stride ))
89 DECL_PIXELS( uint64_t, var, avx,  ( pixel *pix, intptr_t i_stride ))
90 DECL_PIXELS( uint64_t, var, xop,  ( pixel *pix, intptr_t i_stride ))
91 DECL_PIXELS( uint64_t, hadamard_ac, mmx2,  ( pixel *pix, intptr_t i_stride ))
92 DECL_PIXELS( uint64_t, hadamard_ac, sse2,  ( pixel *pix, intptr_t i_stride ))
93 DECL_PIXELS( uint64_t, hadamard_ac, ssse3, ( pixel *pix, intptr_t i_stride ))
94 DECL_PIXELS( uint64_t, hadamard_ac, sse4,  ( pixel *pix, intptr_t i_stride ))
95 DECL_PIXELS( uint64_t, hadamard_ac, avx,   ( pixel *pix, intptr_t i_stride ))
96 DECL_PIXELS( uint64_t, hadamard_ac, xop,   ( pixel *pix, intptr_t i_stride ))
97
98
99 void x264_intra_satd_x3_4x4_mmx2   ( pixel   *, pixel   *, int * );
100 void x264_intra_sad_x3_4x4_mmx2    ( pixel   *, pixel   *, int * );
101 void x264_intra_sad_x3_4x4_sse2    ( pixel   *, pixel   *, int * );
102 void x264_intra_sad_x3_4x4_ssse3   ( pixel   *, pixel   *, int * );
103 void x264_intra_sad_x3_4x4_avx     ( pixel   *, pixel   *, int * );
104 void x264_intra_satd_x3_8x8c_mmx2  ( pixel   *, pixel   *, int * );
105 void x264_intra_satd_x3_8x8c_ssse3 ( uint8_t *, uint8_t *, int * );
106 void x264_intra_sad_x3_8x8c_mmx2   ( pixel   *, pixel   *, int * );
107 void x264_intra_sad_x3_8x8c_sse2   ( pixel   *, pixel   *, int * );
108 void x264_intra_sad_x3_8x8c_ssse3  ( pixel   *, pixel   *, int * );
109 void x264_intra_satd_x3_16x16_mmx2 ( pixel   *, pixel   *, int * );
110 void x264_intra_satd_x3_16x16_ssse3( uint8_t *, uint8_t *, int * );
111 void x264_intra_sad_x3_16x16_mmx2  ( pixel   *, pixel   *, int * );
112 void x264_intra_sad_x3_16x16_sse2  ( pixel   *, pixel   *, int * );
113 void x264_intra_sad_x3_16x16_ssse3 ( pixel   *, pixel   *, int * );
114 void x264_intra_sa8d_x3_8x8_mmx2   ( uint8_t *, uint8_t *, int * );
115 void x264_intra_sa8d_x3_8x8_sse2   ( pixel   *, pixel   *, int * );
116 void x264_intra_sad_x3_8x8_mmx2    ( pixel   *, pixel   *, int * );
117 void x264_intra_sad_x3_8x8_sse2    ( pixel   *, pixel   *, int * );
118 void x264_intra_sad_x3_8x8_ssse3   ( pixel   *, pixel   *, int * );
119 int x264_intra_satd_x9_4x4_ssse3( uint8_t *, uint8_t *, uint16_t * );
120 int x264_intra_satd_x9_4x4_sse4 ( uint8_t *, uint8_t *, uint16_t * );
121 int x264_intra_satd_x9_4x4_avx  ( uint8_t *, uint8_t *, uint16_t * );
122 int x264_intra_satd_x9_4x4_xop  ( uint8_t *, uint8_t *, uint16_t * );
123 int x264_intra_sad_x9_4x4_ssse3 ( uint8_t *, uint8_t *, uint16_t * );
124 int x264_intra_sad_x9_4x4_sse4  ( uint8_t *, uint8_t *, uint16_t * );
125 int x264_intra_sad_x9_4x4_avx   ( uint8_t *, uint8_t *, uint16_t * );
126 int x264_intra_sa8d_x9_8x8_ssse3( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
127 int x264_intra_sa8d_x9_8x8_sse4 ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
128 int x264_intra_sa8d_x9_8x8_avx  ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
129 int x264_intra_sad_x9_8x8_ssse3 ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
130 int x264_intra_sad_x9_8x8_sse4  ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
131 int x264_intra_sad_x9_8x8_avx   ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
132
133 void x264_pixel_ssd_nv12_core_mmx2( pixel *pixuv1, intptr_t stride1,
134                                     pixel *pixuv2, intptr_t stride2, int width,
135                                     int height, uint64_t *ssd_u, uint64_t *ssd_v );
136 void x264_pixel_ssd_nv12_core_sse2( pixel *pixuv1, intptr_t stride1,
137                                     pixel *pixuv2, intptr_t stride2, int width,
138                                     int height, uint64_t *ssd_u, uint64_t *ssd_v );
139 void x264_pixel_ssd_nv12_core_avx ( pixel *pixuv1, intptr_t stride1,
140                                     pixel *pixuv2, intptr_t stride2, int width,
141                                     int height, uint64_t *ssd_u, uint64_t *ssd_v );
142 void x264_pixel_ssim_4x4x2_core_mmx2( const uint8_t *pix1, intptr_t stride1,
143                                       const uint8_t *pix2, intptr_t stride2, int sums[2][4] );
144 void x264_pixel_ssim_4x4x2_core_sse2( const pixel *pix1, intptr_t stride1,
145                                       const pixel *pix2, intptr_t stride2, int sums[2][4] );
146 void x264_pixel_ssim_4x4x2_core_avx ( const pixel *pix1, intptr_t stride1,
147                                       const pixel *pix2, intptr_t stride2, int sums[2][4] );
148 float x264_pixel_ssim_end4_sse2( int sum0[5][4], int sum1[5][4], int width );
149 float x264_pixel_ssim_end4_avx ( int sum0[5][4], int sum1[5][4], int width );
150 int  x264_pixel_var2_8x8_mmx2  ( pixel *,   intptr_t, pixel *,   intptr_t, int * );
151 int  x264_pixel_var2_8x8_sse2  ( pixel *,   intptr_t, pixel *,   intptr_t, int * );
152 int  x264_pixel_var2_8x8_ssse3 ( uint8_t *, intptr_t, uint8_t *, intptr_t, int * );
153 int  x264_pixel_var2_8x8_xop   ( uint8_t *, intptr_t, uint8_t *, intptr_t, int * );
154 int  x264_pixel_var2_8x16_mmx2 ( pixel *,   intptr_t, pixel *,   intptr_t, int * );
155 int  x264_pixel_var2_8x16_sse2 ( pixel *,   intptr_t, pixel *,   intptr_t, int * );
156 int  x264_pixel_var2_8x16_ssse3( uint8_t *, intptr_t, uint8_t *, intptr_t, int * );
157 int  x264_pixel_var2_8x16_xop  ( uint8_t *, intptr_t, uint8_t *, intptr_t, int * );
158 int  x264_pixel_vsad_mmx2 ( pixel *src, intptr_t stride, int height );
159 int  x264_pixel_vsad_sse2 ( pixel *src, intptr_t stride, int height );
160 int  x264_pixel_vsad_ssse3( pixel *src, intptr_t stride, int height );
161 int  x264_pixel_vsad_xop  ( pixel *src, intptr_t stride, int height );
162 int x264_pixel_asd8_sse2 ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, int height );
163 int x264_pixel_asd8_ssse3( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, int height );
164 int x264_pixel_asd8_xop  ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, int height );
165
166 #define DECL_ADS( size, suffix ) \
167 int x264_pixel_ads##size##_##suffix( int enc_dc[size], uint16_t *sums, int delta,\
168                                      uint16_t *cost_mvx, int16_t *mvs, int width, int thresh );
169 DECL_ADS( 4, mmx2 )
170 DECL_ADS( 2, mmx2 )
171 DECL_ADS( 1, mmx2 )
172 DECL_ADS( 4, sse2 )
173 DECL_ADS( 2, sse2 )
174 DECL_ADS( 1, sse2 )
175 DECL_ADS( 4, ssse3 )
176 DECL_ADS( 2, ssse3 )
177 DECL_ADS( 1, ssse3 )
178 DECL_ADS( 4, avx )
179 DECL_ADS( 2, avx )
180 DECL_ADS( 1, avx )
181
182 #undef DECL_PIXELS
183 #undef DECL_X1
184 #undef DECL_X4
185 #undef DECL_ADS
186
187 #endif