michael@0: /******************************************************************** michael@0: * * michael@0: * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. * michael@0: * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * michael@0: * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * michael@0: * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * michael@0: * * michael@0: * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2009 * michael@0: * by the Xiph.Org Foundation and contributors http://www.xiph.org/ * michael@0: * * michael@0: ******************************************************************** michael@0: michael@0: function: michael@0: last mod: $Id: x86int.h 17578 2010-10-29 04:21:26Z tterribe $ michael@0: michael@0: ********************************************************************/ michael@0: michael@0: #if !defined(_x86_x86int_H) michael@0: # define _x86_x86int_H (1) michael@0: # include "../internal.h" michael@0: michael@0: # if defined(OC_X86_ASM) michael@0: # define oc_state_accel_init oc_state_accel_init_x86 michael@0: # if defined(OC_X86_64_ASM) michael@0: /*x86-64 guarantees SIMD support up through at least SSE2. michael@0: If the best routine we have available only needs SSE2 (which at the moment michael@0: covers all of them), then we can avoid runtime detection and the indirect michael@0: call.*/ michael@0: # define oc_frag_copy(_state,_dst,_src,_ystride) \ michael@0: oc_frag_copy_mmx(_dst,_src,_ystride) michael@0: # define oc_frag_copy_list(_state,_dst_frame,_src_frame,_ystride, \ michael@0: _fragis,_nfragis,_frag_buf_offs) \ michael@0: oc_frag_copy_list_mmx(_dst_frame,_src_frame,_ystride, \ michael@0: _fragis,_nfragis,_frag_buf_offs) michael@0: # define oc_frag_recon_intra(_state,_dst,_ystride,_residue) \ michael@0: oc_frag_recon_intra_mmx(_dst,_ystride,_residue) michael@0: # define oc_frag_recon_inter(_state,_dst,_src,_ystride,_residue) \ michael@0: oc_frag_recon_inter_mmx(_dst,_src,_ystride,_residue) michael@0: # define oc_frag_recon_inter2(_state,_dst,_src1,_src2,_ystride,_residue) \ michael@0: oc_frag_recon_inter2_mmx(_dst,_src1,_src2,_ystride,_residue) michael@0: # define oc_idct8x8(_state,_y,_x,_last_zzi) \ michael@0: oc_idct8x8_sse2(_y,_x,_last_zzi) michael@0: # define oc_state_frag_recon oc_state_frag_recon_mmx michael@0: # define oc_loop_filter_init(_state,_bv,_flimit) \ michael@0: oc_loop_filter_init_mmxext(_bv,_flimit) michael@0: # define oc_state_loop_filter_frag_rows oc_state_loop_filter_frag_rows_mmxext michael@0: # define oc_restore_fpu(_state) \ michael@0: oc_restore_fpu_mmx() michael@0: # else michael@0: # define OC_STATE_USE_VTABLE (1) michael@0: # endif michael@0: # endif michael@0: michael@0: # include "../state.h" michael@0: # include "x86cpu.h" michael@0: michael@0: /*Converts the expression in the argument to a string.*/ michael@0: #define OC_M2STR(_s) #_s michael@0: michael@0: /*Memory operands do not always include an offset. michael@0: To avoid warnings, we force an offset with %H (which adds 8).*/ michael@0: # if __GNUC_PREREQ(4,0) michael@0: # define OC_MEM_OFFS(_offs,_name) \ michael@0: OC_M2STR(_offs-8+%H[_name]) michael@0: # endif michael@0: /*If your gcc version does't support %H, then you get to suffer the warnings. michael@0: Note that Apple's gas breaks on things like _offs+(%esp): it throws away the michael@0: whole offset, instead of substituting in 0 for the missing operand to +.*/ michael@0: # if !defined(OC_MEM_OFFS) michael@0: # define OC_MEM_OFFS(_offs,_name) \ michael@0: OC_M2STR(_offs+%[_name]) michael@0: # endif michael@0: michael@0: /*Declare an array operand with an exact size. michael@0: This tells gcc we're going to clobber this memory region, without having to michael@0: clobber all of "memory" and lets us access local buffers directly using the michael@0: stack pointer, without allocating a separate register to point to them.*/ michael@0: #define OC_ARRAY_OPERAND(_type,_ptr,_size) \ michael@0: (*({ \ michael@0: struct{_type array_value__[(_size)];} *array_addr__=(void *)(_ptr); \ michael@0: array_addr__; \ michael@0: })) michael@0: michael@0: /*Declare an array operand with an exact size. michael@0: This tells gcc we're going to clobber this memory region, without having to michael@0: clobber all of "memory" and lets us access local buffers directly using the michael@0: stack pointer, without allocating a separate register to point to them.*/ michael@0: #define OC_CONST_ARRAY_OPERAND(_type,_ptr,_size) \ michael@0: (*({ \ michael@0: const struct{_type array_value__[(_size)];} *array_addr__= \ michael@0: (const void *)(_ptr); \ michael@0: array_addr__; \ michael@0: })) michael@0: michael@0: extern const unsigned short __attribute__((aligned(16))) OC_IDCT_CONSTS[64]; michael@0: michael@0: void oc_state_accel_init_x86(oc_theora_state *_state); michael@0: michael@0: void oc_frag_copy_mmx(unsigned char *_dst, michael@0: const unsigned char *_src,int _ystride); michael@0: void oc_frag_copy_list_mmx(unsigned char *_dst_frame, michael@0: const unsigned char *_src_frame,int _ystride, michael@0: const ptrdiff_t *_fragis,ptrdiff_t _nfragis,const ptrdiff_t *_frag_buf_offs); michael@0: void oc_frag_recon_intra_mmx(unsigned char *_dst,int _ystride, michael@0: const ogg_int16_t *_residue); michael@0: void oc_frag_recon_inter_mmx(unsigned char *_dst, michael@0: const unsigned char *_src,int _ystride,const ogg_int16_t *_residue); michael@0: void oc_frag_recon_inter2_mmx(unsigned char *_dst,const unsigned char *_src1, michael@0: const unsigned char *_src2,int _ystride,const ogg_int16_t *_residue); michael@0: void oc_idct8x8_mmx(ogg_int16_t _y[64],ogg_int16_t _x[64],int _last_zzi); michael@0: void oc_idct8x8_sse2(ogg_int16_t _y[64],ogg_int16_t _x[64],int _last_zzi); michael@0: void oc_state_frag_recon_mmx(const oc_theora_state *_state,ptrdiff_t _fragi, michael@0: int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,ogg_uint16_t _dc_quant); michael@0: void oc_loop_filter_init_mmx(signed char _bv[256],int _flimit); michael@0: void oc_loop_filter_init_mmxext(signed char _bv[256],int _flimit); michael@0: void oc_state_loop_filter_frag_rows_mmx(const oc_theora_state *_state, michael@0: signed char _bv[256],int _refi,int _pli,int _fragy0,int _fragy_end); michael@0: void oc_state_loop_filter_frag_rows_mmxext(const oc_theora_state *_state, michael@0: signed char _bv[256],int _refi,int _pli,int _fragy0,int _fragy_end); michael@0: void oc_restore_fpu_mmx(void); michael@0: michael@0: #endif