|
|
|
@@ -39,7 +39,8 @@ |
|
|
|
#define RA288_BLOCKS_PER_FRAME 32 |
|
|
|
|
|
|
|
typedef struct RA288Context { |
|
|
|
AVFloatDSPContext *fdsp; |
|
|
|
void (*vector_fmul)(float *dst, const float *src0, const float *src1, |
|
|
|
int len); |
|
|
|
DECLARE_ALIGNED(32, float, sp_lpc)[FFALIGN(36, 16)]; ///< LPC coefficients for speech data (spec: A) |
|
|
|
DECLARE_ALIGNED(32, float, gain_lpc)[FFALIGN(10, 16)]; ///< LPC coefficients for gain (spec: GB) |
|
|
|
|
|
|
|
@@ -60,18 +61,10 @@ typedef struct RA288Context { |
|
|
|
float gain_rec[11]; |
|
|
|
} RA288Context; |
|
|
|
|
|
|
|
static av_cold int ra288_decode_close(AVCodecContext *avctx) |
|
|
|
{ |
|
|
|
RA288Context *ractx = avctx->priv_data; |
|
|
|
|
|
|
|
av_freep(&ractx->fdsp); |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
static av_cold int ra288_decode_init(AVCodecContext *avctx) |
|
|
|
{ |
|
|
|
RA288Context *ractx = avctx->priv_data; |
|
|
|
AVFloatDSPContext *fdsp; |
|
|
|
|
|
|
|
avctx->channels = 1; |
|
|
|
avctx->channel_layout = AV_CH_LAYOUT_MONO; |
|
|
|
@@ -82,9 +75,11 @@ static av_cold int ra288_decode_init(AVCodecContext *avctx) |
|
|
|
return AVERROR_PATCHWELCOME; |
|
|
|
} |
|
|
|
|
|
|
|
ractx->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); |
|
|
|
if (!ractx->fdsp) |
|
|
|
fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); |
|
|
|
if (!fdsp) |
|
|
|
return AVERROR(ENOMEM); |
|
|
|
ractx->vector_fmul = fdsp->vector_fmul; |
|
|
|
av_free(fdsp); |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |
|
|
|
@@ -158,7 +153,7 @@ static void do_hybrid_window(RA288Context *ractx, |
|
|
|
|
|
|
|
av_assert2(order>=0); |
|
|
|
|
|
|
|
ractx->fdsp->vector_fmul(work, window, hist, FFALIGN(order + n + non_rec, 16)); |
|
|
|
ractx->vector_fmul(work, window, hist, FFALIGN(order + n + non_rec, 16)); |
|
|
|
|
|
|
|
convolve(buffer1, work + order , n , order); |
|
|
|
convolve(buffer2, work + order + n, non_rec, order); |
|
|
|
@@ -185,7 +180,7 @@ static void backward_filter(RA288Context *ractx, |
|
|
|
do_hybrid_window(ractx, order, n, non_rec, temp, hist, rec, window); |
|
|
|
|
|
|
|
if (!compute_lpc_coefs(temp, order, lpc, 0, 1, 1)) |
|
|
|
ractx->fdsp->vector_fmul(lpc, lpc, tab, FFALIGN(order, 16)); |
|
|
|
ractx->vector_fmul(lpc, lpc, tab, FFALIGN(order, 16)); |
|
|
|
|
|
|
|
memmove(hist, hist + n, move_size*sizeof(*hist)); |
|
|
|
} |
|
|
|
@@ -249,6 +244,5 @@ AVCodec ff_ra_288_decoder = { |
|
|
|
.priv_data_size = sizeof(RA288Context), |
|
|
|
.init = ra288_decode_init, |
|
|
|
.decode = ra288_decode_frame, |
|
|
|
.close = ra288_decode_close, |
|
|
|
.capabilities = AV_CODEC_CAP_DR1, |
|
|
|
}; |