annotate rectangle.h @ 11377:f9e0f62a7d8a libavcodec

Move ff_set_qscale() prototype to mpegvideo.h; it is defined in mpegvideo.c
author mru
date Sat, 06 Mar 2010 22:36:52 +0000
parents fea25a6f874e
children 7dd2a45249a9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
1 /*
6020
c531defb03ee Make fill_rectangle() available for other decoders
kostya
parents: 6019
diff changeset
2 * rectangle filling function
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
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
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
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
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
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
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
15 * Lesser General Public License for more details.
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
16 *
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
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
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
20 */
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
21
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
22 /**
8718
e9d9d946f213 Use full internal pathname in doxygen @file directives.
diego
parents: 8648
diff changeset
23 * @file libavcodec/rectangle.h
6020
c531defb03ee Make fill_rectangle() available for other decoders
kostya
parents: 6019
diff changeset
24 * useful rectangle filling function
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
25 * @author Michael Niedermayer <michaelni@gmx.at>
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
26 */
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
27
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 6763
diff changeset
28 #ifndef AVCODEC_RECTANGLE_H
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 6763
diff changeset
29 #define AVCODEC_RECTANGLE_H
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
30
8648
1612935d2e4d Add required headers to fix 'make checkheaders'.
diego
parents: 8590
diff changeset
31 #include <assert.h>
1612935d2e4d Add required headers to fix 'make checkheaders'.
diego
parents: 8590
diff changeset
32 #include "config.h"
6763
f7cbb7733146 Use full path for #includes from another directory.
diego
parents: 6506
diff changeset
33 #include "libavutil/common.h"
8648
1612935d2e4d Add required headers to fix 'make checkheaders'.
diego
parents: 8590
diff changeset
34 #include "dsputil.h"
4277
113f3b395bac Making rem6 and div6 globally visible and thus adding prefixes.
takis
parents: 4276
diff changeset
35
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
36 /**
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
37 * fill a rectangle.
2392
299f2d85d27d add multi slice support
michael
parents: 2384
diff changeset
38 * @param h height of the rectangle, should be a constant
299f2d85d27d add multi slice support
michael
parents: 2384
diff changeset
39 * @param w width of the rectangle, should be a constant
11279
08fdccf61a03 Fix doxy and assert().
michael
parents: 11278
diff changeset
40 * @param size the size of val (1, 2 or 4), should be a constant
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
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
f3c659bfdb8e minor cleanup / some warning fixes
michaelni
parents: 1184
diff changeset
43 uint8_t *p= (uint8_t*)vp;
11279
08fdccf61a03 Fix doxy and assert().
michael
parents: 11278
diff changeset
44 assert(size==1 || size==2 || size==4);
3315
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
45 assert(w<=4);
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
46
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
47 w *= size;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
48 stride *= size;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
49
2962
fde28cb7e3d5 use PRIxN, %zd, %td formats where needed
mru
parents: 2960
diff changeset
50 assert((((long)vp)&(FFMIN(w, STRIDE_ALIGN)-1)) == 0);
2669
a4e3a37ed57b some asserts()
michael
parents: 2650
diff changeset
51 assert((stride&(w-1))==0);
3315
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
52 if(w==2){
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
53 const uint16_t v= size==4 ? val : val*0x0101;
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
54 *(uint16_t*)(p + 0*stride)= v;
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
55 if(h==1) return;
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
56 *(uint16_t*)(p + 1*stride)= v;
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
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
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
59 *(uint16_t*)(p + 3*stride)= v;
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
60 }else if(w==4){
11276
dd948aea1c20 Extend fill_rectangle() support for 16bit
michael
parents: 8718
diff changeset
61 const uint32_t v= size==4 ? val : size==2 ? val*0x00010001 : val*0x01010101;
3315
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
62 *(uint32_t*)(p + 0*stride)= v;
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
63 if(h==1) return;
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
64 *(uint32_t*)(p + 1*stride)= v;
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
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
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
67 *(uint32_t*)(p + 3*stride)= v;
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
68 }else if(w==8){
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
69 //gcc can't optimize 64bit math on x86_32
8590
7a463923ecd1 Change semantic of CONFIG_*, HAVE_* and ARCH_*.
aurel
parents: 7760
diff changeset
70 #if HAVE_FAST_64BIT
11276
dd948aea1c20 Extend fill_rectangle() support for 16bit
michael
parents: 8718
diff changeset
71 const uint64_t v= size==2 ? val*0x0001000100010001ULL : val*0x0100000001ULL;
3315
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
72 *(uint64_t*)(p + 0*stride)= v;
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
73 if(h==1) return;
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
74 *(uint64_t*)(p + 1*stride)= v;
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
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
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
77 *(uint64_t*)(p + 3*stride)= v;
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
78 }else if(w==16){
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
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
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
83 *(uint64_t*)(p + 8+1*stride)= v;
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
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
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
88 *(uint64_t*)(p + 8+3*stride)= v;
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
89 #else
11280
fea25a6f874e 3rd and hopefully last 100l fix.
michael
parents: 11279
diff changeset
90 const uint32_t v= size==2 ? val*0x00010001 : val;
11276
dd948aea1c20 Extend fill_rectangle() support for 16bit
michael
parents: 8718
diff changeset
91 *(uint32_t*)(p + 0+0*stride)= v;
dd948aea1c20 Extend fill_rectangle() support for 16bit
michael
parents: 8718
diff changeset
92 *(uint32_t*)(p + 4+0*stride)= v;
3315
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
93 if(h==1) return;
11276
dd948aea1c20 Extend fill_rectangle() support for 16bit
michael
parents: 8718
diff changeset
94 *(uint32_t*)(p + 0+1*stride)= v;
dd948aea1c20 Extend fill_rectangle() support for 16bit
michael
parents: 8718
diff changeset
95 *(uint32_t*)(p + 4+1*stride)= v;
3315
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
96 if(h==2) return;
11276
dd948aea1c20 Extend fill_rectangle() support for 16bit
michael
parents: 8718
diff changeset
97 *(uint32_t*)(p + 0+2*stride)= v;
dd948aea1c20 Extend fill_rectangle() support for 16bit
michael
parents: 8718
diff changeset
98 *(uint32_t*)(p + 4+2*stride)= v;
dd948aea1c20 Extend fill_rectangle() support for 16bit
michael
parents: 8718
diff changeset
99 *(uint32_t*)(p + 0+3*stride)= v;
dd948aea1c20 Extend fill_rectangle() support for 16bit
michael
parents: 8718
diff changeset
100 *(uint32_t*)(p + 4+3*stride)= v;
3315
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
101 }else if(w==16){
11278
bd5ea8e6f1d3 Try to fix 100l compilation failure on some systems.
michael
parents: 11276
diff changeset
102 *(uint32_t*)(p + 0+0*stride)= val;
bd5ea8e6f1d3 Try to fix 100l compilation failure on some systems.
michael
parents: 11276
diff changeset
103 *(uint32_t*)(p + 4+0*stride)= val;
bd5ea8e6f1d3 Try to fix 100l compilation failure on some systems.
michael
parents: 11276
diff changeset
104 *(uint32_t*)(p + 8+0*stride)= val;
bd5ea8e6f1d3 Try to fix 100l compilation failure on some systems.
michael
parents: 11276
diff changeset
105 *(uint32_t*)(p +12+0*stride)= val;
bd5ea8e6f1d3 Try to fix 100l compilation failure on some systems.
michael
parents: 11276
diff changeset
106 *(uint32_t*)(p + 0+1*stride)= val;
bd5ea8e6f1d3 Try to fix 100l compilation failure on some systems.
michael
parents: 11276
diff changeset
107 *(uint32_t*)(p + 4+1*stride)= val;
bd5ea8e6f1d3 Try to fix 100l compilation failure on some systems.
michael
parents: 11276
diff changeset
108 *(uint32_t*)(p + 8+1*stride)= val;
bd5ea8e6f1d3 Try to fix 100l compilation failure on some systems.
michael
parents: 11276
diff changeset
109 *(uint32_t*)(p +12+1*stride)= val;
3315
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
110 if(h==2) return;
11278
bd5ea8e6f1d3 Try to fix 100l compilation failure on some systems.
michael
parents: 11276
diff changeset
111 *(uint32_t*)(p + 0+2*stride)= val;
bd5ea8e6f1d3 Try to fix 100l compilation failure on some systems.
michael
parents: 11276
diff changeset
112 *(uint32_t*)(p + 4+2*stride)= val;
bd5ea8e6f1d3 Try to fix 100l compilation failure on some systems.
michael
parents: 11276
diff changeset
113 *(uint32_t*)(p + 8+2*stride)= val;
bd5ea8e6f1d3 Try to fix 100l compilation failure on some systems.
michael
parents: 11276
diff changeset
114 *(uint32_t*)(p +12+2*stride)= val;
bd5ea8e6f1d3 Try to fix 100l compilation failure on some systems.
michael
parents: 11276
diff changeset
115 *(uint32_t*)(p + 0+3*stride)= val;
bd5ea8e6f1d3 Try to fix 100l compilation failure on some systems.
michael
parents: 11276
diff changeset
116 *(uint32_t*)(p + 4+3*stride)= val;
bd5ea8e6f1d3 Try to fix 100l compilation failure on some systems.
michael
parents: 11276
diff changeset
117 *(uint32_t*)(p + 8+3*stride)= val;
bd5ea8e6f1d3 Try to fix 100l compilation failure on some systems.
michael
parents: 11276
diff changeset
118 *(uint32_t*)(p +12+3*stride)= val;
3315
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
119 #endif
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
120 }else
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
121 assert(0);
3315
cfd452a6560b h264: faster fill_rectangle()
lorenm
parents: 3298
diff changeset
122 assert(h==4);
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
123 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
124
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 6763
diff changeset
125 #endif /* AVCODEC_RECTANGLE_H */