You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

497 lines
20KB

  1. /*
  2. * DSP utils
  3. * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  4. * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
  5. *
  6. * This file is part of Libav.
  7. *
  8. * Libav is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * Libav is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with Libav; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. /**
  23. * @file
  24. * DSP utils.
  25. * note, many functions in here may use MMX which trashes the FPU state, it is
  26. * absolutely necessary to call emms_c() between dsp & float/double code
  27. */
  28. #ifndef AVCODEC_DSPUTIL_H
  29. #define AVCODEC_DSPUTIL_H
  30. #include "libavutil/intreadwrite.h"
  31. #include "avcodec.h"
  32. //#define DEBUG
  33. /* dct code */
  34. void ff_fdct_ifast(int16_t *data);
  35. void ff_fdct_ifast248(int16_t *data);
  36. void ff_jpeg_fdct_islow_8(int16_t *data);
  37. void ff_jpeg_fdct_islow_10(int16_t *data);
  38. void ff_fdct248_islow_8(int16_t *data);
  39. void ff_fdct248_islow_10(int16_t *data);
  40. void ff_j_rev_dct(int16_t *data);
  41. void ff_fdct_mmx(int16_t *block);
  42. void ff_fdct_mmxext(int16_t *block);
  43. void ff_fdct_sse2(int16_t *block);
  44. /* encoding scans */
  45. extern const uint8_t ff_alternate_horizontal_scan[64];
  46. extern const uint8_t ff_alternate_vertical_scan[64];
  47. extern const uint8_t ff_zigzag_direct[64];
  48. extern const uint8_t ff_zigzag248_direct[64];
  49. /* pixel operations */
  50. #define MAX_NEG_CROP 1024
  51. /* temporary */
  52. extern uint32_t ff_squareTbl[512];
  53. extern uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP];
  54. #define PUTAVG_PIXELS(depth)\
  55. void ff_put_pixels8x8_ ## depth ## _c(uint8_t *dst, uint8_t *src, int stride);\
  56. void ff_avg_pixels8x8_ ## depth ## _c(uint8_t *dst, uint8_t *src, int stride);\
  57. void ff_put_pixels16x16_ ## depth ## _c(uint8_t *dst, uint8_t *src, int stride);\
  58. void ff_avg_pixels16x16_ ## depth ## _c(uint8_t *dst, uint8_t *src, int stride);
  59. PUTAVG_PIXELS( 8)
  60. PUTAVG_PIXELS( 9)
  61. PUTAVG_PIXELS(10)
  62. #define ff_put_pixels8x8_c ff_put_pixels8x8_8_c
  63. #define ff_avg_pixels8x8_c ff_avg_pixels8x8_8_c
  64. #define ff_put_pixels16x16_c ff_put_pixels16x16_8_c
  65. #define ff_avg_pixels16x16_c ff_avg_pixels16x16_8_c
  66. /* RV40 functions */
  67. void ff_put_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride);
  68. void ff_avg_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride);
  69. void ff_put_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride);
  70. void ff_avg_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride);
  71. /* 1/2^n downscaling functions from imgconvert.c */
  72. void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
  73. void ff_shrink44(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
  74. void ff_shrink88(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
  75. void ff_gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
  76. int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height);
  77. /* minimum alignment rules ;)
  78. If you notice errors in the align stuff, need more alignment for some ASM code
  79. for some CPU or need to use a function with less aligned data then send a mail
  80. to the libav-devel mailing list, ...
  81. !warning These alignments might not match reality, (missing attribute((align))
  82. stuff somewhere possible).
  83. I (Michael) did not check them, these are just the alignments which I think
  84. could be reached easily ...
  85. !future video codecs might need functions with less strict alignment
  86. */
  87. /*
  88. void get_pixels_c(int16_t *block, const uint8_t *pixels, int line_size);
  89. void diff_pixels_c(int16_t *block, const uint8_t *s1, const uint8_t *s2, int stride);
  90. void put_pixels_clamped_c(const int16_t *block, uint8_t *pixels, int line_size);
  91. void add_pixels_clamped_c(const int16_t *block, uint8_t *pixels, int line_size);
  92. void clear_blocks_c(int16_t *blocks);
  93. */
  94. /* add and put pixel (decoding) */
  95. // blocksizes for op_pixels_func are 8x4,8x8 16x8 16x16
  96. //h for op_pixels_func is limited to {width/2, width} but never larger than 16 and never smaller than 4
  97. typedef void (*op_pixels_func)(uint8_t *block/*align width (8 or 16)*/, const uint8_t *pixels/*align 1*/, ptrdiff_t line_size, int h);
  98. typedef void (*tpel_mc_func)(uint8_t *block/*align width (8 or 16)*/, const uint8_t *pixels/*align 1*/, int line_size, int w, int h);
  99. typedef void (*qpel_mc_func)(uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);
  100. typedef void (*op_fill_func)(uint8_t *block/*align width (8 or 16)*/, uint8_t value, int line_size, int h);
  101. #define DEF_OLD_QPEL(name)\
  102. void ff_put_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);\
  103. void ff_put_no_rnd_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);\
  104. void ff_avg_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);
  105. DEF_OLD_QPEL(qpel16_mc11_old_c)
  106. DEF_OLD_QPEL(qpel16_mc31_old_c)
  107. DEF_OLD_QPEL(qpel16_mc12_old_c)
  108. DEF_OLD_QPEL(qpel16_mc32_old_c)
  109. DEF_OLD_QPEL(qpel16_mc13_old_c)
  110. DEF_OLD_QPEL(qpel16_mc33_old_c)
  111. DEF_OLD_QPEL(qpel8_mc11_old_c)
  112. DEF_OLD_QPEL(qpel8_mc31_old_c)
  113. DEF_OLD_QPEL(qpel8_mc12_old_c)
  114. DEF_OLD_QPEL(qpel8_mc32_old_c)
  115. DEF_OLD_QPEL(qpel8_mc13_old_c)
  116. DEF_OLD_QPEL(qpel8_mc33_old_c)
  117. #define CALL_2X_PIXELS(a, b, n)\
  118. static void a(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
  119. b(block , pixels , line_size, h);\
  120. b(block+n, pixels+n, line_size, h);\
  121. }
  122. /* motion estimation */
  123. // h is limited to {width/2, width, 2*width} but never larger than 16 and never smaller than 2
  124. // although currently h<4 is not used as functions with width <8 are neither used nor implemented
  125. typedef int (*me_cmp_func)(void /*MpegEncContext*/ *s, uint8_t *blk1/*align width (8 or 16)*/, uint8_t *blk2/*align 1*/, int line_size, int h)/* __attribute__ ((const))*/;
  126. /**
  127. * Scantable.
  128. */
  129. typedef struct ScanTable{
  130. const uint8_t *scantable;
  131. uint8_t permutated[64];
  132. uint8_t raster_end[64];
  133. } ScanTable;
  134. void ff_init_scantable(uint8_t *, ScanTable *st, const uint8_t *src_scantable);
  135. void ff_init_scantable_permutation(uint8_t *idct_permutation,
  136. int idct_permutation_type);
  137. /**
  138. * DSPContext.
  139. */
  140. typedef struct DSPContext {
  141. /**
  142. * Size of DCT coefficients.
  143. */
  144. int dct_bits;
  145. /* pixel ops : interface with DCT */
  146. void (*get_pixels)(int16_t *block/*align 16*/, const uint8_t *pixels/*align 8*/, int line_size);
  147. void (*diff_pixels)(int16_t *block/*align 16*/, const uint8_t *s1/*align 8*/, const uint8_t *s2/*align 8*/, int stride);
  148. void (*put_pixels_clamped)(const int16_t *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
  149. void (*put_signed_pixels_clamped)(const int16_t *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
  150. void (*add_pixels_clamped)(const int16_t *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
  151. void (*add_pixels8)(uint8_t *pixels, int16_t *block, int line_size);
  152. void (*add_pixels4)(uint8_t *pixels, int16_t *block, int line_size);
  153. int (*sum_abs_dctelem)(int16_t *block/*align 16*/);
  154. /**
  155. * translational global motion compensation.
  156. */
  157. void (*gmc1)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x16, int y16, int rounder);
  158. /**
  159. * global motion compensation.
  160. */
  161. void (*gmc )(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int ox, int oy,
  162. int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height);
  163. void (*clear_block)(int16_t *block/*align 16*/);
  164. void (*clear_blocks)(int16_t *blocks/*align 16*/);
  165. int (*pix_sum)(uint8_t * pix, int line_size);
  166. int (*pix_norm1)(uint8_t * pix, int line_size);
  167. // 16x16 8x8 4x4 2x2 16x8 8x4 4x2 8x16 4x8 2x4
  168. me_cmp_func sad[6]; /* identical to pix_absAxA except additional void * */
  169. me_cmp_func sse[6];
  170. me_cmp_func hadamard8_diff[6];
  171. me_cmp_func dct_sad[6];
  172. me_cmp_func quant_psnr[6];
  173. me_cmp_func bit[6];
  174. me_cmp_func rd[6];
  175. me_cmp_func vsad[6];
  176. me_cmp_func vsse[6];
  177. me_cmp_func nsse[6];
  178. me_cmp_func dct_max[6];
  179. me_cmp_func dct264_sad[6];
  180. me_cmp_func me_pre_cmp[6];
  181. me_cmp_func me_cmp[6];
  182. me_cmp_func me_sub_cmp[6];
  183. me_cmp_func mb_cmp[6];
  184. me_cmp_func ildct_cmp[6]; //only width 16 used
  185. me_cmp_func frame_skip_cmp[6]; //only width 8 used
  186. int (*ssd_int8_vs_int16)(const int8_t *pix1, const int16_t *pix2,
  187. int size);
  188. /**
  189. * Halfpel motion compensation with rounding (a+b+1)>>1.
  190. * this is an array[4][4] of motion compensation functions for 4
  191. * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
  192. * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
  193. * @param block destination where the result is stored
  194. * @param pixels source
  195. * @param line_size number of bytes in a horizontal line of block
  196. * @param h height
  197. */
  198. op_pixels_func put_pixels_tab[4][4];
  199. /**
  200. * Halfpel motion compensation with rounding (a+b+1)>>1.
  201. * This is an array[4][4] of motion compensation functions for 4
  202. * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
  203. * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
  204. * @param block destination into which the result is averaged (a+b+1)>>1
  205. * @param pixels source
  206. * @param line_size number of bytes in a horizontal line of block
  207. * @param h height
  208. */
  209. op_pixels_func avg_pixels_tab[4][4];
  210. /**
  211. * Halfpel motion compensation with no rounding (a+b)>>1.
  212. * this is an array[2][4] of motion compensation functions for 2
  213. * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
  214. * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
  215. * @param block destination where the result is stored
  216. * @param pixels source
  217. * @param line_size number of bytes in a horizontal line of block
  218. * @param h height
  219. */
  220. op_pixels_func put_no_rnd_pixels_tab[2][4];
  221. /**
  222. * Halfpel motion compensation with no rounding (a+b)>>1.
  223. * this is an array[4] of motion compensation functions for 1
  224. * horizontal blocksize (16) and the 4 halfpel positions<br>
  225. * *pixels_tab[0][ xhalfpel + 2*yhalfpel ]
  226. * @param block destination into which the result is averaged (a+b)>>1
  227. * @param pixels source
  228. * @param line_size number of bytes in a horizontal line of block
  229. * @param h height
  230. */
  231. op_pixels_func avg_no_rnd_pixels_tab[4];
  232. /**
  233. * Thirdpel motion compensation with rounding (a+b+1)>>1.
  234. * this is an array[12] of motion compensation functions for the 9 thirdpe
  235. * positions<br>
  236. * *pixels_tab[ xthirdpel + 4*ythirdpel ]
  237. * @param block destination where the result is stored
  238. * @param pixels source
  239. * @param line_size number of bytes in a horizontal line of block
  240. * @param h height
  241. */
  242. tpel_mc_func put_tpel_pixels_tab[11]; //FIXME individual func ptr per width?
  243. tpel_mc_func avg_tpel_pixels_tab[11]; //FIXME individual func ptr per width?
  244. qpel_mc_func put_qpel_pixels_tab[2][16];
  245. qpel_mc_func avg_qpel_pixels_tab[2][16];
  246. qpel_mc_func put_no_rnd_qpel_pixels_tab[2][16];
  247. qpel_mc_func put_mspel_pixels_tab[8];
  248. me_cmp_func pix_abs[2][4];
  249. /* huffyuv specific */
  250. void (*add_bytes)(uint8_t *dst/*align 16*/, uint8_t *src/*align 16*/, int w);
  251. void (*diff_bytes)(uint8_t *dst/*align 16*/, uint8_t *src1/*align 16*/, uint8_t *src2/*align 1*/,int w);
  252. /**
  253. * subtract huffyuv's variant of median prediction
  254. * note, this might read from src1[-1], src2[-1]
  255. */
  256. void (*sub_hfyu_median_prediction)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int w, int *left, int *left_top);
  257. void (*add_hfyu_median_prediction)(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top);
  258. int (*add_hfyu_left_prediction)(uint8_t *dst, const uint8_t *src, int w, int left);
  259. void (*add_hfyu_left_prediction_bgr32)(uint8_t *dst, const uint8_t *src, int w, int *red, int *green, int *blue, int *alpha);
  260. void (*bswap_buf)(uint32_t *dst, const uint32_t *src, int w);
  261. void (*bswap16_buf)(uint16_t *dst, const uint16_t *src, int len);
  262. void (*h263_v_loop_filter)(uint8_t *src, int stride, int qscale);
  263. void (*h263_h_loop_filter)(uint8_t *src, int stride, int qscale);
  264. void (*h261_loop_filter)(uint8_t *src, int stride);
  265. /* assume len is a multiple of 8, and arrays are 16-byte aligned */
  266. void (*vector_clipf)(float *dst /* align 16 */, const float *src /* align 16 */, float min, float max, int len /* align 16 */);
  267. /* (I)DCT */
  268. void (*fdct)(int16_t *block/* align 16*/);
  269. void (*fdct248)(int16_t *block/* align 16*/);
  270. /* IDCT really*/
  271. void (*idct)(int16_t *block/* align 16*/);
  272. /**
  273. * block -> idct -> clip to unsigned 8 bit -> dest.
  274. * (-1392, 0, 0, ...) -> idct -> (-174, -174, ...) -> put -> (0, 0, ...)
  275. * @param line_size size in bytes of a horizontal line of dest
  276. */
  277. void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, int16_t *block/*align 16*/);
  278. /**
  279. * block -> idct -> add dest -> clip to unsigned 8 bit -> dest.
  280. * @param line_size size in bytes of a horizontal line of dest
  281. */
  282. void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, int16_t *block/*align 16*/);
  283. /**
  284. * idct input permutation.
  285. * several optimized IDCTs need a permutated input (relative to the normal order of the reference
  286. * IDCT)
  287. * this permutation must be performed before the idct_put/add, note, normally this can be merged
  288. * with the zigzag/alternate scan<br>
  289. * an example to avoid confusion:
  290. * - (->decode coeffs -> zigzag reorder -> dequant -> reference idct ->...)
  291. * - (x -> reference dct -> reference idct -> x)
  292. * - (x -> reference dct -> simple_mmx_perm = idct_permutation -> simple_idct_mmx -> x)
  293. * - (->decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant -> simple_idct_mmx ->...)
  294. */
  295. uint8_t idct_permutation[64];
  296. int idct_permutation_type;
  297. #define FF_NO_IDCT_PERM 1
  298. #define FF_LIBMPEG2_IDCT_PERM 2
  299. #define FF_SIMPLE_IDCT_PERM 3
  300. #define FF_TRANSPOSE_IDCT_PERM 4
  301. #define FF_PARTTRANS_IDCT_PERM 5
  302. #define FF_SSE2_IDCT_PERM 6
  303. int (*try_8x8basis)(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale);
  304. void (*add_8x8basis)(int16_t rem[64], int16_t basis[64], int scale);
  305. #define BASIS_SHIFT 16
  306. #define RECON_SHIFT 6
  307. void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, int w, int h, int sides);
  308. #define EDGE_WIDTH 16
  309. #define EDGE_TOP 1
  310. #define EDGE_BOTTOM 2
  311. void (*shrink[4])(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
  312. /**
  313. * Calculate scalar product of two vectors.
  314. * @param len length of vectors, should be multiple of 16
  315. */
  316. int32_t (*scalarproduct_int16)(const int16_t *v1, const int16_t *v2/*align 16*/, int len);
  317. /* ape functions */
  318. /**
  319. * Calculate scalar product of v1 and v2,
  320. * and v1[i] += v3[i] * mul
  321. * @param len length of vectors, should be multiple of 16
  322. */
  323. int32_t (*scalarproduct_and_madd_int16)(int16_t *v1/*align 16*/, const int16_t *v2, const int16_t *v3, int len, int mul);
  324. /**
  325. * Apply symmetric window in 16-bit fixed-point.
  326. * @param output destination array
  327. * constraints: 16-byte aligned
  328. * @param input source array
  329. * constraints: 16-byte aligned
  330. * @param window window array
  331. * constraints: 16-byte aligned, at least len/2 elements
  332. * @param len full window length
  333. * constraints: multiple of ? greater than zero
  334. */
  335. void (*apply_window_int16)(int16_t *output, const int16_t *input,
  336. const int16_t *window, unsigned int len);
  337. /**
  338. * Clip each element in an array of int32_t to a given minimum and maximum value.
  339. * @param dst destination array
  340. * constraints: 16-byte aligned
  341. * @param src source array
  342. * constraints: 16-byte aligned
  343. * @param min minimum value
  344. * constraints: must be in the range [-(1 << 24), 1 << 24]
  345. * @param max maximum value
  346. * constraints: must be in the range [-(1 << 24), 1 << 24]
  347. * @param len number of elements in the array
  348. * constraints: multiple of 32 greater than zero
  349. */
  350. void (*vector_clip_int32)(int32_t *dst, const int32_t *src, int32_t min,
  351. int32_t max, unsigned int len);
  352. op_fill_func fill_block_tab[2];
  353. } DSPContext;
  354. void ff_dsputil_static_init(void);
  355. void ff_dsputil_init(DSPContext* p, AVCodecContext *avctx);
  356. int ff_check_alignment(void);
  357. void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type);
  358. #define BYTE_VEC32(c) ((c)*0x01010101UL)
  359. #define BYTE_VEC64(c) ((c)*0x0001000100010001UL)
  360. static inline uint32_t rnd_avg32(uint32_t a, uint32_t b)
  361. {
  362. return (a | b) - (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
  363. }
  364. static inline uint32_t no_rnd_avg32(uint32_t a, uint32_t b)
  365. {
  366. return (a & b) + (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
  367. }
  368. static inline uint64_t rnd_avg64(uint64_t a, uint64_t b)
  369. {
  370. return (a | b) - (((a ^ b) & ~BYTE_VEC64(0x01)) >> 1);
  371. }
  372. static inline uint64_t no_rnd_avg64(uint64_t a, uint64_t b)
  373. {
  374. return (a & b) + (((a ^ b) & ~BYTE_VEC64(0x01)) >> 1);
  375. }
  376. void ff_dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx);
  377. void ff_dsputil_init_arm(DSPContext* c, AVCodecContext *avctx);
  378. void ff_dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx);
  379. void ff_dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx);
  380. void ff_dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx);
  381. void ff_dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx);
  382. void ff_dsputil_init_vis(DSPContext* c, AVCodecContext *avctx);
  383. #if (ARCH_ARM && HAVE_NEON) || ARCH_PPC || HAVE_MMX
  384. # define STRIDE_ALIGN 16
  385. #else
  386. # define STRIDE_ALIGN 8
  387. #endif
  388. // Some broken preprocessors need a second expansion
  389. // to be forced to tokenize __VA_ARGS__
  390. #define E(x) x
  391. #define LOCAL_ALIGNED_A(a, t, v, s, o, ...) \
  392. uint8_t la_##v[sizeof(t s o) + (a)]; \
  393. t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a)
  394. #define LOCAL_ALIGNED_D(a, t, v, s, o, ...) \
  395. DECLARE_ALIGNED(a, t, la_##v) s o; \
  396. t (*v) o = la_##v
  397. #define LOCAL_ALIGNED(a, t, v, ...) E(LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,))
  398. #if HAVE_LOCAL_ALIGNED_8
  399. # define LOCAL_ALIGNED_8(t, v, ...) E(LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,))
  400. #else
  401. # define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED(8, t, v, __VA_ARGS__)
  402. #endif
  403. #if HAVE_LOCAL_ALIGNED_16
  404. # define LOCAL_ALIGNED_16(t, v, ...) E(LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,))
  405. #else
  406. # define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__)
  407. #endif
  408. #define WRAPPER8_16_SQ(name8, name16)\
  409. static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int stride, int h){\
  410. int score=0;\
  411. score +=name8(s, dst , src , stride, 8);\
  412. score +=name8(s, dst+8 , src+8 , stride, 8);\
  413. if(h==16){\
  414. dst += 8*stride;\
  415. src += 8*stride;\
  416. score +=name8(s, dst , src , stride, 8);\
  417. score +=name8(s, dst+8 , src+8 , stride, 8);\
  418. }\
  419. return score;\
  420. }
  421. #endif /* AVCODEC_DSPUTIL_H */