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.

116 lines
4.5KB

  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_3F;
  47. extern const xmm_reg ff_pb_F8;
  48. extern const uint64_t ff_pb_FC;
  49. extern const double ff_pd_1[2];
  50. extern const double ff_pd_2[2];
  51. #define SBUTTERFLY(a,b,t,n,m)\
  52. "mov" #m " " #a ", " #t " \n\t" /* abcd */\
  53. "punpckl" #n " " #b ", " #a " \n\t" /* aebf */\
  54. "punpckh" #n " " #b ", " #t " \n\t" /* cgdh */\
  55. #define TRANSPOSE4(a,b,c,d,t)\
  56. SBUTTERFLY(a,b,t,wd,q) /* a=aebf t=cgdh */\
  57. SBUTTERFLY(c,d,b,wd,q) /* c=imjn b=kolp */\
  58. SBUTTERFLY(a,c,d,dq,q) /* a=aeim d=bfjn */\
  59. SBUTTERFLY(t,b,c,dq,q) /* t=cgko c=dhlp */
  60. #define MOVQ_WONE(regd) \
  61. __asm__ volatile ( \
  62. "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
  63. "psrlw $15, %%" #regd ::)
  64. void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx);
  65. void ff_dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx);
  66. void ff_add_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, int line_size);
  67. void ff_put_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, int line_size);
  68. void ff_put_signed_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, int line_size);
  69. void ff_avg_pixels8_mmxext(uint8_t *block, const uint8_t *pixels,
  70. ptrdiff_t line_size, int h);
  71. void ff_put_pixels8_mmxext(uint8_t *block, const uint8_t *pixels,
  72. ptrdiff_t line_size, int h);
  73. void ff_avg_pixels16_sse2(uint8_t *block, const uint8_t *pixels,
  74. ptrdiff_t line_size, int h);
  75. void ff_put_pixels16_sse2(uint8_t *block, const uint8_t *pixels,
  76. ptrdiff_t line_size, int h);
  77. void ff_put_cavs_qpel8_mc00_mmxext(uint8_t *dst, uint8_t *src, ptrdiff_t stride);
  78. void ff_avg_cavs_qpel8_mc00_mmxext(uint8_t *dst, uint8_t *src, ptrdiff_t stride);
  79. void ff_put_cavs_qpel16_mc00_mmxext(uint8_t *dst, uint8_t *src, ptrdiff_t stride);
  80. void ff_avg_cavs_qpel16_mc00_mmxext(uint8_t *dst, uint8_t *src, ptrdiff_t stride);
  81. void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, int rnd);
  82. void ff_put_rv40_qpel8_mc33_mmx(uint8_t *block, uint8_t *pixels, ptrdiff_t stride);
  83. void ff_put_rv40_qpel16_mc33_mmx(uint8_t *block, uint8_t *pixels, ptrdiff_t stride);
  84. void ff_avg_rv40_qpel8_mc33_mmx(uint8_t *block, uint8_t *pixels, ptrdiff_t stride);
  85. void ff_avg_rv40_qpel16_mc33_mmx(uint8_t *block, uint8_t *pixels, ptrdiff_t stride);
  86. void ff_deinterlace_line_mmx(uint8_t *dst,
  87. const uint8_t *lum_m4, const uint8_t *lum_m3,
  88. const uint8_t *lum_m2, const uint8_t *lum_m1,
  89. const uint8_t *lum,
  90. int size);
  91. void ff_deinterlace_line_inplace_mmx(const uint8_t *lum_m4,
  92. const uint8_t *lum_m3,
  93. const uint8_t *lum_m2,
  94. const uint8_t *lum_m1,
  95. const uint8_t *lum, int size);
  96. #endif /* AVCODEC_X86_DSPUTIL_MMX_H */