fragment.c 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 <string.h>
  16. #include "internal.h"
  17. void oc_frag_copy_c(unsigned char *_dst,const unsigned char *_src,int _ystride){
  18. int i;
  19. for(i=8;i-->0;){
  20. memcpy(_dst,_src,8*sizeof(*_dst));
  21. _dst+=_ystride;
  22. _src+=_ystride;
  23. }
  24. }
  25. /*Copies the fragments specified by the lists of fragment indices from one
  26. frame to another.
  27. _dst_frame: The reference frame to copy to.
  28. _src_frame: The reference frame to copy from.
  29. _ystride: The row stride of the reference frames.
  30. _fragis: A pointer to a list of fragment indices.
  31. _nfragis: The number of fragment indices to copy.
  32. _frag_buf_offs: The offsets of fragments in the reference frames.*/
  33. void oc_frag_copy_list_c(unsigned char *_dst_frame,
  34. const unsigned char *_src_frame,int _ystride,
  35. const ptrdiff_t *_fragis,ptrdiff_t _nfragis,const ptrdiff_t *_frag_buf_offs){
  36. ptrdiff_t fragii;
  37. for(fragii=0;fragii<_nfragis;fragii++){
  38. ptrdiff_t frag_buf_off;
  39. frag_buf_off=_frag_buf_offs[_fragis[fragii]];
  40. oc_frag_copy_c(_dst_frame+frag_buf_off,
  41. _src_frame+frag_buf_off,_ystride);
  42. }
  43. }
  44. void oc_frag_recon_intra_c(unsigned char *_dst,int _ystride,
  45. const ogg_int16_t _residue[64]){
  46. int i;
  47. for(i=0;i<8;i++){
  48. int j;
  49. for(j=0;j<8;j++)_dst[j]=OC_CLAMP255(_residue[i*8+j]+128);
  50. _dst+=_ystride;
  51. }
  52. }
  53. void oc_frag_recon_inter_c(unsigned char *_dst,
  54. const unsigned char *_src,int _ystride,const ogg_int16_t _residue[64]){
  55. int i;
  56. for(i=0;i<8;i++){
  57. int j;
  58. for(j=0;j<8;j++)_dst[j]=OC_CLAMP255(_residue[i*8+j]+_src[j]);
  59. _dst+=_ystride;
  60. _src+=_ystride;
  61. }
  62. }
  63. void oc_frag_recon_inter2_c(unsigned char *_dst,const unsigned char *_src1,
  64. const unsigned char *_src2,int _ystride,const ogg_int16_t _residue[64]){
  65. int i;
  66. for(i=0;i<8;i++){
  67. int j;
  68. for(j=0;j<8;j++)_dst[j]=OC_CLAMP255(_residue[i*8+j]+(_src1[j]+_src2[j]>>1));
  69. _dst+=_ystride;
  70. _src1+=_ystride;
  71. _src2+=_ystride;
  72. }
  73. }
  74. void oc_restore_fpu_c(void){}