annotate unary.h @ 12530:63edd10ad4bc libavcodec tip

Try to fix crashes introduced by r25218 r25218 made assumptions about the existence of past reference frames that weren't necessarily true.
author darkshikari
date Tue, 28 Sep 2010 09:06:22 +0000
parents 0dce4fe6e6f3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5605
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
1 /*
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
2 * copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
3 *
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
4 * This file is part of FFmpeg.
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
5 *
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
10 *
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
14 * Lesser General Public License for more details.
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
15 *
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
19 */
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
20
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 5830
diff changeset
21 #ifndef AVCODEC_UNARY_H
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 5830
diff changeset
22 #define AVCODEC_UNARY_H
5605
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
23
9428
0dce4fe6e6f3 Rename bitstream.h to get_bits.h.
stefano
parents: 7760
diff changeset
24 #include "get_bits.h"
5605
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
25
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
26 /**
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
27 * Get unary code of limited length
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
28 * @param gb GetBitContext
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
29 * @param[in] stop The bitstop value (unary code of 1's or 0's)
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
30 * @param[in] len Maximum length
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
31 * @return Unary length/index
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
32 */
5606
0bc48f6f78a2 cleanup get_unary()
aurel
parents: 5605
diff changeset
33 static inline int get_unary(GetBitContext *gb, int stop, int len)
5605
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
34 {
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
35 int i;
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
36
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
37 for(i = 0; i < len && get_bits1(gb) != stop; i++);
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
38 return i;
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
39 }
d92fa6e5fc8c move get_unary() to its own file
aurel
parents:
diff changeset
40
5607
5b80d560cdca add get_unary_0_33() to help gcc with inlining
aurel
parents: 5606
diff changeset
41 /**
5b80d560cdca add get_unary_0_33() to help gcc with inlining
aurel
parents: 5606
diff changeset
42 * Get unary code terminated by a 0 with a maximum length of 33
5b80d560cdca add get_unary_0_33() to help gcc with inlining
aurel
parents: 5606
diff changeset
43 * @param gb GetBitContext
5b80d560cdca add get_unary_0_33() to help gcc with inlining
aurel
parents: 5606
diff changeset
44 * @return Unary length/index
5b80d560cdca add get_unary_0_33() to help gcc with inlining
aurel
parents: 5606
diff changeset
45 */
5b80d560cdca add get_unary_0_33() to help gcc with inlining
aurel
parents: 5606
diff changeset
46 static inline int get_unary_0_33(GetBitContext *gb)
5b80d560cdca add get_unary_0_33() to help gcc with inlining
aurel
parents: 5606
diff changeset
47 {
5b80d560cdca add get_unary_0_33() to help gcc with inlining
aurel
parents: 5606
diff changeset
48 return get_unary(gb, 0, 33);
5b80d560cdca add get_unary_0_33() to help gcc with inlining
aurel
parents: 5606
diff changeset
49 }
5b80d560cdca add get_unary_0_33() to help gcc with inlining
aurel
parents: 5606
diff changeset
50
5628
cf88751d8ab7 Remove reimplementation of get_unary.
vitor
parents: 5607
diff changeset
51 static inline int get_unary_0_9(GetBitContext *gb)
cf88751d8ab7 Remove reimplementation of get_unary.
vitor
parents: 5607
diff changeset
52 {
cf88751d8ab7 Remove reimplementation of get_unary.
vitor
parents: 5607
diff changeset
53 return get_unary(gb, 0, 9);
cf88751d8ab7 Remove reimplementation of get_unary.
vitor
parents: 5607
diff changeset
54 }
cf88751d8ab7 Remove reimplementation of get_unary.
vitor
parents: 5607
diff changeset
55
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 5830
diff changeset
56 #endif /* AVCODEC_UNARY_H */