Mercurial > libavcodec.hg
annotate rectangle.h @ 8717:407a1a178cad libavcodec
Fix filenames in doxygen comments.
author | diego |
---|---|
date | Sun, 01 Feb 2009 01:29:30 +0000 |
parents | 1612935d2e4d |
children | e9d9d946f213 |
rev | line source |
---|---|
1168 | 1 /* |
6020 | 2 * rectangle filling function |
1168 | 3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> |
4 * | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3927
diff
changeset
|
5 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3927
diff
changeset
|
6 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3927
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
1168 | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3927
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
1168 | 11 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3927
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
1168 | 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 | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3927
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
3029
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
1168 | 20 */ |
2967 | 21 |
1168 | 22 /** |
6020 | 23 * @file rectangle.h |
24 * useful rectangle filling function | |
1168 | 25 * @author Michael Niedermayer <michaelni@gmx.at> |
26 */ | |
27 | |
7760 | 28 #ifndef AVCODEC_RECTANGLE_H |
29 #define AVCODEC_RECTANGLE_H | |
1168 | 30 |
8648 | 31 #include <assert.h> |
32 #include "config.h" | |
6763 | 33 #include "libavutil/common.h" |
8648 | 34 #include "dsputil.h" |
4277
113f3b395bac
Making rem6 and div6 globally visible and thus adding prefixes.
takis
parents:
4276
diff
changeset
|
35 |
1168 | 36 /** |
37 * fill a rectangle. | |
2392 | 38 * @param h height of the rectangle, should be a constant |
39 * @param w width of the rectangle, should be a constant | |
1168 | 40 * @param size the size of val (1 or 4), should be a constant |
41 */ | |
4283
d6f83e2f8804
rename always_inline to av_always_inline and move to common.h
mru
parents:
4277
diff
changeset
|
42 static av_always_inline void fill_rectangle(void *vp, int w, int h, int stride, uint32_t val, int size){ |
1187 | 43 uint8_t *p= (uint8_t*)vp; |
1168 | 44 assert(size==1 || size==4); |
3315 | 45 assert(w<=4); |
2967 | 46 |
1168 | 47 w *= size; |
48 stride *= size; | |
2967 | 49 |
2962 | 50 assert((((long)vp)&(FFMIN(w, STRIDE_ALIGN)-1)) == 0); |
2669 | 51 assert((stride&(w-1))==0); |
3315 | 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; | |
5545
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
58 *(uint16_t*)(p + 2*stride)= v; |
3315 | 59 *(uint16_t*)(p + 3*stride)= v; |
60 }else if(w==4){ | |
61 const uint32_t v= size==4 ? val : 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; | |
5545
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
66 *(uint32_t*)(p + 2*stride)= v; |
3315 | 67 *(uint32_t*)(p + 3*stride)= v; |
68 }else if(w==8){ | |
69 //gcc can't optimize 64bit math on x86_32 | |
8590 | 70 #if HAVE_FAST_64BIT |
3315 | 71 const uint64_t v= val*0x0100000001ULL; |
72 *(uint64_t*)(p + 0*stride)= v; | |
73 if(h==1) return; | |
74 *(uint64_t*)(p + 1*stride)= v; | |
75 if(h==2) return; | |
5545
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
76 *(uint64_t*)(p + 2*stride)= v; |
3315 | 77 *(uint64_t*)(p + 3*stride)= v; |
78 }else if(w==16){ | |
79 const uint64_t v= val*0x0100000001ULL; | |
5545
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
80 *(uint64_t*)(p + 0+0*stride)= v; |
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
81 *(uint64_t*)(p + 8+0*stride)= v; |
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
82 *(uint64_t*)(p + 0+1*stride)= v; |
3315 | 83 *(uint64_t*)(p + 8+1*stride)= v; |
84 if(h==2) return; | |
5545
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
85 *(uint64_t*)(p + 0+2*stride)= v; |
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
86 *(uint64_t*)(p + 8+2*stride)= v; |
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
87 *(uint64_t*)(p + 0+3*stride)= v; |
3315 | 88 *(uint64_t*)(p + 8+3*stride)= v; |
89 #else | |
5545
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
90 *(uint32_t*)(p + 0+0*stride)= val; |
3315 | 91 *(uint32_t*)(p + 4+0*stride)= val; |
92 if(h==1) return; | |
5545
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
93 *(uint32_t*)(p + 0+1*stride)= val; |
3315 | 94 *(uint32_t*)(p + 4+1*stride)= val; |
95 if(h==2) return; | |
5545
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
96 *(uint32_t*)(p + 0+2*stride)= val; |
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
97 *(uint32_t*)(p + 4+2*stride)= val; |
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
98 *(uint32_t*)(p + 0+3*stride)= val; |
3315 | 99 *(uint32_t*)(p + 4+3*stride)= val; |
100 }else if(w==16){ | |
5545
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
101 *(uint32_t*)(p + 0+0*stride)= val; |
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
102 *(uint32_t*)(p + 4+0*stride)= val; |
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
103 *(uint32_t*)(p + 8+0*stride)= val; |
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
104 *(uint32_t*)(p +12+0*stride)= val; |
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
105 *(uint32_t*)(p + 0+1*stride)= val; |
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
106 *(uint32_t*)(p + 4+1*stride)= val; |
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
107 *(uint32_t*)(p + 8+1*stride)= val; |
3315 | 108 *(uint32_t*)(p +12+1*stride)= val; |
109 if(h==2) return; | |
5545
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
110 *(uint32_t*)(p + 0+2*stride)= val; |
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
111 *(uint32_t*)(p + 4+2*stride)= val; |
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
112 *(uint32_t*)(p + 8+2*stride)= val; |
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
113 *(uint32_t*)(p +12+2*stride)= val; |
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
114 *(uint32_t*)(p + 0+3*stride)= val; |
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
115 *(uint32_t*)(p + 4+3*stride)= val; |
397cb90b66d0
Statements like a = b = c = d = e; store from right-to-left, so if
gpoirier
parents:
5528
diff
changeset
|
116 *(uint32_t*)(p + 8+3*stride)= val; |
3315 | 117 *(uint32_t*)(p +12+3*stride)= val; |
118 #endif | |
1168 | 119 }else |
120 assert(0); | |
3315 | 121 assert(h==4); |
1168 | 122 } |
123 | |
7760 | 124 #endif /* AVCODEC_RECTANGLE_H */ |