#include "libavutil/channel_layout.h"
#include "libavutil/float_dsp.h"
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#include "avcodec.h"
#include "internal.h"
for (n = 0; n <= 64; n++) {
float pwr;
- idx = FFMAX(0, lrint((max - lpcs[n]) * irange) - 1);
+ idx = lrint((max - lpcs[n]) * irange - 1);
+ idx = FFMAX(0, idx);
pwr = wmavoice_denoise_power_table[s->denoise_strength][idx];
lpcs[n] = angle_mul * pwr;
/* 70.57 =~ 1/log10(1.0331663) */
- idx = (pwr * gain_mul - 0.0295) * 70.570526123;
+ idx = av_clipf((pwr * gain_mul - 0.0295) * 70.570526123, 0, INT_MAX / 2);
+
if (idx > 127) { // fall back if index falls outside table range
coeffs[n] = wmavoice_energy_table[127] *
powf(1.0331663, idx - 127);
* @param size size of the source data, in bytes
* @param gb bit I/O context specifying the current position in the source.
* data. This function might use this to align the bit position to
- * a whole-byte boundary before calling #avpriv_copy_bits() on aligned
+ * a whole-byte boundary before calling #ff_copy_bits() on aligned
* source data
* @param nbits the amount of bits to copy from source to target
*
rmn_bits &= 7; rmn_bytes >>= 3;
if ((rmn_bits = FFMIN(rmn_bits, nbits)) > 0)
put_bits(pb, rmn_bits, get_bits(gb, rmn_bits));
- avpriv_copy_bits(pb, data + size - rmn_bytes,
+ ff_copy_bits(pb, data + size - rmn_bytes,
FFMIN(nbits - rmn_bits, rmn_bytes << 3));
}