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.

122 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 <stdint.h>
  24. #include "libavcodec/dsputil.h"
  25. #include "libavutil/x86_cpu.h"
  26. typedef struct { uint64_t a, b; } xmm_reg;
  27. extern const uint64_t ff_bone;
  28. extern const uint64_t ff_wtwo;
  29. extern const uint64_t ff_pdw_80000000[2];
  30. extern const xmm_reg ff_pw_3;
  31. extern const xmm_reg ff_pw_4;
  32. extern const xmm_reg ff_pw_5;
  33. extern const xmm_reg ff_pw_8;
  34. extern const uint64_t ff_pw_15;
  35. extern const xmm_reg ff_pw_16;
  36. extern const xmm_reg ff_pw_18;
  37. extern const uint64_t ff_pw_20;
  38. extern const xmm_reg ff_pw_27;
  39. extern const xmm_reg ff_pw_28;
  40. extern const xmm_reg ff_pw_32;
  41. extern const uint64_t ff_pw_42;
  42. extern const uint64_t ff_pw_53;
  43. extern const xmm_reg ff_pw_63;
  44. extern const xmm_reg ff_pw_64;
  45. extern const uint64_t ff_pw_96;
  46. extern const uint64_t ff_pw_128;
  47. extern const uint64_t ff_pw_255;
  48. extern const xmm_reg ff_pb_1;
  49. extern const xmm_reg ff_pb_3;
  50. extern const uint64_t ff_pb_7;
  51. extern const uint64_t ff_pb_1F;
  52. extern const uint64_t ff_pb_3F;
  53. extern const uint64_t ff_pb_81;
  54. extern const xmm_reg ff_pb_A1;
  55. extern const xmm_reg ff_pb_F8;
  56. extern const uint64_t ff_pb_FC;
  57. extern const xmm_reg ff_pb_FE;
  58. extern const double ff_pd_1[2];
  59. extern const double ff_pd_2[2];
  60. #define SBUTTERFLY(a,b,t,n,m)\
  61. "mov" #m " " #a ", " #t " \n\t" /* abcd */\
  62. "punpckl" #n " " #b ", " #a " \n\t" /* aebf */\
  63. "punpckh" #n " " #b ", " #t " \n\t" /* cgdh */\
  64. #define TRANSPOSE4(a,b,c,d,t)\
  65. SBUTTERFLY(a,b,t,wd,q) /* a=aebf t=cgdh */\
  66. SBUTTERFLY(c,d,b,wd,q) /* c=imjn b=kolp */\
  67. SBUTTERFLY(a,c,d,dq,q) /* a=aeim d=bfjn */\
  68. SBUTTERFLY(t,b,c,dq,q) /* t=cgko c=dhlp */
  69. #define MOVQ_WONE(regd) \
  70. __asm__ volatile ( \
  71. "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
  72. "psrlw $15, %%" #regd ::)
  73. void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx);
  74. void ff_dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx);
  75. void ff_add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);
  76. void ff_put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);
  77. void ff_put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);
  78. void ff_put_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride);
  79. void ff_avg_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride);
  80. void ff_put_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride);
  81. void ff_avg_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride);
  82. void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, int stride, int rnd);
  83. void ff_avg_vc1_mspel_mc00_mmx2(uint8_t *dst, const uint8_t *src, int stride, int rnd);
  84. void ff_put_rv40_qpel8_mc33_mmx(uint8_t *block, uint8_t *pixels, int line_size);
  85. void ff_put_rv40_qpel16_mc33_mmx(uint8_t *block, uint8_t *pixels, int line_size);
  86. void ff_avg_rv40_qpel8_mc33_mmx(uint8_t *block, uint8_t *pixels, int line_size);
  87. void ff_avg_rv40_qpel16_mc33_mmx(uint8_t *block, uint8_t *pixels, int line_size);
  88. void ff_mmx_idct(DCTELEM *block);
  89. void ff_mmxext_idct(DCTELEM *block);
  90. void ff_deinterlace_line_mmx(uint8_t *dst,
  91. const uint8_t *lum_m4, const uint8_t *lum_m3,
  92. const uint8_t *lum_m2, const uint8_t *lum_m1,
  93. const uint8_t *lum,
  94. int size);
  95. void ff_deinterlace_line_inplace_mmx(const uint8_t *lum_m4,
  96. const uint8_t *lum_m3,
  97. const uint8_t *lum_m2,
  98. const uint8_t *lum_m1,
  99. const uint8_t *lum, int size);
  100. #endif /* AVCODEC_X86_DSPUTIL_MMX_H */