Git init
[external/libtheora.git] / lib / x86 / x86state.c
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
13   function:
14     last mod: $Id: x86state.c 16503 2009-08-22 18:14:02Z giles $
15
16  ********************************************************************/
17
18 #include "x86int.h"
19
20 #if defined(OC_X86_ASM)
21
22 #include "../cpu.c"
23
24 /*This table has been modified from OC_FZIG_ZAG by baking a 4x4 transpose into
25    each quadrant of the destination.*/
26 static const unsigned char OC_FZIG_ZAG_MMX[128]={
27    0, 8, 1, 2, 9,16,24,17,
28   10, 3,32,11,18,25, 4,12,
29    5,26,19,40,33,34,41,48,
30   27, 6,13,20,28,21,14, 7,
31   56,49,42,35,43,50,57,36,
32   15,22,29,30,23,44,37,58,
33   51,59,38,45,52,31,60,53,
34   46,39,47,54,61,62,55,63,
35   64,64,64,64,64,64,64,64,
36   64,64,64,64,64,64,64,64,
37   64,64,64,64,64,64,64,64,
38   64,64,64,64,64,64,64,64,
39   64,64,64,64,64,64,64,64,
40   64,64,64,64,64,64,64,64,
41   64,64,64,64,64,64,64,64,
42   64,64,64,64,64,64,64,64,
43 };
44
45 void oc_state_vtable_init_x86(oc_theora_state *_state){
46   _state->cpu_flags=oc_cpu_flags_get();
47   if(_state->cpu_flags&OC_CPU_X86_MMX){
48     _state->opt_vtable.frag_copy=oc_frag_copy_mmx;
49     _state->opt_vtable.frag_recon_intra=oc_frag_recon_intra_mmx;
50     _state->opt_vtable.frag_recon_inter=oc_frag_recon_inter_mmx;
51     _state->opt_vtable.frag_recon_inter2=oc_frag_recon_inter2_mmx;
52     _state->opt_vtable.idct8x8=oc_idct8x8_mmx;
53     _state->opt_vtable.state_frag_recon=oc_state_frag_recon_mmx;
54     _state->opt_vtable.state_frag_copy_list=oc_state_frag_copy_list_mmx;
55     _state->opt_vtable.state_loop_filter_frag_rows=
56      oc_state_loop_filter_frag_rows_mmx;
57     _state->opt_vtable.restore_fpu=oc_restore_fpu_mmx;
58     _state->opt_data.dct_fzig_zag=OC_FZIG_ZAG_MMX;
59   }
60   else oc_state_vtable_init_c(_state);
61 }
62 #endif