summaryrefslogtreecommitdiff
path: root/bitstream.c (follow)
Commit message (Collapse)AuthorAge
* Include regex.h from para.h.Andre Noll2025-05-19
| | | | Every .c file includes it anyway.
* string: Introduce arr_realloc() and check for integer overflow.Andre Noll2022-07-29
| | | | | | | | Use __builtin_mul_overflow() for the check. This builtin was introduced in gcc-5, so we need to bump the lowest supported version. Re-implement para_realloc() as a trivial wrapper for arr_realloc() to simplify and to avoid duplicating the size check.
* Shorten copyright notice.Andre Noll2017-09-22
| | | | | | | | | | | | | | | | | | | | | The GPLv2 line does not add any additional information, so drop it. This leaves a single line of legalese text for most files, which is about the amount of screen real estate it deserves. This patch was created with the following script (plus some manual fixups): awk '{ if (NR <= 5) { gs = gensub(/.*Copyright.* ([0-9]+).*Andre Noll.*/, "\\1", "g") if (gs != $0) year = gs next } if (NR == 6 && year != "") printf("/* Copyright (C) %s Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */\n", year) print }'
* wma: Simplify get_vlc().Andre Noll2017-07-06
| | | | | | | The "bits" argument of the function is implicitly given by the vlc structure and may thus be omitted from the call. For this to work we must pass a pointer to struct vlc instead of only the table, which further simplifies wmadec_filter.c.
* wma: Remove pointless VLC_TYPE define.Andre Noll2017-07-06
| | | | It was defined to int16_t which only obfuscates the code.
* wmadec: Use read_u32_be().Andre Noll2017-03-25
| | | | | | | | | | The shift operation in show_bits() was buggy because p[0] is promoted to int, and the shift p[0] << 24 results in undefined behavior, causing the sanitizer of gcc to complain: bitstream.h:40:21: runtime error: left shift of 230 by 24 places cannot be represented in type 'int' read_u32_be() gets this right.
* wmadec: Simplify get_vlc().Andre Noll2016-03-06
| | | | | | The last parameter is always bigger than 2, which is all the function needs to know. Hence we may remove the parameter and get rid of some macros that were only used to compute it.
* bitstream.c: Convert GET_DATA macro to inline function.Andre Noll2015-09-20
| | | | | | There is no benefit from defining this as a macro. With the inline function we get type safety for free, and the new version is better readable.
* Remove unnecessary system header includes.Andre Noll2015-01-12
| | | | All these headers get included from para.h.
* bitstream: Improve documentation.Andre Noll2014-04-22
| | | | | | Mention that the bitstream API is only used for the WMA decoder, avoid overlong descriptions of function parameters and add some doxygen \ref commands.
* bitstream: Replace check for impossible condition by assertion.Andre Noll2014-04-22
| | | | | No big deal because behaviour is unchanged (abort). Calling assert() is a bit shorter and will print a better error message.
* bitstream: Remove pointless variable "code_prefix2".Andre Noll2014-04-22
| | | | | This variable is only used at one place. Using the computed value directly in the conditional allows to get rid of it.
* bitstream: Micro-optimization.Andre Noll2014-04-22
| | | | | Subtract n_prefix right away, and don't get the next code if n becomes non-positive. This is equivalent and saves one comparison.
* bitstream: Kill pointless variable "symbol".Andre Noll2014-04-22
| | | | | It is just a copy of the loop index i. Since i is never modified we may simply use i instead.
* bitstream: Trivial coding style fixes.Andre Noll2014-04-22
|
* bitstream: Trivial spelling fix auxillary -> auxiliary.Andre Noll2014-04-22
|
* Add some missing documentation.Andre Noll2012-04-21
| | | | This makes doxygen a bit happier.
* wma: Improve error diagnostics.Andre Noll2009-11-18
| | | | | This makes all functions in wmadec.c and bitstream.c return proper error codes.
* Add some more documentationAndre Noll2009-11-18
|
* Uninline get_vlc().Andre Noll2009-11-18
|
* save one level of indentation in build_table().Andre Noll2009-11-18
|
* Kill codes_wrap parameter from init_vlc().Andre Noll2009-11-18
|
* make init_vlc() return void.Andre Noll2009-11-18
|
* bitstream: Abort on invalid codesAndre Noll2009-11-18
|
* Simplify alloc_table().Andre Noll2009-11-18
|
* Kill the bits_wrap and bits_size parameters of init_vlc().Andre Noll2009-11-18
|
* Trivial whitespace fixes.Andre Noll2009-11-18
|
* Use para_realloc() instead of realloc() in alloc_table().Andre Noll2009-11-18
|
* First draft of the wma decoder.Andre Noll2009-11-18
Understands only v1, but is easy to crash.