Anton Khirnov
0b33310cd0
lavc/bitstream: avoid UB in bits_{read,peek}_signed(0)
...
bits_*_signed(0) will currently invoke an undefined shift by
8 * sizeof(int).
Add bits_*_signed_nz() that only works for n>0, analogous to
bits_read_nz(). Add an explicit check for n=0 in bits_*_signed().
Found-by: James Almer
2 years ago
Anton Khirnov
9177970bca
lavc/bitstream: templatize for BE/LE
...
Allows using both BE and LE bitstream readers in the same file.
2 years ago
Alexandra Hájková
8fe551eca0
lavc: add standalone cached bitstream reader
...
The cached bitstream reader was originally written by Alexandra Hájková
for Libav, with significant input from Kostya Shishkov and Luca Barbato.
It was then committed to FFmpeg in ca079b0954
, by merging it with the
implementation of the current bitstream reader.
This merge makes the code of get_bits.h significantly harder to read,
since it now contains two different bitstream readers interleaved with
#ifdefs. Additionally, the code was committed without proper authorship
attribution.
This commit re-adds the cached bitstream reader as a standalone header,
as it was originally developed. It will be made useful in following
commits.
Integration by Anton Khirnov.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2 years ago
Luca Barbato
79f64f7ebc
bitstream: Avoid undefined behavior in bitstream_skip()
...
Do not use skip_remaining() to fully wipe the cache, as this could do
a 64-bit shift of a 64-bit variable which is undefined behavior in C.
Instead set the related variables to zero directly.
Thanks to Uoti for pointing out the problem.
CC: libav-stable@libav.org
7 years ago
Luca Barbato
0ac1fec1c3
bitstream: Move VLC reading functions into the vlc.h header
...
This makes the bitstream.h header leaner.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
8 years ago
Luca Barbato
9c2d36fcaf
dv: Convert to the new bitstream reader
8 years ago
Alexandra Hájková
dd3d7ddf2a
lavc: add a new bitstream reader to replace get_bits
...
The new bit reader features a simpler API and an implementation without
stacks of nested macros.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
8 years ago
Stefano Sabatini
9106a698e7
Rename bitstream.h to get_bits.h.
...
Originally committed as revision 18494 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Stefano Sabatini
b275500706
Split bitstream.h, put the bitstream writer stuff in the new file
...
put_bits.h.
Originally committed as revision 18461 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Stefano Sabatini
4af615b81e
Document the 'size' parameter of set_put_bits_buffer_size().
...
Originally committed as revision 18448 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Stefano Sabatini
930cab5944
Document ff_put_string().
...
Originally committed as revision 18447 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Stefano Sabatini
54b02ccda2
Rename the 'put_zero' parameter of ff_put_string() to
...
'terminate_string'.
Originally committed as revision 18442 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Stefano Sabatini
980f54513e
Add documentation for skip_put_bytes().
...
Originally committed as revision 18441 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Stefano Sabatini
093364da30
Doxygenate ff_copy_bits().
...
Originally committed as revision 18440 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Stefano Sabatini
86755e82f7
Factorize declaration for the two variants of put_bits().
...
Originally committed as revision 18439 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Stefano Sabatini
0a73e94fd6
Clarify documentation for put_bits_count().
...
Originally committed as revision 18432 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Stefano Sabatini
facf521daa
Document align_put_bits().
...
Originally committed as revision 18427 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Stefano Sabatini
fc660a0143
Doxygenate flush_put_bits() documentation.
...
Originally committed as revision 18426 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Stefano Sabatini
e46ddebd14
Doxygenate put_bits_count() documentation.
...
Originally committed as revision 18425 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Stefano Sabatini
f7a2aab7d8
Doxygenate init_put_bits().
...
Originally committed as revision 18423 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Stefano Sabatini
f9f74ab97b
Add a notice telling that the behavior of skip_put_bits() is undefined
...
if n is 0.
Originally committed as revision 18285 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Justin Ruggles
017c0811a1
Add a get_sbits_long() function.
...
Originally committed as revision 17740 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Reimar Döffinger
edd532db64
Simplify show_bits_long and copy the GetBitsContext around only once instead of twice.
...
Originally committed as revision 17736 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Michael Niedermayer
71a48ff23c
Add size_in_bits to PutBitContext
...
Originally committed as revision 17006 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Diego Biurrun
bad5537e2c
Use full internal pathname in doxygen @file directives.
...
Otherwise doxygen complains about ambiguous filenames when files exist
under the same name in different subdirectories.
Originally committed as revision 16912 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Reimar Döffinger
724cc2dfaa
Use AV_WL32/AV_WB32 in bitstream.h
...
Originally committed as revision 16778 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Aurelien Jacobs
b250f9c66d
Change semantic of CONFIG_*, HAVE_* and ARCH_*.
...
They are now always defined to either 0 or 1.
Originally committed as revision 16590 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Måns Rullgård
23ae2b68b0
Replace UNALIGNED_STORES_ARE_BAD with !HAVE_FAST_UNALIGNED
...
Originally committed as revision 16364 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Måns Rullgård
a2fc0f6a6d
ARM: replace "armv4l" with "arm"
...
Originally committed as revision 16179 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Diego Pettenò
be449fca79
Convert asm keyword into __asm__.
...
Neither the asm() nor the __asm__() keyword is part of the C99
standard, but while GCC accepts the former in C89 syntax, it is not
accepted in C99 unless GNU extensions are turned on (with -fasm). The
latter form is accepted in any syntax as an extension (without
requiring further command-line options).
Sun Studio C99 compiler also does not accept asm() while accepting
__asm__(), albeit reporting warnings that it's not valid C99 syntax.
Originally committed as revision 15627 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Stefano Sabatini
987903826b
Globally rename the header inclusion guard names.
...
Consistently apply this rule: the guard name is obtained from the
filename by stripping the leading "lib", converting '/' and '.' to
'_' and uppercasing the resulting name. Guard names in the root
directory have to be prefixed by "FFMPEG_".
Originally committed as revision 15120 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Stefano Sabatini
7a7c4a7bf7
Fix typo.
...
Originally committed as revision 15034 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Bartlomiej Wolowiec
8580314463
Little-endian bitstream writer
...
Originally committed as revision 14965 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Måns Rullgård
29c8b6263a
Remove dead code in bitstream.h
...
Originally committed as revision 14238 to svn://svn.ffmpeg.org/ffmpeg/trunk
17 years ago
Ramiro Polla
6647ab80e3
bitstream: move put_sbits() from flacenc.c to bitstream.h and use it
...
throughout libavcodec.
Originally committed as revision 14204 to svn://svn.ffmpeg.org/ffmpeg/trunk
17 years ago
Måns Rullgård
71c465a151
Bitstream: use AV_RB16() in LIBMPEG2_BITSTREAM_READER
...
This makes LIBMPEG2_BITSTREAM_READER_HACK redundant, so remove it.
Originally committed as revision 14197 to svn://svn.ffmpeg.org/ffmpeg/trunk
17 years ago
Michael Niedermayer
d05b24ff89
Little helper macro to make the use of INIT_VLC_USE_NEW_STATIC easier.
...
Originally committed as revision 13562 to svn://svn.ffmpeg.org/ffmpeg/trunk
17 years ago
Michael Niedermayer
ccc54864fe
Make init_vlc* support proper static tables instead of this broken beyond
...
imagination alloc_static() trash.
Originally committed as revision 13561 to svn://svn.ffmpeg.org/ffmpeg/trunk
17 years ago
Diego Biurrun
245976da2a
Use full path for #includes from another directory.
...
Originally committed as revision 13098 to svn://svn.ffmpeg.org/ffmpeg/trunk
17 years ago
Michael Niedermayer
1701cbfafc
const
...
Originally committed as revision 11846 to svn://svn.ffmpeg.org/ffmpeg/trunk
17 years ago
Kostya Shishkov
b44665c4e6
Make decode210() common function.
...
Originally committed as revision 11382 to svn://svn.ffmpeg.org/ffmpeg/trunk
17 years ago
Diego Biurrun
5b21bdabe4
Add FFMPEG_ prefix to all multiple inclusion guards.
...
Originally committed as revision 10765 to svn://svn.ffmpeg.org/ffmpeg/trunk
17 years ago
Aurelien Jacobs
28296f9c9e
move get_unary() to its own file
...
Originally committed as revision 10240 to svn://svn.ffmpeg.org/ffmpeg/trunk
17 years ago
Roman Shaposhnik
67c1b32f3d
* getting rid of code duplication
...
Originally committed as revision 9997 to svn://svn.ffmpeg.org/ffmpeg/trunk
18 years ago
Alex Beregszaszi
971e878dca
copy get_unary from vc1
...
Originally committed as revision 9994 to svn://svn.ffmpeg.org/ffmpeg/trunk
18 years ago
Michael Niedermayer
1ae7a85116
indent
...
Originally committed as revision 9894 to svn://svn.ffmpeg.org/ffmpeg/trunk
18 years ago
Diego Biurrun
df3a80b50a
cosmetics: misc typo fixes
...
Originally committed as revision 9815 to svn://svn.ffmpeg.org/ffmpeg/trunk
18 years ago
Aurelien Jacobs
98f7b56bb6
move ff_copy_bits to bitstream.c
...
Originally committed as revision 9503 to svn://svn.ffmpeg.org/ffmpeg/trunk
18 years ago
Måns Rullgård
99545457bf
include all prerequisites in header files
...
Originally committed as revision 9344 to svn://svn.ffmpeg.org/ffmpeg/trunk
18 years ago
Diego Biurrun
755bfeabcc
misc spelling fixes
...
Originally committed as revision 9289 to svn://svn.ffmpeg.org/ffmpeg/trunk
18 years ago