[FFmpeg-devel] [PATCH 6/8 v2] x86/flacdsp: add a SSE2 version of wasted32
James Almer
jamrial at gmail.com
Sun May 12 21:51:56 EEST 2024
flac_wasted_32_c: 851.3
flac_wasted_32_sse2: 41.3
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavcodec/x86/flacdsp.asm | 24 ++++++++++++++++++++++++
libavcodec/x86/flacdsp_init.c | 3 +++
2 files changed, 27 insertions(+)
diff --git a/libavcodec/x86/flacdsp.asm b/libavcodec/x86/flacdsp.asm
index f38eb7db76..21b2439bc0 100644
--- a/libavcodec/x86/flacdsp.asm
+++ b/libavcodec/x86/flacdsp.asm
@@ -89,6 +89,30 @@ LPC_32 sse4, 32, psrlq
LPC_32 xop, 32, psrlq
%endif
+INIT_XMM sse2
+cglobal flac_wasted_32, 3,3,5, decoded, wasted, len
+ shl lend, 2
+ add decodedq, lenq
+ neg lenq
+ movd m4, wastedd
+ALIGN 16
+.loop:
+ mova m0, [decodedq+lenq+mmsize*0]
+ mova m1, [decodedq+lenq+mmsize*1]
+ mova m2, [decodedq+lenq+mmsize*2]
+ mova m3, [decodedq+lenq+mmsize*3]
+ pslld m0, m4
+ pslld m1, m4
+ pslld m2, m4
+ pslld m3, m4
+ mova [decodedq+lenq+mmsize*0], m0
+ mova [decodedq+lenq+mmsize*1], m1
+ mova [decodedq+lenq+mmsize*2], m2
+ mova [decodedq+lenq+mmsize*3], m3
+ add lenq, mmsize * 4
+ jl .loop
+ RET
+
;----------------------------------------------------------------------------------
;void ff_flac_decorrelate_[lrm]s_16_sse2(uint8_t **out, int32_t **in, int channels,
; int len, int shift);
diff --git a/libavcodec/x86/flacdsp_init.c b/libavcodec/x86/flacdsp_init.c
index dee4bf88fc..67aa118760 100644
--- a/libavcodec/x86/flacdsp_init.c
+++ b/libavcodec/x86/flacdsp_init.c
@@ -30,6 +30,8 @@ void ff_flac_lpc_32_sse4(int32_t *samples, const int coeffs[32], int order,
void ff_flac_lpc_32_xop(int32_t *samples, const int coeffs[32], int order,
int qlevel, int len);
+void ff_flac_wasted_32_sse2(int32_t *decoded, int wasted, int len);
+
#define DECORRELATE_FUNCS(fmt, opt) \
void ff_flac_decorrelate_ls_##fmt##_##opt(uint8_t **out, int32_t **in, int channels, \
int len, int shift); \
@@ -63,6 +65,7 @@ av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int
int cpu_flags = av_get_cpu_flags();
if (EXTERNAL_SSE2(cpu_flags)) {
+ c->wasted32 = ff_flac_wasted_32_sse2;
if (fmt == AV_SAMPLE_FMT_S16) {
c->decorrelate[1] = ff_flac_decorrelate_ls_16_sse2;
c->decorrelate[2] = ff_flac_decorrelate_rs_16_sse2;
--
2.45.0
More information about the ffmpeg-devel
mailing list