media/libtheora/lib/fragment.c

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libtheora/lib/fragment.c	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,82 @@
     1.4 +/********************************************************************
     1.5 + *                                                                  *
     1.6 + * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
     1.7 + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
     1.8 + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
     1.9 + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
    1.10 + *                                                                  *
    1.11 + * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2009                *
    1.12 + * by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
    1.13 + *                                                                  *
    1.14 + ********************************************************************
    1.15 +
    1.16 +  function:
    1.17 +    last mod: $Id: fragment.c 17410 2010-09-21 21:53:48Z tterribe $
    1.18 +
    1.19 + ********************************************************************/
    1.20 +#include <string.h>
    1.21 +#include "internal.h"
    1.22 +
    1.23 +void oc_frag_copy_c(unsigned char *_dst,const unsigned char *_src,int _ystride){
    1.24 +  int i;
    1.25 +  for(i=8;i-->0;){
    1.26 +    memcpy(_dst,_src,8*sizeof(*_dst));
    1.27 +    _dst+=_ystride;
    1.28 +    _src+=_ystride;
    1.29 +  }
    1.30 +}
    1.31 +
    1.32 +/*Copies the fragments specified by the lists of fragment indices from one
    1.33 +   frame to another.
    1.34 +  _dst_frame:     The reference frame to copy to.
    1.35 +  _src_frame:     The reference frame to copy from.
    1.36 +  _ystride:       The row stride of the reference frames.
    1.37 +  _fragis:        A pointer to a list of fragment indices.
    1.38 +  _nfragis:       The number of fragment indices to copy.
    1.39 +  _frag_buf_offs: The offsets of fragments in the reference frames.*/
    1.40 +void oc_frag_copy_list_c(unsigned char *_dst_frame,
    1.41 + const unsigned char *_src_frame,int _ystride,
    1.42 + const ptrdiff_t *_fragis,ptrdiff_t _nfragis,const ptrdiff_t *_frag_buf_offs){
    1.43 +  ptrdiff_t fragii;
    1.44 +  for(fragii=0;fragii<_nfragis;fragii++){
    1.45 +    ptrdiff_t frag_buf_off;
    1.46 +    frag_buf_off=_frag_buf_offs[_fragis[fragii]];
    1.47 +    oc_frag_copy_c(_dst_frame+frag_buf_off,
    1.48 +     _src_frame+frag_buf_off,_ystride);
    1.49 +  }
    1.50 +}
    1.51 +
    1.52 +void oc_frag_recon_intra_c(unsigned char *_dst,int _ystride,
    1.53 + const ogg_int16_t _residue[64]){
    1.54 +  int i;
    1.55 +  for(i=0;i<8;i++){
    1.56 +    int j;
    1.57 +    for(j=0;j<8;j++)_dst[j]=OC_CLAMP255(_residue[i*8+j]+128);
    1.58 +    _dst+=_ystride;
    1.59 +  }
    1.60 +}
    1.61 +
    1.62 +void oc_frag_recon_inter_c(unsigned char *_dst,
    1.63 + const unsigned char *_src,int _ystride,const ogg_int16_t _residue[64]){
    1.64 +  int i;
    1.65 +  for(i=0;i<8;i++){
    1.66 +    int j;
    1.67 +    for(j=0;j<8;j++)_dst[j]=OC_CLAMP255(_residue[i*8+j]+_src[j]);
    1.68 +    _dst+=_ystride;
    1.69 +    _src+=_ystride;
    1.70 +  }
    1.71 +}
    1.72 +
    1.73 +void oc_frag_recon_inter2_c(unsigned char *_dst,const unsigned char *_src1,
    1.74 + const unsigned char *_src2,int _ystride,const ogg_int16_t _residue[64]){
    1.75 +  int i;
    1.76 +  for(i=0;i<8;i++){
    1.77 +    int j;
    1.78 +    for(j=0;j<8;j++)_dst[j]=OC_CLAMP255(_residue[i*8+j]+(_src1[j]+_src2[j]>>1));
    1.79 +    _dst+=_ystride;
    1.80 +    _src1+=_ystride;
    1.81 +    _src2+=_ystride;
    1.82 +  }
    1.83 +}
    1.84 +
    1.85 +void oc_restore_fpu_c(void){}

mercurial