1 /********************************************************************
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. *
8 * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2003 *
9 * by the Xiph.Org Foundation http://www.xiph.org/ *
11 ********************************************************************
16 ********************************************************************/
21 #include "theora/theora.h"
26 void (*save_fpu
) (void);
27 void (*restore_fpu
) (void);
29 void (*sub8x8
) (unsigned char *FiltPtr
, unsigned char *ReconPtr
,
30 ogg_int16_t
*DctInputPtr
, ogg_uint32_t PixelsPerLine
,
31 ogg_uint32_t ReconPixelsPerLine
);
33 void (*sub8x8_128
) (unsigned char *FiltPtr
, ogg_int16_t
*DctInputPtr
,
34 ogg_uint32_t PixelsPerLine
);
36 void (*sub8x8avg2
) (unsigned char *FiltPtr
, unsigned char *ReconPtr1
,
37 unsigned char *ReconPtr2
, ogg_int16_t
*DctInputPtr
,
38 ogg_uint32_t PixelsPerLine
,
39 ogg_uint32_t ReconPixelsPerLine
);
41 void (*copy8x8
) (unsigned char *src
, unsigned char *dest
,
44 void (*recon_intra8x8
) (unsigned char *ReconPtr
, ogg_int16_t
*ChangePtr
,
45 ogg_uint32_t LineStep
);
47 void (*recon_inter8x8
) (unsigned char *ReconPtr
, unsigned char *RefPtr
,
48 ogg_int16_t
*ChangePtr
, ogg_uint32_t LineStep
);
50 void (*recon_inter8x8_half
) (unsigned char *ReconPtr
, unsigned char *RefPtr1
,
51 unsigned char *RefPtr2
, ogg_int16_t
*ChangePtr
,
52 ogg_uint32_t LineStep
);
54 void (*fdct_short
) (ogg_int16_t
*InputData
, ogg_int16_t
*OutputData
);
56 ogg_uint32_t (*row_sad8
) (unsigned char *Src1
, unsigned char *Src2
);
58 ogg_uint32_t (*col_sad8x8
) (unsigned char *Src1
, unsigned char *Src2
,
61 ogg_uint32_t (*sad8x8
) (unsigned char *ptr1
, ogg_uint32_t stride1
,
62 unsigned char *ptr2
, ogg_uint32_t stride2
);
64 ogg_uint32_t (*sad8x8_thres
) (unsigned char *ptr1
, ogg_uint32_t stride1
,
65 unsigned char *ptr2
, ogg_uint32_t stride2
,
68 ogg_uint32_t (*sad8x8_xy2_thres
)(unsigned char *SrcData
, ogg_uint32_t SrcStride
,
69 unsigned char *RefDataPtr1
,
70 unsigned char *RefDataPtr2
, ogg_uint32_t RefStride
,
73 ogg_uint32_t (*intra8x8_err
) (unsigned char *DataPtr
, ogg_uint32_t Stride
);
75 ogg_uint32_t (*inter8x8_err
) (unsigned char *SrcData
, ogg_uint32_t SrcStride
,
76 unsigned char *RefDataPtr
, ogg_uint32_t RefStride
);
78 ogg_uint32_t (*inter8x8_err_xy2
)(unsigned char *SrcData
, ogg_uint32_t SrcStride
,
79 unsigned char *RefDataPtr1
,
80 unsigned char *RefDataPtr2
, ogg_uint32_t RefStride
);
82 void (*FilterHoriz
) (unsigned char * PixelPtr
,
83 ogg_int32_t LineLength
, ogg_int16_t
*BoundingValuePtr
);
85 void (*FilterVert
) (unsigned char * PixelPtr
,
86 ogg_int32_t LineLength
, ogg_int16_t
*BoundingValuePtr
);
88 void (*IDctSlow
) (ogg_int16_t
*InputData
,
89 ogg_int16_t
*QuantMatrix
, ogg_int16_t
*OutputData
);
91 void (*IDct3
) (ogg_int16_t
*InputData
,
92 ogg_int16_t
*QuantMatrix
, ogg_int16_t
*OutputData
);
94 void (*IDct10
) (ogg_int16_t
*InputData
,
95 ogg_int16_t
*QuantMatrix
, ogg_int16_t
*OutputData
);
98 extern void dsp_dct_init(DspFunctions
*funcs
, ogg_uint32_t cpu_flags
);
99 extern void dsp_recon_init (DspFunctions
*funcs
, ogg_uint32_t cpu_flags
);
100 extern void dsp_dct_decode_init(DspFunctions
*funcs
, ogg_uint32_t cpu_flags
);
101 extern void dsp_idct_init(DspFunctions
*funcs
, ogg_uint32_t cpu_flags
);
103 void dsp_init(DspFunctions
*funcs
);
104 void dsp_static_init(DspFunctions
*funcs
);
105 #if defined(USE_ASM) && (defined(__i386__) || defined(__x86_64__) || defined(WIN32))
106 extern void dsp_mmx_init(DspFunctions
*funcs
);
107 extern void dsp_mmxext_init(DspFunctions
*funcs
);
108 extern void dsp_mmx_fdct_init(DspFunctions
*funcs
);
109 extern void dsp_mmx_recon_init(DspFunctions
*funcs
);
110 extern void dsp_mmx_dct_decode_init(DspFunctions
*funcs
);
111 extern void dsp_mmx_idct_init(DspFunctions
*funcs
);
114 #define dsp_save_fpu(funcs) (funcs.save_fpu ())
116 #define dsp_restore_fpu(funcs) (funcs.restore_fpu ())
118 #define dsp_sub8x8(funcs,a1,a2,a3,a4,a5) (funcs.sub8x8 (a1,a2,a3,a4,a5))
120 #define dsp_sub8x8_128(funcs,a1,a2,a3) (funcs.sub8x8_128 (a1,a2,a3))
122 #define dsp_sub8x8avg2(funcs,a1,a2,a3,a4,a5,a6) (funcs.sub8x8avg2 (a1,a2,a3,a4,a5,a6))
124 #define dsp_copy8x8(funcs,ptr1,ptr2,str1) (funcs.copy8x8 (ptr1,ptr2,str1))
126 #define dsp_recon_intra8x8(funcs,ptr1,ptr2,str1) (funcs.recon_intra8x8 (ptr1,ptr2,str1))
128 #define dsp_recon_inter8x8(funcs,ptr1,ptr2,ptr3,str1) \
129 (funcs.recon_inter8x8 (ptr1,ptr2,ptr3,str1))
131 #define dsp_recon_inter8x8_half(funcs,ptr1,ptr2,ptr3,ptr4,str1) \
132 (funcs.recon_inter8x8_half (ptr1,ptr2,ptr3,ptr4,str1))
134 #define dsp_fdct_short(funcs,in,out) (funcs.fdct_short (in,out))
136 #define dsp_row_sad8(funcs,ptr1,ptr2) (funcs.row_sad8 (ptr1,ptr2))
138 #define dsp_col_sad8x8(funcs,ptr1,ptr2,str1) (funcs.col_sad8x8 (ptr1,ptr2,str1))
140 #define dsp_sad8x8(funcs,ptr1,str1,ptr2,str2) (funcs.sad8x8 (ptr1,str1,ptr2,str2))
142 #define dsp_sad8x8_thres(funcs,ptr1,str1,ptr2,str2,t) (funcs.sad8x8_thres (ptr1,str1,ptr2,str2,t))
144 #define dsp_sad8x8_xy2_thres(funcs,ptr1,str1,ptr2,ptr3,str2,t) \
145 (funcs.sad8x8_xy2_thres (ptr1,str1,ptr2,ptr3,str2,t))
147 #define dsp_intra8x8_err(funcs,ptr1,str1) (funcs.intra8x8_err (ptr1,str1))
149 #define dsp_inter8x8_err(funcs,ptr1,str1,ptr2,str2) \
150 (funcs.inter8x8_err (ptr1,str1,ptr2,str2))
152 #define dsp_inter8x8_err_xy2(funcs,ptr1,str1,ptr2,ptr3,str2) \
153 (funcs.inter8x8_err_xy2 (ptr1,str1,ptr2,ptr3,str2))
155 #define dsp_FilterHoriz(funcs, ptr1, ptr2, ptr3) \
156 (funcs.FilterHoriz(ptr1, ptr2, ptr3))
158 #define dsp_FilterVert(funcs, ptr1, ptr2, ptr3) \
159 (funcs.FilterVert(ptr1, ptr2, ptr3))
161 #define dsp_IDctSlow(funcs, ptr1, ptr2, ptr3) \
162 (funcs.IDctSlow(ptr1, ptr2, ptr3))
164 #define dsp_IDct3(funcs, ptr1, ptr2, ptr3) \
165 (funcs.IDctSlow(ptr1, ptr2, ptr3))
167 #define dsp_IDct10(funcs, ptr1, ptr2, ptr3) \
168 (funcs.IDctSlow(ptr1, ptr2, ptr3))