Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > VSs > VSs__H264__App
diff libavcodec/rectangle.h @ 2:897f711a7157
rearrange to work with autoconf
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Tue, 25 Sep 2012 15:55:33 +0200 |
| parents | |
| children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libavcodec/rectangle.h Tue Sep 25 15:55:33 2012 +0200 1.3 @@ -0,0 +1,92 @@ 1.4 +/* 1.5 + * rectangle filling function 1.6 + * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> 1.7 + * 1.8 + * This file is part of FFmpeg. 1.9 + * 1.10 + * FFmpeg is free software; you can redistribute it and/or 1.11 + * modify it under the terms of the GNU Lesser General Public 1.12 + * License as published by the Free Software Foundation; either 1.13 + * version 2.1 of the License, or (at your option) any later version. 1.14 + * 1.15 + * FFmpeg is distributed in the hope that it will be useful, 1.16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 1.17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1.18 + * Lesser General Public License for more details. 1.19 + * 1.20 + * You should have received a copy of the GNU Lesser General Public 1.21 + * License along with FFmpeg; if not, write to the Free Software 1.22 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 1.23 + */ 1.24 + 1.25 +/** 1.26 + * @file 1.27 + * useful rectangle filling function 1.28 + * @author Michael Niedermayer <michaelni@gmx.at> 1.29 + */ 1.30 + 1.31 +#ifndef AVCODEC_RECTANGLE_H 1.32 +#define AVCODEC_RECTANGLE_H 1.33 + 1.34 +#include <assert.h> 1.35 +//#include "config.h" 1.36 +#include "libavutil/common.h" 1.37 +#include "dsputil.h" 1.38 + 1.39 +/** 1.40 + * fill a rectangle. 1.41 + * @param h height of the rectangle, should be a constant 1.42 + * @param w width of the rectangle, should be a constant 1.43 + * @param size the size of val (1, 2 or 4), should be a constant 1.44 + */ 1.45 +static av_always_inline void fill_rectangle(void *vp, int w, int h, int stride, uint32_t val, int size){ 1.46 + uint8_t *p= (uint8_t*)vp; 1.47 + assert(size==1 || size==2 || size==4); 1.48 + assert(w<=4); 1.49 + 1.50 + w *= size; 1.51 + stride *= size; 1.52 + 1.53 + assert((((long)vp)&(FFMIN(w, STRIDE_ALIGN)-1)) == 0); 1.54 + assert((stride&(w-1))==0); 1.55 + if(w==2){ 1.56 + const uint16_t v= size==4 ? val : val*0x0101; 1.57 + *(uint16_t*)(p + 0*stride)= v; 1.58 + if(h==1) return; 1.59 + *(uint16_t*)(p + 1*stride)= v; 1.60 + if(h==2) return; 1.61 + *(uint16_t*)(p + 2*stride)= v; 1.62 + *(uint16_t*)(p + 3*stride)= v; 1.63 + }else if(w==4){ 1.64 + const uint32_t v= size==4 ? val : size==2 ? val*0x00010001 : val*0x01010101; 1.65 + *(uint32_t*)(p + 0*stride)= v; 1.66 + if(h==1) return; 1.67 + *(uint32_t*)(p + 1*stride)= v; 1.68 + if(h==2) return; 1.69 + *(uint32_t*)(p + 2*stride)= v; 1.70 + *(uint32_t*)(p + 3*stride)= v; 1.71 + }else if(w==8){ 1.72 + const uint64_t v= size==2 ? val*0x0001000100010001ULL : val*0x0100000001ULL; 1.73 + *(uint64_t*)(p + 0*stride)= v; 1.74 + if(h==1) return; 1.75 + *(uint64_t*)(p + 1*stride)= v; 1.76 + if(h==2) return; 1.77 + *(uint64_t*)(p + 2*stride)= v; 1.78 + *(uint64_t*)(p + 3*stride)= v; 1.79 + }else if(w==16){ 1.80 + const uint64_t v= val*0x0100000001ULL; 1.81 + *(uint64_t*)(p + 0+0*stride)= v; 1.82 + *(uint64_t*)(p + 8+0*stride)= v; 1.83 + *(uint64_t*)(p + 0+1*stride)= v; 1.84 + *(uint64_t*)(p + 8+1*stride)= v; 1.85 + if(h==2) return; 1.86 + *(uint64_t*)(p + 0+2*stride)= v; 1.87 + *(uint64_t*)(p + 8+2*stride)= v; 1.88 + *(uint64_t*)(p + 0+3*stride)= v; 1.89 + *(uint64_t*)(p + 8+3*stride)= v; 1.90 + }else 1.91 + assert(0); 1.92 + assert(h==4); 1.93 +} 1.94 + 1.95 +#endif /* AVCODEC_RECTANGLE_H */
