Michael Niedermayer
11512d70fa
avcodec/get_bits: add BITS_LEFT() for finding the bits left with an opened reader
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Timothy Gu
ea6178fff8
get_bits: remove unused assignment
...
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
e6f9fc4adc
avcodec/bitstream: try to make vlc init code inherently thread safe
...
also remove spinlock, it doesnt work on AIX
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Matthew Lindner
b372f67342
avcodec: better level/index printing
11 years ago
Michael Niedermayer
6df33c4926
avcodec: include GET_RL_VLC() in trace output
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Reimar Döffinger
8cbf0827e1
Various small spelling fixes.
...
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
11 years ago
Michael Niedermayer
44e8e82d34
avcodec/get_bits: add skip_1stop_8data_bits
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
54197c7aae
skip_bits: dont call UPDATE_CACHE
...
UPDATE_CACHE isnt needed and can cause segfaults
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
121fc05b4d
avcodec/get_bits: place volatile at the right spot
...
Should fix Ticket2825
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
43411f416f
avcodec/get_bits: init_state is used for thread sync, make it volatile
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
6af8326354
avcodec/ff_init_vlc_sparse: use a spinlock for thread sync
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Paul B Mahol
48f2750de8
get_bits: add get_bits_le()
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Michael Niedermayer
ff130d7363
get_xbits: assert validity of the number of bits
...
similar is already done in the other get_bits() functions
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Ronald S. Bultje
9918f57dcf
get_bits: Return pointer to buffer that is the result of the alignment
...
This allows more transparent mixing of get_bits and whole-byte access
without having to touch get_bits internals.
Signed-off-by: Martin Storsjö <martin@martin.st>
12 years ago
Ronald S. Bultje
fd6a021d8e
get_bits: return pointer to buffer that is the result of the alignment.
...
This allows more transparent mixing of get_bits and whole-byte access
without having to touch get_bits internals.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Diego Biurrun
4af5310d29
get_bits/put_bits: K&R formatting cosmetics
...
Signed-off-by: Diego Biurrun <diego@biurrun.de>
12 years ago
Luca Barbato
4603ec85ed
get_bits: change the failure condition in init_get_bits
...
Too much code relies in having init_get_bits fed with a valid
buffer and set its dimension to 0.
Check for NULL buffer instead.
12 years ago
Michael Niedermayer
7980cca05c
init_get_bits: fix off by 1 error
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
153fad14e5
init_get_bits8: zero pointers & struct on error
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
ac73d3a12a
init_get_bits8: check byte_size against being positive
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Luca Barbato
e28ac6e5e2
lavc: introduce the convenience function init_get_bits8
...
Accept the buffer size in bytes and check for overflow before passing
the value in bits to init_get_bits.
12 years ago
Luca Barbato
d9cf5f5169
lavc: check for overflow in init_get_bits
...
Fix an undefined behaviour and make the function return a proper
error in case of overflow.
CC: libav-stable@libav.org
12 years ago
Michael Niedermayer
7efee140d7
get_bits: rename get_bits_longlong to get_bits64
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
41540b36a1
bitstream: add get_bits64() to support reading more than 32 bits at once
...
Also remove a duplicate function in the MPEG-TS demuxer.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
12 years ago
Michael Niedermayer
094a82c7de
get_bits: get_bits_long() support n=0 as the docs allow it
...
also the 0 case is indeed used in some code pathes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
f51c4bfe3f
bitstream: add get_bits_longlong() to support more than 32bits
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
5f1c3c785c
get_bits_long: fix variable type
...
This fixes a theoretical signed overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Diego Biurrun
e00215040a
get_bits: const correctness for get_bits_trace()/get_xbits_trace() arguments
12 years ago
Michael Niedermayer
6560fa390e
get_bits: check the number of bits parameter through av_assert2()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Ronald S. Bultje
b44b41633f
get_bits: add HAVE_BITS_REMAINING macro.
13 years ago
Martin Storsjö
e96b4a53df
vlc/rl: Add ff_ prefix to the nonstatic symbols
...
Signed-off-by: Martin Storsjö <martin@martin.st>
13 years ago
Diego Biurrun
aaf47bcde7
Drop ALT_ prefix from BITSTREAM_READER_LE name.
...
The prefix is a historic remnant that probably meant "alternative".
Now that the A32 bitstream reader has been dropped it makes no sense anymore.
13 years ago
Michael Niedermayer
1a2484fc4e
get_bits: drop the a32 reader.
...
that way qatar maintains the code for me and i dont need to resolve conflicts.
If someone wants the a32 reader back, only thing you need to do is maintain
it, i would be happy to have it back, iam just not volunteering to maintain
it due to lack of time.
Based on: a1e98f198e
by Mans Rullgard.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Mans Rullgard
86a10281c7
get_bits: remove LAST_SKIP_CACHE macro
...
This macro is empty since the removal of the A32 bitstream reader.
Signed-off-by: Mans Rullgard <mans@mansr.com>
13 years ago
Mans Rullgard
5d8122db5c
get_bits: remove strange/obsolete comments
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
13 years ago
Mans Rullgard
e42bb0ee01
get_bits: whitespace (mostly) cosmetics
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
13 years ago
Mans Rullgard
adb28c49bd
get_bits: remove unnecessary #includes
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
13 years ago
Ronald S. Bultje
8cfbbd928c
get_bits: introduce safe bitreading to prevent overreads.
...
When turned on, H264/CAVLC gets ~15% (CVPCMNL1_SVA_C.264) slower for
ultra-high-bitrate files, or ~2.5% (CVFI1_SVA_C.264) for lower-bitrate
files. Other codecs are affected to a lesser extent because they are
less optimized; e.g., VC-1 slows down by less than 1% (all on x86).
The patch generated 3 extra instructions (cmp, cmovae and mov) per
call to get_bits().
The performance penalty on ARM is within the error margin for most
files, up to 4% in extreme cases such as CVPCMNL1_SVA_C.264.
Based on work (for GCI) by Aneesh Dogra <lionaneesh@gmail.com>, and
inspired by patch in Chromium by Chris Evans <cevans@chromium.org>.
13 years ago
Mans Rullgard
a1e98f198e
get_bits: remove A32 variant
...
The A32 bitstream reader variant is only used on ARMv5 and for
Prores due to the larger bit cache this decoder requires.
In benchmarks on ARMv5 (Marvell Sheeva) with gcc 4.6, the only
statistically significant difference between ALT and A32 is
a 4% advantage for ALT in FLAC decoding. There is thus no (longer)
any reason to keep the A32 reader from this point of view.
This patch adds an option to the ALT reader increasing the bit
cache to 32 bits as required by the Prores decoder. Benchmarking
shows no significant change in speed on Intel i7. Again, the
A32 reader fails to justify its existence.
Signed-off-by: Mans Rullgard <mans@mansr.com>
13 years ago
Mans Rullgard
b8909cb364
get_bits: remove useless pointer casts
...
These pointers are already of the correct type.
Signed-off-by: Mans Rullgard <mans@mansr.com>
13 years ago
Diego Biurrun
58c42af722
doxygen: misc consistency, spelling and wording fixes
13 years ago
Elvis Presley
3dd47ae537
Revert "get_bits: remove x86 inline asm in A32 bitstream reader"
...
This reverts commit 23ce6e7212
.
13 years ago
Mans Rullgard
23ce6e7212
get_bits: remove x86 inline asm in A32 bitstream reader
...
x86 does not use this variant so having inline asm there
is pointless.
Signed-off-by: Mans Rullgard <mans@mansr.com>
14 years ago
Diego Biurrun
be73d76b34
cosmetics: fix some then/than typos
14 years ago
Mans Rullgard
e01e05ee66
get_bits: add av_unused tag to cache variable
...
This silences numerous compiler warnings from skip_bits(),
where the cache variable is not used.
Signed-off-by: Mans Rullgard <mans@mansr.com>
14 years ago
Michael Niedermayer
105a3c7a6b
bitstream_reader: Try to fix "get_bits.h:305:45: warning: variable ‘re_cache’ set but not used [-Wunused-but-set-variable]"
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
14 years ago
Michael Niedermayer
3acc44b739
bitstream reader: remove unneeded variable initilization.
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
14 years ago
Alex Converse
47bc52f821
get_bits: make cache unsigned to eliminate undefined signed overflow.
14 years ago
Mans Rullgard
2912e87a6c
Replace FFmpeg with Libav in licence headers
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
14 years ago
Mans Rullgard
a4bff12cdd
get_bits: move tracing macros to end of file
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 611a6f59ce
)
14 years ago