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",
106 const float *win = s->
windows[window_index];
108 float n = 2.0 * 32768.0 / window_len;
125 float v, *q, max_scale, *q_end;
133 v = pow(10, *exp_param++ *(1.0 / 16.0));
134 max_scale =
FFMAX(max_scale, v);
153 last_exp = *exp_param++;
154 av_assert0(last_exp - 10 >= 0 && last_exp - 10 < 32);
160 int exp = *exp_param++;
161 int code = exp - last_exp + 60;
174 int v, bsize, ch, coef_nb_bits, parse_exponents;
177 static const int fixed_exp[25] = {
205 mdct_norm = 1.0 / (float) n4;
207 mdct_norm *= sqrt(n4);
223 float *coefs, *exponents,
mult;
228 mult = pow(10, total_gain * 0.05) / s->
max_exponent[ch];
230 coefs = src_coefs[ch];
236 for (i = 0; i <
n; i++) {
237 double t = *coefs++ / (exponents[i] *
mult);
238 if (t < -32768 || t > 32767)
241 coefs1[i] =
lrint(t);
257 for (v = total_gain - 1; v >= 127; v -= 127)
268 for (i = 0; i <
n; i++) {
281 if (parse_exponents) {
301 eptr = ptr + nb_coefs[ch];
304 for (; ptr < eptr; ptr++) {
307 int abs_level =
FFABS(level);
309 if (abs_level <= s->
coef_vlcs[tindex]->max_level)
310 if (run < s->
coef_vlcs[tindex]->levels[abs_level - 1])
311 code = run + s->
int_table[tindex][abs_level - 1];
318 if (1 << coef_nb_bits <= abs_level)
359 int i, total_gain,
ret, error;
371 a = s->
coefs[0][i] * 0.5;
372 b = s->
coefs[1][i] * 0.5;
382 for (i = 64; i; i >>= 1) {
389 while(total_gain <= 128 && error > 0)
392 av_log(avctx,
AV_LOG_ERROR,
"Invalid input data or requested bitrate too low, cannot encode\n");
413 #if CONFIG_WMAV1_ENCODER
427 #if CONFIG_WMAV2_ENCODER