33 int i, flags1, flags2, block_align;
40 "too many channels: got %i, need %i or fewer\n",
53 "bitrate too low: got %i, need 24000 or higher\n",
108 const float *win = s->
windows[window_index];
110 float n = 2.0 * 32768.0 / window_len;
127 float v, *q, max_scale, *q_end;
135 v = pow(10, *exp_param++ *(1.0 / 16.0));
136 max_scale =
FFMAX(max_scale, v);
155 last_exp = *exp_param++;
156 av_assert0(last_exp - 10 >= 0 && last_exp - 10 < 32);
162 int exp = *exp_param++;
163 int code = exp - last_exp + 60;
176 int v, bsize, ch, coef_nb_bits, parse_exponents;
179 static const int fixed_exp[25] = {
207 mdct_norm = 1.0 / (float) n4;
209 mdct_norm *= sqrt(n4);
225 float *coefs, *exponents,
mult;
230 mult = pow(10, total_gain * 0.05) / s->
max_exponent[ch];
232 coefs = src_coefs[ch];
238 for (i = 0; i <
n; i++) {
239 double t = *coefs++ / (exponents[i] *
mult);
240 if (t < -32768 || t > 32767)
243 coefs1[i] =
lrint(t);
259 for (v = total_gain - 1; v >= 127; v -= 127)
270 for (i = 0; i <
n; i++) {
283 if (parse_exponents) {
303 eptr = ptr + nb_coefs[ch];
306 for (; ptr < eptr; ptr++) {
309 int abs_level =
FFABS(level);
311 if (abs_level <= s->
coef_vlcs[tindex]->max_level)
312 if (run < s->
coef_vlcs[tindex]->levels[abs_level - 1])
313 code = run + s->
int_table[tindex][abs_level - 1];
320 if (1 << coef_nb_bits <= abs_level)
361 int i, total_gain,
ret, error;
373 a = s->
coefs[0][i] * 0.5;
374 b = s->
coefs[1][i] * 0.5;
384 for (i = 64; i; i >>= 1) {
391 while(total_gain <= 128 && error > 0)
394 av_log(avctx,
AV_LOG_ERROR,
"Invalid input data or requested bitrate too low, cannot encode\n");
415 #if CONFIG_WMAV1_ENCODER
429 #if CONFIG_WMAV2_ENCODER