x86int.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /********************************************************************
  2. * *
  3. * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
  4. * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
  5. * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  6. * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
  7. * *
  8. * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2009 *
  9. * by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
  10. * *
  11. ********************************************************************
  12. function:
  13. last mod: $Id$
  14. ********************************************************************/
  15. #if !defined(_x86_x86int_H)
  16. # define _x86_x86int_H (1)
  17. # include "../internal.h"
  18. # if defined(OC_X86_ASM)
  19. # define oc_state_accel_init oc_state_accel_init_x86
  20. # if defined(OC_X86_64_ASM)
  21. /*x86-64 guarantees SIMD support up through at least SSE2.
  22. If the best routine we have available only needs SSE2 (which at the moment
  23. covers all of them), then we can avoid runtime detection and the indirect
  24. call.*/
  25. # define oc_frag_copy(_state,_dst,_src,_ystride) \
  26. oc_frag_copy_mmx(_dst,_src,_ystride)
  27. # define oc_frag_copy_list(_state,_dst_frame,_src_frame,_ystride, \
  28. _fragis,_nfragis,_frag_buf_offs) \
  29. oc_frag_copy_list_mmx(_dst_frame,_src_frame,_ystride, \
  30. _fragis,_nfragis,_frag_buf_offs)
  31. # define oc_frag_recon_intra(_state,_dst,_ystride,_residue) \
  32. oc_frag_recon_intra_mmx(_dst,_ystride,_residue)
  33. # define oc_frag_recon_inter(_state,_dst,_src,_ystride,_residue) \
  34. oc_frag_recon_inter_mmx(_dst,_src,_ystride,_residue)
  35. # define oc_frag_recon_inter2(_state,_dst,_src1,_src2,_ystride,_residue) \
  36. oc_frag_recon_inter2_mmx(_dst,_src1,_src2,_ystride,_residue)
  37. # define oc_idct8x8(_state,_y,_x,_last_zzi) \
  38. oc_idct8x8_sse2(_y,_x,_last_zzi)
  39. # define oc_state_frag_recon oc_state_frag_recon_mmx
  40. # define oc_loop_filter_init(_state,_bv,_flimit) \
  41. oc_loop_filter_init_mmxext(_bv,_flimit)
  42. # define oc_state_loop_filter_frag_rows oc_state_loop_filter_frag_rows_mmxext
  43. # define oc_restore_fpu(_state) \
  44. oc_restore_fpu_mmx()
  45. # else
  46. # define OC_STATE_USE_VTABLE (1)
  47. # endif
  48. # endif
  49. # include "../state.h"
  50. # include "x86cpu.h"
  51. /*Converts the expression in the argument to a string.*/
  52. #define OC_M2STR(_s) #_s
  53. /*Memory operands do not always include an offset.
  54. To avoid warnings, we force an offset with %H (which adds 8).*/
  55. # if __GNUC_PREREQ(4,0)
  56. # define OC_MEM_OFFS(_offs,_name) \
  57. OC_M2STR(_offs-8+%H[_name])
  58. # endif
  59. /*If your gcc version does't support %H, then you get to suffer the warnings.
  60. Note that Apple's gas breaks on things like _offs+(%esp): it throws away the
  61. whole offset, instead of substituting in 0 for the missing operand to +.*/
  62. # if !defined(OC_MEM_OFFS)
  63. # define OC_MEM_OFFS(_offs,_name) \
  64. OC_M2STR(_offs+%[_name])
  65. # endif
  66. /*Declare an array operand with an exact size.
  67. This tells gcc we're going to clobber this memory region, without having to
  68. clobber all of "memory" and lets us access local buffers directly using the
  69. stack pointer, without allocating a separate register to point to them.*/
  70. #define OC_ARRAY_OPERAND(_type,_ptr,_size) \
  71. (*({ \
  72. struct{_type array_value__[(_size)];} *array_addr__=(void *)(_ptr); \
  73. array_addr__; \
  74. }))
  75. /*Declare an array operand with an exact size.
  76. This tells gcc we're going to clobber this memory region, without having to
  77. clobber all of "memory" and lets us access local buffers directly using the
  78. stack pointer, without allocating a separate register to point to them.*/
  79. #define OC_CONST_ARRAY_OPERAND(_type,_ptr,_size) \
  80. (*({ \
  81. const struct{_type array_value__[(_size)];} *array_addr__= \
  82. (const void *)(_ptr); \
  83. array_addr__; \
  84. }))
  85. extern const unsigned short __attribute__((aligned(16))) OC_IDCT_CONSTS[64];
  86. void oc_state_accel_init_x86(oc_theora_state *_state);
  87. void oc_frag_copy_mmx(unsigned char *_dst,
  88. const unsigned char *_src,int _ystride);
  89. void oc_frag_copy_list_mmx(unsigned char *_dst_frame,
  90. const unsigned char *_src_frame,int _ystride,
  91. const ptrdiff_t *_fragis,ptrdiff_t _nfragis,const ptrdiff_t *_frag_buf_offs);
  92. void oc_frag_recon_intra_mmx(unsigned char *_dst,int _ystride,
  93. const ogg_int16_t *_residue);
  94. void oc_frag_recon_inter_mmx(unsigned char *_dst,
  95. const unsigned char *_src,int _ystride,const ogg_int16_t *_residue);
  96. void oc_frag_recon_inter2_mmx(unsigned char *_dst,const unsigned char *_src1,
  97. const unsigned char *_src2,int _ystride,const ogg_int16_t *_residue);
  98. void oc_idct8x8_mmx(ogg_int16_t _y[64],ogg_int16_t _x[64],int _last_zzi);
  99. void oc_idct8x8_sse2(ogg_int16_t _y[64],ogg_int16_t _x[64],int _last_zzi);
  100. void oc_state_frag_recon_mmx(const oc_theora_state *_state,ptrdiff_t _fragi,
  101. int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,ogg_uint16_t _dc_quant);
  102. void oc_loop_filter_init_mmx(signed char _bv[256],int _flimit);
  103. void oc_loop_filter_init_mmxext(signed char _bv[256],int _flimit);
  104. void oc_state_loop_filter_frag_rows_mmx(const oc_theora_state *_state,
  105. signed char _bv[256],int _refi,int _pli,int _fragy0,int _fragy_end);
  106. void oc_state_loop_filter_frag_rows_mmxext(const oc_theora_state *_state,
  107. signed char _bv[256],int _refi,int _pli,int _fragy0,int _fragy_end);
  108. void oc_restore_fpu_mmx(void);
  109. #endif