avcodec/flacdsp: split off lpc33 into a dsp function

Signed-off-by: James Almer <jamrial@gmail.com>
release/7.1
James Almer 8 months ago
parent 62397bcf6a
commit 0380a03f1f
  1. 7
      libavcodec/flacdec.c
  2. 15
      libavcodec/flacdsp.c
  3. 2
      libavcodec/flacdsp.h

@ -509,12 +509,7 @@ static int decode_subframe_lpc_33bps(FLACContext *s, int64_t *decoded,
if ((ret = decode_residuals(s, residual, pred_order)) < 0)
return ret;
for (i = pred_order; i < s->blocksize; i++, decoded++) {
int64_t sum = 0;
for (j = 0; j < pred_order; j++)
sum += (int64_t)coeffs[j] * (uint64_t)decoded[j];
decoded[j] = residual[i] + (sum >> qlevel);
}
s->dsp.lpc33(decoded, residual, coeffs, pred_order, qlevel, s->blocksize);
return 0;
}

@ -84,6 +84,20 @@ static void flac_lpc_32_c(int32_t *decoded, const int coeffs[32],
}
static void flac_lpc_33_c(int64_t *decoded, const int32_t *residual,
const int coeffs[32], int pred_order,
int qlevel, int len)
{
int i, j;
for (i = pred_order; i < len; i++, decoded++) {
int64_t sum = 0;
for (j = 0; j < pred_order; j++)
sum += (int64_t)coeffs[j] * (uint64_t)decoded[j];
decoded[j] = residual[i] + (sum >> qlevel);
}
}
static void flac_wasted_32_c(int32_t *decoded, int wasted, int len)
{
for (int i = 0; i < len; i++)
@ -101,6 +115,7 @@ av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int cha
{
c->lpc16 = flac_lpc_16_c;
c->lpc32 = flac_lpc_32_c;
c->lpc33 = flac_lpc_33_c;
c->wasted32 = flac_wasted_32_c;
c->wasted33 = flac_wasted_33_c;

@ -30,6 +30,8 @@ typedef struct FLACDSPContext {
int qlevel, int len);
void (*lpc32)(int32_t *samples, const int coeffs[32], int order,
int qlevel, int len);
void (*lpc33)(int64_t *samples, const int32_t *residual, const int coeffs[32],
int pred_order, int qlevel, int len);
void (*wasted32)(int32_t *decoded, int wasted, int len);
void (*wasted33)(int64_t *decoded, const int32_t *residual,
int wasted, int len);

Loading…
Cancel
Save