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