media/libtheora/lib/fragment.c

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial