Mercurial > libavcodec.hg
comparison put_bits.h @ 12024:fdafbcef52f5 libavcodec
Fix grammar errors in documentation
author | mru |
---|---|
date | Wed, 30 Jun 2010 15:38:06 +0000 |
parents | 7dd2a45249a9 |
children | ee740a4e80c5 |
comparison
equal
deleted
inserted
replaced
12023:c7455450364d | 12024:fdafbcef52f5 |
---|---|
50 #endif | 50 #endif |
51 int size_in_bits; | 51 int size_in_bits; |
52 } PutBitContext; | 52 } PutBitContext; |
53 | 53 |
54 /** | 54 /** |
55 * Initializes the PutBitContext s. | 55 * Initialize the PutBitContext s. |
56 * | 56 * |
57 * @param buffer the buffer where to put bits | 57 * @param buffer the buffer where to put bits |
58 * @param buffer_size the size in bytes of buffer | 58 * @param buffer_size the size in bytes of buffer |
59 */ | 59 */ |
60 static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size) | 60 static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size) |
77 s->bit_buf=0; | 77 s->bit_buf=0; |
78 #endif | 78 #endif |
79 } | 79 } |
80 | 80 |
81 /** | 81 /** |
82 * Returns the total number of bits written to the bitstream. | 82 * @return the total number of bits written to the bitstream. |
83 */ | 83 */ |
84 static inline int put_bits_count(PutBitContext *s) | 84 static inline int put_bits_count(PutBitContext *s) |
85 { | 85 { |
86 #ifdef ALT_BITSTREAM_WRITER | 86 #ifdef ALT_BITSTREAM_WRITER |
87 return s->index; | 87 return s->index; |
89 return (s->buf_ptr - s->buf) * 8 + 32 - s->bit_left; | 89 return (s->buf_ptr - s->buf) * 8 + 32 - s->bit_left; |
90 #endif | 90 #endif |
91 } | 91 } |
92 | 92 |
93 /** | 93 /** |
94 * Pads the end of the output stream with zeros. | 94 * Pad the end of the output stream with zeros. |
95 */ | 95 */ |
96 static inline void flush_put_bits(PutBitContext *s) | 96 static inline void flush_put_bits(PutBitContext *s) |
97 { | 97 { |
98 #ifdef ALT_BITSTREAM_WRITER | 98 #ifdef ALT_BITSTREAM_WRITER |
99 align_put_bits(s); | 99 align_put_bits(s); |
121 #define align_put_bits align_put_bits_unsupported_here | 121 #define align_put_bits align_put_bits_unsupported_here |
122 #define ff_put_string ff_put_string_unsupported_here | 122 #define ff_put_string ff_put_string_unsupported_here |
123 #define ff_copy_bits ff_copy_bits_unsupported_here | 123 #define ff_copy_bits ff_copy_bits_unsupported_here |
124 #else | 124 #else |
125 /** | 125 /** |
126 * Pads the bitstream with zeros up to the next byte boundary. | 126 * Pad the bitstream with zeros up to the next byte boundary. |
127 */ | 127 */ |
128 void align_put_bits(PutBitContext *s); | 128 void align_put_bits(PutBitContext *s); |
129 | 129 |
130 /** | 130 /** |
131 * Puts the string string in the bitstream. | 131 * Put the string string in the bitstream. |
132 * | 132 * |
133 * @param terminate_string 0-terminates the written string if value is 1 | 133 * @param terminate_string 0-terminates the written string if value is 1 |
134 */ | 134 */ |
135 void ff_put_string(PutBitContext *pb, const char *string, int terminate_string); | 135 void ff_put_string(PutBitContext *pb, const char *string, int terminate_string); |
136 | 136 |
137 /** | 137 /** |
138 * Copies the content of src to the bitstream. | 138 * Copy the content of src to the bitstream. |
139 * | 139 * |
140 * @param length the number of bits of src to copy | 140 * @param length the number of bits of src to copy |
141 */ | 141 */ |
142 void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length); | 142 void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length); |
143 #endif | 143 #endif |
144 | 144 |
145 /** | 145 /** |
146 * Writes up to 31 bits into a bitstream. | 146 * Write up to 31 bits into a bitstream. |
147 * Use put_bits32 to write 32 bits. | 147 * Use put_bits32 to write 32 bits. |
148 */ | 148 */ |
149 static inline void put_bits(PutBitContext *s, int n, unsigned int value) | 149 static inline void put_bits(PutBitContext *s, int n, unsigned int value) |
150 #ifndef ALT_BITSTREAM_WRITER | 150 #ifndef ALT_BITSTREAM_WRITER |
151 { | 151 { |
268 | 268 |
269 put_bits(pb, n, value & ((1<<n)-1)); | 269 put_bits(pb, n, value & ((1<<n)-1)); |
270 } | 270 } |
271 | 271 |
272 /** | 272 /** |
273 * Writes exactly 32 bits into a bitstream. | 273 * Write exactly 32 bits into a bitstream. |
274 */ | 274 */ |
275 static void av_unused put_bits32(PutBitContext *s, uint32_t value) | 275 static void av_unused put_bits32(PutBitContext *s, uint32_t value) |
276 { | 276 { |
277 int lo = value & 0xffff; | 277 int lo = value & 0xffff; |
278 int hi = value >> 16; | 278 int hi = value >> 16; |
284 put_bits(s, 16, lo); | 284 put_bits(s, 16, lo); |
285 #endif | 285 #endif |
286 } | 286 } |
287 | 287 |
288 /** | 288 /** |
289 * Returns the pointer to the byte where the bitstream writer will put | 289 * Return the pointer to the byte where the bitstream writer will put |
290 * the next bit. | 290 * the next bit. |
291 */ | 291 */ |
292 static inline uint8_t* put_bits_ptr(PutBitContext *s) | 292 static inline uint8_t* put_bits_ptr(PutBitContext *s) |
293 { | 293 { |
294 #ifdef ALT_BITSTREAM_WRITER | 294 #ifdef ALT_BITSTREAM_WRITER |
297 return s->buf_ptr; | 297 return s->buf_ptr; |
298 #endif | 298 #endif |
299 } | 299 } |
300 | 300 |
301 /** | 301 /** |
302 * Skips the given number of bytes. | 302 * Skip the given number of bytes. |
303 * PutBitContext must be flushed & aligned to a byte boundary before calling this. | 303 * PutBitContext must be flushed & aligned to a byte boundary before calling this. |
304 */ | 304 */ |
305 static inline void skip_put_bytes(PutBitContext *s, int n) | 305 static inline void skip_put_bytes(PutBitContext *s, int n) |
306 { | 306 { |
307 assert((put_bits_count(s)&7)==0); | 307 assert((put_bits_count(s)&7)==0); |
313 s->buf_ptr += n; | 313 s->buf_ptr += n; |
314 #endif | 314 #endif |
315 } | 315 } |
316 | 316 |
317 /** | 317 /** |
318 * Skips the given number of bits. | 318 * Skip the given number of bits. |
319 * Must only be used if the actual values in the bitstream do not matter. | 319 * Must only be used if the actual values in the bitstream do not matter. |
320 * If n is 0 the behavior is undefined. | 320 * If n is 0 the behavior is undefined. |
321 */ | 321 */ |
322 static inline void skip_put_bits(PutBitContext *s, int n) | 322 static inline void skip_put_bits(PutBitContext *s, int n) |
323 { | 323 { |
329 s->bit_left &= 31; | 329 s->bit_left &= 31; |
330 #endif | 330 #endif |
331 } | 331 } |
332 | 332 |
333 /** | 333 /** |
334 * Changes the end of the buffer. | 334 * Change the end of the buffer. |
335 * | 335 * |
336 * @param size the new size in bytes of the buffer where to put bits | 336 * @param size the new size in bytes of the buffer where to put bits |
337 */ | 337 */ |
338 static inline void set_put_bits_buffer_size(PutBitContext *s, int size) | 338 static inline void set_put_bits_buffer_size(PutBitContext *s, int size) |
339 { | 339 { |