#include "libavutil/opt.h"
#include "lossless_audiodsp.h"
#include "avcodec.h"
-#include "dsputil.h"
+#include "bswapdsp.h"
#include "bytestream.h"
#include "internal.h"
#include "get_bits.h"
typedef struct APEContext {
AVClass *class; ///< class for AVOptions
AVCodecContext *avctx;
- DSPContext dsp;
+ BswapDSPContext bdsp;
LLAudDSPContext adsp;
int channels;
int samples; ///< samples left to decode in current frame
s->predictor_decode_stereo = predictor_decode_stereo_3950;
}
- ff_dsputil_init(&s->dsp, avctx);
+ ff_bswapdsp_init(&s->bdsp);
ff_llauddsp_init(&s->adsp);
avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
sign = APESIGN(buffer[i]);
for (j = 0; j < order; j++) {
dotprod += delay[j] * coeffs[j];
- coeffs[j] -= (((delay[j] >> 30) & 2) - 1) * sign;
+ coeffs[j] += ((delay[j] >> 31) | 1) * sign;
}
buffer[i] -= dotprod >> shift;
for (j = 0; j < order - 1; j++)
{
int i, j;
int32_t dotprod, sign;
- int32_t coeffs[8], delay[8];
+ int32_t coeffs[8] = { 0 }, delay[8] = { 0 };
- memset(coeffs, 0, sizeof(coeffs));
- memset(delay, 0, sizeof(delay));
for (i = 0; i < length; i++) {
dotprod = 0;
sign = APESIGN(buffer[i]);
for (j = 7; j >= 0; j--) {
dotprod += delay[j] * coeffs[j];
- coeffs[j] -= (((delay[j] >> 30) & 2) - 1) * sign;
+ coeffs[j] += ((delay[j] >> 31) | 1) * sign;
}
for (j = 7; j > 0; j--)
delay[j] = delay[j - 1];
av_fast_padded_malloc(&s->data, &s->data_size, buf_size);
if (!s->data)
return AVERROR(ENOMEM);
- s->dsp.bswap_buf((uint32_t*)s->data, (const uint32_t*)buf, buf_size >> 2);
+ s->bdsp.bswap_buf((uint32_t *) s->data, (const uint32_t *) buf,
+ buf_size >> 2);
memset(s->data + (buf_size & ~3), 0, buf_size & 3);
s->ptr = s->data;
s->data_end = s->data + buf_size;