[FFmpeg-cvslog] avcodec/flacdsp: split off lpc33 into a dsp function
James Almer
git at videolan.org
Fri May 24 17:47:58 EEST 2024
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sun May 12 17:36:10 2024 -0300| [0380a03f1f9d55e5690bb92bfa4897f2c728c1e5] | committer: James Almer
avcodec/flacdsp: split off lpc33 into a dsp function
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0380a03f1f9d55e5690bb92bfa4897f2c728c1e5
---
libavcodec/flacdec.c | 7 +------
libavcodec/flacdsp.c | 15 +++++++++++++++
libavcodec/flacdsp.h | 2 ++
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index 6e6a2896b4..460d3bc01e 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -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;
}
diff --git a/libavcodec/flacdsp.c b/libavcodec/flacdsp.c
index 27d3e923ee..f5362bf66f 100644
--- a/libavcodec/flacdsp.c
+++ b/libavcodec/flacdsp.c
@@ -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;
diff --git a/libavcodec/flacdsp.h b/libavcodec/flacdsp.h
index 5a59c0c864..3b7b35a112 100644
--- a/libavcodec/flacdsp.h
+++ b/libavcodec/flacdsp.h
@@ -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);
More information about the ffmpeg-cvslog
mailing list