Shorten copyright notice. 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(). 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. It was defined to int16_t which only obfuscates the code.
wma: Make bitstream API more robust. The ->buffer_end field of struct getbit_context is set but never used. In fact, we never check bounds and happily read beyond the supplied data buffer. Fix this by replacing the field by ->num_bits, an integer which is initialized in init_get_bits() to the number of bits available. All functions which read the bitstream are modified to check bounds.
wmadec: Use read_u32_be(). 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.
bitstream.h: Remove some superflous parentheses.
wmadec: Simplify get_vlc(). 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: Improve documentation. Mention that the bitstream API is only used for the WMA decoder, avoid overlong descriptions of function parameters and add some doxygen \ref commands.
wma: Doxify some comments. struct coef_vlc_table->levels and struct getbit_context had undoxified comments.
Add documentation of struct vlc.
Update documentation of get_bit()'s buffer parameter.
Uninline get_vlc().
Rename get_bits1() to get_bit().
get rid of AV_RB32().
Simplify get_bits1().
Always call getbit_context structures gbc.
get rid of the useless preprocessor madness in bitstream.h.
open code NEG_USR32
simplify skip_bits().
Open code SKIP_BITS