Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > VSs > VSs__H264__App
comparison libavcodec/rectangle.h @ 9:ea1ba68cf0ed
update to match api changes + add sscc produced source
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Wed, 05 Jun 2013 14:43:26 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:aeaf3d08b391 |
|---|---|
| 1 /* | |
| 2 * rectangle filling function | |
| 3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> | |
| 4 * | |
| 5 * This file is part of FFmpeg. | |
| 6 * | |
| 7 * FFmpeg is free software; you can redistribute it and/or | |
| 8 * modify it under the terms of the GNU Lesser General Public | |
| 9 * License as published by the Free Software Foundation; either | |
| 10 * version 2.1 of the License, or (at your option) any later version. | |
| 11 * | |
| 12 * FFmpeg is distributed in the hope that it will be useful, | |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 15 * Lesser General Public License for more details. | |
| 16 * | |
| 17 * You should have received a copy of the GNU Lesser General Public | |
| 18 * License along with FFmpeg; if not, write to the Free Software | |
| 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 */ | |
| 21 | |
| 22 /** | |
| 23 * @file | |
| 24 * useful rectangle filling function | |
| 25 * @author Michael Niedermayer <michaelni@gmx.at> | |
| 26 */ | |
| 27 | |
| 28 #ifndef AVCODEC_RECTANGLE_H | |
| 29 #define AVCODEC_RECTANGLE_H | |
| 30 | |
| 31 #include <assert.h> | |
| 32 //#include "config.h" | |
| 33 #include "libavutil/common.h" | |
| 34 #include "dsputil.h" | |
| 35 | |
| 36 /** | |
| 37 * fill a rectangle. | |
| 38 * @param h height of the rectangle, should be a constant | |
| 39 * @param w width of the rectangle, should be a constant | |
| 40 * @param size the size of val (1, 2 or 4), should be a constant | |
| 41 */ | |
| 42 static av_always_inline void fill_rectangle(void *vp, int w, int h, int stride, uint32_t val, int size){ | |
| 43 uint8_t *p= (uint8_t*)vp; | |
| 44 assert(size==1 || size==2 || size==4); | |
| 45 assert(w<=4); | |
| 46 | |
| 47 w *= size; | |
| 48 stride *= size; | |
| 49 | |
| 50 assert((((long)vp)&(FFMIN(w, STRIDE_ALIGN)-1)) == 0); | |
| 51 assert((stride&(w-1))==0); | |
| 52 if(w==2){ | |
| 53 const uint16_t v= size==4 ? val : val*0x0101; | |
| 54 *(uint16_t*)(p + 0*stride)= v; | |
| 55 if(h==1) return; | |
| 56 *(uint16_t*)(p + 1*stride)= v; | |
| 57 if(h==2) return; | |
| 58 *(uint16_t*)(p + 2*stride)= v; | |
| 59 *(uint16_t*)(p + 3*stride)= v; | |
| 60 }else if(w==4){ | |
| 61 const uint32_t v= size==4 ? val : size==2 ? val*0x00010001 : val*0x01010101; | |
| 62 *(uint32_t*)(p + 0*stride)= v; | |
| 63 if(h==1) return; | |
| 64 *(uint32_t*)(p + 1*stride)= v; | |
| 65 if(h==2) return; | |
| 66 *(uint32_t*)(p + 2*stride)= v; | |
| 67 *(uint32_t*)(p + 3*stride)= v; | |
| 68 }else if(w==8){ | |
| 69 const uint64_t v= size==2 ? val*0x0001000100010001ULL : val*0x0100000001ULL; | |
| 70 *(uint64_t*)(p + 0*stride)= v; | |
| 71 if(h==1) return; | |
| 72 *(uint64_t*)(p + 1*stride)= v; | |
| 73 if(h==2) return; | |
| 74 *(uint64_t*)(p + 2*stride)= v; | |
| 75 *(uint64_t*)(p + 3*stride)= v; | |
| 76 }else if(w==16){ | |
| 77 const uint64_t v= val*0x0100000001ULL; | |
| 78 *(uint64_t*)(p + 0+0*stride)= v; | |
| 79 *(uint64_t*)(p + 8+0*stride)= v; | |
| 80 *(uint64_t*)(p + 0+1*stride)= v; | |
| 81 *(uint64_t*)(p + 8+1*stride)= v; | |
| 82 if(h==2) return; | |
| 83 *(uint64_t*)(p + 0+2*stride)= v; | |
| 84 *(uint64_t*)(p + 8+2*stride)= v; | |
| 85 *(uint64_t*)(p + 0+3*stride)= v; | |
| 86 *(uint64_t*)(p + 8+3*stride)= v; | |
| 87 }else | |
| 88 assert(0); | |
| 89 assert(h==4); | |
| 90 } | |
| 91 | |
| 92 #endif /* AVCODEC_RECTANGLE_H */ |
