3 |
* XVID MPEG-4 VIDEO CODEC |
* XVID MPEG-4 VIDEO CODEC |
4 |
* - Sum Of Absolute Difference header - |
* - Sum Of Absolute Difference header - |
5 |
* |
* |
6 |
* Copyright(C) 2001-2003 Peter Ross <pross@xvid.org> |
* Copyright(C) 2001-2010 Peter Ross <pross@xvid.org> |
7 |
* |
* |
8 |
* This program is free software ; you can redistribute it and/or modify |
* This program is free software ; you can redistribute it and/or modify |
9 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
19 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
20 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
* |
* |
22 |
* $Id: sad.h,v 1.24 2008-11-26 01:04:34 Isibaar Exp $ |
* $Id: sad.h,v 1.25 2010-11-28 15:18:21 Isibaar Exp $ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
181 |
sse8Func_8bit sse8_8bit_mmx; |
sse8Func_8bit sse8_8bit_mmx; |
182 |
#endif |
#endif |
183 |
|
|
184 |
|
typedef uint32_t (sseh8Func_16bit)(const int16_t * cur, |
185 |
|
const int16_t * ref, |
186 |
|
uint16_t mask); |
187 |
|
typedef sseh8Func_16bit *sseh8Func_16bitPtr; |
188 |
|
extern sseh8Func_16bitPtr sseh8_16bit; |
189 |
|
|
190 |
|
sseh8Func_16bit sseh8_16bit_c; |
191 |
|
#if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) |
192 |
|
sseh8Func_16bit sseh8_16bit_sse2; |
193 |
|
#endif |
194 |
|
|
195 |
|
typedef uint32_t (coeff8_energyFunc)(const int16_t * cur); |
196 |
|
typedef coeff8_energyFunc *coeff8_energyFunc_Ptr; |
197 |
|
extern coeff8_energyFunc_Ptr coeff8_energy; |
198 |
|
|
199 |
|
coeff8_energyFunc coeff8_energy_c; |
200 |
|
#if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) |
201 |
|
coeff8_energyFunc coeff8_energy_sse2; |
202 |
|
#endif |
203 |
|
|
204 |
|
typedef uint32_t (blocksum8Func)(const int8_t * cur, int stride, |
205 |
|
uint16_t sums[4], uint32_t squares[4]); |
206 |
|
typedef blocksum8Func *blocksum8Func_Ptr; |
207 |
|
extern blocksum8Func_Ptr blocksum8; |
208 |
|
|
209 |
|
blocksum8Func blocksum8_c; |
210 |
|
#if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) |
211 |
|
blocksum8Func blocksum8_sse2; |
212 |
|
#endif |
213 |
|
|
214 |
|
/* Coeffs for MSE_H calculation */ |
215 |
|
|
216 |
|
static const int16_t Inv_iMask_Coeff[64] = { |
217 |
|
0, 155, 128, 328, 737, 2048, 3329, 4763, |
218 |
|
184, 184, 251, 462, 865, 4306, 4608, 3872, |
219 |
|
251, 216, 328, 737, 2048, 4159, 6094, 4014, |
220 |
|
251, 370, 620, 1076, 3329, 9688, 8192, 4920, |
221 |
|
415, 620, 1752, 4014, 5919, 15207, 13579, 7589, |
222 |
|
737, 1568, 3872, 5243, 8398, 13844, 16345, 10834, |
223 |
|
3073, 5243, 7787, 9688, 13579, 18741, 18433, 13057, |
224 |
|
6636, 10834, 11552, 12294, 16056, 12800, 13579, 12545 |
225 |
|
}; |
226 |
|
|
227 |
|
static const uint16_t iCSF_Coeff[64] = { |
228 |
|
26353, 38331, 42164, 26353, 17568, 10541, 8268, 6912, |
229 |
|
35137, 35137, 30117, 22192, 16217, 7270, 7027, 7666, |
230 |
|
30117, 32434, 26353, 17568, 10541, 7397, 6111, 7529, |
231 |
|
30117, 24803, 19166, 14539, 8268, 4846, 5271, 6801, |
232 |
|
23425, 19166, 11396, 7529, 6201, 3868, 4094, 5476, |
233 |
|
17568, 12047, 7666, 6588, 5205, 4054, 3731, 4583, |
234 |
|
8605, 6588, 5406, 4846, 4094, 3485, 3514, 4175, |
235 |
|
5856, 4583, 4438, 4302, 3765, 4216, 4094, 4259 |
236 |
|
}; |
237 |
|
|
238 |
|
static const uint16_t iCSF_Round[64] = { |
239 |
|
1, 1, 1, 1, 2, 3, 4, 5, |
240 |
|
1, 1, 1, 1, 2, 5, 5, 4, |
241 |
|
1, 1, 1, 2, 3, 4, 5, 4, |
242 |
|
1, 1, 2, 2, 4, 7, 6, 5, |
243 |
|
1, 2, 3, 4, 5, 8, 8, 6, |
244 |
|
2, 3, 4, 5, 6, 8, 9, 7, |
245 |
|
4, 5, 6, 7, 8, 9, 9, 8, |
246 |
|
6, 7, 7, 8, 9, 8, 8, 8 |
247 |
|
}; |
248 |
|
|
249 |
#endif /* _ENCODER_SAD_H_ */ |
#endif /* _ENCODER_SAD_H_ */ |