x86state.c 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. #include "x86int.h"
  16. #if defined(OC_X86_ASM)
  17. #if defined(OC_STATE_USE_VTABLE)
  18. /*This table has been modified from OC_FZIG_ZAG by baking a 4x4 transpose into
  19. each quadrant of the destination.*/
  20. static const unsigned char OC_FZIG_ZAG_MMX[128]={
  21. 0, 8, 1, 2, 9,16,24,17,
  22. 10, 3,32,11,18,25, 4,12,
  23. 5,26,19,40,33,34,41,48,
  24. 27, 6,13,20,28,21,14, 7,
  25. 56,49,42,35,43,50,57,36,
  26. 15,22,29,30,23,44,37,58,
  27. 51,59,38,45,52,31,60,53,
  28. 46,39,47,54,61,62,55,63,
  29. 64,64,64,64,64,64,64,64,
  30. 64,64,64,64,64,64,64,64,
  31. 64,64,64,64,64,64,64,64,
  32. 64,64,64,64,64,64,64,64,
  33. 64,64,64,64,64,64,64,64,
  34. 64,64,64,64,64,64,64,64,
  35. 64,64,64,64,64,64,64,64,
  36. 64,64,64,64,64,64,64,64
  37. };
  38. #endif
  39. /*This table has been modified from OC_FZIG_ZAG by baking an 8x8 transpose into
  40. the destination.*/
  41. static const unsigned char OC_FZIG_ZAG_SSE2[128]={
  42. 0, 8, 1, 2, 9,16,24,17,
  43. 10, 3, 4,11,18,25,32,40,
  44. 33,26,19,12, 5, 6,13,20,
  45. 27,34,41,48,56,49,42,35,
  46. 28,21,14, 7,15,22,29,36,
  47. 43,50,57,58,51,44,37,30,
  48. 23,31,38,45,52,59,60,53,
  49. 46,39,47,54,61,62,55,63,
  50. 64,64,64,64,64,64,64,64,
  51. 64,64,64,64,64,64,64,64,
  52. 64,64,64,64,64,64,64,64,
  53. 64,64,64,64,64,64,64,64,
  54. 64,64,64,64,64,64,64,64,
  55. 64,64,64,64,64,64,64,64,
  56. 64,64,64,64,64,64,64,64,
  57. 64,64,64,64,64,64,64,64
  58. };
  59. void oc_state_accel_init_x86(oc_theora_state *_state){
  60. oc_state_accel_init_c(_state);
  61. _state->cpu_flags=oc_cpu_flags_get();
  62. # if defined(OC_STATE_USE_VTABLE)
  63. if(_state->cpu_flags&OC_CPU_X86_MMX){
  64. _state->opt_vtable.frag_copy=oc_frag_copy_mmx;
  65. _state->opt_vtable.frag_copy_list=oc_frag_copy_list_mmx;
  66. _state->opt_vtable.frag_recon_intra=oc_frag_recon_intra_mmx;
  67. _state->opt_vtable.frag_recon_inter=oc_frag_recon_inter_mmx;
  68. _state->opt_vtable.frag_recon_inter2=oc_frag_recon_inter2_mmx;
  69. _state->opt_vtable.idct8x8=oc_idct8x8_mmx;
  70. _state->opt_vtable.state_frag_recon=oc_state_frag_recon_mmx;
  71. _state->opt_vtable.loop_filter_init=oc_loop_filter_init_mmx;
  72. _state->opt_vtable.state_loop_filter_frag_rows=
  73. oc_state_loop_filter_frag_rows_mmx;
  74. _state->opt_vtable.restore_fpu=oc_restore_fpu_mmx;
  75. _state->opt_data.dct_fzig_zag=OC_FZIG_ZAG_MMX;
  76. }
  77. if(_state->cpu_flags&OC_CPU_X86_MMXEXT){
  78. _state->opt_vtable.loop_filter_init=oc_loop_filter_init_mmxext;
  79. _state->opt_vtable.state_loop_filter_frag_rows=
  80. oc_state_loop_filter_frag_rows_mmxext;
  81. }
  82. if(_state->cpu_flags&OC_CPU_X86_SSE2){
  83. _state->opt_vtable.idct8x8=oc_idct8x8_sse2;
  84. # endif
  85. _state->opt_data.dct_fzig_zag=OC_FZIG_ZAG_SSE2;
  86. # if defined(OC_STATE_USE_VTABLE)
  87. }
  88. # endif
  89. }
  90. #endif