34                           float **plevel_table, uint16_t **pint_table,
    39     const uint32_t *table_codes  = vlc_table->
huffcodes;
    40     const uint16_t *levels_table = vlc_table->
levels;
    41     uint16_t *run_table, *level_table, *int_table;
    47     run_table   = 
av_malloc(n * 
sizeof(uint16_t));
    48     level_table = 
av_malloc(n * 
sizeof(uint16_t));
    49     flevel_table= 
av_malloc(n * 
sizeof(*flevel_table));
    50     int_table   = 
av_malloc(n * 
sizeof(uint16_t));
    56         l = levels_table[k++];
    57         for (j = 0; j < l; j++) {
    65     *prun_table   = run_table;
    66     *plevel_table = flevel_table;
    67     *pint_table   = int_table;
    75     float bps1, high_freq;
   104         nb = ((flags2 >> 3) & 3) + 1;
   122         if (sample_rate1 >= 44100) {
   123             sample_rate1 = 44100;
   124         } 
else if (sample_rate1 >= 22050) {
   125             sample_rate1 = 22050;
   126         } 
else if (sample_rate1 >= 16000) {
   127             sample_rate1 = 16000;
   128         } 
else if (sample_rate1 >= 11025) {
   129             sample_rate1 = 11025;
   130         } 
else if (sample_rate1 >= 8000) {
   147     if (sample_rate1 == 44100) {
   151             high_freq = high_freq * 0.4;
   153     } 
else if (sample_rate1 == 22050) {
   156         } 
else if (bps1 >= 0.72) {
   157             high_freq = high_freq * 0.7;
   159             high_freq = high_freq * 0.6;
   161     } 
else if (sample_rate1 == 16000) {
   163             high_freq = high_freq * 0.5;
   165             high_freq = high_freq * 0.3;
   167     } 
else if (sample_rate1 == 11025) {
   168         high_freq = high_freq * 0.7;
   169     } 
else if (sample_rate1 == 8000) {
   171             high_freq = high_freq * 0.5;
   172         } 
else if (bps > 0.75) {
   175             high_freq = high_freq * 0.65;
   179             high_freq = high_freq * 0.75;
   180         } 
else if (bps >= 0.6) {
   181             high_freq = high_freq * 0.6;
   183             high_freq = high_freq * 0.5;
   187     av_dlog(s->
avctx, 
"version=%d channels=%d sample_rate=%d bitrate=%d block_align=%d\n",
   190     av_dlog(s->
avctx, 
"bps=%f bps1=%f high_freq=%f bitoffset=%d\n",
   192     av_dlog(s->
avctx, 
"use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n",
   197         int a, 
b, pos, lpos, 
k, block_len, 
i, j, 
n;
   210                 for (i = 0; i < 25; i++) {
   213                     pos = ((block_len * 2 * 
a) + (b >> 1)) / b;
   217                     if (pos >= block_len) {
   239                     for (i = 0; i < 
n; i++)
   245                     for (i = 0; i < 25; i++) {
   248                         pos = ((block_len * 2 * 
a) + (b << 1)) / (4 * b);
   254                         if (pos >= block_len)
   270             for (i = 0; i < 
n; i++) {
   275                 if (start < s->high_band_start[k])
   284             tprintf(s->
avctx, 
"%5d: coefs_end=%d high_band_start=%d nb_high_bands=%d: ",
   346     if (avctx->sample_rate >= 32000) {
   349         } 
else if (bps1 < 1.16) {
   353     s->coef_vlcs[0]= &
coef_vlcs[coef_vlc_table * 2    ];
   354     s->coef_vlcs[1]= &
coef_vlcs[coef_vlc_table * 2 + 1];
   355     init_coef_vlc(&
s->coef_vlc[0], &
s->run_table[0], &
s->level_table[0], &
s->int_table[0],
   357     init_coef_vlc(&
s->coef_vlc[1], &
s->run_table[1], &
s->level_table[1], &
s->int_table[1],
   365          if (total_gain < 15) 
return 13;
   366     else if (total_gain < 32) 
return 12;
   367     else if (total_gain < 40) 
return 11;
   368     else if (total_gain < 45) 
return 10;
   386     for (i = 0; i < 2; i++) {
   436                             const float *level_table, 
const uint16_t *run_table,
   438                             int num_coefs, 
int block_len, 
int frame_len_bits,
   442     const uint32_t *ilvl = (
const uint32_t*)level_table;
   443     uint32_t *iptr = (uint32_t*)ptr;
   444     const unsigned int coef_mask = block_len - 1;
   445     for (; offset < num_coefs; offset++) {
   449             offset += run_table[
code];
   451             iptr[offset & coef_mask] = ilvl[
code] ^ sign<<31;
   452         } 
else if (code == 1) {
   461                 offset += 
get_bits(gb, frame_len_bits);
   469                                 "broken escape sequence\n");
   472                             offset += 
get_bits(gb, frame_len_bits) + 4;
   478             ptr[offset & coef_mask] = (level^sign) - sign;
   482     if (offset > num_coefs) {
 const struct AVCodec * codec
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits. 
int next_block_len_bits
log2 of next block length 
int ff_wma_run_level_decode(AVCodecContext *avctx, GetBitContext *gb, VLC *vlc, const float *level_table, const uint16_t *run_table, int version, WMACoef *ptr, int offset, int num_coefs, int block_len, int frame_len_bits, int coef_nb_bits)
Decode run level compressed coefficients. 
const uint8_t * huffbits
VLC bit size. 
av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (%s)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic?ac->func_descr_generic:ac->func_descr)
static void init_coef_vlc(VLC *vlc, uint16_t **prun_table, float **plevel_table, uint16_t **pint_table, const CoefVLCTable *vlc_table)
int n
total number of codes 
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
int high_band_start[BLOCK_NB_SIZES]
index of first coef in high band 
int exponent_sizes[BLOCK_NB_SIZES]
float WMACoef
type for decoded coefficients, int16_t would be enough for wma 1/2 
const uint32_t * huffcodes
VLC bit values. 
#define CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT). 
int nb_block_sizes
number of block sizes 
int ff_wma_total_gain_to_bits(int total_gain)
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
static const struct endianess table[]
uint16_t exponent_bands[BLOCK_NB_SIZES][25]
void av_log(void *avcl, int level, const char *fmt,...)
static const uint8_t offset[127][2]
int exponent_high_bands[BLOCK_NB_SIZES][HIGH_BAND_MAX_SIZE]
int ff_wma_end(AVCodecContext *avctx)
int bit_rate
the average bitrate 
float * windows[BLOCK_NB_SIZES]
static const uint8_t exponent_band_44100[3][25]
int version
1 = 0x160 (WMAV1), 2 = 0x161 (WMAV2) 
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code. 
int frame_len
frame length in samples 
FIXME Range Coding of cr are level
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome. 
or the Software in violation of any applicable export control laws in any jurisdiction Except as provided by mandatorily applicable UPF has no obligation to provide you with source code to the Software In the event Software contains any source code
int frame_len_bits
frame_len = 1 << frame_len_bits 
int sample_rate
samples per second 
int use_exp_vlc
exponent coding: 0 = lsp, 1 = vlc + delta 
main external API structure. 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered. 
#define init_vlc(vlc, nb_bits, nb_codes,bits, bits_wrap, bits_size,codes, codes_wrap, codes_size,flags)
int exponent_high_sizes[BLOCK_NB_SIZES]
static unsigned int get_bits1(GetBitContext *s)
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
synthesis window for stochastic i
int use_noise_coding
true if perceptual noise is added 
SINETABLE_CONST float *const ff_sine_windows[14]
int use_variable_block_len
FFTContext mdct_ctx[BLOCK_NB_SIZES]
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits. 
av_cold int ff_wma_get_frame_len_bits(int sample_rate, int version, unsigned int decode_flags)
Get the samples per frame for this stream. 
int prev_block_len_bits
log2 of prev block length 
int coefs_end[BLOCK_NB_SIZES]
max number of coded coefficients 
const uint16_t ff_wma_critical_freqs[25]
FmtConvertContext fmt_conv
av_cold void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx)
int channels
number of audio channels 
VLC_TYPE(* table)[2]
code, bits 
unsigned int ff_wma_get_large_val(GetBitContext *gb)
Decode an uncompressed coefficient. 
static const CoefVLCTable coef_vlcs[6]
int coefs_start
first coded coef 
int block_len_bits
log2 of current block length 
void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int bit_exact)
Initialize a float DSP context. 
static const uint8_t exponent_band_22050[3][25]
static const uint8_t exponent_band_32000[3][25]
void ff_free_vlc(VLC *vlc)
int ff_wma_init(AVCodecContext *avctx, int flags2)
void ff_init_ff_sine_windows(int index)
initialize the specified entry of ff_sine_windows 
float noise_table[NOISE_TAB_SIZE]
const uint16_t * levels
table to build run/level tables