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

michael@0 1 /********************************************************************
michael@0 2 * *
michael@0 3 * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
michael@0 4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
michael@0 5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
michael@0 6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
michael@0 7 * *
michael@0 8 * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2009 *
michael@0 9 * by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
michael@0 10 * *
michael@0 11 ********************************************************************
michael@0 12
michael@0 13 function:
michael@0 14 last mod: $Id: fragment.c 17410 2010-09-21 21:53:48Z tterribe $
michael@0 15
michael@0 16 ********************************************************************/
michael@0 17 #include <string.h>
michael@0 18 #include "internal.h"
michael@0 19
michael@0 20 void oc_frag_copy_c(unsigned char *_dst,const unsigned char *_src,int _ystride){
michael@0 21 int i;
michael@0 22 for(i=8;i-->0;){
michael@0 23 memcpy(_dst,_src,8*sizeof(*_dst));
michael@0 24 _dst+=_ystride;
michael@0 25 _src+=_ystride;
michael@0 26 }
michael@0 27 }
michael@0 28
michael@0 29 /*Copies the fragments specified by the lists of fragment indices from one
michael@0 30 frame to another.
michael@0 31 _dst_frame: The reference frame to copy to.
michael@0 32 _src_frame: The reference frame to copy from.
michael@0 33 _ystride: The row stride of the reference frames.
michael@0 34 _fragis: A pointer to a list of fragment indices.
michael@0 35 _nfragis: The number of fragment indices to copy.
michael@0 36 _frag_buf_offs: The offsets of fragments in the reference frames.*/
michael@0 37 void oc_frag_copy_list_c(unsigned char *_dst_frame,
michael@0 38 const unsigned char *_src_frame,int _ystride,
michael@0 39 const ptrdiff_t *_fragis,ptrdiff_t _nfragis,const ptrdiff_t *_frag_buf_offs){
michael@0 40 ptrdiff_t fragii;
michael@0 41 for(fragii=0;fragii<_nfragis;fragii++){
michael@0 42 ptrdiff_t frag_buf_off;
michael@0 43 frag_buf_off=_frag_buf_offs[_fragis[fragii]];
michael@0 44 oc_frag_copy_c(_dst_frame+frag_buf_off,
michael@0 45 _src_frame+frag_buf_off,_ystride);
michael@0 46 }
michael@0 47 }
michael@0 48
michael@0 49 void oc_frag_recon_intra_c(unsigned char *_dst,int _ystride,
michael@0 50 const ogg_int16_t _residue[64]){
michael@0 51 int i;
michael@0 52 for(i=0;i<8;i++){
michael@0 53 int j;
michael@0 54 for(j=0;j<8;j++)_dst[j]=OC_CLAMP255(_residue[i*8+j]+128);
michael@0 55 _dst+=_ystride;
michael@0 56 }
michael@0 57 }
michael@0 58
michael@0 59 void oc_frag_recon_inter_c(unsigned char *_dst,
michael@0 60 const unsigned char *_src,int _ystride,const ogg_int16_t _residue[64]){
michael@0 61 int i;
michael@0 62 for(i=0;i<8;i++){
michael@0 63 int j;
michael@0 64 for(j=0;j<8;j++)_dst[j]=OC_CLAMP255(_residue[i*8+j]+_src[j]);
michael@0 65 _dst+=_ystride;
michael@0 66 _src+=_ystride;
michael@0 67 }
michael@0 68 }
michael@0 69
michael@0 70 void oc_frag_recon_inter2_c(unsigned char *_dst,const unsigned char *_src1,
michael@0 71 const unsigned char *_src2,int _ystride,const ogg_int16_t _residue[64]){
michael@0 72 int i;
michael@0 73 for(i=0;i<8;i++){
michael@0 74 int j;
michael@0 75 for(j=0;j<8;j++)_dst[j]=OC_CLAMP255(_residue[i*8+j]+(_src1[j]+_src2[j]>>1));
michael@0 76 _dst+=_ystride;
michael@0 77 _src1+=_ystride;
michael@0 78 _src2+=_ystride;
michael@0 79 }
michael@0 80 }
michael@0 81
michael@0 82 void oc_restore_fpu_c(void){}

mercurial