fragment.c 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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: fragment.c 16503 2009-08-22 18:14:02Z giles $
  14. ********************************************************************/
  15. #include <string.h>
  16. #include "internal.h"
  17. void oc_frag_copy(const oc_theora_state *_state,unsigned char *_dst,
  18. const unsigned char *_src,int _ystride){
  19. (*_state->opt_vtable.frag_copy)(_dst,_src,_ystride);
  20. }
  21. void oc_frag_copy_c(unsigned char *_dst,const unsigned char *_src,int _ystride){
  22. int i;
  23. for(i=8;i-->0;){
  24. memcpy(_dst,_src,8*sizeof(*_dst));
  25. _dst+=_ystride;
  26. _src+=_ystride;
  27. }
  28. }
  29. void oc_frag_recon_intra(const oc_theora_state *_state,unsigned char *_dst,
  30. int _ystride,const ogg_int16_t _residue[64]){
  31. _state->opt_vtable.frag_recon_intra(_dst,_ystride,_residue);
  32. }
  33. void oc_frag_recon_intra_c(unsigned char *_dst,int _ystride,
  34. const ogg_int16_t _residue[64]){
  35. int i;
  36. for(i=0;i<8;i++){
  37. int j;
  38. for(j=0;j<8;j++)_dst[j]=OC_CLAMP255(_residue[i*8+j]+128);
  39. _dst+=_ystride;
  40. }
  41. }
  42. void oc_frag_recon_inter(const oc_theora_state *_state,unsigned char *_dst,
  43. const unsigned char *_src,int _ystride,const ogg_int16_t _residue[64]){
  44. _state->opt_vtable.frag_recon_inter(_dst,_src,_ystride,_residue);
  45. }
  46. void oc_frag_recon_inter_c(unsigned char *_dst,
  47. const unsigned char *_src,int _ystride,const ogg_int16_t _residue[64]){
  48. int i;
  49. for(i=0;i<8;i++){
  50. int j;
  51. for(j=0;j<8;j++)_dst[j]=OC_CLAMP255(_residue[i*8+j]+_src[j]);
  52. _dst+=_ystride;
  53. _src+=_ystride;
  54. }
  55. }
  56. void oc_frag_recon_inter2(const oc_theora_state *_state,unsigned char *_dst,
  57. const unsigned char *_src1,const unsigned char *_src2,int _ystride,
  58. const ogg_int16_t _residue[64]){
  59. _state->opt_vtable.frag_recon_inter2(_dst,_src1,_src2,_ystride,_residue);
  60. }
  61. void oc_frag_recon_inter2_c(unsigned char *_dst,const unsigned char *_src1,
  62. const unsigned char *_src2,int _ystride,const ogg_int16_t _residue[64]){
  63. int i;
  64. for(i=0;i<8;i++){
  65. int j;
  66. for(j=0;j<8;j++)_dst[j]=OC_CLAMP255(_residue[i*8+j]+(_src1[j]+_src2[j]>>1));
  67. _dst+=_ystride;
  68. _src1+=_ystride;
  69. _src2+=_ystride;
  70. }
  71. }
  72. void oc_restore_fpu(const oc_theora_state *_state){
  73. _state->opt_vtable.restore_fpu();
  74. }
  75. void oc_restore_fpu_c(void){}