Imported Upstream version 3.0

This commit is contained in:
Sebastian Ramacher
2016-03-07 00:15:29 +01:00
parent 788abe4bd5
commit cc62001e2f
1590 changed files with 88868 additions and 33375 deletions
+16 -6
View File
@@ -20,6 +20,7 @@
*/
#include "libavutil/attributes.h"
#include "libavutil/internal.h"
#include "avcodec.h"
#include "internal.h"
@@ -51,8 +52,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
if (avctx->bit_rate < 24 * 1000) {
av_log(avctx, AV_LOG_ERROR,
"bitrate too low: got %i, need 24000 or higher\n",
avctx->bit_rate);
"bitrate too low: got %"PRId64", need 24000 or higher\n",
(int64_t)avctx->bit_rate);
return AVERROR(EINVAL);
}
@@ -99,7 +100,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
return 0;
}
static void apply_window_and_mdct(AVCodecContext *avctx, const AVFrame *frame)
static int apply_window_and_mdct(AVCodecContext *avctx, const AVFrame *frame)
{
WMACodecContext *s = avctx->priv_data;
float **audio = (float **) frame->extended_data;
@@ -118,7 +119,13 @@ static void apply_window_and_mdct(AVCodecContext *avctx, const AVFrame *frame)
win, len);
s->fdsp->vector_fmul(s->frame_out[ch], s->frame_out[ch], win, len);
mdct->mdct_calc(mdct, s->coefs[ch], s->output);
if (!isfinite(s->coefs[ch][0])) {
av_log(avctx, AV_LOG_ERROR, "Input contains NaN/+-Inf\n");
return AVERROR(EINVAL);
}
}
return 0;
}
// FIXME use for decoding too
@@ -134,7 +141,7 @@ static void init_exp(WMACodecContext *s, int ch, const int *exp_param)
max_scale = 0;
while (q < q_end) {
/* XXX: use a table */
v = pow(10, *exp_param++ *(1.0 / 16.0));
v = ff_exp10(*exp_param++ *(1.0 / 16.0));
max_scale = FFMAX(max_scale, v);
n = *ptr++;
do {
@@ -229,7 +236,7 @@ static int encode_block(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE],
coefs1 = s->coefs1[ch];
exponents = s->exponents[ch];
mult = pow(10, total_gain * 0.05) / s->max_exponent[ch];
mult = ff_exp10(total_gain * 0.05) / s->max_exponent[ch];
mult *= mdct_norm;
coefs = src_coefs[ch];
if (s->use_noise_coding && 0) {
@@ -365,7 +372,10 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt,
s->block_len_bits = s->frame_len_bits; // required by non variable block len
s->block_len = 1 << s->block_len_bits;
apply_window_and_mdct(avctx, frame);
ret = apply_window_and_mdct(avctx, frame);
if (ret < 0)
return ret;
if (s->ms_stereo) {
float a, b;