#ifndef AVCODEC_AACENC_UTILS_H
#define AVCODEC_AACENC_UTILS_H
+#include "libavutil/ffmath.h"
#include "aac.h"
#include "aacenctab.h"
#include "aactab.h"
const float rounding)
{
int i;
- double qc;
for (i = 0; i < size; i++) {
- qc = scaled[i] * Q34;
- out[i] = (int)FFMIN(qc + rounding, (double)maxval);
+ float qc = scaled[i] * Q34;
+ int tmp = (int)FFMIN(qc + rounding, (float)maxval);
if (is_signed && in[i] < 0.0f) {
- out[i] = -out[i];
+ tmp = -tmp;
}
+ out[i] = tmp;
}
}
if (s >= ethresh) {
nzl += 1.0f;
} else {
- nzl += powf(s / ethresh, nzslope);
+ if (nzslope == 2.f)
+ nzl += (s / ethresh) * (s / ethresh);
+ else
+ nzl += ff_fast_powf(s / ethresh, nzslope);
}
}
if (e2 > thresh) {