* [FFmpeg-devel] [PATCH 1/2] avcodec/lpc: zero the middle odd sample in the output @ 2022-09-22 18:58 James Almer 2022-09-22 18:58 ` [FFmpeg-devel] [PATCH 2/2] tests/checkasm/lpc: randomize buffer length James Almer 0 siblings, 1 reply; 3+ messages in thread From: James Almer @ 2022-09-22 18:58 UTC (permalink / raw) To: ffmpeg-devel Signed-off-by: James Almer <jamrial@gmail.com> --- libavcodec/lpc.c | 1 + libavcodec/x86/lpc.asm | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c index 8603bb9709..dc6a3060ce 100644 --- a/libavcodec/lpc.c +++ b/libavcodec/lpc.c @@ -53,6 +53,7 @@ static void lpc_apply_welch_window_c(const int32_t *data, ptrdiff_t len, w_data[i] = data[i] * w; w_data[len-1-i] = data[len-1-i] * w; } + w_data[n2] = 0.0; return; } diff --git a/libavcodec/x86/lpc.asm b/libavcodec/x86/lpc.asm index ad74f1d8ac..47b31aa147 100644 --- a/libavcodec/x86/lpc.asm +++ b/libavcodec/x86/lpc.asm @@ -37,7 +37,7 @@ SECTION .text %macro APPLY_WELCH_FN 0 cglobal lpc_apply_welch_window, 3, 5, 8, data, len, out, off1, off2 cmp lenq, 0 - je .end + je .end_e cmp lenq, 2 je .two cmp lenq, 1 @@ -104,7 +104,7 @@ cglobal lpc_apply_welch_window, 3, 5, 8, data, len, out, off1, off2 add lend, (mmsize/4 - 1) cmp lend, 0 - je .end + je .end_o sub lenq, (mmsize/4 - 1) .scalar_o: @@ -135,6 +135,10 @@ cglobal lpc_apply_welch_window, 3, 5, 8, data, len, out, off1, off2 sub lenq, 2 jg .loop_o_scalar + +.end_o: + xorps xm3, xm3 + movlpd [outq + off1q*2], xm3 RET .even: @@ -233,7 +237,7 @@ cglobal lpc_apply_welch_window, 3, 5, 8, data, len, out, off1, off2 .one: xorpd xm0, xm0 movhpd [outq], xm0 -.end: +.end_e: RET %endmacro -- 2.37.3 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 3+ messages in thread
* [FFmpeg-devel] [PATCH 2/2] tests/checkasm/lpc: randomize buffer length 2022-09-22 18:58 [FFmpeg-devel] [PATCH 1/2] avcodec/lpc: zero the middle odd sample in the output James Almer @ 2022-09-22 18:58 ` James Almer 2022-09-22 20:12 ` [FFmpeg-devel] [PATCH 3/3] x86/lpc: use fused negative multiply-add instructions where useful James Almer 0 siblings, 1 reply; 3+ messages in thread From: James Almer @ 2022-09-22 18:58 UTC (permalink / raw) To: ffmpeg-devel Simplifies the test, while trying more values and preventing pointlessly running benchmarks in a loop. Signed-off-by: James Almer <jamrial@gmail.com> --- tests/checkasm/lpc.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/tests/checkasm/lpc.c b/tests/checkasm/lpc.c index da5364def0..8528fd6e20 100644 --- a/tests/checkasm/lpc.c +++ b/tests/checkasm/lpc.c @@ -54,31 +54,18 @@ static void test_window(int len) void checkasm_check_lpc(void) { LPCContext ctx; + int len = rnd() % 5000; ff_lpc_init(&ctx, 32, 16, FF_LPC_TYPE_DEFAULT); if (check_func(ctx.lpc_apply_welch_window, "apply_welch_window_even")) { - for (int i = 0; i < 64; i += 2) - test_window(i); + test_window(len & ~1); } report("apply_welch_window_even"); if (check_func(ctx.lpc_apply_welch_window, "apply_welch_window_odd")) { - for (int i = 1; i < 64; i += 2) - test_window(i); + test_window(len | 1); } report("apply_welch_window_odd"); - if (check_func(ctx.lpc_apply_welch_window, "apply_welch_window_2560")) - test_window(2560); - report("apply_welch_window_2560"); - - if (check_func(ctx.lpc_apply_welch_window, "apply_welch_window_4096")) - test_window(4096); - report("apply_welch_window_4096"); - - if (check_func(ctx.lpc_apply_welch_window, "apply_welch_window_4097")) - test_window(4097); - report("apply_welch_window_4097"); - ff_lpc_end(&ctx); } -- 2.37.3 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 3+ messages in thread
* [FFmpeg-devel] [PATCH 3/3] x86/lpc: use fused negative multiply-add instructions where useful 2022-09-22 18:58 ` [FFmpeg-devel] [PATCH 2/2] tests/checkasm/lpc: randomize buffer length James Almer @ 2022-09-22 20:12 ` James Almer 0 siblings, 0 replies; 3+ messages in thread From: James Almer @ 2022-09-22 20:12 UTC (permalink / raw) To: ffmpeg-devel Signed-off-by: James Almer <jamrial@gmail.com> --- libavcodec/x86/lpc.asm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/libavcodec/x86/lpc.asm b/libavcodec/x86/lpc.asm index 61a5796e5d..a585c17ef5 100644 --- a/libavcodec/x86/lpc.asm +++ b/libavcodec/x86/lpc.asm @@ -79,11 +79,12 @@ cglobal lpc_apply_welch_window, 3, 5, 8, data, len, out, off1, off2 .loop_o: movapd m1, m6 - mulpd m2, m0, m0 - subpd m1, m2 %if cpuflag(avx2) + fnmaddpd m1, m0, m0, m1 vpermpd m2, m1, q0123 %else + mulpd m2, m0, m0 + subpd m1, m2 shufpd m2, m1, m1, 01b %endif @@ -116,8 +117,12 @@ cglobal lpc_apply_welch_window, 3, 5, 8, data, len, out, off1, off2 .loop_o_scalar: movapd xm1, xm6 +%if cpuflag(avx2) + fnmaddpd xm1, xm0, xm0, xm1 +%else mulpd xm2, xm0, xm0 subpd xm1, xm2 +%endif cvtdq2pd xm3, [dataq + off1q] cvtdq2pd xm4, [dataq + off2q] @@ -174,8 +179,12 @@ cglobal lpc_apply_welch_window, 3, 5, 8, data, len, out, off1, off2 .loop_e: movapd m1, m6 +%if cpuflag(avx2) + fnmaddpd m1, m0, m0, m1 +%else mulpd m2, m0, m0 subpd m1, m2 +%endif %if cpuflag(avx2) vpermpd m2, m1, q0123 %else @@ -210,8 +219,12 @@ cglobal lpc_apply_welch_window, 3, 5, 8, data, len, out, off1, off2 .loop_e_scalar: movapd xm1, xm6 +%if cpuflag(avx2) + fnmaddpd xm1, xm0, xm0, xm1 +%else mulpd xm2, xm0, xm0 subpd xm1, xm2 +%endif cvtdq2pd xm3, [dataq + off1q] cvtdq2pd xm4, [dataq + off2q] -- 2.37.3 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-22 20:12 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-09-22 18:58 [FFmpeg-devel] [PATCH 1/2] avcodec/lpc: zero the middle odd sample in the output James Almer 2022-09-22 18:58 ` [FFmpeg-devel] [PATCH 2/2] tests/checkasm/lpc: randomize buffer length James Almer 2022-09-22 20:12 ` [FFmpeg-devel] [PATCH 3/3] x86/lpc: use fused negative multiply-add instructions where useful James Almer
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git