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.

100 lines
2.5KB

  1. #ifndef DSPUTIL_H
  2. #define DSPUTIL_H
  3. #include "common.h"
  4. #include <inttypes.h>
  5. /* dct code */
  6. typedef short DCTELEM;
  7. void jpeg_fdct_ifast (DCTELEM *data);
  8. void j_rev_dct (DCTELEM *data);
  9. void fdct_mmx(DCTELEM *block);
  10. void (*av_fdct)(DCTELEM *block);
  11. /* pixel operations */
  12. #define MAX_NEG_CROP 384
  13. /* temporary */
  14. extern UINT32 squareTbl[512];
  15. void dsputil_init(void);
  16. /* pixel ops : interface with DCT */
  17. extern void (*get_pixels)(DCTELEM *block, const UINT8 *pixels, int line_size);
  18. extern void (*put_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size);
  19. extern void (*add_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size);
  20. void get_pixels_c(DCTELEM *block, const UINT8 *pixels, int line_size);
  21. void put_pixels_clamped_c(const DCTELEM *block, UINT8 *pixels, int line_size);
  22. void add_pixels_clamped_c(const DCTELEM *block, UINT8 *pixels, int line_size);
  23. /* add and put pixel (decoding) */
  24. typedef void (*op_pixels_func)(UINT8 *block, const UINT8 *pixels, int line_size, int h);
  25. extern op_pixels_func put_pixels_tab[4];
  26. extern op_pixels_func avg_pixels_tab[4];
  27. extern op_pixels_func put_no_rnd_pixels_tab[4];
  28. extern op_pixels_func avg_no_rnd_pixels_tab[4];
  29. /* sub pixel (encoding) */
  30. extern void (*sub_pixels_tab[4])(DCTELEM *block, const UINT8 *pixels, int line_size, int h);
  31. #define sub_pixels_2(block, pixels, line_size, dxy) \
  32. sub_pixels_tab[dxy](block, pixels, line_size, 8)
  33. /* motion estimation */
  34. typedef int (*op_pixels_abs_func)(UINT8 *blk1, UINT8 *blk2, int line_size, int h);
  35. extern op_pixels_abs_func pix_abs16x16;
  36. extern op_pixels_abs_func pix_abs16x16_x2;
  37. extern op_pixels_abs_func pix_abs16x16_y2;
  38. extern op_pixels_abs_func pix_abs16x16_xy2;
  39. int pix_abs16x16_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
  40. int pix_abs16x16_x2_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
  41. int pix_abs16x16_y2_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
  42. int pix_abs16x16_xy2_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
  43. #ifdef HAVE_MMX
  44. #define MM_MMX 0x0001 /* standard MMX */
  45. #define MM_3DNOW 0x0004 /* AMD 3DNOW */
  46. #define MM_MMXEXT 0x0002 /* SSE integer functions or AMD MMX ext */
  47. #define MM_SSE 0x0008 /* SSE functions */
  48. #define MM_SSE2 0x0010 /* PIV SSE2 functions */
  49. extern int mm_flags;
  50. int mm_support(void);
  51. static inline void emms(void)
  52. {
  53. __asm __volatile ("emms;":::"memory");
  54. }
  55. #define emms_c() \
  56. {\
  57. if (mm_flags & MM_MMX)\
  58. emms();\
  59. }
  60. #define __align8 __attribute__ ((aligned (8)))
  61. void dsputil_init_mmx(void);
  62. #else
  63. #define emms_c()
  64. #define __align8
  65. #endif
  66. #endif