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.

119 lines
4.6KB

  1. /*
  2. * MMX optimized DSP utils
  3. * Copyright (c) 2007 Aurelien Jacobs <aurel@gnuage.org>
  4. *
  5. * This file is part of Libav.
  6. *
  7. * Libav is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * Libav is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with Libav; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #ifndef AVCODEC_X86_DSPUTIL_MMX_H
  22. #define AVCODEC_X86_DSPUTIL_MMX_H
  23. #include <stddef.h>
  24. #include <stdint.h>
  25. #include "libavcodec/dsputil.h"
  26. #include "libavutil/x86/asm.h"
  27. extern const uint64_t ff_bone;
  28. extern const uint64_t ff_wtwo;
  29. extern const xmm_reg ff_pw_3;
  30. extern const xmm_reg ff_pw_4;
  31. extern const xmm_reg ff_pw_5;
  32. extern const xmm_reg ff_pw_8;
  33. extern const uint64_t ff_pw_15;
  34. extern const xmm_reg ff_pw_16;
  35. extern const xmm_reg ff_pw_18;
  36. extern const uint64_t ff_pw_20;
  37. extern const xmm_reg ff_pw_32;
  38. extern const uint64_t ff_pw_42;
  39. extern const uint64_t ff_pw_53;
  40. extern const xmm_reg ff_pw_64;
  41. extern const uint64_t ff_pw_96;
  42. extern const uint64_t ff_pw_128;
  43. extern const uint64_t ff_pw_255;
  44. extern const xmm_reg ff_pb_1;
  45. extern const xmm_reg ff_pb_3;
  46. extern const uint64_t ff_pb_7;
  47. extern const uint64_t ff_pb_1F;
  48. extern const uint64_t ff_pb_3F;
  49. extern const uint64_t ff_pb_81;
  50. extern const xmm_reg ff_pb_F8;
  51. extern const uint64_t ff_pb_FC;
  52. extern const double ff_pd_1[2];
  53. extern const double ff_pd_2[2];
  54. #define SBUTTERFLY(a,b,t,n,m)\
  55. "mov" #m " " #a ", " #t " \n\t" /* abcd */\
  56. "punpckl" #n " " #b ", " #a " \n\t" /* aebf */\
  57. "punpckh" #n " " #b ", " #t " \n\t" /* cgdh */\
  58. #define TRANSPOSE4(a,b,c,d,t)\
  59. SBUTTERFLY(a,b,t,wd,q) /* a=aebf t=cgdh */\
  60. SBUTTERFLY(c,d,b,wd,q) /* c=imjn b=kolp */\
  61. SBUTTERFLY(a,c,d,dq,q) /* a=aeim d=bfjn */\
  62. SBUTTERFLY(t,b,c,dq,q) /* t=cgko c=dhlp */
  63. #define MOVQ_WONE(regd) \
  64. __asm__ volatile ( \
  65. "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
  66. "psrlw $15, %%" #regd ::)
  67. void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx);
  68. void ff_dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx);
  69. void ff_add_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, int line_size);
  70. void ff_put_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, int line_size);
  71. void ff_put_signed_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, int line_size);
  72. void ff_avg_pixels8_mmxext(uint8_t *block, const uint8_t *pixels,
  73. ptrdiff_t line_size, int h);
  74. void ff_put_pixels8_mmxext(uint8_t *block, const uint8_t *pixels,
  75. ptrdiff_t line_size, int h);
  76. void ff_avg_pixels16_sse2(uint8_t *block, const uint8_t *pixels,
  77. ptrdiff_t line_size, int h);
  78. void ff_put_pixels16_sse2(uint8_t *block, const uint8_t *pixels,
  79. ptrdiff_t line_size, int h);
  80. void ff_put_cavs_qpel8_mc00_mmxext(uint8_t *dst, uint8_t *src, ptrdiff_t stride);
  81. void ff_avg_cavs_qpel8_mc00_mmxext(uint8_t *dst, uint8_t *src, ptrdiff_t stride);
  82. void ff_put_cavs_qpel16_mc00_mmxext(uint8_t *dst, uint8_t *src, ptrdiff_t stride);
  83. void ff_avg_cavs_qpel16_mc00_mmxext(uint8_t *dst, uint8_t *src, ptrdiff_t stride);
  84. void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, int rnd);
  85. void ff_put_rv40_qpel8_mc33_mmx(uint8_t *block, uint8_t *pixels, ptrdiff_t stride);
  86. void ff_put_rv40_qpel16_mc33_mmx(uint8_t *block, uint8_t *pixels, ptrdiff_t stride);
  87. void ff_avg_rv40_qpel8_mc33_mmx(uint8_t *block, uint8_t *pixels, ptrdiff_t stride);
  88. void ff_avg_rv40_qpel16_mc33_mmx(uint8_t *block, uint8_t *pixels, ptrdiff_t stride);
  89. void ff_deinterlace_line_mmx(uint8_t *dst,
  90. const uint8_t *lum_m4, const uint8_t *lum_m3,
  91. const uint8_t *lum_m2, const uint8_t *lum_m1,
  92. const uint8_t *lum,
  93. int size);
  94. void ff_deinterlace_line_inplace_mmx(const uint8_t *lum_m4,
  95. const uint8_t *lum_m3,
  96. const uint8_t *lum_m2,
  97. const uint8_t *lum_m1,
  98. const uint8_t *lum, int size);
  99. #endif /* AVCODEC_X86_DSPUTIL_MMX_H */