]> git.sesse.net Git - x264/blob - common/x86/pixel.h
SSE2 high bit depth SSIM functions
[x264] / common / x86 / pixel.h
1 /*****************************************************************************
2  * pixel.h: x86 pixel metrics
3  *****************************************************************************
4  * Copyright (C) 2003-2010 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##_4x8_##suffix args;\
38     ret x264_pixel_##name##_4x4_##suffix args;\
39
40 #define DECL_X1( name, suffix ) \
41     DECL_PIXELS( int, name, suffix, ( pixel *, int, pixel *, int ) )
42
43 #define DECL_X4( name, suffix ) \
44     DECL_PIXELS( void, name##_x3, suffix, ( pixel *, pixel *, pixel *, pixel *, int, int * ) )\
45     DECL_PIXELS( void, name##_x4, suffix, ( pixel *, pixel *, pixel *, pixel *, pixel *, int, int * ) )
46
47 DECL_X1( sad, mmxext )
48 DECL_X1( sad, sse2 )
49 DECL_X4( sad, sse2_misalign )
50 DECL_X1( sad, sse3 )
51 DECL_X1( sad, sse2_aligned )
52 DECL_X1( sad, ssse3 )
53 DECL_X1( sad, ssse3_aligned )
54 DECL_X4( sad, mmxext )
55 DECL_X4( sad, sse2 )
56 DECL_X4( sad, sse3 )
57 DECL_X4( sad, ssse3 )
58 DECL_X1( ssd, mmx )
59 DECL_X1( ssd, mmxext )
60 DECL_X1( ssd, sse2slow )
61 DECL_X1( ssd, sse2 )
62 DECL_X1( ssd, ssse3 )
63 DECL_X1( satd, mmxext )
64 DECL_X1( satd, sse2 )
65 DECL_X1( satd, ssse3 )
66 DECL_X1( satd, sse4 )
67 DECL_X1( sa8d, mmxext )
68 DECL_X1( sa8d, sse2 )
69 DECL_X1( sa8d, ssse3 )
70 DECL_X1( sa8d, sse4)
71 DECL_X1( sad, cache32_mmxext );
72 DECL_X1( sad, cache64_mmxext );
73 DECL_X1( sad, cache64_sse2 );
74 DECL_X1( sad, cache64_ssse3 );
75 DECL_X4( sad, cache32_mmxext );
76 DECL_X4( sad, cache64_mmxext );
77 DECL_X4( sad, cache64_sse2 );
78 DECL_X4( sad, cache64_ssse3 );
79
80 DECL_PIXELS( uint64_t, var, mmxext, ( pixel *pix, int i_stride ))
81 DECL_PIXELS( uint64_t, var, sse2,   ( pixel *pix, int i_stride ))
82 DECL_PIXELS( uint64_t, hadamard_ac, mmxext, ( pixel *pix, int i_stride ))
83 DECL_PIXELS( uint64_t, hadamard_ac, sse2,   ( pixel *pix, int i_stride ))
84 DECL_PIXELS( uint64_t, hadamard_ac, ssse3,  ( pixel *pix, int i_stride ))
85 DECL_PIXELS( uint64_t, hadamard_ac, sse4,   ( pixel *pix, int i_stride ))
86
87
88 void x264_intra_satd_x3_4x4_mmxext  ( pixel   *, pixel   *, int * );
89 void x264_intra_satd_x3_4x4_ssse3   ( uint8_t *, uint8_t *, int * );
90 void x264_intra_sad_x3_4x4_mmxext   ( pixel   *, pixel   *, int * );
91 void x264_intra_sad_x3_4x4_sse4     ( uint8_t *, uint8_t *, int * );
92 void x264_intra_satd_x3_8x8c_mmxext ( pixel   *, pixel   *, int * );
93 void x264_intra_satd_x3_8x8c_ssse3  ( uint8_t *, uint8_t *, int * );
94 void x264_intra_sad_x3_8x8c_mmxext  ( pixel   *, pixel   *, int * );
95 void x264_intra_sad_x3_8x8c_sse2    ( pixel   *, pixel   *, int * );
96 void x264_intra_sad_x3_8x8c_ssse3   ( pixel   *, pixel   *, int * );
97 void x264_intra_satd_x3_16x16_mmxext( pixel   *, pixel   *, int * );
98 void x264_intra_satd_x3_16x16_ssse3 ( uint8_t *, uint8_t *, int * );
99 void x264_intra_sad_x3_16x16_mmxext ( pixel   *, pixel   *, int * );
100 void x264_intra_sad_x3_16x16_sse2   ( pixel   *, pixel   *, int * );
101 void x264_intra_sad_x3_16x16_ssse3  ( pixel   *, pixel   *, int * );
102 void x264_intra_sa8d_x3_8x8_mmxext  ( uint8_t *, uint8_t *, int * );
103 void x264_intra_sa8d_x3_8x8_sse2    ( pixel   *, pixel   *, int * );
104 void x264_intra_sa8d_x3_8x8_ssse3   ( uint8_t *, uint8_t *, int * );
105 void x264_intra_sad_x3_8x8_mmxext   ( pixel   *, pixel   *, int * );
106 void x264_intra_sad_x3_8x8_sse2     ( pixel   *, pixel   *, int * );
107 void x264_intra_sad_x3_8x8_ssse3    ( pixel   *, pixel   *, int * );
108 void x264_intra_sa8d_x3_8x8_core_mmxext( uint8_t *, int16_t [2][8], int * );
109 void x264_intra_sa8d_x3_8x8_core_sse2  ( uint8_t *, int16_t [2][8], int * );
110 void x264_intra_sa8d_x3_8x8_core_ssse3 ( uint8_t *, int16_t [2][8], int * );
111
112 void x264_pixel_ssd_nv12_core_mmxext( pixel *pixuv1, int stride1,
113                                       pixel *pixuv2, int stride2, int width,
114                                       int height, uint64_t *ssd_u, uint64_t *ssd_v );
115 void x264_pixel_ssd_nv12_core_sse2( pixel *pixuv1, int stride1,
116                                     pixel *pixuv2, int stride2, int width,
117                                     int height, uint64_t *ssd_u, uint64_t *ssd_v );
118 void x264_pixel_ssim_4x4x2_core_mmxext( const uint8_t *pix1, int stride1,
119                                         const uint8_t *pix2, int stride2, int sums[2][4] );
120 void x264_pixel_ssim_4x4x2_core_sse2( const pixel *pix1, int stride1,
121                                       const pixel *pix2, int stride2, int sums[2][4] );
122 float x264_pixel_ssim_end4_sse2( int sum0[5][4], int sum1[5][4], int width );
123 int  x264_pixel_var2_8x8_mmxext( pixel *, int, pixel *, int, int * );
124 int  x264_pixel_var2_8x8_sse2( pixel *, int, pixel *, int, int * );
125 int  x264_pixel_var2_8x8_ssse3( uint8_t *, int, uint8_t *, int, int * );
126
127 #define DECL_ADS( size, suffix ) \
128 int x264_pixel_ads##size##_##suffix( int enc_dc[size], uint16_t *sums, int delta,\
129                                      uint16_t *cost_mvx, int16_t *mvs, int width, int thresh );
130 DECL_ADS( 4, mmxext )
131 DECL_ADS( 2, mmxext )
132 DECL_ADS( 1, mmxext )
133 DECL_ADS( 4, sse2 )
134 DECL_ADS( 2, sse2 )
135 DECL_ADS( 1, sse2 )
136 DECL_ADS( 4, ssse3 )
137 DECL_ADS( 2, ssse3 )
138 DECL_ADS( 1, ssse3 )
139
140 #undef DECL_PIXELS
141 #undef DECL_X1
142 #undef DECL_X4
143 #undef DECL_ADS
144
145 #endif